Hi Eric,
Try using the CVODES solver, it seems to avoid the "No unique solution for solving linear equation..." error. However, that alone wont simply solve your state selection problem.
In the two port component, the derivative of T occurs in the following equation:
flowPort_a.H_flow + flowPort_b.H_flow + Q_flow = m * medium.cv * der(T);
So if any state beside T is to be chosen using stateSelect=always, it needs to be able to use that to solve der(T). V_flow is not such a variable, possibly due to the presence of the special "semiLinear" function in the component. I was however able to trick it to add an additional state, beside T by using your original approach:
Change
V_flow = flowPort_a.m_flow / medium.rho;
To
der(V_flow) = der(flowPort_a.m_flow) / medium.rho;
in the TwoPort component. In your model, you will only be able to set 2 out of 3 pipes to use V_flow as a state, since the third variable can be directly calculated from the other 2. With 3 states, the solution would be over determined. You can for example have:
PipelineSection pipelineSection(T_a.fixed = false, T_b.fixed = false, T0fixed = true, V_flow(stateSelect = StateSelect.always));
PipelineSection pipelineSection1(T_a.fixed = false, T_b.fixed = false, T0fixed = true, V_flow(stateSelect = StateSelect.always));
PipelineSection pipelineSection2(T_a.fixed = false, T_b.fixed = false, T0fixed = true);
Try the attached model and see if it works for your purposes.
This could be considered a pretty dirty fix, so there could be a better way. I would have to think about it a bit more.
Attachments: