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
37 changes: 3 additions & 34 deletions ThermofluidStream/FlowControl/BasicControlValve.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ within ThermofluidStream.FlowControl;
model BasicControlValve "Basic valve model with optional flow characteristics for incompressible fluids"

extends ThermofluidStream.FlowControl.Internal.PartialValve;
extends ThermofluidStream.FlowControl.Internal.ValveIcon;

import FlowCoeffType = ThermofluidStream.FlowControl.Internal.Types.FlowCoefficientTypesBasic;

Expand Down Expand Up @@ -52,40 +53,8 @@ equation

k_u = valveCharacteristics(u, k_min);

annotation (Icon(coordinateSystem(preserveAspectRatio=true), graphics={
Line(
points={{-100,0},{-40,0}},
color={28,108,200},
thickness=0.5),
Line(
points={{40,0},{-40,0}},
color={28,108,200},
thickness=0.5,
pattern=LinePattern.Dash),
Line(
points={{0,0},{0,80}},
color={0,0,127},
thickness=0.5),
Line(
points={{40,0},{100,0}},
color={28,108,200},
thickness=0.5),
Polygon(
points={{-20,40},{0,0},{20,40},{-20,40}},
lineColor={28,108,200},
lineThickness=0.5,
fillColor=DynamicSelect({255,255,255}, if invertInput == true then
{28,108,200} else {255,255,255}),
fillPattern=FillPattern.Solid),
Polygon(
points={{-20,20},{0,-20},{20,20},{-20,20}},
lineColor={28,108,200},
lineThickness=0.5,
fillColor=DynamicSelect({255,255,255}, if invertInput == true then
{28,108,200} else {255,255,255}),
fillPattern=FillPattern.Solid,
origin={0,-20},
rotation=180)}), Diagram(coordinateSystem(preserveAspectRatio=true)),
annotation (Icon(coordinateSystem(preserveAspectRatio=true)),
Diagram(coordinateSystem(preserveAspectRatio=true)),
Documentation(info="<html>
<p>This model serves for most incompressible applications where basic control valves are needed. </p>
<p><br>The modeler has the ability to choose between different valve characteristics and flow coefficients.</p>
Expand Down
55 changes: 55 additions & 0 deletions ThermofluidStream/FlowControl/Internal/ValveIcon.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
within ThermofluidStream.FlowControl.Internal;
partial model ValveIcon

annotation (Icon(coordinateSystem(preserveAspectRatio=true), graphics={
Rectangle(
extent=DynamicSelect({{-80,0},{80,0}},{{-80,u*30},{80,-u*30}}),
lineColor={255,255,255},
pattern=LinePattern.None,
lineThickness=1,
fillColor={220,239,255},
fillPattern=FillPattern.VerticalCylinder),
Line(
points={{-100,0},{-40,0}},
color={28,108,200},
thickness=0.5),
Line(
points={{40,0},{-40,0}},
color={28,108,200},
thickness=0.5,
pattern=LinePattern.Dash),
Line(
points={{0,50},{0,80}},
color={0,0,127},
thickness=0.5),
Line(
points={{40,0},{100,0}},
color={28,108,200},
thickness=0.5),
Polygon(
points=DynamicSelect({{-30,50},{0,0},{30,50},{-30,50}},{{-30,50},{0,u*30},{30,50},{-30,50}}),
lineColor={28,108,200},
lineThickness=0.5,
fillColor=DynamicSelect({255,255,255}, if invertInput == true then
{28,108,200} else {255,255,255}),
fillPattern=FillPattern.Solid),
Polygon(
points=DynamicSelect({{-30,-50},{0,0},{30,-50},{-30,-50}},{{-30,-50},{0,-u*30},{30,-50},{-30,-50}}),
lineColor={28,108,200},
lineThickness=0.5,
fillColor=DynamicSelect({255,255,255}, if invertInput == true then
{28,108,200} else {255,255,255}),
fillPattern=FillPattern.Solid),
Text(
extent={{40,100},{100,70}},
textColor={0,0,0},
textString=DynamicSelect("u", String(u, format="1.2f")))}),
Diagram(coordinateSystem(preserveAspectRatio=true)),
Documentation(info="<html>
<p>This model serves for most incompressible applications where basic control valves are needed. </p>
<p><br>The modeler has the ability to choose between different valve characteristics and flow coefficients.</p>
<p>The three standard curve characteristics (linear, parabolic, equal-percentage) are implemented and can be chosen.</p>
<p><br>To conclude the parameterization, a flow coefficient has to be set. Most data sheets of valves deliver a corresponding &quot;KVs (CVs)&quot;-Value. Otherwise a nominal mass-flow rate can be set. </p>
<p>For incompressible flow, the reference values for density (1g/cm3) and pressure (1bar) should be unchanged.</p>
</html>"));
end ValveIcon;
1 change: 1 addition & 0 deletions ThermofluidStream/FlowControl/Internal/package.order
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ ControlValve
Types
Curves
PartialValve
ValveIcon
87 changes: 87 additions & 0 deletions ThermofluidStream/FlowControl/Tests/IconTest.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
within ThermofluidStream.FlowControl.Tests;
model IconTest "Test for Switches"
extends Modelica.Icons.Example;

replaceable package Medium = Media.myMedia.Air.SimpleAir
constrainedby Media.myMedia.Interfaces.PartialMedium "Medium package"
annotation (choicesAllMatching=true, Documentation(info="<html>
<p>
Medium package used in the Test.
</p>
</html>"));

inner DropOfCommons dropOfCommons(assertionLevel = AssertionLevel.warning)
annotation (Placement(transformation(extent={{80,80},{100,100}})));
Boundaries.Source source2(
redeclare package Medium = Medium,
pressureFromInput=false,
T0_par(displayUnit="K") = 300,
p0_par=300000)
annotation (Placement(transformation(extent={{10,-10},{-10,10}},
rotation=180,
origin={-50,30})));
Boundaries.Sink sink3(redeclare package Medium = Medium, p0_par=100000)
annotation (Placement(transformation(extent={{10,-10},{-10,10}},
rotation=180,
origin={30,30})));
Modelica.Blocks.Sources.Ramp ramp(duration=2, startTime=0.5)
annotation (Placement(transformation(extent={{-30,50},{-10,70}})));
ThermofluidStream.FlowControl.BasicControlValve basicControlValve(redeclare package Medium = Medium,
invertInput=true,
redeclare function valveCharacteristics =
ThermofluidStream.FlowControl.Internal.ControlValve.linearCharacteristics,
Kvs=1)
annotation (Placement(transformation(extent={{-10,20},{10,40}})));
Boundaries.Source source1(
redeclare package Medium = Medium,
pressureFromInput=false,
T0_par(displayUnit="K") = 300,
p0_par=300000)
annotation (Placement(transformation(extent={{10,-10},{-10,10}},
rotation=180,
origin={-50,-50})));
Boundaries.Sink sink1(redeclare package Medium = Medium, p0_par=100000)
annotation (Placement(transformation(extent={{10,-10},{-10,10}},
rotation=180,
origin={30,-50})));
Modelica.Blocks.Sources.Ramp ramp1(duration=2, startTime=0.5)
annotation (Placement(transformation(extent={{-30,-30},{-10,-10}})));
ThermofluidStream.FlowControl.BasicControlValve basicControlValve1(
redeclare package Medium = Medium,
invertInput=false,
redeclare function valveCharacteristics =
ThermofluidStream.FlowControl.Internal.ControlValve.linearCharacteristics,
Kvs=1)
annotation (Placement(transformation(extent={{-10,-60},{10,-40}})));
equation
connect(source2.outlet, basicControlValve.inlet) annotation (Line(
points={{-40,30},{-10,30}},
color={28,108,200},
thickness=0.5));
connect(sink3.inlet, basicControlValve.outlet) annotation (Line(
points={{20,30},{10,30}},
color={28,108,200},
thickness=0.5));
connect(ramp.y, basicControlValve.u_in)
annotation (Line(points={{-9,60},{0,60},{0,38}}, color={0,0,127}));
connect(source1.outlet, basicControlValve1.inlet) annotation (Line(
points={{-40,-50},{-10,-50}},
color={28,108,200},
thickness=0.5));
connect(sink1.inlet, basicControlValve1.outlet) annotation (Line(
points={{20,-50},{10,-50}},
color={28,108,200},
thickness=0.5));
connect(ramp1.y, basicControlValve1.u_in)
annotation (Line(points={{-9,-20},{0,-20},{0,-42}}, color={0,0,127}));
annotation (Diagram(coordinateSystem(extent={{-120,-100},{100,100}})),
experiment(
StopTime=3,
Interval=0.01,
Tolerance=1e-06,
__Dymola_Algorithm="Dassl"),
Documentation(info="<html>
<p>Test for the switches.</p>
<p>Owner: Michael Mei&szlig;ner</p>
</html>"));
end IconTest;
1 change: 1 addition & 0 deletions ThermofluidStream/FlowControl/Tests/package.order
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ SpecificValveType
MCV
PCV
Switch
IconTest