You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not able to find all local variables to a component in SDESystem
Expected behavior
The local variable h should be accessed using sol[src.h] after solving.
Minimal Reproducible Example 👇
using ModelingToolkit, Plots, DifferentialEquations, StochasticDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D
@connectorfunctionmyconnect(;name)
vars =@variablesbeginx(t), [input =true]
y(t), [input =true]
z(t), [input =true]
endSystem(Equation[],t, vars, [];name=name)
endfunctionsource(;name)
@named port =myconnect()
para =@parametersbeginend
vars =@variablesbeginx(t)
y(t)
z(t)
h(t)
end@brownian Bx By
eqs = [
D(x) ~0+ Bx
D(y) ~0+ By
D(z) ~0
port.x ~ x
port.y ~ y
port.z ~ z
h ~ x + y + z
]
compose(System(eqs,t, vars, para;name),port)
endfunctionsink(;name)
@named port =myconnect()
para =@parametersbeginend
vars =@variablesbeginx(t)
y(t)
z(t)
end@brownian B
eqs = [
port.x ~ x +0*B
port.y ~ y +0*B
port.z ~ z +0*B
]
compose(System(eqs ,t, vars, para;name),port)
end@named src =source()
@named snk =sink()
eqs = [
connect(src.port,snk.port)
]
systems = [src,snk]
@named model =System(eqs,t, systems=systems)
sys =structural_simplify(model)
typeof(sys)
prob =SDEProblem(sys, [sys.src.x=>1,sys.src.y=>1,sys.src.z=>1], (0.0, 100.0), [])
sol =solve(prob, SRIW1())
@show sol[src.h]
Describe the bug 🐞
Not able to find all local variables to a component in
SDESystem
Expected behavior
The local variable
h
should be accessed usingsol[src.h]
after solving.Minimal Reproducible Example 👇
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
The system works as expected if I remove the
@brownian
variables and run the genericODESystem
instead ofSDESystem
The text was updated successfully, but these errors were encountered: