I am trying to model simple hydraulic components such as a check valve. How to make the flow runs in one direction ? Will a simple if statement as the one shown below work or do you recommend another approach ?
m_flow = port_b.m_flow - port_a.m_flow; // defined in the interface
m_flow=if port_a.m_flow < 0 then 0 else port_a.m_flow;