Hi James,
This is an interesting topic. I think working through this particular case may help clear up some areas where some additional flexibility in the extensible reactor model could be useful.
One thing is that in the reactor network, a compressor is more analogous to a flow device, like a MassFlowController, than it is to a reactor itself, as it doesn’t have a single thermodynamic state. Instead, I’d think of the inlet and outlet being the Reactor objects. However, since we don’t yet have an ExtensibleFlowDevice to build on, the only way to do this is to add the custom behavior to one of the reactors, similar to what you’ve done here, or this example that implements an equation for wall inertia.
Do you have a brief writeup of the equations that you’re trying to implement? It might help to see them in their mathematical form rather than the translation to code where its easy to get lost in the details. It’s not quite clear to me whether you all of your equations are differential equations, or whether you have some algebraic constraints. Currently, the ExtensibleReactor model doesn’t support these algebraic equations, though the underlying ReactorNet integrator can handle them and this is an enhancement that could be made at some point.
Regards,
Ray
