IdealPump

model IdealPump "Model of an ideal pump"
    extends Modelica.Thermal.FluidHeatFlow.Interfaces.Partials.TwoPort(final tapT = 1);

    parameter Modelica.SIunits.AngularVelocity wNominal(start = 1, displayUnit = "rev/min") "Nominal speed"
        annotation (Dialog(group = "Pump characteristic"));
    parameter Modelica.SIunits.Pressure dp0(start = 2) "Max. pressure increase @ V_flow=0"
        annotation (Dialog(group = "Pump characteristic"));
    parameter Modelica.SIunits.VolumeFlowRate V_flow0(start = 2) "Max. volume flow rate @ dp=0"
        annotation (Dialog(group = "Pump characteristic"));
    Modelica.SIunits.AngularVelocity w = der(flange_a.phi) "Speed";
protected
    Modelica.SIunits.Pressure dp1;
    Modelica.SIunits.VolumeFlowRate V_flow1;
public
    Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a annotation (Placement(transformation(extent = {
        {-10, -110}, 
        {10, -90}})));
equation
    if noEvent(abs(w) < Modelica.Constants.small) then 
        dp = 0;
        flange_a.tau = 0;
    else 
        dp = -dp1 * (1 - V_flow / V_flow1);
        flange_a.tau * w = -dp * V_flow;
    end if;
    Q_flow = 0;
    V_flow1 = V_flow0 * (w / wNominal);
    dp1 = dp0 * sign(w / wNominal) * (w / wNominal) ^ 2;

    annotation (
        Documentation(info = "<html>\n<p>\nSimple fan resp. pump where characteristic is dependent on shaft's speed, <br>\ntorque * speed = pressure increase * volume flow (without losses)<br>\nPressure increase versus volume flow is defined by a linear function,\nfrom dp0(V_flow=0) to V_flow0(dp=0).<br>\nThe axis intersections vary with speed as follows:\n</p>\n<ul>\n<li>dp prop. speed^2</li>\n<li>V_flow prop. speed</li>\n</ul>\n<p>\nCoolant's temperature and enthalpy flow are not affected.<br>\nSetting parameter m (mass of medium within fan/pump) to zero\nleads to neglection of temperature transient cv*m*der(T).<br>\nThermodynamic equations are defined by Partials.TwoPort.\n</p>\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Ellipse(
                    extent = {
                        {-90, 90}, 
                        {90, -90}},
                    lineColor = {255, 0, 0},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {-150, 150}, 
                        {150, 90}},
                    lineColor = {0, 0, 255},
                    textString = "%name"), 
                Rectangle(
                    extent = {
                        {-10, -40}, 
                        {10, -100}},
                    fillPattern = FillPattern.VerticalCylinder,
                    fillColor = {175, 175, 175}), 
                Polygon(
                    points = {
                        {-60, 68}, 
                        {90, 10}, 
                        {90, -10}, 
                        {-60, -68}, 
                        {-60, 68}},
                    fillPattern = FillPattern.HorizontalCylinder,
                    fillColor = {0, 0, 255})}));
end IdealPump;