Hi, I would like to solve the system below as a component based modeling. DifferentialEquations is a possibility to solve as steady states.
‘’’
using ModelingToolkit, NonlinearSolve
function plant_7_1_b()
ModelingToolkit.@variables m2 p2
ModelingToolkit.@parameters m1 p1
eqs = [0 ~ m1 - m2
0 ~ p1 - p2]
@named ns = NonlinearSystem(eqs, [m2,p2], [m1,p1])
guess = [m2 => 20.0,
p2 => 0.5]
ps = [
m1 => 20.0
p1 => 0.5
]
prob = NonlinearProblem(ns,guess,ps)
sol = solve(prob,NewtonRaphson())
println("mcond_out = ", round(sol[1],digits=1)," kg/s")
println("pcond_out = ", round(sol[2],digits=1)," bar")
end
@time plant_7_1_b();
‘’’