Skip to content

Commit e17ebb0

Browse files
committed
make literal parameter allowable in LHS timescale
1 parent b918f48 commit e17ebb0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ProcessBasedModelling"
22
uuid = "ca969041-2cf3-4b10-bc21-86f4417093eb"
33
authors = ["Datseris <[email protected]>"]
4-
version = "1.2.0"
4+
version = "1.2.1"
55

66
[deps]
77
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"

src/API.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ The type must extend the following functions from the module `ProcessBasedModell
1212
- (optional) `lhs(p)` which returns the left-hand-side. Let `τ = timescale(p)`.
1313
Then default `lhs(p)` behaviour depends on `τ` as follows:
1414
- Just `lhs_variable(p)` if `τ == NoTimeDerivative()`.
15-
- `Differential(t)(p)` if `τ == nothing`.
15+
- `Differential(t)(p)` if `τ == nothing`, or multiplied with a number
16+
if `τ isa LiteralParameter`.
1617
- `τ_var*Differential(t)(p)` if `τ isa Union{Real, Num}`. If real,
1718
a new named parameter `τ_var` is created that has the prefix `:τ_` and then the
1819
lhs-variable name and has default value `τ`. Else if `Num`, `τ_var = τ` as given.
@@ -62,6 +63,8 @@ function lhs(p::Process)
6263
v = lhs_variable(p)
6364
if isnothing(τ) # time variability exists but timescale is nonexistent (unity)
6465
return D(v) # `D` is the MTK canonical variable for time derivative
66+
elseif τ isa LiteralParameter
67+
return τ.p*D(v)
6568
elseif τ isa NoTimeDerivative || iszero(τ) # no time variability
6669
return v
6770
else # τ is either Num or Real

0 commit comments

Comments
 (0)