-
-
Notifications
You must be signed in to change notification settings - Fork 233
Closed
Description
Is your feature request related to a problem? Please describe.
I like to make my "acausal" components using the following format
function MyComp(;name,...)
@named inport = ...connector..
@named outport = ...connector..
para = @parameters begin
MyParas ...
end
vars = @variables begin
MyVars ...
end
eqs = [ outport.mdot ~ abs(inport.mdot)
outport.p ~ eq1 ...
outport.h ~ eq2 ...
..
]
compose(ODESystem(eqs, t, vars, para;name), inport, outport)
end
This works very well for ODESystems
I would like to know if I can have the same possibility of doing the same with SDESystem
Describe the solution you’d like
So it should look something like this:
using ModelingToolkit, StochasticDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D
using Plots
function sto(;name)
para = @parameters begin
σ=10.0
ρ=28
β=8/3
end
vars = @variables begin
x(t)
y(t)
z(t)
end
br = @brownian begin
B
end
eqs = [D(x) ~ σ * (y - x) + B,
D(y) ~ x * (ρ - z) - y ,
D(z) ~ x * y - β * z ]
System(eqs,t,vars,para,br;name)
end
@named de = sto()
sys = structural_simplify(de)
typeof(sys)
The current example of SDESystem
works well as described in here but uses @mtkbuild
which does not allow me to make my function.
Describe alternatives you’ve considered
The example in the tutorial is the only alternative I know but the "low-level" interface allows for more flexibility as I have mentioned in the example of ODESystem
and SDESystem
.
Additional context
Metadata
Metadata
Assignees
Labels
No labels