diff --git a/Project.toml b/Project.toml index dae6a30..c183802 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ProcessBasedModelling" uuid = "ca969041-2cf3-4b10-bc21-86f4417093eb" authors = ["Datseris "] -version = "1.2.0" +version = "1.2.1" [deps] ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" diff --git a/src/API.jl b/src/API.jl index 3a462af..bf626d8 100644 --- a/src/API.jl +++ b/src/API.jl @@ -12,7 +12,8 @@ The type must extend the following functions from the module `ProcessBasedModell - (optional) `lhs(p)` which returns the left-hand-side. Let `τ = timescale(p)`. Then default `lhs(p)` behaviour depends on `τ` as follows: - Just `lhs_variable(p)` if `τ == NoTimeDerivative()`. - - `Differential(t)(p)` if `τ == nothing`. + - `Differential(t)(p)` if `τ == nothing`, or multiplied with a number + if `τ isa LiteralParameter`. - `τ_var*Differential(t)(p)` if `τ isa Union{Real, Num}`. If real, a new named parameter `τ_var` is created that has the prefix `:τ_` and then the lhs-variable name and has default value `τ`. Else if `Num`, `τ_var = τ` as given. @@ -62,6 +63,8 @@ function lhs(p::Process) v = lhs_variable(p) if isnothing(τ) # time variability exists but timescale is nonexistent (unity) return D(v) # `D` is the MTK canonical variable for time derivative + elseif τ isa LiteralParameter + return τ.p*D(v) elseif τ isa NoTimeDerivative || iszero(τ) # no time variability return v else # τ is either Num or Real