Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
within ThermofluidStream.FlowControl.Internal.Types;
type PressureControlValveMode = enumeration(
outlet "Control outlet pressure",
drop "Control pressure drop") "Modes of operation for PCV";
outlet_pressure "Control outlet pressure",
pressure_drop "Control pressure drop") "Modes of operation for PCV";
31 changes: 19 additions & 12 deletions ThermofluidStream/FlowControl/MCV.mo
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ model MCV "Flow rate control valve"


Modelica.Blocks.Interfaces.RealInput setpoint_var if setpointFromInput "Flow rate input connector"
annotation (Placement(transformation(extent={{-20,-20},{20,20}},rotation=270,origin={0,80})));
annotation (Placement(transformation(extent={{-20,-20},{20,20}},rotation=90, origin={0,-120}), iconTransformation(
extent={{-20,-20},{20,20}},
rotation=90,
origin={0,-120})));
Modelica.Blocks.Interfaces.RealOutput clippingOutput = (dp - dp_int) if enableClippingOutput ""
annotation (Placement(transformation(extent={{-10,-10},{10,10}},rotation=270,origin={0,-110})));
annotation (Placement(transformation(extent={{-10,-10},{10,10}},rotation=0, origin={110,-60}), iconTransformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={110,-60})));

SI.Density rho_in = Medium.density(inlet.state) "Inlet density";
SI.VolumeFlowRate V_flow = m_flow/rho_in "Inlet volume flow rate";
Expand Down Expand Up @@ -95,17 +101,13 @@ equation
annotation (
Icon(coordinateSystem(preserveAspectRatio=true), graphics={
Text(visible= displayInstanceName and not enableClippingOutput,
extent={{-150,-80},{150,-120}},
extent={{-150,140},{150,100}},
textString="%name",
textColor=dropOfCommons.instanceNameColor),
Text(visible= displayInstanceName and enableClippingOutput,
extent={{-150,-60},{150,-100}},
extent={{-150,120},{150,80}},
textString="%name",
textColor=dropOfCommons.instanceNameColor),
Text(visible=displayParameters and displayFlowRate and not setpointFromInput,
extent={{-150,70},{150,100}},
textColor={0,0,0},
textString=displayString),
Ellipse(
extent={{-56,54},{64,-66}},
lineColor={28,108,200},
Expand Down Expand Up @@ -141,18 +143,23 @@ equation
color={28,108,200},
thickness=0.5),
Ellipse(
extent={{60,40},{80,60}},
extent=DynamicSelect({{0,0},{0,0}}, if abs(dp - dp_int) <= eps then {{0,0},{0,0}} else {{10,10},{80,80}}),
lineColor={0,0,0},
fillColor = DynamicSelect({255,255,255}, if abs(dp - dp_int) <= eps then {0,140,72} else {238,46,47}),
fillColor = {238,46,47},
fillPattern=FillPattern.Solid),
Line(visible=enableClippingOutput and not displayInstanceName,
points={{0,-110},{0,-60}},
color={0,0,127},
thickness=0.5)}),
thickness=0.5),
Line(visible = setpointFromInput,
points={{0,-60},{0,-100}},
color={0,0,127},
pattern=LinePattern.Dash,
thickness=1)}),
Diagram(coordinateSystem(preserveAspectRatio=true)),
Documentation(info="<html>
<p>This component can be used to emulate a mass- or volume-flow regulated valve, depending on its mode. </p>
<p>The mass- or volume-flow-setpoint can be set or given by a real input signal, and the valve tries to enforce a PT1- dynamic on this setpoint, within its pressure limits. The valve will not create pressure, or let the outlet pressure drop below p_min. To avoid this, the internally integrated pressure-drop is clipped. If it is clipped and hence the setpoint cannot be reached, an optional output leaves its &quot;zero&quot; value and a visual wanring is shown (circle becomes red). </p>
<p>The mass- or volume-flow-setpoint can be set or given by a real input signal, and the valve tries to enforce a PT1- dynamic on this setpoint, within its pressure limits. The valve will not create pressure, or let the outlet pressure drop below p_min. To avoid this, the internally integrated pressure-drop is clipped. If it is clipped and hence the setpoint cannot be reached, an optional output leaves its &quot;zero&quot; value and a visual warning is shown in the form of a red circle on the icon. </p>
<p>Documentation of the used equations:</p>
<p><img src=\"modelica://ThermoFluidStream/Resources/Doku/ThermofluidStream.FlowControl.MCV.png\"/></p>
</html>"));
Expand Down
30 changes: 22 additions & 8 deletions ThermofluidStream/FlowControl/PCV.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ model PCV "Pressure and pressure-drop control valve"
import Mode = ThermofluidStream.FlowControl.Internal.Types.PressureControlValveMode;


parameter Mode mode = Mode.drop "Valve mode"
parameter Mode mode=ThermofluidStream.FlowControl.Internal.Types.PressureControlValveMode.pressure_drop "Valve mode"
annotation(Dialog(group="Pressure setpoint"));
parameter Boolean pressureFromInput = false "= true, if pressure input connector is enabled";
parameter Boolean pressureFromInput = false "= if true, the pressure input connector is enabled"
annotation(Dialog(group="Pressure setpoint"), Evaluate=true, HideResult=true, choices(checkBox=true));
parameter SI.AbsolutePressure pressure_set_par = 0 "Setpoint for pressure / pressure difference"
annotation(Dialog(group="Pressure setpoint",enable=not pressureFromInput));

parameter SI.MassFlowRate m_flow_reg = dropOfCommons.m_flow_reg "Regularization mass flow"
annotation(Dialog(tab="Advanced"));

Modelica.Blocks.Interfaces.RealInput pressure_set_var(unit="Pa") if pressureFromInput "Pressure input connector [Pa]"
annotation (Placement(transformation(extent={{-20,-20},{20,20}},rotation=270,origin={0,80})));
annotation (Placement(transformation(extent={{-20,-20},{20,20}},rotation=90, origin={0,-120})));

constant SI.Pressure eps = 1;

protected
Modelica.Blocks.Interfaces.RealInput pressure_set(unit="Pa") "Internal pressure connector [Pa]";
Expand All @@ -33,7 +36,7 @@ equation
// the motherclass will further normalize dp, such that p_out >= dp_min.
dp = ThermofluidStream.Undirected.Internal.regStep(m_flow - m_flow_reg, min(0, dp_raw), 0, m_flow_reg);

if mode ==Mode.drop then
if mode ==Mode.pressure_drop then
dp_raw = -pressure_set;
else
dp_raw = pressure_set - p_in;
Expand All @@ -42,10 +45,10 @@ equation
h_out = h_in;
Xi_out = Xi_in;

annotation(Dialog(group="Pressure setpoint"),Evaluate=true, HideResult=true, choices(checkBox=true),
annotation(
Icon(coordinateSystem(preserveAspectRatio=true), graphics={
Text(visible=displayInstanceName,
extent={{-150,-80},{150,-120}},
extent={{-150,140},{150,100}},
textString="%name",
textColor=dropOfCommons.instanceNameColor),
Ellipse(
Expand Down Expand Up @@ -81,11 +84,22 @@ equation
Line(
points={{0,0},{0,60}},
color={28,108,200},
thickness=0.5)}), Diagram(coordinateSystem(preserveAspectRatio=true)),
thickness=0.5),
Ellipse(
extent=DynamicSelect({{0,0},{0,0}}, if abs(dp - dp_raw) <= eps then {{0,0},{0,0}} else {{10,10},{80,80}}),
lineColor={0,0,0},
fillColor = {238,46,47},
fillPattern=FillPattern.Solid),
Line(visible= pressureFromInput,
points={{0,-60},{0,-100}},
color={0,0,127},
pattern=LinePattern.Dash,
thickness=1)}), Diagram(coordinateSystem(preserveAspectRatio=true)),
Documentation(info="<html>
<p>This component can be used to emulate a pressure-drop or output-pressure regulated control valve, depending on the chosen valve mode.</p>
<p>Depending on the parameter <code>mode</code>, either the pressure at the outlet <code>p_out</code> or the pressure difference <code>dp</code> between inlet and outlet can be stipulated. This is done either by parameter <code>pressure_set_par</code> or via input connector <code>pressure_set_var</code> when setting <code>pressureFromInput = true</code>. The resulting mass flow will be determined by its usual dynamics.</p>
<p>Setting <code>dp</code> instead of <code>p_out</code> has advantages, when <code>p_out</code> is determined by a volume at the outlet (for instance an accumulator).</p>
<p>The pressure difference <code>dp</code> is normalized, such that it cannot create pressure and it is zero for zero or negative mass flow. </p>
<p>The pressure difference <code>dp</code> is normalized, such that it cannot create pressure and it is zero for zero or negative mass flow.</p>
<p>If the desired pressure drop or outlet pressure, i.e. the target pressure drop in either case, can&apos;t be reached, a red dot shows up on the icon.</p>
</html>"));
end PCV;
Loading