I am playing around with MTK v11 (v11.14) and trying to understand connectors, components + signals. My code now work, and I can specify signals. I use a chemical reactor (liquid phase) as an example, where the temperature evolves as:
The model involves comparison of (i) a Clapeyron.jl EoS vs. a crude model (IS), and (ii) a model with compressible liquid (solid) vs. one with specified reactor pressure (dash).
So, now I want to try to find a linear approximation of my model. As often in the past, I have some problem in linearizing the model, and I don’t know whether this is due to updates in MTK or not.
Here are some snapshots of how I (a) included the analysis points, e.g.,
connect(T_src_w.y, :Twi_ap, pb_H2O_s.T_set),
inserts the analysis point :Twi_ap between signal T_src_w.y and a component port pb_H2O_s.T_set ,
next, (b) how I compose the model:
@named __sys_rx_s = System(eqs_rx_s, t)
@named _sys_rx_s = compose(__sys_rx_s, [p_src_w, T_src_w, p_src_eo, T_src_eo,
u_v_src_w, u_v_src_eo, u_v_src_e, T_src_c, p_src_e, T_src_e,
pb_H2O_s, pb_EO_s, pb_e_s, va_H2O_s, va_EO_s, va_e_s, rx_s])
sys_rx_s = mtkcompile(_sys_rx_s)
For simulation, I create and solve the numeric problem:
tspan = (0.0, 100).*60
prob_rx_s = ODEProblem(sys_rx_s, [], tspan; use_scc=false)
sol_rx_s = solve(prob_rx_s,Rodas5P(); reltol=1e-7, abstol=1e-7)
[The use_scc keyword is to get around a limitation in NonlinearSolve, I think: the case is rather stiff due to including liquid compression.]
Simulating for 100 minutes leads to steady state conditions.
Now, for the linearization part, which should have the form:
linearize(model, inputs, outputs; op=op)
But which “model” should I use? sys_rx_s? _sys_rx_s? structural_simplify(_sys_rx_s)?
Suppose my outputs are [sys_rx_s.T, sys_rx_s.xi]… (or something else?), what should be the inputs for my two analysis points :Twi_ap and :Tc_ap? Should I set inputs to [:Twi_ap, :Tc_ap], or something else?
And how do I specify the operating point?

