We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following produces the error: ERROR: UndefVarError: vol2₊rho not defined, which as can be seen is defined.
ERROR: UndefVarError:
not defined
using ModelingToolkit using ModelingToolkit: D_nounits as D, t_nounits as t import ModelingToolkitStandardLibrary.Blocks as B import ModelingToolkitStandardLibrary.Mechanical.Translational as T import ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible as IC using OrdinaryDiffEq using Plots liquid_pressure(rho, rho_0, bulk) = (rho/rho_0 - 1)*bulk gas_pressure(rho, rho_0, p_gas, rho_gas) = rho * ((0 - p_gas) / (rho_0 - rho_gas)) full_pressure(rho, rho_0, bulk, p_gas, rho_gas) = ifelse( rho >= rho_0, liquid_pressure(rho, rho_0, bulk), gas_pressure(rho, rho_0, p_gas, rho_gas)) @component function Volume(; #parameters area, direction = +1, x_int, name) pars = @parameters begin area = area x_int = x_int rho_0 = 1000 bulk = 1e9 p_gas = -1000 rho_gas = 1 end vars = @variables begin x(t)=x_int dx(t), [guess=0] p(t), [guess=0] f(t), [guess=0] rho(t), [guess=0] m(t), [guess=0] dm(t), [guess=0] end systems = @named begin port = IC.HydraulicPort() flange = T.MechanicalPort() end eqs = [ # connectors port.p ~ p port.dm ~ dm flange.v * direction ~ dx flange.f * direction ~ -f # differentials D(x) ~ dx D(m) ~ dm # physics p ~ full_pressure(rho, rho_0, bulk, p_gas, rho_gas) f ~ p * area m ~ rho * x * area] return ODESystem(eqs, t, vars, pars; name, systems) end systems = @named begin fluid = IC.HydraulicFluid(; bulk_modulus = 1e9) src1 = IC.Pressure(;) src2 = IC.Pressure(;) vol1 = Volume(;area=0.01, direction = +1, x_int=0.1) vol2 = Volume(;area=0.01, direction = +1, x_int=0.1) mass = T.Mass(; m = 10) sin1 = B.Sine(; frequency = 0.5, amplitude = +0.5e5, offset = 10e5) sin2 = B.Sine(; frequency = 0.5, amplitude = -0.5e5, offset = 10e5) end eqs = [connect(fluid, src1.port) connect(fluid, src2.port) connect(src1.port, vol1.port) connect(src2.port, vol2.port) connect(vol1.flange, mass.flange, vol2.flange) connect(src1.p, sin1.output) connect(src2.p, sin2.output)] initialization_eqs = [ mass.s ~ 0.0 mass.v ~ 0.0 ] @mtkbuild sys = ODESystem(eqs, t, [], []; systems, initialization_eqs) prob = ODEProblem(sys, [], (0, 5)) sol = solve(prob) #ERROR: UndefVarError: `vol2₊rho` not defined
The current versions used are...
(Issue953) pkg> st Status `C:\Work\Packages\Issue953\Project.toml` [961ee093] ModelingToolkit v9.60.0 [16a59e39] ModelingToolkitStandardLibrary v2.19.0 [1dea7af3] OrdinaryDiffEq v6.90.1 [91a5bcdd] Plots v1.40.9
The text was updated successfully, but these errors were encountered:
@AayushSabharwal was this covered by the hash consing fixes?
Sorry, something went wrong.
It doesn't seem so. I'm yet to figure out if it's hashconsing related or not, but it does seem like it could be.
This is an SCCNonlinearProblem issue. Passing use_scc=false to ODEProblem is a workaround.
SCCNonlinearProblem
use_scc=false
ODEProblem
Successfully merging a pull request may close this issue.
The following produces the error:
ERROR: UndefVarError:
vol2₊rhonot defined
, which as can be seen is defined.The current versions used are...
The text was updated successfully, but these errors were encountered: