Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. model TwoPumpCode
  2. // Pump 1
  3. Modelica.SIunits.Frequency fPump1 "pump 1 frequency";
  4. Modelica.SIunits.Frequency fMax = 50 "maximum frequency";
  5. Modelica.SIunits.VolumeFlowRate v1;
  6.  
  7. // Pump 2
  8. // Boolean runPump2(start=false) "true if pump 2 should run";
  9. Modelica.SIunits.VolumeFlowRate v2IfRunning = 30;
  10. Modelica.SIunits.VolumeFlowRate v2
  11. "actual flow through pump 2";
  12.  
  13. Integer nPumpsRunning(start = 1) "number of pumps running";
  14.  
  15. // Total flow
  16. Modelica.SIunits.VolumeFlowRate vTotal = 70;
  17.  
  18. equation
  19. // Calculate the flow through pump 1 as a function of frequency
  20. v1 = fPump1;
  21.  
  22. // Calculate the flow through pump 2 based upon running state
  23. if fPump1 > fMax then
  24. nPumpsRunning = 2;
  25. v2 = v2IfRunning;
  26. else
  27. nPumpsRunning = 1;
  28. v2 = 0;
  29. end if;
  30.  
  31. // Calculate the total flow
  32. vTotal = v1 + v2;
  33.  
  34. end TwoPumpCode;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement