Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- model TwoPumpCode
- // Pump 1
- Modelica.SIunits.Frequency fPump1 "pump 1 frequency";
- Modelica.SIunits.Frequency fMax = 50 "maximum frequency";
- Modelica.SIunits.VolumeFlowRate v1;
- // Pump 2
- // Boolean runPump2(start=false) "true if pump 2 should run";
- Modelica.SIunits.VolumeFlowRate v2IfRunning = 30;
- Modelica.SIunits.VolumeFlowRate v2
- "actual flow through pump 2";
- Integer nPumpsRunning(start = 1) "number of pumps running";
- // Total flow
- Modelica.SIunits.VolumeFlowRate vTotal = 70;
- equation
- // Calculate the flow through pump 1 as a function of frequency
- v1 = fPump1;
- // Calculate the flow through pump 2 based upon running state
- if fPump1 > fMax then
- nPumpsRunning = 2;
- v2 = v2IfRunning;
- else
- nPumpsRunning = 1;
- v2 = 0;
- end if;
- // Calculate the total flow
- vTotal = v1 + v2;
- end TwoPumpCode;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement