PrescribedPump

model PrescribedPump "Centrifugal pump with ideally controlled speed"
    extends Modelica.Fluid.Machines.BaseClasses.PartialPump;

    parameter Boolean use_N_in = false "Get the rotational speed from the input connector";
    parameter Modelica.SIunits.Conversions.NonSIunits.AngularVelocity_rpm N_const = N_nominal "Constant rotational speed"
        annotation (Dialog(enable = not use_N_in));
    Modelica.Blocks.Interfaces.RealInput N_in(unit = "rev/min") if use_N_in "Prescribed rotational speed"
        annotation (Placement(
            transformation(
                extent = {
                    {-20, -20}, 
                    {20, 20}},
                rotation = -90,
                origin = {0, 100}),
            iconTransformation(
                extent = {
                    {-20, -20}, 
                    {20, 20}},
                rotation = -90,
                origin = {0, 100})));
protected
    Modelica.Blocks.Interfaces.RealInput N_in_internal(unit = "rev/min") "Needed to connect to conditional connector";
equation
    connect(N_in,N_in_internal);
    if not use_N_in then 
        N_in_internal = N_const;
    end if;
    N = max(N_in_internal, 0.001) "Rotational speed";

    annotation (
        defaultComponentName = "pump",
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Text(
                    visible = use_N_in,
                    extent = {
                        {14, 98}, 
                        {178, 82}},
                    textString = "N_in [rpm]")}),
        Documentation(
            info = "<html>\n<p>This model describes a centrifugal pump (or a group of <code>nParallel</code> pumps) with prescribed speed, either fixed or provided by an external signal.</p>\n<p>The model extends <code>PartialPump</code></p>\n<p>If the <code>N_in</code> input connector is wired, it provides rotational speed of the pumps (rpm); otherwise, a constant rotational speed equal to <code>n_const</code> (which can be different from <code>N_nominal</code>) is assumed.</p>\n</html>",
            revisions = "<html>\n<ul>\n<li><em>31 Oct 2005</em>\n    by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>\n       Model added to the Fluid library</li>\n</ul>\n</html>"));
end PrescribedPump;