I had a model running successfully until I tried to implement proportional control. The only changes I made were as follows:
Added below model, above equations:
parameter SI.MassFlowRate desiredFlow = 2;
parameter SI.MassFlowRate errorInFlow;
parameter Real kp = 0.1;
Added under equations:
errorInFlow = desiredFlow - sink.ports[1].m_flow;
valveLinear1.opening = errorInFlow * kp;
Deleted under equations
valveLinear1.opening = 0.5;
...So altogether I have 4 variables (valveLinear1.opening, errorInFlow, desiredFlow, kp). I define kp and desiredFlow (2 equations) plus the other 2 under equations = 4. I don't see why I am still getting this error of an over-constrained system (one to many equations).