From 13c961e3494fc1026ce7a9b4f00c857d60ce74a9 Mon Sep 17 00:00:00 2001 From: tobolar Date: Thu, 3 Aug 2023 16:48:56 +0200 Subject: [PATCH] Add library ThermofluidStreamTest (similar to MSL - ModelicaTest) --- .../Boundaries/ConditionalConnectors.mo | 144 ++++++++++++++ .../ConditionalConnectorsSetEnthalpy.mo | 135 +++++++++++++ ThermofluidStreamTest/Boundaries/package.mo | 5 + .../Boundaries/package.order | 2 + .../Resources/Reference/.gitignore | 5 + .../comparisonSignals.txt | 16 ++ .../comparisonSignals.txt | 13 ++ .../comparisonSignals.txt | 3 + .../comparisonSignals.txt | 9 + .../Resources/Reference/readme.txt | 4 + .../Boundaries/ConditionalConnectors.mo | 23 +++ .../ConditionalConnectorsSetEnthalpy.mo | 181 ++++++++++++++++++ .../Undirected/Boundaries/package.mo | 5 + .../Undirected/Boundaries/package.order | 2 + ThermofluidStreamTest/Undirected/package.mo | 5 + .../Undirected/package.order | 1 + ThermofluidStreamTest/package.mo | 65 +++++++ ThermofluidStreamTest/package.order | 2 + 18 files changed, 620 insertions(+) create mode 100644 ThermofluidStreamTest/Boundaries/ConditionalConnectors.mo create mode 100644 ThermofluidStreamTest/Boundaries/ConditionalConnectorsSetEnthalpy.mo create mode 100644 ThermofluidStreamTest/Boundaries/package.mo create mode 100644 ThermofluidStreamTest/Boundaries/package.order create mode 100644 ThermofluidStreamTest/Resources/Reference/.gitignore create mode 100644 ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Boundaries/ConditionalConnectors/comparisonSignals.txt create mode 100644 ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Boundaries/ConditionalConnectorsSetEnthalpy/comparisonSignals.txt create mode 100644 ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectors/comparisonSignals.txt create mode 100644 ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectorsSetEnthalpy/comparisonSignals.txt create mode 100644 ThermofluidStreamTest/Resources/Reference/readme.txt create mode 100644 ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectors.mo create mode 100644 ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectorsSetEnthalpy.mo create mode 100644 ThermofluidStreamTest/Undirected/Boundaries/package.mo create mode 100644 ThermofluidStreamTest/Undirected/Boundaries/package.order create mode 100644 ThermofluidStreamTest/Undirected/package.mo create mode 100644 ThermofluidStreamTest/Undirected/package.order create mode 100644 ThermofluidStreamTest/package.mo create mode 100644 ThermofluidStreamTest/package.order diff --git a/ThermofluidStreamTest/Boundaries/ConditionalConnectors.mo b/ThermofluidStreamTest/Boundaries/ConditionalConnectors.mo new file mode 100644 index 00000000..194a1b47 --- /dev/null +++ b/ThermofluidStreamTest/Boundaries/ConditionalConnectors.mo @@ -0,0 +1,144 @@ +within ThermofluidStreamTest.Boundaries; +model ConditionalConnectors + extends Modelica.Icons.Example; + + replaceable package Medium = ThermofluidStream.Media.myMedia.Air.MoistAir + constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium annotation(choicesAllMatching = true); + + inner ThermofluidStream.DropOfCommons dropOfCommons annotation (Placement(transformation(extent={{-100,80},{-80,100}}))); + ThermofluidStream.Boundaries.Source source( + redeclare package Medium = Medium, + outlet(m_flow(start=0.5, fixed=true))) + annotation (Placement(transformation(extent={{-60,80},{-40,100}}))); + ThermofluidStream.Boundaries.Source source1( + redeclare package Medium = Medium, + setEnthalpy=false, + pressureFromInput=true, + temperatureFromInput=true, + enthalpyFromInput=true, + xiFromInput=true, + outlet(m_flow(start=0.5, fixed=true))) + annotation (Placement(transformation(extent={{-50,0},{-30,20}}))); + ThermofluidStream.Boundaries.Source source2( + redeclare package Medium = Medium, + setEnthalpy=true, + pressureFromInput=true, + temperatureFromInput=false, + enthalpyFromInput=true, + xiFromInput=true) annotation (Placement(transformation(extent={{-50,-30},{-30,-10}}))); + ThermofluidStream.Boundaries.Sink sink( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{0,80},{20,100}}))); + ThermofluidStream.Boundaries.Sink sink1( + redeclare package Medium = Medium, + pressureFromInput=true) + annotation (Placement(transformation(extent={{-10,0},{10,20}}))); + ThermofluidStream.Boundaries.CreateState createState( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-60,50},{-40,70}}))); + ThermofluidStream.Boundaries.CreateState createState1( + redeclare package Medium = Medium, + setEnthalpy=false, + PFromInput=true, + TFromInput=true, + XiFromInput=true) annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + ThermofluidStream.Boundaries.CreateState createState2( + redeclare package Medium = Medium, + setEnthalpy=true, + PFromInput=true, + TFromInput=false, + hFromInput=true, + XiFromInput=true) annotation (Placement(transformation(extent={{-40,-90},{-20,-70}}))); + ThermofluidStream.Boundaries.DynamicPressureInflow dynamicPressureInflow( + redeclare package Medium = Medium, + v_in_par=0.1) + annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermofluidStream.Boundaries.DynamicPressureInflow dynamicPressureInflow1( + redeclare package Medium = Medium, + areaFromInput=true, + velocityFromInput=true) annotation (Placement(transformation(extent={{20,-10},{40,-30}}))); + ThermofluidStream.Boundaries.DynamicPressureOutflow dynamicPressureOutflow( + redeclare package Medium = Medium, + v_out_par=0.1) + annotation (Placement(transformation(extent={{20,50},{40,70}}))); + ThermofluidStream.Boundaries.DynamicPressureOutflow dynamicPressureOutflow1( + redeclare package Medium = Medium, + areaFromInput=true, + velocityFromInput=true) annotation (Placement(transformation(extent={{50,-10},{70,-30}}))); + ThermofluidStream.Topology.SplitterT2 splitterT2_1( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-30,100},{-10,80}}))); + Modelica.Blocks.Sources.Sine sine_p( + amplitude=0.1, + f=1, + offset=1e5) annotation (Placement(transformation(extent={{-100,10},{-80,30}}))); + Modelica.Blocks.Sources.Ramp ramp( + height=0.1, + duration=5, + offset=0.1) annotation (Placement(transformation(extent={{0,-70},{20,-50}}))); + Modelica.Blocks.Sources.Sine sine_h( + amplitude=1, + f=1, + offset=4e4) annotation (Placement(transformation(extent={{-100,-90},{-80,-70}}))); + Modelica.Blocks.Sources.Ramp ramp1( + height=0.1, + duration=5, + offset=0.1) annotation (Placement(transformation(extent={{100,-60},{80,-40}}))); + Modelica.Blocks.Sources.Sine sine_T( + amplitude=1, + f=1, + offset=293) annotation (Placement(transformation(extent={{-100,-30},{-80,-10}}))); + Modelica.Blocks.Sources.Sine sine_xi( + amplitude=0.001, + f=0.5, + offset=0.01) annotation (Placement(transformation(extent={{-100,-60},{-80,-40}}))); + Modelica.Blocks.Sources.Constant const(k=9e4) + annotation (Placement(transformation(extent={{40,0},{20,20}}))); +equation + connect(sine_p.y, source1.p0_var) annotation (Line(points={{-79,20},{-62,20},{-62,16},{-42,16}}, color={0,0,127})); + connect(sine_p.y, source2.p0_var) annotation (Line(points={{-79,20},{-62,20},{-62,-14},{-42,-14}}, color={0,0,127})); + connect(dynamicPressureInflow.outlet,dynamicPressureOutflow. inlet) annotation (Line( + points={{10,60},{20,60}}, + color={28,108,200}, + thickness=0.5)); + connect(source.outlet,splitterT2_1. inlet) annotation (Line( + points={{-40,90},{-30,90}}, + color={28,108,200}, + thickness=0.5)); + connect(splitterT2_1.outletB,sink. inlet) annotation (Line( + points={{-10,90},{0,90}}, + color={28,108,200}, + thickness=0.5)); + connect(splitterT2_1.outletA,dynamicPressureInflow. inlet) annotation (Line( + points={{-20,80},{-20,60},{-10,60}}, + color={28,108,200}, + thickness=0.5)); + connect(source1.outlet, sink1.inlet) annotation (Line( + points={{-30,10},{-10,10}}, + color={28,108,200}, + thickness=0.5)); + connect(sine_p.y, createState1.p_inp) annotation (Line(points={{-79,20},{-62,20},{-62,-40},{-40,-40}}, color={0,0,127})); + connect(sine_p.y, createState2.p_inp) annotation (Line(points={{-79,20},{-62,20},{-62,-70},{-40,-70}}, color={0,0,127})); + connect(dynamicPressureInflow1.outlet, dynamicPressureOutflow1.inlet) annotation (Line( + points={{40,-20},{50,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(source2.outlet, dynamicPressureInflow1.inlet) annotation (Line( + points={{-30,-20},{20,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(ramp.y, dynamicPressureInflow1.v_in_var) annotation (Line(points={{21,-60},{30,-60},{30,-30}}, color={0,0,127})); + connect(ramp.y, dynamicPressureOutflow1.v_out_var) annotation (Line(points={{21,-60},{54,-60},{54,-30}}, color={0,0,127})); + connect(ramp1.y, dynamicPressureInflow1.A_var) annotation (Line(points={{79,-50},{36,-50},{36,-30}}, color={0,0,127})); + connect(ramp1.y, dynamicPressureOutflow1.A_var) annotation (Line(points={{79,-50},{60,-50},{60,-30}}, color={0,0,127})); + connect(sine_T.y, source1.T0_var) annotation (Line(points={{-79,-20},{-68,-20},{-68,10},{-42,10}}, color={0,0,127})); + connect(sine_xi.y, source1.xi_var[1]) annotation (Line(points={{-79,-50},{-74,-50},{-74,4},{-42,4}}, color={0,0,127})); + connect(sine_xi.y, source2.xi_var[1]) annotation (Line(points={{-79,-50},{-74,-50},{-74,-26},{-42,-26}}, color={0,0,127})); + connect(const.y, sink1.p0_var) annotation (Line(points={{19,10},{2,10}}, color={0,0,127})); + connect(sine_T.y, createState1.T_inp) annotation (Line(points={{-79,-20},{-68,-20},{-68,-50},{-40,-50}}, color={0,0,127})); + connect(sine_xi.y, createState1.Xi_inp[1]) annotation (Line(points={{-79,-50},{-74,-50},{-74,-60},{-40,-60}}, color={0,0,127})); + connect(sine_xi.y, createState2.Xi_inp[1]) annotation (Line(points={{-79,-50},{-74,-50},{-74,-90},{-40,-90}}, color={0,0,127})); + connect(sine_h.y, createState2.h0_var) annotation (Line(points={{-79,-80},{-32,-80}}, color={0,0,127})); + connect(sine_h.y, source2.h0_var) annotation (Line(points={{-79,-80},{-56,-80},{-56,-20},{-42,-20}}, color={0,0,127})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end ConditionalConnectors; diff --git a/ThermofluidStreamTest/Boundaries/ConditionalConnectorsSetEnthalpy.mo b/ThermofluidStreamTest/Boundaries/ConditionalConnectorsSetEnthalpy.mo new file mode 100644 index 00000000..1f612cdf --- /dev/null +++ b/ThermofluidStreamTest/Boundaries/ConditionalConnectorsSetEnthalpy.mo @@ -0,0 +1,135 @@ +within ThermofluidStreamTest.Boundaries; +model ConditionalConnectorsSetEnthalpy + extends Modelica.Icons.Example; + + replaceable package Medium = ThermofluidStream.Media.myMedia.Air.MoistAir + constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium annotation(choicesAllMatching = true); + + inner ThermofluidStream.DropOfCommons dropOfCommons annotation (Placement(transformation(extent={{-100,80},{-80,100}}))); + ThermofluidStream.Boundaries.Source source1( + redeclare package Medium = Medium, + setEnthalpy=false, + pressureFromInput=true, + temperatureFromInput=true, + enthalpyFromInput=true, + xiFromInput=true, + outlet(m_flow(start=0.5, fixed=true))) + annotation (Placement(transformation(extent={{-20,80},{0,100}}))); + ThermofluidStream.Boundaries.Source source2( + redeclare package Medium = Medium, + setEnthalpy=true, + pressureFromInput=true, + temperatureFromInput=true, + enthalpyFromInput=true, + xiFromInput=true) annotation (Placement(transformation(extent={{40,60},{60,80}}))); + ThermofluidStream.Boundaries.Source source3( + redeclare package Medium = Medium, + setEnthalpy=false, + pressureFromInput=true, + temperatureFromInput=false, + enthalpyFromInput=false, + xiFromInput=true, + outlet(m_flow(start=0.5, fixed=true))) + annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + ThermofluidStream.Boundaries.Source source4( + redeclare package Medium = Medium, + setEnthalpy=true, + pressureFromInput=true, + temperatureFromInput=false, + enthalpyFromInput=false, + xiFromInput=true) annotation (Placement(transformation(extent={{40,20},{60,40}}))); + ThermofluidStream.Boundaries.CreateState createState1( + redeclare package Medium = Medium, + setEnthalpy=false, + PFromInput=true, + TFromInput=true, + hFromInput=true, + XiFromInput=true) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermofluidStream.Boundaries.CreateState createState2( + redeclare package Medium = Medium, + setEnthalpy=true, + PFromInput=true, + TFromInput=true, + hFromInput=true, + XiFromInput=true) annotation (Placement(transformation(extent={{42,-40},{62,-20}}))); + ThermofluidStream.Boundaries.CreateState createState3( + redeclare package Medium = Medium, + setEnthalpy=false, + PFromInput=true, + TFromInput=true, + hFromInput=true, + XiFromInput=true) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermofluidStream.Boundaries.CreateState createState4( + redeclare package Medium = Medium, + setEnthalpy=true, + PFromInput=true, + TFromInput=true, + hFromInput=true, + XiFromInput=true) annotation (Placement(transformation(extent={{42,-100},{62,-80}}))); + Modelica.Blocks.Sources.Sine sine_p( + amplitude=0.1, + f=1, + offset=1e5) annotation (Placement(transformation(extent={{-80,30},{-60,50}}))); + Modelica.Blocks.Sources.Sine sine_h( + amplitude=1, + f=1, + offset=4e4) annotation (Placement(transformation(extent={{-80,-100},{-60,-80}}))); + Modelica.Blocks.Sources.Sine sine_T( + amplitude=1, + f=1, + offset=293) annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Sine sine_xi( + amplitude=0.001, + f=0.5, + offset=0.01) annotation (Placement(transformation(extent={{-80,-40},{-60,-20}}))); +equation + connect(sine_p.y, source1.p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,96},{-12,96}}, + color={0,0,127})); + connect(sine_p.y, source2.p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,76},{48,76}}, color={0,0,127})); + connect(sine_p.y, createState1.p_inp) annotation (Line(points={{-59,40},{-32,40},{-32,10},{-10,10}}, color={0,0,127})); + connect(sine_p.y, createState2.p_inp) annotation (Line(points={{-59,40},{-32,40},{-32,-20},{42,-20}}, color={0,0,127})); + connect(sine_T.y, source1.T0_var) annotation (Line(points={{-59,10},{-38,10},{-38,90},{-12,90}}, + color={0,0,127})); + connect(sine_xi.y, source1.xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,84},{-12,84}}, + color={0,0,127})); + connect(sine_xi.y, source2.xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,64},{48,64}},color={0,0,127})); + connect(sine_T.y, createState1.T_inp) annotation (Line(points={{-59,10},{-38,10},{-38,0},{-10,0}}, color={0,0,127})); + connect(sine_xi.y, createState1.Xi_inp[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,-10},{-10,-10}}, color={0,0,127})); + connect(sine_xi.y, createState2.Xi_inp[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,-40},{42,-40}}, color={0,0,127})); + connect(sine_h.y, createState2.h0_var) annotation (Line(points={{-59,-90},{-26,-90},{-26,-30},{50,-30}}, + color={0,0,127})); + connect(sine_h.y, source2.h0_var) annotation (Line(points={{-59,-90},{-26,-90},{-26,70},{48,70}}, + color={0,0,127})); + connect(sine_p.y,source3. p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,56},{-12,56}}, + color={0,0,127})); + connect(sine_p.y,source4. p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,36},{48,36}},color={0,0,127})); + connect(sine_T.y,source3. T0_var) annotation (Line(points={{-59,10},{-38,10},{-38,50},{-12,50}}, + color={0,0,127})); + connect(sine_xi.y,source3. xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,44},{-12,44}}, + color={0,0,127})); + connect(sine_xi.y,source4. xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,24},{48,24}},color={0,0,127})); + connect(sine_h.y,source4. h0_var) annotation (Line(points={{-59,-90},{-26,-90},{-26,30},{48,30}}, + color={0,0,127})); + connect(sine_p.y,createState3. p_inp) annotation (Line(points={{-59,40},{-32,40},{-32,-50},{-10,-50}},color={0,0,127})); + connect(sine_p.y,createState4. p_inp) annotation (Line(points={{-59,40},{-32,40},{-32,-80},{42,-80}}, color={0,0,127})); + connect(sine_T.y,createState3. T_inp) annotation (Line(points={{-59,10},{-38,10},{-38,-60},{-10,-60}}, + color={0,0,127})); + connect(sine_xi.y,createState3. Xi_inp[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,-70},{-10,-70}},color={0,0,127})); + connect(sine_xi.y,createState4. Xi_inp[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,-100},{42,-100}}, + color={0,0,127})); + connect(sine_h.y,createState4. h0_var) annotation (Line(points={{-59,-90},{50,-90}}, color={0,0,127})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false), graphics={ + Text( + extent={{32,22},{78,12}}, + textColor={0,140,72}, + textString="setEnthalpy=true"), + Line( + points={{30,96},{30,-98}}, + color={0,140,72}, + pattern=LinePattern.Dash, + thickness=0.5), + Text( + extent={{-18,22},{28,12}}, + textColor={238,46,47}, + textString="setEnthalpy=false")})); +end ConditionalConnectorsSetEnthalpy; diff --git a/ThermofluidStreamTest/Boundaries/package.mo b/ThermofluidStreamTest/Boundaries/package.mo new file mode 100644 index 00000000..a86a9ce3 --- /dev/null +++ b/ThermofluidStreamTest/Boundaries/package.mo @@ -0,0 +1,5 @@ +within ThermofluidStreamTest; +package Boundaries "Test models for ThermofluidStream.Boundaries" + extends Modelica.Icons.ExamplesPackage; + +end Boundaries; diff --git a/ThermofluidStreamTest/Boundaries/package.order b/ThermofluidStreamTest/Boundaries/package.order new file mode 100644 index 00000000..690bbf35 --- /dev/null +++ b/ThermofluidStreamTest/Boundaries/package.order @@ -0,0 +1,2 @@ +ConditionalConnectors +ConditionalConnectorsSetEnthalpy diff --git a/ThermofluidStreamTest/Resources/Reference/.gitignore b/ThermofluidStreamTest/Resources/Reference/.gitignore new file mode 100644 index 00000000..37fb31c1 --- /dev/null +++ b/ThermofluidStreamTest/Resources/Reference/.gitignore @@ -0,0 +1,5 @@ +# exclude following files +*.csv +*.log +*.mat +**/creation.txt diff --git a/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Boundaries/ConditionalConnectors/comparisonSignals.txt b/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Boundaries/ConditionalConnectors/comparisonSignals.txt new file mode 100644 index 00000000..5d0c183d --- /dev/null +++ b/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Boundaries/ConditionalConnectors/comparisonSignals.txt @@ -0,0 +1,16 @@ +time +createState.y.state.p +createState.y.state.T +createState1.y.state.p +createState1.y.state.T +createState2.y.state.p +createState2.y.state.T +dynamicPressureInflow.outlet.m_flow +dynamicPressureInflow1.outlet.m_flow +dynamicPressureOutflow.outlet.m_flow +dynamicPressureOutflow1.outlet.m_flow +sink.inlet.m_flow +sink1.r +source.outlet.m_flow +source1.outlet.m_flow +source2.outlet.m_flow diff --git a/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Boundaries/ConditionalConnectorsSetEnthalpy/comparisonSignals.txt b/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Boundaries/ConditionalConnectorsSetEnthalpy/comparisonSignals.txt new file mode 100644 index 00000000..ab64907a --- /dev/null +++ b/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Boundaries/ConditionalConnectorsSetEnthalpy/comparisonSignals.txt @@ -0,0 +1,13 @@ +time +createState1.y.state.p +createState1.y.state.T +createState2.y.state.p +createState2.y.state.T +createState3.y.state.p +createState3.y.state.T +createState4.y.state.p +createState4.y.state.T +source1.outlet.m_flow +source2.outlet.m_flow +source3.outlet.m_flow +source4.outlet.m_flow diff --git a/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectors/comparisonSignals.txt b/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectors/comparisonSignals.txt new file mode 100644 index 00000000..9eb5bcbf --- /dev/null +++ b/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectors/comparisonSignals.txt @@ -0,0 +1,3 @@ +time +mCV.outlet.m_flow +sourceA.outlet.m_flow diff --git a/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectorsSetEnthalpy/comparisonSignals.txt b/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectorsSetEnthalpy/comparisonSignals.txt new file mode 100644 index 00000000..7dbdc857 --- /dev/null +++ b/ThermofluidStreamTest/Resources/Reference/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectorsSetEnthalpy/comparisonSignals.txt @@ -0,0 +1,9 @@ +time +boundaryRear1.fore.m_flow +boundaryRear2.fore.m_flow +boundaryRear3.fore.m_flow +boundaryRear4.fore.m_flow +boundaryFore1.rear.m_flow +boundaryFore2.rear.m_flow +boundaryFore3.rear.m_flow +boundaryFore4.rear.m_flow diff --git a/ThermofluidStreamTest/Resources/Reference/readme.txt b/ThermofluidStreamTest/Resources/Reference/readme.txt new file mode 100644 index 00000000..d80d3157 --- /dev/null +++ b/ThermofluidStreamTest/Resources/Reference/readme.txt @@ -0,0 +1,4 @@ +This directory contains the variable names of all example models to be used +as comparison signals for testing purposes. The directory structure is according to +the library tree of the Modelica package. Each file must be named +comparisonSignals.txt and must at least contain the "time" signal as first line. diff --git a/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectors.mo b/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectors.mo new file mode 100644 index 00000000..9ac38a47 --- /dev/null +++ b/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectors.mo @@ -0,0 +1,23 @@ +within ThermofluidStreamTest.Undirected.Boundaries; +model ConditionalConnectors + extends Modelica.Icons.Example; + + replaceable package Medium = ThermofluidStream.Media.myMedia.Incompressible.Examples.Glycol47 + constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium annotation(choicesAllMatching = true); + + inner ThermofluidStream.DropOfCommons dropOfCommons annotation (Placement(transformation(extent={{-100,80},{-80,100}}))); + ThermofluidStream.Boundaries.Source sourceA( + redeclare package Medium = Medium, + T0_par=333.15) + annotation (Placement(transformation( + extent={{10,-10},{-10,10}}, + rotation=180, + origin={-30,50}))); + ThermofluidStream.FlowControl.MCV mCV annotation (Placement(transformation(extent={{20,40},{40,60}}))); +equation + connect(sourceA.outlet, mCV.inlet) annotation (Line( + points={{-20,50},{20,50}}, + color={28,108,200}, + thickness=0.5)); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end ConditionalConnectors; diff --git a/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectorsSetEnthalpy.mo b/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectorsSetEnthalpy.mo new file mode 100644 index 00000000..d805941c --- /dev/null +++ b/ThermofluidStreamTest/Undirected/Boundaries/ConditionalConnectorsSetEnthalpy.mo @@ -0,0 +1,181 @@ +within ThermofluidStreamTest.Undirected.Boundaries; +model ConditionalConnectorsSetEnthalpy + extends Modelica.Icons.Example; + + replaceable package Medium = ThermofluidStream.Media.myMedia.Air.MoistAir + constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium annotation(choicesAllMatching = true); + + ThermofluidStream.Undirected.Boundaries.BoundaryRear boundaryRear1( + redeclare package Medium = Medium, + setEnthalpy=false, + pressureFromInput=true, + temperatureFromInput=true, + enthalpyFromInput=true, + xiFromInput=true) annotation (Placement(transformation(extent={{-20,80},{0,100}}))); + ThermofluidStream.Undirected.Boundaries.BoundaryRear boundaryRear2( + redeclare package Medium = Medium, + setEnthalpy=true, + pressureFromInput=true, + temperatureFromInput=true, + enthalpyFromInput=true, + xiFromInput=true) annotation (Placement(transformation(extent={{40,60},{60,80}}))); + ThermofluidStream.Undirected.Boundaries.BoundaryRear boundaryRear3( + redeclare package Medium = Medium, + setEnthalpy=false, + pressureFromInput=true, + temperatureFromInput=false, + enthalpyFromInput=false, + xiFromInput=true) annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + ThermofluidStream.Undirected.Boundaries.BoundaryRear boundaryRear4( + redeclare package Medium = Medium, + setEnthalpy=true, + pressureFromInput=true, + temperatureFromInput=false, + enthalpyFromInput=false, + xiFromInput=true) annotation (Placement(transformation(extent={{40,20},{60,40}}))); + ThermofluidStream.Undirected.Boundaries.TerminalFore terminalFore1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{10,80},{30,100}}))); + ThermofluidStream.Undirected.Boundaries.TerminalFore terminalFore2( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{70,60},{90,80}}))); + ThermofluidStream.Undirected.Boundaries.TerminalFore terminalFore3( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{10,40},{30,60}}))); + ThermofluidStream.Undirected.Boundaries.TerminalFore terminalFore4( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{70,20},{90,40}}))); + ThermofluidStream.Undirected.Boundaries.BoundaryFore boundaryFore1( + redeclare package Medium = Medium, + setEnthalpy=false, + pressureFromInput=true, + temperatureFromInput=true, + enthalpyFromInput=true, + xiFromInput=true) annotation (Placement(transformation(extent={{0,-20},{-20,0}}))); + ThermofluidStream.Undirected.Boundaries.BoundaryFore boundaryFore2( + redeclare package Medium = Medium, + setEnthalpy=true, + pressureFromInput=true, + temperatureFromInput=true, + enthalpyFromInput=true, + xiFromInput=true) annotation (Placement(transformation(extent={{60,-38},{40,-18}}))); + ThermofluidStream.Undirected.Boundaries.BoundaryFore boundaryFore3( + redeclare package Medium = Medium, + setEnthalpy=false, + pressureFromInput=true, + temperatureFromInput=false, + enthalpyFromInput=false, + xiFromInput=true) annotation (Placement(transformation(extent={{0,-58},{-20,-38}}))); + ThermofluidStream.Undirected.Boundaries.BoundaryFore boundaryFore4( + redeclare package Medium = Medium, + setEnthalpy=true, + pressureFromInput=true, + temperatureFromInput=false, + enthalpyFromInput=false, + xiFromInput=true) annotation (Placement(transformation(extent={{60,-78},{40,-58}}))); + ThermofluidStream.Undirected.Boundaries.TerminalRear terminalRear1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-20},{10,0}}))); + ThermofluidStream.Undirected.Boundaries.TerminalRear terminalRear2( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{90,-38},{70,-18}}))); + ThermofluidStream.Undirected.Boundaries.TerminalRear terminalRear3( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{30,-58},{10,-38}}))); + ThermofluidStream.Undirected.Boundaries.TerminalRear terminalRear4( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{90,-78},{70,-58}}))); + inner ThermofluidStream.DropOfCommons dropOfCommons annotation (Placement(transformation(extent={{-100,80},{-80,100}}))); + Modelica.Blocks.Sources.Sine sine_p( + amplitude=0.1, + f=1, + offset=1e5) annotation (Placement(transformation(extent={{-80,30},{-60,50}}))); + Modelica.Blocks.Sources.Sine sine_h( + amplitude=1, + f=1, + offset=4e4) annotation (Placement(transformation(extent={{-80,-100},{-60,-80}}))); + Modelica.Blocks.Sources.Sine sine_T( + amplitude=1, + f=1, + offset=293) annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Sine sine_xi( + amplitude=0.001, + f=0.5, + offset=0.01) annotation (Placement(transformation(extent={{-80,-40},{-60,-20}}))); +equation + connect(sine_p.y, boundaryRear1.p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,96},{-12,96}}, color={0,0,127})); + connect(sine_p.y, boundaryRear2.p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,76},{48,76}}, color={0,0,127})); + connect(sine_T.y, boundaryRear1.T0_var) annotation (Line(points={{-59,10},{-38,10},{-38,90},{-12,90}}, color={0,0,127})); + connect(sine_xi.y, boundaryRear1.xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,84},{-12,84}}, color={0,0,127})); + connect(sine_xi.y, boundaryRear2.xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,64},{48,64}}, color={0,0,127})); + connect(sine_h.y, boundaryRear2.h0_var) annotation (Line(points={{-59,-90},{-26,-90},{-26,70},{48,70}}, color={0,0,127})); + connect(sine_p.y,boundaryRear3. p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,56},{-12,56}}, color={0,0,127})); + connect(sine_p.y,boundaryRear4. p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,36},{48,36}}, color={0,0,127})); + connect(sine_T.y,boundaryRear3. T0_var) annotation (Line(points={{-59,10},{-38,10},{-38,50},{-12,50}}, color={0,0,127})); + connect(sine_xi.y,boundaryRear3. xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,44},{-12,44}}, color={0,0,127})); + connect(sine_xi.y,boundaryRear4. xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,24},{48,24}}, color={0,0,127})); + connect(sine_h.y,boundaryRear4. h0_var) annotation (Line(points={{-59,-90},{-26,-90},{-26,30},{48,30}}, color={0,0,127})); + connect(boundaryRear1.fore, terminalFore1.rear) annotation (Line( + points={{0,90},{10,90}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryRear2.fore,terminalFore2. rear) annotation (Line( + points={{60,70},{70,70}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryRear3.fore,terminalFore3. rear) annotation (Line( + points={{0,50},{10,50}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryRear4.fore,terminalFore4. rear) annotation (Line( + points={{60,30},{70,30}}, + color={28,108,200}, + thickness=0.5)); + connect(sine_p.y, boundaryFore1.p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,-4},{-12,-4}}, color={0,0,127})); + connect(sine_T.y, boundaryFore1.T0_var) annotation (Line(points={{-59,10},{-38,10},{-38,-10},{-12,-10}}, color={0,0,127})); + connect(sine_xi.y, boundaryFore1.xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,-16},{-12,-16}}, color={0,0,127})); + connect(boundaryFore1.rear, terminalRear1.fore) annotation (Line( + points={{0,-10},{10,-10}}, + color={28,108,200}, + thickness=0.5)); + connect(sine_p.y,boundaryFore2. p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,-22},{48,-22}}, + color={0,0,127})); + connect(sine_xi.y,boundaryFore2. xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,-34},{48,-34}}, + color={0,0,127})); + connect(sine_h.y,boundaryFore2. h0_var) annotation (Line(points={{-59,-90},{-26,-90},{-26,-28},{48,-28}}, + color={0,0,127})); + connect(sine_p.y,boundaryFore3. p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,-42},{-12,-42}}, + color={0,0,127})); + connect(sine_p.y,boundaryFore4. p0_var) annotation (Line(points={{-59,40},{-32,40},{-32,-62},{48,-62}}, + color={0,0,127})); + connect(sine_T.y,boundaryFore3. T0_var) annotation (Line(points={{-59,10},{-38,10},{-38,-48},{-12,-48}}, + color={0,0,127})); + connect(sine_xi.y,boundaryFore3. xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,-54},{-12,-54}}, + color={0,0,127})); + connect(sine_xi.y,boundaryFore4. xi_var[1]) annotation (Line(points={{-59,-30},{-44,-30},{-44,-74},{48,-74}}, + color={0,0,127})); + connect(sine_h.y,boundaryFore4. h0_var) annotation (Line(points={{-59,-90},{-26,-90},{-26,-68},{48,-68}}, + color={0,0,127})); + connect(boundaryFore2.rear, terminalRear2.fore) annotation (Line( + points={{60,-28},{70,-28}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryFore3.rear,terminalRear3. fore) annotation (Line( + points={{0,-48},{10,-48}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryFore4.rear,terminalRear4. fore) annotation (Line( + points={{60,-68},{70,-68}}, + color={28,108,200}, + thickness=0.5)); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false), graphics={ + Text( + extent={{32,22},{78,12}}, + textColor={0,140,72}, + textString="setEnthalpy=true"), + Line( + points={{30,96},{30,-98}}, + color={0,140,72}, + pattern=LinePattern.Dash, + thickness=0.5), + Text( + extent={{-18,22},{28,12}}, + textColor={238,46,47}, + textString="setEnthalpy=false")})); +end ConditionalConnectorsSetEnthalpy; diff --git a/ThermofluidStreamTest/Undirected/Boundaries/package.mo b/ThermofluidStreamTest/Undirected/Boundaries/package.mo new file mode 100644 index 00000000..feb8fb1c --- /dev/null +++ b/ThermofluidStreamTest/Undirected/Boundaries/package.mo @@ -0,0 +1,5 @@ +within ThermofluidStreamTest.Undirected; +package Boundaries "Test models for ThermofluidStream.Undirected.Boundaries" + extends Modelica.Icons.ExamplesPackage; + +end Boundaries; diff --git a/ThermofluidStreamTest/Undirected/Boundaries/package.order b/ThermofluidStreamTest/Undirected/Boundaries/package.order new file mode 100644 index 00000000..690bbf35 --- /dev/null +++ b/ThermofluidStreamTest/Undirected/Boundaries/package.order @@ -0,0 +1,2 @@ +ConditionalConnectors +ConditionalConnectorsSetEnthalpy diff --git a/ThermofluidStreamTest/Undirected/package.mo b/ThermofluidStreamTest/Undirected/package.mo new file mode 100644 index 00000000..a9a1db3e --- /dev/null +++ b/ThermofluidStreamTest/Undirected/package.mo @@ -0,0 +1,5 @@ +within ThermofluidStreamTest; +package Undirected "Test models for ThermofluidStream.Undirected" + extends Modelica.Icons.ExamplesPackage; + +end Undirected; diff --git a/ThermofluidStreamTest/Undirected/package.order b/ThermofluidStreamTest/Undirected/package.order new file mode 100644 index 00000000..7ff5b91d --- /dev/null +++ b/ThermofluidStreamTest/Undirected/package.order @@ -0,0 +1 @@ +Boundaries diff --git a/ThermofluidStreamTest/package.mo b/ThermofluidStreamTest/package.mo new file mode 100644 index 00000000..7cd7a659 --- /dev/null +++ b/ThermofluidStreamTest/package.mo @@ -0,0 +1,65 @@ +within ; +package ThermofluidStreamTest "Library to test components of package ThermofluidStream" + extends Modelica.Icons.Package; + annotation ( + preferredView="info", + version="1.1.0", + versionDate="2024-02-05", + dateModified = "2024-02-05 11:00:00Z", + revisionId="$Format:%h %ci$", + uses( + ThermofluidStream(version="1.1.0"), + Modelica(version="4.0.0")), + Documentation( + info=" +

+This library provides models and functions to test components of +package ThermofluidStream. +

+ +

+Further development of this library should be performed in the following +way: +

+ + + +

+ +This Modelica package is free software and the use is completely at +your own risk; it can be redistributed and/or modified under the terms +of the 3-Clause BSD license. For license conditions (including the disclaimer of warranty) +visit ThermofluidStream.UsersGuide.License. + +

+", + revisions=" + + + + + +
+ \"Logo + + Copyright © 2024, DLR Institut für Systemdynamik und Regelungstechnik +
+")); +end ThermofluidStreamTest; diff --git a/ThermofluidStreamTest/package.order b/ThermofluidStreamTest/package.order new file mode 100644 index 00000000..ed06cae7 --- /dev/null +++ b/ThermofluidStreamTest/package.order @@ -0,0 +1,2 @@ +Boundaries +Undirected