diff --git a/ThermofluidStream/Boundaries/PhaseSeparator.mo b/ThermofluidStream/Boundaries/PhaseSeparator.mo index b29ac143..62361d57 100644 --- a/ThermofluidStream/Boundaries/PhaseSeparator.mo +++ b/ThermofluidStream/Boundaries/PhaseSeparator.mo @@ -35,6 +35,8 @@ model PhaseSeparator "Parent to Reciever and Accumulator models" Real liquid_level(unit="1") "level of liquid line"; Real liquid_level_pipe(unit="1") "level of liquid line in pipe"; + Real vapor_quality = max(0,min(1,x)); + protected Medium.MassFraction x = (medium.h-h_bubble)/(h_dew - h_bubble) "Calculated vapor quality of medium that can go below zero and above one"; SI.SpecificEnthalpy h_pipe; diff --git a/ThermofluidStream/Boundaries/Tests/Reservoir.mo b/ThermofluidStream/Boundaries/Tests/Reservoir.mo index a8fb1d3b..46ab89d4 100644 --- a/ThermofluidStream/Boundaries/Tests/Reservoir.mo +++ b/ThermofluidStream/Boundaries/Tests/Reservoir.mo @@ -2,7 +2,8 @@ within ThermofluidStream.Boundaries.Tests; model Reservoir "Test for Reservoir" extends Modelica.Icons.Example; - replaceable package Medium = Media.myMedia.CompressibleLiquids.LinearColdWater + replaceable package Medium = + Media.myMedia.CompressibleLiquids.LinearColdWater constrainedby Media.myMedia.Interfaces.PartialMedium "Medium Model" annotation(choicesAllMatching=true, Documentation(info=" @@ -25,7 +26,8 @@ model Reservoir "Test for Reservoir" Processes.Pump pump(redeclare package Medium=Medium, initM_flow= ThermofluidStream.Utilities.Types.InitializationMethods.state, omega_from_input=true, - redeclare function dp_tau_pump = Processes.Internal.TurboComponent.dp_tau_nominal_flow ( + redeclare function dp_tau_pump = + Processes.Internal.TurboComponent.dp_tau_nominal_flow ( V_r_input(displayUnit="m3") = 0.1, k_p_input=500, k_fric_input=0)) diff --git a/ThermofluidStream/Boundaries/Tests/SourceSink.mo b/ThermofluidStream/Boundaries/Tests/SourceSink.mo index 45eca1cf..e5cb942f 100644 --- a/ThermofluidStream/Boundaries/Tests/SourceSink.mo +++ b/ThermofluidStream/Boundaries/Tests/SourceSink.mo @@ -3,7 +3,8 @@ model SourceSink "Test for source and sink model" extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.SimpleAir - constrainedby Media.myMedia.Interfaces.PartialMedium + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium package" annotation (Documentation(info="
Medium package used in the Test.
diff --git a/ThermofluidStream/Boundaries/Tests/TerminalSourceSink.mo b/ThermofluidStream/Boundaries/Tests/TerminalSourceSink.mo index bd67db28..669ab75d 100644 --- a/ThermofluidStream/Boundaries/Tests/TerminalSourceSink.mo +++ b/ThermofluidStream/Boundaries/Tests/TerminalSourceSink.mo @@ -3,7 +3,8 @@ model TerminalSourceSink "Test for Terminal source and sink model" extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.SimpleAir - constrainedby Media.myMedia.Interfaces.PartialMedium + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium package" annotation (Documentation(info="Medium package used in the Test.
diff --git a/ThermofluidStream/Boundaries/Tests/Volumes.mo b/ThermofluidStream/Boundaries/Tests/Volumes.mo index a435a618..b101896e 100644 --- a/ThermofluidStream/Boundaries/Tests/Volumes.mo +++ b/ThermofluidStream/Boundaries/Tests/Volumes.mo @@ -3,7 +3,8 @@ model Volumes "Test Volumes" extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.SimpleAir - constrainedby Media.myMedia.Interfaces.PartialMedium + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium package" annotation (Documentation(info="Medium package used in the Test.
diff --git a/ThermofluidStream/Examples/EspressoMachine.mo b/ThermofluidStream/Examples/EspressoMachine.mo index 56c2653a..5958296f 100644 --- a/ThermofluidStream/Examples/EspressoMachine.mo +++ b/ThermofluidStream/Examples/EspressoMachine.mo @@ -168,7 +168,8 @@ model EspressoMachine "Get your simulated coffe!" initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, omega_from_input=true, omegaStateSelect=StateSelect.never, - redeclare function dp_tau_pump = Processes.Internal.TurboComponent.dp_tau_nominal_flow (k_fric_input=0)) + redeclare function dp_tau_pump = + Processes.Internal.TurboComponent.dp_tau_nominal_flow ( k_fric_input=0)) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, @@ -199,7 +200,8 @@ model EspressoMachine "Get your simulated coffe!" annotation (Placement(transformation(extent={{126,-106},{146,-86}}))); Processes.Pump pump1( J_p=1e-3,redeclare package Medium = Water, - redeclare function dp_tau_pump = Processes.Internal.TurboComponent.dp_tau_nominal_flow ( + redeclare function dp_tau_pump = + Processes.Internal.TurboComponent.dp_tau_nominal_flow ( parametrizeByDesignPoint=false, V_r_input(displayUnit="m3") = 0.1, k_p_input=1e6, diff --git a/ThermofluidStream/Examples/HeatPump.mo b/ThermofluidStream/Examples/HeatPump.mo index 8cf8330a..07272a03 100644 --- a/ThermofluidStream/Examples/HeatPump.mo +++ b/ThermofluidStream/Examples/HeatPump.mo @@ -2,17 +2,21 @@ within ThermofluidStream.Examples; model HeatPump extends Modelica.Icons.Example; - replaceable package Medium = Media.XRGMedia.R1234yf_ph constrainedby Media.myMedia.Interfaces.PartialMedium "Refrigerant Medium" + replaceable package Medium = Media.XRGMedia.R1234yf_ph constrainedby + Media.myMedia.Interfaces.PartialMedium "Refrigerant Medium" annotation(choicesAllMatching=true); - replaceable package Air = Media.myMedia.Air.DryAirNasa constrainedby Media.myMedia.Interfaces.PartialMedium "Air Medium" + replaceable package Air = Media.myMedia.Air.DryAirNasa constrainedby + Media.myMedia.Interfaces.PartialMedium "Air Medium" annotation(choicesAllMatching=true); HeatExchangers.DiscretizedCounterFlowHEX condenser( redeclare package MediumA = Air, redeclare package MediumB = Medium, - redeclare model ConductionElementA = HeatExchangers.Internal.ConductionElementHEX, - redeclare model ConductionElementB = HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementA = + HeatExchangers.Internal.ConductionElementHEX, + redeclare model ConductionElementB = + HeatExchangers.Internal.ConductionElementHEX_twoPhase, initializeMassFlow=false, nCells=10, A=10, @@ -23,8 +27,10 @@ model HeatPump HeatExchangers.DiscretizedCounterFlowHEX evaporator( redeclare package MediumA = Air, redeclare package MediumB = Medium, - redeclare model ConductionElementA = HeatExchangers.Internal.ConductionElementHEX, - redeclare model ConductionElementB = HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementA = + HeatExchangers.Internal.ConductionElementHEX, + redeclare model ConductionElementB = + HeatExchangers.Internal.ConductionElementHEX_twoPhase, initializeMassFlow=false, nCells=10, A=10, diff --git a/ThermofluidStream/Examples/ReverseHeatPump.mo b/ThermofluidStream/Examples/ReverseHeatPump.mo index 4d2dcefd..c80e1815 100644 --- a/ThermofluidStream/Examples/ReverseHeatPump.mo +++ b/ThermofluidStream/Examples/ReverseHeatPump.mo @@ -17,7 +17,8 @@ model ReverseHeatPump redeclare package Medium = RefrigerantMedium, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.none, omega_from_input=true, - redeclare function dp_tau_compressor = Processes.Internal.TurboComponent.dp_tau_const_isentrop ( + redeclare function dp_tau_compressor = + Processes.Internal.TurboComponent.dp_tau_const_isentrop ( kappaFromMedia=false, kappa_fixed=1.13, eta=0.8)) @@ -29,8 +30,10 @@ model ReverseHeatPump discretizedHEX( redeclare package MediumA = SecondaryMedium, redeclare package MediumB = RefrigerantMedium, - redeclare model ConductionElementA = Undirected.HeatExchangers.Internal.ConductionElementHEX, - redeclare model ConductionElementB = Undirected.HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementA = + Undirected.HeatExchangers.Internal.ConductionElementHEX, + redeclare model ConductionElementB = + Undirected.HeatExchangers.Internal.ConductionElementHEX_twoPhase, init_B=ThermofluidStream.Undirected.Processes.Internal.InitializationMethodsCondElement.fore, nCells=5, initializeMassFlow=false, @@ -43,8 +46,10 @@ model ReverseHeatPump discretizedHEX1( redeclare package MediumA = SecondaryMedium, redeclare package MediumB = RefrigerantMedium, - redeclare model ConductionElementA = Undirected.HeatExchangers.Internal.ConductionElementHEX, - redeclare model ConductionElementB = Undirected.HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementA = + Undirected.HeatExchangers.Internal.ConductionElementHEX, + redeclare model ConductionElementB = + Undirected.HeatExchangers.Internal.ConductionElementHEX_twoPhase, init_B=ThermofluidStream.Undirected.Processes.Internal.InitializationMethodsCondElement.rear, nCells=5, initializeMassFlow=false, @@ -147,8 +152,8 @@ model ReverseHeatPump annotation (Placement(transformation(extent={{10,10},{-10,-10}}, rotation=90, origin={0,-38}))); - Undirected.Topology.ConnectRearOutlet connectRearOutlet(redeclare package Medium = - RefrigerantMedium, useDefaultStateAsRear=true) annotation ( + Undirected.Topology.ConnectRearOutlet connectRearOutlet(redeclare package + Medium = RefrigerantMedium, useDefaultStateAsRear=true) annotation ( Placement(transformation( extent={{10,-10},{-10,10}}, rotation=90, @@ -209,19 +214,19 @@ model ReverseHeatPump rotation=90, origin={0,-10}))); inner DropOfCommons dropOfCommons(m_flow_reg=0.001) annotation (Placement(transformation(extent={{96,10},{116,30}}))); - Undirected.Topology.ConnectInletFore connectInletFore(redeclare package Medium = - RefrigerantMedium) annotation (Placement(transformation( + Undirected.Topology.ConnectInletFore connectInletFore(redeclare package + Medium = RefrigerantMedium) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, origin={-44,40}))); - Undirected.Topology.ConnectInletFore connectInletFore1(redeclare package Medium = - RefrigerantMedium) annotation (Placement(transformation( + Undirected.Topology.ConnectInletFore connectInletFore1(redeclare package + Medium = RefrigerantMedium) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, origin={46,40}))); ThermofluidStream.Utilities.Icons.DLRLogo dLRLogo annotation (Placement(transformation(extent={{104,-64},{160,-8}}))); - Undirected.Topology.ConnectRearOutlet connectRearOutlet1(redeclare package Medium = - RefrigerantMedium, useDefaultStateAsRear=true) annotation ( + Undirected.Topology.ConnectRearOutlet connectRearOutlet1(redeclare package + Medium = RefrigerantMedium, useDefaultStateAsRear=true) annotation ( Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, diff --git a/ThermofluidStream/Examples/SimpleAirCycle.mo b/ThermofluidStream/Examples/SimpleAirCycle.mo index e48c16fd..a73695bd 100644 --- a/ThermofluidStream/Examples/SimpleAirCycle.mo +++ b/ThermofluidStream/Examples/SimpleAirCycle.mo @@ -4,10 +4,12 @@ model SimpleAirCycle "Basic bootstrap cooling cycle" extends Modelica.Icons.Example; replaceable package Medium_ram = ThermofluidStream.Media.myMedia.Air.MoistAir - constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium + constrainedby + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium annotation(choicesAllMatching = true); - replaceable package Medium_bleed = ThermofluidStream.Media.myMedia.Air.MoistAir - constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium + replaceable package Medium_bleed = + ThermofluidStream.Media.myMedia.Air.MoistAir constrainedby + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium annotation(choicesAllMatching = true); @@ -53,7 +55,8 @@ model SimpleAirCycle "Basic bootstrap cooling cycle" initOmega=ThermofluidStream.Utilities.Types.InitializationMethods.state, initPhi=true, redeclare function dp_tau_compressor = - ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop ( + ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop + ( omega_ref=2000, skew=1, m_flow_ref=1, @@ -70,7 +73,8 @@ model SimpleAirCycle "Basic bootstrap cooling cycle" L=5e2, omega_from_input=false, redeclare function dp_tau_turbine = - ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop ( + ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop + ( omega_ref=Modelica.Constants.inf, m_flow_ref=0.36, skew=-0.2, @@ -92,7 +96,8 @@ model SimpleAirCycle "Basic bootstrap cooling cycle" initOmega=ThermofluidStream.Utilities.Types.InitializationMethods.state, initPhi=true, redeclare function dp_tau_turbine = - ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop ( + ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop + ( omega_ref=Modelica.Constants.inf, m_flow_ref=0.39, skew=-0.2, @@ -115,8 +120,10 @@ model SimpleAirCycle "Basic bootstrap cooling cycle" extent={{-10,-10},{10,10}}, rotation=270, origin={0,96}))); - Processes.Fan fan(redeclare package Medium = Medium_ram, redeclare function dp_tau_fan = - ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop ( + Processes.Fan fan(redeclare package Medium = Medium_ram, redeclare function + dp_tau_fan = + ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop + ( omega_ref=500, skew=1, m_flow_ref=0.21, @@ -124,8 +131,10 @@ model SimpleAirCycle "Basic bootstrap cooling cycle" extent={{-10,10},{10,-10}}, rotation=270, origin={-80,-66}))); - Processes.Fan fan1(redeclare package Medium = Medium_ram, redeclare function dp_tau_fan = - ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop ( + Processes.Fan fan1(redeclare package Medium = Medium_ram, redeclare function + dp_tau_fan = + ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop + ( omega_ref=1000, skew=1, eta=0.7)) annotation (Placement(transformation( diff --git a/ThermofluidStream/Examples/SimpleCoolingCycle.mo b/ThermofluidStream/Examples/SimpleCoolingCycle.mo index dd578912..408e0254 100644 --- a/ThermofluidStream/Examples/SimpleCoolingCycle.mo +++ b/ThermofluidStream/Examples/SimpleCoolingCycle.mo @@ -2,7 +2,8 @@ within ThermofluidStream.Examples; model SimpleCoolingCycle "Basic cooling cycle with a load" extends Modelica.Icons.Example; - replaceable package Medium_liquid = Media.myMedia.Water.ConstantPropertyLiquidWater + replaceable package Medium_liquid = + Media.myMedia.Water.ConstantPropertyLiquidWater constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium annotation(choicesAllMatching = true); replaceable package Medium_air = @@ -41,23 +42,23 @@ extends Modelica.Icons.Example; r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1e5)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=1e5)) annotation (Placement(transformation(extent={{60,50},{80,70}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - Medium_liquid, temperatureUnit="degC") + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = Medium_liquid, temperatureUnit="degC") annotation (Placement(transformation(extent={{50,-14},{30,6}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - Medium_liquid, temperatureUnit="degC") + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = Medium_liquid, temperatureUnit="degC") annotation (Placement(transformation(extent={{-6,-14},{-26,6}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - Medium_liquid, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = Medium_liquid, digits=2, outputMassFlowRate=true, temperatureUnit="degC") annotation (Placement(transformation(extent={{-60,-14},{-80,-34}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package Medium = - Medium_liquid, temperatureUnit="degC") + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package + Medium = Medium_liquid, temperatureUnit="degC") annotation (Placement(transformation(extent={{10,10},{-10,-10}}, rotation=180, origin={-30,70}))); @@ -69,8 +70,8 @@ extends Modelica.Icons.Example; extent={{10,-10},{-10,10}}, rotation=180, origin={8,-46}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package Medium = - Medium_air, temperatureUnit="degC") + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package + Medium = Medium_air, temperatureUnit="degC") annotation (Placement( transformation( extent={{10,-10},{-10,10}}, @@ -88,7 +89,8 @@ extends Modelica.Icons.Example; annotation (Placement(transformation(extent={{98,-70},{118,-50}}))); ThermofluidStream.Processes.Fan fan(redeclare package Medium = Medium_air, - initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state,redeclare function dp_tau_fan = + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state,redeclare + function dp_tau_fan = Processes.Internal.TurboComponent.dp_tau_const_isentrop (omega_ref=100)) annotation (Placement(transformation(extent={{140,-36},{160,-16}}))); Modelica.Blocks.Sources.RealExpression pump_speed(y=80 + 273.15) @@ -103,13 +105,13 @@ extends Modelica.Icons.Example; annotation (Placement(transformation(extent={{-190,70},{-170,90}}))); inner ThermofluidStream.DropOfCommons dropOfCommons annotation (Placement(transformation(extent={{150,76},{170,96}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm6(redeclare package Medium = - Medium_liquid, temperatureUnit="degC") + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm6(redeclare package + Medium = Medium_liquid, temperatureUnit="degC") annotation (Placement(transformation(extent={{-10,10},{10,-10}}, rotation=180, origin={124,-4}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm7(redeclare package Medium = - Medium_air, temperatureUnit="degC") + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm7(redeclare package + Medium = Medium_air, temperatureUnit="degC") annotation (Placement( transformation( extent={{10,-10},{-10,10}}, diff --git a/ThermofluidStream/Examples/SimpleEngine.mo b/ThermofluidStream/Examples/SimpleEngine.mo index 05751d4a..1a25a437 100644 --- a/ThermofluidStream/Examples/SimpleEngine.mo +++ b/ThermofluidStream/Examples/SimpleEngine.mo @@ -17,8 +17,8 @@ model SimpleEngine "Simple steam engine" rotation=90, origin={190,90}))); - Processes.ConductionElement conductionElement( redeclare package Medium = - Water, + Processes.ConductionElement conductionElement( redeclare package + Medium = Water, A=20, init=ThermofluidStream.Processes.Internal.InitializationMethodsCondElement.T, T_0=573.15) @@ -49,13 +49,13 @@ model SimpleEngine "Simple steam engine" m0_left=0.1, m0_right=0.1, x0=0.5) annotation (Placement(transformation(extent={{88,-92},{28,-32}}))); - Undirected.Topology.ConnectorInletOutletFore switchConnector(redeclare package Medium = - Water) annotation (Placement(transformation( + Undirected.Topology.ConnectorInletOutletFore switchConnector(redeclare + package Medium = Water) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, origin={70,34}))); - Undirected.Topology.ConnectorInletOutletFore switchConnector1(redeclare package Medium = - Water) annotation (Placement(transformation( + Undirected.Topology.ConnectorInletOutletFore switchConnector1(redeclare + package Medium = Water) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, origin={50,54}))); diff --git a/ThermofluidStream/Examples/SimpleGasTurbine.mo b/ThermofluidStream/Examples/SimpleGasTurbine.mo index 5e831097..6ff80f3c 100644 --- a/ThermofluidStream/Examples/SimpleGasTurbine.mo +++ b/ThermofluidStream/Examples/SimpleGasTurbine.mo @@ -3,8 +3,8 @@ model SimpleGasTurbine "Simple version of a Gas Turbine" extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.DryAirNasa - constrainedby Media.myMedia.Interfaces.PartialMedium - "Medium Model" + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium Model" annotation (Documentation( info="Medium used for this Example. Should be a gas.
@@ -19,7 +19,8 @@ model SimpleGasTurbine "Simple version of a Gas Turbine" annotation (Placement(transformation(extent={{-90,-20},{-70,0}}))); Processes.Turbine turbine(redeclare package Medium=Medium, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, - redeclare function dp_tau_turbine = + redeclare function + dp_tau_turbine = Processes.Internal.TurboComponent.dp_tau_const_isentrop ( omega_ref=1000, m_flow_ref=1.2, diff --git a/ThermofluidStream/Examples/Utilities/Tests/Piston.mo b/ThermofluidStream/Examples/Utilities/Tests/Piston.mo index 43024459..44f2f3bc 100644 --- a/ThermofluidStream/Examples/Utilities/Tests/Piston.mo +++ b/ThermofluidStream/Examples/Utilities/Tests/Piston.mo @@ -46,13 +46,13 @@ model Piston "Test for Piston model" startTime=1) annotation (Placement(transformation(extent={{-64,46},{-44,66}}))); ThermofluidStream.Utilities.showRealValue showRealValue annotation (Placement(transformation(extent={{32,-82},{52,-62}}))); - Undirected.Topology.ConnectorInletOutletFore switchConnector(redeclare package Medium = - Medium) annotation (Placement(transformation( + Undirected.Topology.ConnectorInletOutletFore switchConnector(redeclare + package Medium = Medium) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, origin={-10,-20}))); - Undirected.Topology.ConnectorInletOutletFore switchConnector1(redeclare package Medium = - Medium) annotation (Placement(transformation( + Undirected.Topology.ConnectorInletOutletFore switchConnector1(redeclare + package Medium = Medium) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, origin={16,10}))); diff --git a/ThermofluidStream/Examples/VaporCycle.mo b/ThermofluidStream/Examples/VaporCycle.mo index 8357786b..036f8cfb 100644 --- a/ThermofluidStream/Examples/VaporCycle.mo +++ b/ThermofluidStream/Examples/VaporCycle.mo @@ -14,8 +14,10 @@ model VaporCycle HeatExchangers.DiscretizedCounterFlowHEX condenser( redeclare package MediumA = SecondaryMedium, redeclare package MediumB = RefrigerantMedium, - redeclare model ConductionElementA = HeatExchangers.Internal.ConductionElementHEX, - redeclare model ConductionElementB = HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementA = + HeatExchangers.Internal.ConductionElementHEX, + redeclare model ConductionElementB = + HeatExchangers.Internal.ConductionElementHEX_twoPhase, initializeMassFlow=true, nCells=10, A=30, @@ -26,8 +28,10 @@ model VaporCycle HeatExchangers.DiscretizedCounterFlowHEX evaporator( redeclare package MediumA = SecondaryMedium, redeclare package MediumB = RefrigerantMedium, - redeclare model ConductionElementA = HeatExchangers.Internal.ConductionElementHEX, - redeclare model ConductionElementB = HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementA = + HeatExchangers.Internal.ConductionElementHEX, + redeclare model ConductionElementB = + HeatExchangers.Internal.ConductionElementHEX_twoPhase, initializeMassFlow=false, nCells=10, A=30, @@ -199,7 +203,8 @@ model VaporCycle Processes.Compressor compressor( redeclare package Medium = RefrigerantMedium, omega_from_input=true, - redeclare function dp_tau_compressor = Processes.Internal.TurboComponent.dp_tau_const_isentrop ( + redeclare function dp_tau_compressor = + Processes.Internal.TurboComponent.dp_tau_const_isentrop ( kappaFromMedia=false, kappa_fixed=1.13, eta=0.8)) diff --git a/ThermofluidStream/Examples/VenturiPump.mo b/ThermofluidStream/Examples/VenturiPump.mo index c8077af8..6e6d1522 100644 --- a/ThermofluidStream/Examples/VenturiPump.mo +++ b/ThermofluidStream/Examples/VenturiPump.mo @@ -3,7 +3,8 @@ model VenturiPump "pumping of liquid water using the venturi effect" extends Modelica.Icons.Example; - replaceable package Medium = Media.myMedia.Water.StandardWater constrainedby Media.myMedia.Interfaces.PartialMedium + replaceable package Medium = Media.myMedia.Water.StandardWater constrainedby + Media.myMedia.Interfaces.PartialMedium annotation(choicesAllMatching=true); parameter SI.Area A_in_hp=0.0002; @@ -59,11 +60,14 @@ model VenturiPump "pumping of liquid water using the venturi effect" extent={{-10,-10},{10,10}}, rotation=270, origin={0,-40}))); - Boundaries.DynamicPressureInflow dynamicPressureInflow(redeclare package Medium = Medium, A_par=A_in_hp) + Boundaries.DynamicPressureInflow dynamicPressureInflow(redeclare package + Medium = Medium, A_par=A_in_hp) annotation (Placement(transformation(extent={{-60,-70},{-40,-50}}))); - Boundaries.DynamicPressureOutflow dynamicPressureOutflow(redeclare package Medium = Medium, A_par=A_out) + Boundaries.DynamicPressureOutflow dynamicPressureOutflow(redeclare package + Medium = Medium, A_par=A_out) annotation (Placement(transformation(extent={{40,-70},{60,-50}}))); - Boundaries.DynamicPressureInflow dynamicPressureInflow2(redeclare package Medium = Medium, A_par=A_in_lp) + Boundaries.DynamicPressureInflow dynamicPressureInflow2(redeclare package + Medium = Medium, A_par=A_in_lp) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, diff --git a/ThermofluidStream/Examples/WaterHammer.mo b/ThermofluidStream/Examples/WaterHammer.mo index 5ba8df93..b8bb5f07 100644 --- a/ThermofluidStream/Examples/WaterHammer.mo +++ b/ThermofluidStream/Examples/WaterHammer.mo @@ -33,25 +33,26 @@ model WaterHammer "Pump water by using dynamic pressures" ThermofluidStream.Boundaries.Sink sink1(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{60,-10},{80,10}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - Medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{-70,0},{-50,20}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - Medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{26,0},{46,20}}))); Modelica.Blocks.Sources.Constant const2(k=1.5e5) annotation (Placement(transformation(extent={{-170,-10},{-150,10}}))); Topology.SplitterT2 splitterT2_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-40,-10},{-20,10}}))); - ThermofluidStream.FlowControl.CheckValve checkValve(redeclare package Medium = Medium, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state) + ThermofluidStream.FlowControl.CheckValve checkValve(redeclare package Medium + = Medium, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={-30,30}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=90, origin={-40,70}))); diff --git a/ThermofluidStream/FlowControl/FourWaySwitch.mo b/ThermofluidStream/FlowControl/FourWaySwitch.mo index 13ddbcd8..f082590f 100644 --- a/ThermofluidStream/FlowControl/FourWaySwitch.mo +++ b/ThermofluidStream/FlowControl/FourWaySwitch.mo @@ -43,9 +43,11 @@ model FourWaySwitch extent={{-10,10},{10,-10}}, rotation=180, origin={60,-60}))); - ThermofluidStream.Topology.JunctionT2 junctionT2_1(redeclare package Medium = Medium) + ThermofluidStream.Topology.JunctionT2 junctionT2_1(redeclare package Medium + = Medium) annotation (Placement(transformation(extent={{-70,-70},{-50,-50}}))); - ThermofluidStream.Topology.JunctionT2 junctionT2_2(redeclare package Medium = Medium) + ThermofluidStream.Topology.JunctionT2 junctionT2_2(redeclare package Medium + = Medium) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, diff --git a/ThermofluidStream/FlowControl/MCV.mo b/ThermofluidStream/FlowControl/MCV.mo index 3e2e77a4..0cae2f31 100644 --- a/ThermofluidStream/FlowControl/MCV.mo +++ b/ThermofluidStream/FlowControl/MCV.mo @@ -42,6 +42,8 @@ model MCV "Massflow and volume control valve" SI.Density rho_in = Medium.density(inlet.state); SI.VolumeFlowRate V_flow = m_flow/rho_in; + constant SI.Pressure eps = 1; + protected outer ThermofluidStream.DropOfCommons dropOfCommons; @@ -51,7 +53,7 @@ protected SI.Pressure dr = outlet.r - inlet.r; SI.Pressure dr_set; - +public SI.Pressure dp_int(start=-1e5); // dp corr for anti windup "back calculation" compensation after "Integrator windup and how to avoid it" 1989 Astrom SI.Pressure dp_corr = k2*(dp - dp_int); @@ -121,10 +123,17 @@ equation Line( points={{0,0},{0,60}}, color={28,108,200}, - thickness=0.5)}), Diagram(coordinateSystem(preserveAspectRatio=false)), + thickness=0.5), + Ellipse( + extent={{40,-60},{60,-80}}, + lineColor={0,0,0}, + fillColor = DynamicSelect({255,255,255}, if abs(dp - dp_int) <= eps then {0,140,72} else {238,46,47}), + fillPattern=FillPattern.Solid)}), + Diagram(coordinateSystem(preserveAspectRatio=false)), Documentation(info="This component can be used to emulate a mass- or volume-flow regulated valve, depending on its mode.
-The mass- or volume-flow-setpoint can be set or given by a real 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.
-Documentation of the used equations:
+The mass- or volume-flow-setpoint can be set or given by a real 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 setpint cannot be reached, an optional output leaves it's "zero" value and a visual wanring is shown (circle becomes red).
+Documentation of the used equations:
+ ")); end MCV; diff --git a/ThermofluidStream/FlowControl/Switch.mo b/ThermofluidStream/FlowControl/Switch.mo index d3f33f5f..2bf0a1ce 100644 --- a/ThermofluidStream/FlowControl/Switch.mo +++ b/ThermofluidStream/FlowControl/Switch.mo @@ -44,7 +44,8 @@ model Switch extent={{-10,10},{10,-10}}, rotation=0, origin={40,0}))); - ThermofluidStream.Topology.SplitterT2 splitterT2_1(redeclare package Medium = Medium, L=0) + ThermofluidStream.Topology.SplitterT2 splitterT2_1(redeclare package Medium + = Medium, L=0) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); // for dynamic select of graphics only diff --git a/ThermofluidStream/FlowControl/Tests/BasicControlValve.mo b/ThermofluidStream/FlowControl/Tests/BasicControlValve.mo index 37ea57c7..f5bc28e4 100644 --- a/ThermofluidStream/FlowControl/Tests/BasicControlValve.mo +++ b/ThermofluidStream/FlowControl/Tests/BasicControlValve.mo @@ -36,11 +36,11 @@ model BasicControlValve "Test for BasicControlValve" ThermofluidStream.Boundaries.Sink sink1(redeclare package Medium = medium, p0_par=100000) annotation (Placement(transformation(extent={{96,50},{116,70}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{-40,60},{-20,80}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{26,60},{46,80}}))); Modelica.Blocks.Sources.Ramp ramp( height=1, @@ -67,11 +67,11 @@ model BasicControlValve "Test for BasicControlValve" ThermofluidStream.Boundaries.Sink sink2(redeclare package Medium = medium, p0_par=100000) annotation (Placement(transformation(extent={{96,-10},{116,10}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{-40,0},{-20,20}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{26,0},{46,20}}))); ThermofluidStream.Boundaries.Source source2( redeclare package Medium = medium, @@ -90,11 +90,11 @@ model BasicControlValve "Test for BasicControlValve" ThermofluidStream.Boundaries.Sink sink3(redeclare package Medium = medium, p0_par=100000) annotation (Placement(transformation(extent={{96,-70},{116,-50}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm7(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm7(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm8(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm8(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{26,-60},{46,-40}}))); Modelica.Blocks.Sources.Constant const2(k=1.1e5) annotation (Placement(transformation(extent={{-170,-10},{-150,10}}))); diff --git a/ThermofluidStream/FlowControl/Tests/MCV.mo b/ThermofluidStream/FlowControl/Tests/MCV.mo index dbeff577..7f28a680 100644 --- a/ThermofluidStream/FlowControl/Tests/MCV.mo +++ b/ThermofluidStream/FlowControl/Tests/MCV.mo @@ -2,7 +2,8 @@ within ThermofluidStream.FlowControl.Tests; model MCV "Test for MCV" extends Modelica.Icons.Example; - replaceable package Medium = ThermofluidStream.Media.myMedia.Air.SimpleAir constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium + replaceable package Medium = ThermofluidStream.Media.myMedia.Air.SimpleAir constrainedby + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium package" annotation (choicesAllMatching=true, Documentation(info="Medium package used in the Test.
@@ -30,7 +31,8 @@ model MCV "Test for MCV" l=10, L_value=0.01, computeL=false, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{20,20},{40,40}}))); ThermofluidStream.Boundaries.Source source1( redeclare package Medium = Medium, @@ -51,7 +53,8 @@ model MCV "Test for MCV" l=10, L_value=0.01, computeL=false, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{20,-10},{40,10}}))); Modelica.Blocks.Sources.Pulse pulse1( amplitude=2e5, @@ -78,7 +81,8 @@ model MCV "Test for MCV" l=10, L_value=0.01, computeL=false, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{20,-40},{40,-20}}))); Modelica.Blocks.Sources.Trapezoid trapezoid( @@ -109,7 +113,8 @@ model MCV "Test for MCV" l=10, L_value=0.01, computeL=false, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{20,-70},{40,-50}}))); Modelica.Blocks.Sources.Pulse pulse3( amplitude=2e5, @@ -136,7 +141,8 @@ model MCV "Test for MCV" l=10, L_value=0.01, computeL=false, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{20,-100},{40,-80}}))); Modelica.Blocks.Sources.Trapezoid trapezoid1( @@ -168,7 +174,8 @@ model MCV "Test for MCV" l=10, L_value=0.01, computeL=false, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{20,60},{40,80}}))); Modelica.Blocks.Sources.Pulse pulse5( amplitude=0.2, @@ -186,6 +193,23 @@ model MCV "Test for MCV" offset=1, startTime=0) annotation (Placement(transformation(extent={{-80,80},{-60,100}}))); + Boundaries.Source source6( + redeclare package Medium = Medium, + pressureFromInput=false, + T0_par(displayUnit="K") = 300, + p0_par=100000) annotation (Placement(transformation(extent={{-38,130},{-18, + 150}}))); + Boundaries.Sink sink6(redeclare package Medium = Medium, + p0_par=100000) + annotation (Placement(transformation(extent={{52,130},{72,150}}))); + ThermofluidStream.FlowControl.MCV mCV6( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.mass_flow, + + massFlow_set_par=1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{-8,130}, + {12,150}}))); equation connect(mCV.inlet, source.outlet) annotation (Line( points={{-10,30},{-20,30}}, @@ -267,6 +291,14 @@ equation thickness=0.5)); connect(pulse5.y, mCV.setpoint_var) annotation (Line(points={{-59,50},{0,50},{0,38}}, color={0,0,127})); connect(trapezoid2.y, mCV5.setpoint_var) annotation (Line(points={{-59,90},{0,90},{0,78}}, color={0,0,127})); + connect(mCV6.inlet,source6. outlet) annotation (Line( + points={{-8,140},{-18,140}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV6.outlet, sink6.inlet) annotation (Line( + points={{12,140},{52,140}}, + color={28,108,200}, + thickness=0.5)); annotation ( Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}})), Diagram( coordinateSystem(preserveAspectRatio=false, extent={{-120,-120},{120,120}})), diff --git a/ThermofluidStream/FlowControl/Tests/PCV.mo b/ThermofluidStream/FlowControl/Tests/PCV.mo index 4b4c0064..4762e3e4 100644 --- a/ThermofluidStream/FlowControl/Tests/PCV.mo +++ b/ThermofluidStream/FlowControl/Tests/PCV.mo @@ -2,7 +2,8 @@ within ThermofluidStream.FlowControl.Tests; model PCV "Test for PCV" extends Modelica.Icons.Example; - replaceable package Medium = ThermofluidStream.Media.myMedia.Air.SimpleAir constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium + replaceable package Medium = ThermofluidStream.Media.myMedia.Air.SimpleAir constrainedby + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium package" annotation (choicesAllMatching=true, Documentation(info="Medium package used in the Test.
@@ -45,7 +46,8 @@ model PCV "Test for PCV" redeclare package Medium = Medium, r(displayUnit="mm") = 0.02, l=3, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{10,-50},{30,-30}}))); ThermofluidStream.Boundaries.VolumeFlex volumeFlex3( @@ -59,7 +61,8 @@ model PCV "Test for PCV" redeclare package Medium = Medium, r(displayUnit="mm") = 0.02, l=3, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{10,-20},{30,0}}))); ThermofluidStream.Boundaries.Source source(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}))); @@ -70,7 +73,8 @@ model PCV "Test for PCV" m_flow_0=10, r(displayUnit="mm") = 0.02, l=3, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{-20,-80},{0,-60}}))); ThermofluidStream.FlowControl.PCV pCV2( redeclare package Medium = Medium, @@ -86,7 +90,8 @@ model PCV "Test for PCV" m_flow_0=10, r(displayUnit="mm") = 0.02, l=3, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{10,10},{30,30}}))); ThermofluidStream.FlowControl.PCV pCV3( redeclare package Medium = Medium, @@ -103,7 +108,8 @@ model PCV "Test for PCV" m_flow_0=10, r(displayUnit="mm") = 0.02, l=3, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation(extent={{10,50},{30,70}}))); ThermofluidStream.FlowControl.PCV pCV4( redeclare package Medium = Medium, diff --git a/ThermofluidStream/FlowControl/Tests/SpecificValveType.mo b/ThermofluidStream/FlowControl/Tests/SpecificValveType.mo index 51e1a6d9..a286513f 100644 --- a/ThermofluidStream/FlowControl/Tests/SpecificValveType.mo +++ b/ThermofluidStream/FlowControl/Tests/SpecificValveType.mo @@ -34,11 +34,11 @@ model SpecificValveType "Test for SpecificValveType" ThermofluidStream.Boundaries.Sink sink1(redeclare package Medium = medium, p0_par=100000) annotation (Placement(transformation(extent={{96,50},{116,70}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{-40,60},{-20,80}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{26,60},{46,80}}))); Modelica.Blocks.Sources.Ramp ramp( height=1, @@ -65,11 +65,11 @@ model SpecificValveType "Test for SpecificValveType" ThermofluidStream.Boundaries.Sink sink2(redeclare package Medium = medium, p0_par=100000) annotation (Placement(transformation(extent={{96,-10},{116,10}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{-40,0},{-20,20}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package Medium = - medium) + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package + Medium = medium) annotation (Placement(transformation(extent={{26,0},{46,20}}))); Modelica.Blocks.Sources.Constant const2(k=1.1e5) diff --git a/ThermofluidStream/HeatExchangers/DiscretizedCounterFlowHEX.mo b/ThermofluidStream/HeatExchangers/DiscretizedCounterFlowHEX.mo index 49dee7bb..95db2e8c 100644 --- a/ThermofluidStream/HeatExchangers/DiscretizedCounterFlowHEX.mo +++ b/ThermofluidStream/HeatExchangers/DiscretizedCounterFlowHEX.mo @@ -2,9 +2,11 @@ within ThermofluidStream.HeatExchangers; model DiscretizedCounterFlowHEX "Discretized heat exchanger for single- or two-phase fluids without pressure drop" extends Internal.DiscretizedHexIcon; - replaceable package MediumA = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" + replaceable package MediumA = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable package MediumB = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" + replaceable package MediumB = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); replaceable model ConductionElementA = Internal.ConductionElementHEX @@ -95,6 +97,8 @@ equation summary.dT_B = summary.Tout_B - summary.Tin_B; summary.dh_A = summary.hout_A - summary.hin_A; summary.dh_B = summary.hout_B - summary.hin_B; + summary.Q_flow_A=Q_flow_A; + summary.Q_flow_B=Q_flow_B; //Connecting equations (to interconnect pipes) //Fluid Side B diff --git a/ThermofluidStream/HeatExchangers/DiscretizedCounterFlowHEX_FR.mo b/ThermofluidStream/HeatExchangers/DiscretizedCounterFlowHEX_FR.mo index c2315adc..7b373bd1 100644 --- a/ThermofluidStream/HeatExchangers/DiscretizedCounterFlowHEX_FR.mo +++ b/ThermofluidStream/HeatExchangers/DiscretizedCounterFlowHEX_FR.mo @@ -2,9 +2,11 @@ within ThermofluidStream.HeatExchangers; model DiscretizedCounterFlowHEX_FR "Discretized Heat Exchanger for single- or two-phase working fluid with pressure drop" extends Internal.DiscretizedHexIcon; - replaceable package MediumA = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" + replaceable package MediumA = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable package MediumB = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" + replaceable package MediumB = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); replaceable model ConductionElementA = Internal.ConductionElementHEX @@ -66,14 +68,16 @@ public each r = r_A, each l=l_A/nCells, each computeL=false, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss(each ks_input=ks_A)) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( each ks_input=ks_A)) annotation (Placement(transformation(extent={{-10,-10},{10,10}},rotation=180,origin={-50,-80}))); Processes.FlowResistance flowResistanceB[nCells]( redeclare package Medium = MediumB, each r = r_B, each l=l_B/nCells, each computeL=false, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss(each ks_input=ks_B)) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( each ks_input=ks_B)) annotation (Placement(transformation(extent={{40,70},{60,90}}))); Modelica.Thermal.HeatTransfer.Components.ThermalConductor thermalConductor[nCells](each G=G/nCells) @@ -118,6 +122,8 @@ equation summary.dT_B = summary.Tout_B - summary.Tin_B; summary.dh_A = summary.hout_A - summary.hin_A; summary.dh_B = summary.hout_B - summary.hin_B; + summary.Q_flow_A=Q_flow_A; + summary.Q_flow_B=Q_flow_B; //Connecting equations (to interconnect pipes) //Fluid Side B diff --git a/ThermofluidStream/HeatExchangers/DiscretizedCrossFlowHEX.mo b/ThermofluidStream/HeatExchangers/DiscretizedCrossFlowHEX.mo index 09e76565..bde0f50c 100644 --- a/ThermofluidStream/HeatExchangers/DiscretizedCrossFlowHEX.mo +++ b/ThermofluidStream/HeatExchangers/DiscretizedCrossFlowHEX.mo @@ -2,9 +2,11 @@ within ThermofluidStream.HeatExchangers; model DiscretizedCrossFlowHEX "Discretized Heat Exchanger for single- or two-phase working fluid without pressure drop" extends Internal.DiscretizedHexIcon; - replaceable package MediumA = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" + replaceable package MediumA = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable package MediumB = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" + replaceable package MediumB = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); replaceable model ConductionElementA = Internal.ConductionElementHEX @@ -81,7 +83,8 @@ public redeclare package Medium = MediumA, each r(each displayUnit="mm") = 0.025, each l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.linearQuadraticPressureLoss (each k=50)) + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( each k=50)) annotation (Placement(transformation(extent={{20,70},{40,90}}))); Topology.JunctionN junctionN(redeclare package Medium = MediumA, N=nCells) annotation (Placement(transformation(extent={{50,70},{70,90}}))); Topology.SplitterN splitterN(redeclare package Medium = MediumA, N=nCells) annotation (Placement(transformation(extent={{-60,70},{-40,90}}))); @@ -116,6 +119,8 @@ equation summary.dT_B = summary.Tout_B - summary.Tin_B; summary.dh_A = summary.hout_A - summary.hin_A; summary.dh_B = summary.hout_B - summary.hin_B; + summary.Q_flow_A=Q_flow_A; + summary.Q_flow_B=Q_flow_B; //Connecting equations (to interconnect pipes) diff --git a/ThermofluidStream/HeatExchangers/DiscretizedCrossFlowHEX_FR.mo b/ThermofluidStream/HeatExchangers/DiscretizedCrossFlowHEX_FR.mo index 78f873bb..de180154 100644 --- a/ThermofluidStream/HeatExchangers/DiscretizedCrossFlowHEX_FR.mo +++ b/ThermofluidStream/HeatExchangers/DiscretizedCrossFlowHEX_FR.mo @@ -2,9 +2,11 @@ within ThermofluidStream.HeatExchangers; model DiscretizedCrossFlowHEX_FR "Discretized Heat Exchanger for single- or two-phase working fluid with pressure drop" extends Internal.DiscretizedHexIcon; - replaceable package MediumA = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" + replaceable package MediumA = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable package MediumB = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" + replaceable package MediumB = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); replaceable model ConductionElementA = Internal.ConductionElementHEX @@ -93,7 +95,8 @@ public redeclare package Medium = MediumA, each r(each displayUnit="mm") = r_A/nCells, each l=l_A, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss(each ks_input=ks_A)) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( each ks_input=ks_A)) annotation (Placement(transformation(extent={{20,70},{40,90}}))); Topology.JunctionN junctionN(redeclare package Medium = MediumA, N=nCells) annotation (Placement(transformation(extent={{50,70},{70,90}}))); Topology.SplitterN splitterN(redeclare package Medium = MediumA, N=nCells) annotation (Placement(transformation(extent={{-60,70},{-40,90}}))); @@ -102,7 +105,8 @@ public each r=r_B, each l=l_B/nCells, each computeL=false, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss (each ks_input=ks_B)) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( each ks_input=ks_B)) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, @@ -138,6 +142,8 @@ equation summary.dT_B = summary.Tout_B - summary.Tin_B; summary.dh_A = summary.hout_A - summary.hin_A; summary.dh_B = summary.hout_B - summary.hin_B; + summary.Q_flow_A=Q_flow_A; + summary.Q_flow_B=Q_flow_B; //Connecting equations (to interconnect pipes) diff --git a/ThermofluidStream/HeatExchangers/Internal/ConductionElementHEX_twoPhase.mo b/ThermofluidStream/HeatExchangers/Internal/ConductionElementHEX_twoPhase.mo index 2c93086a..3e2d73ee 100644 --- a/ThermofluidStream/HeatExchangers/Internal/ConductionElementHEX_twoPhase.mo +++ b/ThermofluidStream/HeatExchangers/Internal/ConductionElementHEX_twoPhase.mo @@ -1,6 +1,7 @@ within ThermofluidStream.HeatExchangers.Internal; model ConductionElementHEX_twoPhase "ConductionElement for two-phase fluids" - extends PartialConductionElementHEX(redeclare package Medium = Media.myMedia.Interfaces.PartialTwoPhaseMedium); + extends PartialConductionElementHEX(redeclare package Medium = + Media.myMedia.Interfaces.PartialTwoPhaseMedium); import Modelica.Math; diff --git a/ThermofluidStream/HeatExchangers/Internal/DiscretizedHEXSummary.mo b/ThermofluidStream/HeatExchangers/Internal/DiscretizedHEXSummary.mo index 386a7460..4a9fe4e2 100644 --- a/ThermofluidStream/HeatExchangers/Internal/DiscretizedHEXSummary.mo +++ b/ThermofluidStream/HeatExchangers/Internal/DiscretizedHEXSummary.mo @@ -19,6 +19,9 @@ record DiscretizedHEXSummary "Summary Record for Discretized Heat Exchangers" SI.SpecificEnthalpy dh_A "Enthalpy differnce A"; SI.SpecificEnthalpy dh_B "Enthalpy differnce B"; + SI.Power Q_flow_A "Heat going into A"; + SI.Power Q_flow_B "Heat going into B"; + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( coordinateSystem(preserveAspectRatio=false))); end DiscretizedHEXSummary; diff --git a/ThermofluidStream/HeatExchangers/Tests/Condenser.mo b/ThermofluidStream/HeatExchangers/Tests/Condenser.mo index b3c45630..a93e1729 100644 --- a/ThermofluidStream/HeatExchangers/Tests/Condenser.mo +++ b/ThermofluidStream/HeatExchangers/Tests/Condenser.mo @@ -22,16 +22,16 @@ model Condenser redeclare package Medium = MediumAir, p0_par=90000) annotation (Placement(transformation(extent={{104,0},{124,20}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package Medium = - MediumAir, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package + Medium = MediumAir, temperatureUnit="degC", pressureUnit="bar") annotation ( Placement(transformation( extent={{-11,-10},{11,10}}, rotation=0, origin={-35,20}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - MediumAir, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = MediumAir, digits=3, temperatureUnit="degC") annotation (Placement(transformation( extent={{10,10},{-10,-10}}, @@ -56,15 +56,15 @@ model Condenser annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, origin={10,-80}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumRefrigerant, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumRefrigerant, digits=3, temperatureUnit="degC") annotation (Placement(transformation(extent={{10,10},{-10,-10}}, rotation=90, origin={20,-24}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumRefrigerant, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumRefrigerant, digits=3, temperatureUnit="degC") annotation (Placement(transformation(extent={{10,-10},{-10,10}}, @@ -88,7 +88,8 @@ model Condenser r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-82,0},{-62,20}}))); Processes.FlowResistance flowResistanceB( @@ -98,7 +99,8 @@ model Condenser r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, diff --git a/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU.mo b/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU.mo index 50a061d6..8d0f6c5d 100644 --- a/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU.mo +++ b/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU.mo @@ -21,16 +21,16 @@ model CounterFlowNTU redeclare package Medium = MediumA, p0_par=MediumA.p_default - 1e4) annotation (Placement(transformation(extent={{116,-30},{136,-10}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package Medium = - MediumA, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package + Medium = MediumA, temperatureUnit="degC", pressureUnit="bar") annotation ( Placement(transformation( extent={{-11,10},{11,-10}}, rotation=0, origin={-45,-30}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - MediumA, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = MediumA, digits=3, temperatureUnit="degC") annotation (Placement(transformation( extent={{10,-10},{-10,10}}, @@ -46,12 +46,12 @@ model CounterFlowNTU ThermofluidStream.Boundaries.Sink sinkB( redeclare package Medium = MediumB, p0_par=90000) annotation (Placement(transformation(extent={{-118,10},{-138,30}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumB, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumB, temperatureUnit="degC") annotation (Placement(transformation(extent={{-74,20},{-94,40}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumB, outputMassFlowRate=false, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumB, outputMassFlowRate=false, temperatureUnit="degC") annotation (Placement(transformation(extent={{66,20},{46,40}}))); inner DropOfCommons dropOfCommons diff --git a/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_parallel.mo b/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_parallel.mo index 7f76feac..7a9db656 100644 --- a/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_parallel.mo +++ b/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_parallel.mo @@ -21,8 +21,8 @@ model CounterFlowNTU_parallel redeclare package Medium = MediumA, p0_par=MediumA.p_default - 1e4) annotation (Placement(transformation(extent={{110,-30},{130,-10}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - MediumA, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = MediumA, digits=3, temperatureUnit="degC") annotation (Placement(transformation( extent={{10,-10},{-10,10}}, @@ -40,13 +40,13 @@ model CounterFlowNTU_parallel pressureFromInput=false, p0_par=100000) annotation (Placement(transformation(extent={{-150,10},{-170,30}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumB, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumB, outputMassFlowRate=false, temperatureUnit="degC") annotation (Placement(transformation(extent={{-100,20},{-120,40}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumB, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumB, temperatureUnit="degC") annotation (Placement(transformation(extent={{116,20},{96,40}}))); inner DropOfCommons dropOfCommons diff --git a/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_serial.mo b/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_serial.mo index 362ff0cc..a6e62dfe 100644 --- a/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_serial.mo +++ b/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_serial.mo @@ -21,8 +21,8 @@ model CounterFlowNTU_serial redeclare package Medium = MediumA, p0_par=MediumA.p_default - 1e4) annotation (Placement(transformation(extent={{136,-14},{156,6}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - MediumA, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = MediumA, digits=3, temperatureUnit="degC") annotation (Placement(transformation( extent={{10,-10},{-10,10}}, @@ -38,12 +38,12 @@ model CounterFlowNTU_serial ThermofluidStream.Boundaries.Sink sinkB( redeclare package Medium = MediumB, p0_par=90000) annotation (Placement(transformation(extent={{-128,-2},{-148,18}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumB, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumB, temperatureUnit="degC") annotation (Placement(transformation(extent={{-50,8},{-70,28}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumB, outputMassFlowRate=false, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumB, outputMassFlowRate=false, temperatureUnit="degC") annotation (Placement(transformation(extent={{90,20},{70,40}}))); inner DropOfCommons dropOfCommons diff --git a/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_zeroMassFlow.mo b/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_zeroMassFlow.mo index 6008482d..9b91f13d 100644 --- a/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_zeroMassFlow.mo +++ b/ThermofluidStream/HeatExchangers/Tests/CounterFlowNTU_zeroMassFlow.mo @@ -22,16 +22,16 @@ model CounterFlowNTU_zeroMassFlow pressureFromInput=true, p0_par=100000) annotation (Placement(transformation(extent={{116,-30},{136,-10}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package Medium = - MediumA, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package + Medium = MediumA, temperatureUnit="degC", pressureUnit="bar") annotation ( Placement(transformation( extent={{-11,10},{11,-10}}, rotation=0, origin={-75,-30}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - MediumA, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = MediumA, digits=3, temperatureUnit="degC") annotation (Placement(transformation( extent={{10,-10},{-10,10}}, @@ -49,12 +49,12 @@ model CounterFlowNTU_zeroMassFlow pressureFromInput=true, p0_par=100000) annotation (Placement(transformation(extent={{-116,10},{-136,30}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumB, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumB, temperatureUnit="degC") annotation (Placement(transformation(extent={{-56,20},{-76,40}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumB, outputMassFlowRate=false, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumB, outputMassFlowRate=false, temperatureUnit="degC") annotation (Placement(transformation(extent={{66,20},{46,40}}))); inner DropOfCommons dropOfCommons diff --git a/ThermofluidStream/HeatExchangers/Tests/CrossFlowNTU.mo b/ThermofluidStream/HeatExchangers/Tests/CrossFlowNTU.mo index dfe486cc..770c1853 100644 --- a/ThermofluidStream/HeatExchangers/Tests/CrossFlowNTU.mo +++ b/ThermofluidStream/HeatExchangers/Tests/CrossFlowNTU.mo @@ -22,16 +22,16 @@ model CrossFlowNTU annotation (Placement(transformation(extent={{116,-10},{136, 10}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package Medium = - MediumA, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package + Medium = MediumA, temperatureUnit="degC", pressureUnit="bar") annotation ( Placement(transformation( extent={{-11,10},{11,-10}}, rotation=0, origin={-43,-10}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - MediumA, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = MediumA, digits=3, temperatureUnit="degC") annotation (Placement(transformation( extent={{10,-10},{-10,10}}, @@ -52,14 +52,14 @@ model CrossFlowNTU annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, origin={0,-84}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumB, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumB, temperatureUnit="degC") annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, origin={-10,-24}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumB, outputMassFlowRate=false, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumB, outputMassFlowRate=false, temperatureUnit="degC") annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, diff --git a/ThermofluidStream/HeatExchangers/Tests/CrossFlowNTU_zeroMassFlow.mo b/ThermofluidStream/HeatExchangers/Tests/CrossFlowNTU_zeroMassFlow.mo index c680bb7a..bf2731a5 100644 --- a/ThermofluidStream/HeatExchangers/Tests/CrossFlowNTU_zeroMassFlow.mo +++ b/ThermofluidStream/HeatExchangers/Tests/CrossFlowNTU_zeroMassFlow.mo @@ -25,8 +25,8 @@ model CrossFlowNTU_zeroMassFlow p0_par=100000) annotation (Placement(transformation(extent={{116,-10},{136, 10}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - MediumA, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = MediumA, digits=3, temperatureUnit="degC") annotation (Placement(transformation( extent={{10,-10},{-10,10}}, @@ -49,14 +49,14 @@ model CrossFlowNTU_zeroMassFlow annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, origin={0,-54}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumB, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumB, temperatureUnit="degC") annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, origin={-10,-24}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumB, outputMassFlowRate=false, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumB, outputMassFlowRate=false, temperatureUnit="degC") annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, diff --git a/ThermofluidStream/HeatExchangers/Tests/ElementTwoPhase.mo b/ThermofluidStream/HeatExchangers/Tests/ElementTwoPhase.mo index a75462a6..1789691f 100644 --- a/ThermofluidStream/HeatExchangers/Tests/ElementTwoPhase.mo +++ b/ThermofluidStream/HeatExchangers/Tests/ElementTwoPhase.mo @@ -136,27 +136,31 @@ model ElementTwoPhase redeclare package Medium = MediumRefrigerant, r(displayUnit="mm") = 0.01, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarPressureLoss) annotation (Placement(transformation(extent={{-40,70},{-20,90}}))); Processes.FlowResistance flowResistance1( redeclare package Medium = MediumRefrigerant, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, r(displayUnit="mm") = 0.01, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarPressureLoss) annotation (Placement(transformation(extent={{-38,40},{-18,60}}))); Processes.FlowResistance flowResistance2( redeclare package Medium = MediumRefrigerant, r(displayUnit="mm") = 0.01, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarPressureLoss) annotation (Placement(transformation(extent={{-40,-40},{-20,-20}}))); Processes.FlowResistance flowResistance3( redeclare package Medium = MediumRefrigerant, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, r(displayUnit="mm") = 0.01, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarPressureLoss) annotation (Placement(transformation(extent={{-40,-90},{-20,-70}}))); Modelica.Blocks.Sources.Trapezoid trapezoid2( diff --git a/ThermofluidStream/HeatExchangers/Tests/Evaporator.mo b/ThermofluidStream/HeatExchangers/Tests/Evaporator.mo index 24b92d69..e98ba06e 100644 --- a/ThermofluidStream/HeatExchangers/Tests/Evaporator.mo +++ b/ThermofluidStream/HeatExchangers/Tests/Evaporator.mo @@ -22,16 +22,16 @@ model Evaporator redeclare package Medium = MediumAir, p0_par=150000) annotation (Placement(transformation(extent={{-74,-16},{-94,4}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package Medium = - MediumAir, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package + Medium = MediumAir, temperatureUnit="degC", pressureUnit="bar") annotation ( Placement(transformation( extent={{11,10},{-11,-10}}, rotation=0, origin={47,-16}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - MediumAir, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = MediumAir, digits=3, temperatureUnit="degC") annotation (Placement(transformation( extent={{-10,-10},{10,10}}, @@ -56,13 +56,13 @@ model Evaporator annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=90, origin={62,60}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumRefrigerant, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumRefrigerant, digits=3, temperatureUnit="degC") annotation (Placement(transformation(extent={{24,10},{44,30}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumRefrigerant, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumRefrigerant, digits=3, temperatureUnit="degC") annotation (Placement(transformation(extent={{-40,10},{-20,30}}))); @@ -72,7 +72,8 @@ model Evaporator redeclare package MediumA = MediumAir, redeclare package MediumB = MediumRefrigerant, redeclare model ConductionElementA = Internal.ConductionElementHEX (U_nom=4000), - redeclare model ConductionElementB = Internal.ConductionElementHEX_twoPhase ( + redeclare model ConductionElementB = Internal.ConductionElementHEX_twoPhase + ( U_liq_nom=1000, U_vap_nom=1400, U_tp_nom=3000), @@ -89,7 +90,8 @@ model Evaporator r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{88,-16},{68,4}}))); Processes.FlowResistance flowResistanceB( @@ -98,7 +100,8 @@ model Evaporator r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation( extent={{10,-10},{-10,10}}, rotation=270, diff --git a/ThermofluidStream/HeatExchangers/Tests/FlowRes.mo b/ThermofluidStream/HeatExchangers/Tests/FlowRes.mo index 60c2ce34..e53339ce 100644 --- a/ThermofluidStream/HeatExchangers/Tests/FlowRes.mo +++ b/ThermofluidStream/HeatExchangers/Tests/FlowRes.mo @@ -25,8 +25,8 @@ model FlowRes pressureFromInput=false, p0_par=100000) annotation (Placement(transformation(extent={{-202,24},{-222,44}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package Medium = - MediumAir, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package + Medium = MediumAir, digits=3, temperatureUnit="degC", pressureUnit="bar") annotation ( @@ -34,8 +34,8 @@ model FlowRes extent={{11,10},{-11,-10}}, rotation=0, origin={-93,24}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = - MediumAir, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = MediumAir, digits=3, temperatureUnit="degC", pressureUnit="bar") annotation (Placement(transformation( @@ -61,14 +61,14 @@ model FlowRes annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0, origin={-26,50}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumRefrigerant, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumRefrigerant, digits=3, temperatureUnit="degC", pressureUnit="bar") annotation (Placement(transformation(extent={{-98,50},{-78,70}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumRefrigerant, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumRefrigerant, digits=3, temperatureUnit="degC", pressureUnit="bar") @@ -79,7 +79,8 @@ model FlowRes redeclare package MediumA = MediumAir, redeclare package MediumB = MediumRefrigerant, redeclare model ConductionElementA = Internal.ConductionElementHEX (U_nom=4000), - redeclare model ConductionElementB = Internal.ConductionElementHEX_twoPhase ( + redeclare model ConductionElementB = Internal.ConductionElementHEX_twoPhase + ( U_liq_nom=1000, U_vap_nom=1400, U_tp_nom=3000), @@ -177,7 +178,8 @@ model FlowRes redeclare package MediumA = MediumAir, redeclare package MediumB = MediumRefrigerant, redeclare model ConductionElementA = Internal.ConductionElementHEX (U_nom=4000), - redeclare model ConductionElementB = Internal.ConductionElementHEX_twoPhase ( + redeclare model ConductionElementB = Internal.ConductionElementHEX_twoPhase + ( U_liq_nom=1000, U_vap_nom=1400, U_tp_nom=3000), @@ -191,13 +193,17 @@ model FlowRes extent={{10,10},{-10,-10}}, rotation=180, origin={-118,-58}))); - Sensors.SingleSensorSelect singleSensorSelect2(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) + Sensors.SingleSensorSelect singleSensorSelect2(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) annotation (Placement(transformation(extent={{-96,-36},{-76,-16}}))); - Sensors.SingleSensorSelect singleSensorSelect3(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) + Sensors.SingleSensorSelect singleSensorSelect3(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) annotation (Placement(transformation(extent={{-140,-36},{-160,-16}}))); - Sensors.TwoPhaseSensorSelect sensorVaporQuality2(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) + Sensors.TwoPhaseSensorSelect sensorVaporQuality2(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) annotation (Placement(transformation(extent={{-140,-26},{-160,-6}}))); - Sensors.TwoPhaseSensorSelect sensorVaporQuality3(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) + Sensors.TwoPhaseSensorSelect sensorVaporQuality3(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) annotation (Placement(transformation(extent={{-96,-26},{-76,-6}}))); FlowControl.MCV mCV2( redeclare package Medium = MediumRefrigerant, @@ -286,7 +292,8 @@ model FlowRes m_flow_0=0.5, r=0.05, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss (material=ThermofluidStream.Processes.Internal.Material.steel)) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{62,32},{82,52}}))); Processes.FlowResistance flowResistanceB( redeclare package Medium = MediumRefrigerant, @@ -294,24 +301,29 @@ model FlowRes m_flow_0=0.3, r=0.05, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss (material=ThermofluidStream.Processes.Internal.Material.steel)) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, origin={88,14}))); - Sensors.SingleSensorSelect singleSensorSelect4(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) + Sensors.SingleSensorSelect singleSensorSelect4(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=180, origin={150,22}))); - Sensors.SingleSensorSelect singleSensorSelect5(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) + Sensors.SingleSensorSelect singleSensorSelect5(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=270, origin={108,76}))); - Sensors.TwoPhaseSensorSelect sensorVaporQuality4(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) + Sensors.TwoPhaseSensorSelect sensorVaporQuality4(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=180, origin={150,14}))); - Sensors.TwoPhaseSensorSelect sensorVaporQuality5(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) + Sensors.TwoPhaseSensorSelect sensorVaporQuality5(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=270, origin={100,76}))); @@ -409,7 +421,8 @@ model FlowRes m_flow_0=0.5, r=0.05, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss (material=ThermofluidStream.Processes.Internal.Material.steel)) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{44,-72},{64,-52}}))); Processes.FlowResistance flowResistanceB1( redeclare package Medium = MediumRefrigerant, @@ -417,24 +430,29 @@ model FlowRes m_flow_0=0.3, r=0.05, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss (material=ThermofluidStream.Processes.Internal.Material.steel)) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, origin={70,-90}))); - Sensors.SingleSensorSelect singleSensorSelect6(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) + Sensors.SingleSensorSelect singleSensorSelect6(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=180, origin={132,-82}))); - Sensors.SingleSensorSelect singleSensorSelect7(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) + Sensors.SingleSensorSelect singleSensorSelect7(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=270, origin={90,-28}))); - Sensors.TwoPhaseSensorSelect sensorVaporQuality6(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) + Sensors.TwoPhaseSensorSelect sensorVaporQuality6(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=180, origin={132,-90}))); - Sensors.TwoPhaseSensorSelect sensorVaporQuality7(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) + Sensors.TwoPhaseSensorSelect sensorVaporQuality7(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=270, origin={82,-28}))); diff --git a/ThermofluidStream/HeatExchangers/Tests/Recuperator.mo b/ThermofluidStream/HeatExchangers/Tests/Recuperator.mo index 6c1e41b0..d253572b 100644 --- a/ThermofluidStream/HeatExchangers/Tests/Recuperator.mo +++ b/ThermofluidStream/HeatExchangers/Tests/Recuperator.mo @@ -26,14 +26,14 @@ model Recuperator annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=180, origin={-60,-6}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - MediumRefrigerant, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = MediumRefrigerant, digits=3, temperatureUnit="degC", pressureUnit="bar") annotation (Placement(transformation(extent={{24,10},{44,30}}))); - ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - MediumRefrigerant, + ThermofluidStream.Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = MediumRefrigerant, digits=3, temperatureUnit="degC", pressureUnit="bar") @@ -76,9 +76,11 @@ model Recuperator temperatureUnit="degC", pressureUnit="bar") annotation (Placement(transformation(extent={{-22,-6},{-42,-26}}))); - Sensors.SingleSensorSelect singleSensorSelect2(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) + Sensors.SingleSensorSelect singleSensorSelect2(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) annotation (Placement(transformation(extent={{-22,-18},{-42,-38}}))); - Sensors.TwoPhaseSensorSelect sensorVaporQuality2(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) + Sensors.TwoPhaseSensorSelect sensorVaporQuality2(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) annotation (Placement(transformation(extent={{-22,-46},{-42,-26}}))); Sensors.MultiSensor_Tpm multiSensor_Tpm4( redeclare package Medium = MediumRefrigerant, @@ -86,9 +88,11 @@ model Recuperator temperatureUnit="degC", pressureUnit="bar") annotation (Placement(transformation(extent={{44,-6},{24,-26}}))); - Sensors.SingleSensorSelect singleSensorSelect3(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) + Sensors.SingleSensorSelect singleSensorSelect3(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.h_Jpkg) annotation (Placement(transformation(extent={{44,-28},{24,-48}}))); - Sensors.TwoPhaseSensorSelect sensorVaporQuality3(redeclare package Medium = MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) + Sensors.TwoPhaseSensorSelect sensorVaporQuality3(redeclare package Medium = + MediumRefrigerant, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) annotation (Placement(transformation(extent={{44,-40},{24,-20}}))); FlowControl.MCV mCV( redeclare package Medium = MediumRefrigerant, diff --git a/ThermofluidStream/Interfaces/Tests/Test_p_out_clipping.mo b/ThermofluidStream/Interfaces/Tests/Test_p_out_clipping.mo index 827544a0..8ae8ee24 100644 --- a/ThermofluidStream/Interfaces/Tests/Test_p_out_clipping.mo +++ b/ThermofluidStream/Interfaces/Tests/Test_p_out_clipping.mo @@ -3,8 +3,8 @@ model Test_p_out_clipping "Test for the lower limit of p_out in SISOFlow compone extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.SimpleAir - constrainedby Media.myMedia.Interfaces.PartialMedium - "Medium package" + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium package" annotation (Documentation(info="Medium package used in the Test.
")); diff --git a/ThermofluidStream/Media/Tests/TestXRGMedia.mo b/ThermofluidStream/Media/Tests/TestXRGMedia.mo index 8db8a290..58ed85fc 100644 --- a/ThermofluidStream/Media/Tests/TestXRGMedia.mo +++ b/ThermofluidStream/Media/Tests/TestXRGMedia.mo @@ -7,8 +7,10 @@ model TestXRGMedia "Test for five XRG Media with various components" HeatExchangers.DiscretizedCounterFlowHEX discretizedHEX( redeclare package MediumA = XRGMedia.R134a_ph, redeclare package MediumB = XRGMedia.NH3_ph, - redeclare model ConductionElementA = HeatExchangers.Internal.ConductionElementHEX, - redeclare model ConductionElementB = HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementA = + HeatExchangers.Internal.ConductionElementHEX, + redeclare model ConductionElementB = + HeatExchangers.Internal.ConductionElementHEX_twoPhase, initializeMassFlow=true) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=180, @@ -16,15 +18,18 @@ model TestXRGMedia "Test for five XRG Media with various components" HeatExchangers.DiscretizedCounterFlowHEX discretizedHEX1( redeclare package MediumA = XRGMedia.NH3_ph, redeclare package MediumB = XRGMedia.CO2_ph, - redeclare model ConductionElementA = HeatExchangers.Internal.ConductionElementHEX, - redeclare model ConductionElementB = HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementA = + HeatExchangers.Internal.ConductionElementHEX, + redeclare model ConductionElementB = + HeatExchangers.Internal.ConductionElementHEX_twoPhase, initializeMassFlow=false) annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=180, origin={30,56}))); HeatExchangers.DiscretizedCounterFlowHEX discretizedHEX2( redeclare package MediumA = XRGMedia.CO2_ph, redeclare package MediumB = XRGMedia.R134a_ph, - redeclare model ConductionElementB = HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementB = + HeatExchangers.Internal.ConductionElementHEX_twoPhase, initializeMassFlow=true) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=180, @@ -44,7 +49,8 @@ model TestXRGMedia "Test for five XRG Media with various components" HeatExchangers.DiscretizedCounterFlowHEX discretizedHEX4( redeclare package MediumA = XRGMedia.R1234yf_ph, redeclare package MediumB = XRGMedia.R134a_ph, - redeclare model ConductionElementB = HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementB = + HeatExchangers.Internal.ConductionElementHEX_twoPhase, initializeMassFlow=true) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=180, @@ -53,7 +59,8 @@ model TestXRGMedia "Test for five XRG Media with various components" Boundaries.Source source1(redeclare package Medium = XRGMedia.CO2_ph, p0_par=130000) annotation (Placement(transformation(extent={{-86,38},{-66,58}}))); Boundaries.VolumeFlex volumeFlex(redeclare package Medium = XRGMedia.CO2_ph) annotation (Placement(transformation(extent={{-4,38},{16,58}}))); - Examples.Utilities.Receiver receiver(redeclare package Medium = XRGMedia.R134a_ph, p_start=200000) + Examples.Utilities.Receiver receiver(redeclare package Medium = + XRGMedia.R134a_ph, p_start=200000) annotation (Placement(transformation(extent={{-36,22},{-56,42}}))); Boundaries.Sink sink3(redeclare package Medium = XRGMedia.R134a_ph, p0_par=180000) annotation (Placement(transformation(extent={{-156,-10},{-176,10}}))); @@ -61,7 +68,8 @@ model TestXRGMedia "Test for five XRG Media with various components" redeclare package Medium = XRGMedia.NH3_ph, r(displayUnit="mm") = 0.005, l=10, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, @@ -70,7 +78,8 @@ model TestXRGMedia "Test for five XRG Media with various components" redeclare package Medium = XRGMedia.CO2_ph, r(displayUnit="mm") = 0.005, l=15, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, @@ -80,7 +89,8 @@ model TestXRGMedia "Test for five XRG Media with various components" initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, r(displayUnit="mm") = 0.002, l=50, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, @@ -89,7 +99,8 @@ model TestXRGMedia "Test for five XRG Media with various components" redeclare package Medium = XRGMedia.R134a_ph, r(displayUnit="mm") = 0.02, l=5, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, @@ -99,12 +110,14 @@ model TestXRGMedia "Test for five XRG Media with various components" initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, r(displayUnit="mm") = 0.005, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, origin={-118,32}))); - Processes.ConductionElement conductionElement(redeclare package Medium = XRGMedia.R134a_ph) + Processes.ConductionElement conductionElement(redeclare package Medium = + XRGMedia.R134a_ph) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, @@ -118,16 +131,21 @@ model TestXRGMedia "Test for five XRG Media with various components" origin={142,32}))); Processes.Nozzle nozzle(redeclare package Medium = XRGMedia.R1234yf_ph, A_out=5) annotation (Placement(transformation(extent={{-14,6},{6,26}}))); Boundaries.Source source2(redeclare package Medium = XRGMedia.R1234yf_ph) annotation (Placement(transformation(extent={{-102,6},{-82,26}}))); - Boundaries.DynamicPressureInflow dynamicPressureInflow(redeclare package Medium = XRGMedia.R1234yf_ph, v_in_par=1) + Boundaries.DynamicPressureInflow dynamicPressureInflow(redeclare package + Medium = + XRGMedia.R1234yf_ph, v_in_par=1) annotation (Placement(transformation(extent={{-74,6},{-54,26}}))); - Boundaries.DynamicPressureOutflow dynamicPressureOutflow(redeclare package Medium = XRGMedia.R1234yf_ph, A_par=2) + Boundaries.DynamicPressureOutflow dynamicPressureOutflow(redeclare package + Medium = + XRGMedia.R1234yf_ph, A_par=2) annotation (Placement(transformation(extent={{52,6},{72,26}}))); Boundaries.Sink sink(redeclare package Medium = XRGMedia.R1234yf_ph) annotation (Placement(transformation(extent={{112,6},{132,26}}))); Processes.FlowResistance flowResistance6( redeclare package Medium = XRGMedia.R1234yf_ph, r(displayUnit="mm") = 0.02, l=20, - redeclare function pLoss = Processes.Internal.FlowResistance.linearQuadraticPressureLoss (k=500, k2=500)) + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=500, k2=500)) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, @@ -138,7 +156,8 @@ model TestXRGMedia "Test for five XRG Media with various components" redeclare package Medium = XRGMedia.R245fa_ph, r(displayUnit="mm") = 0.02, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarPressureLoss) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, @@ -147,12 +166,15 @@ model TestXRGMedia "Test for five XRG Media with various components" setEnthalpy=true, p0_par=120000) annotation (Placement(transformation(extent={{-32,-38},{-12,-18}}))); - FlowControl.BasicControlValve basicControlValve(redeclare package Medium = XRGMedia.R245fa_ph, - redeclare function valveCharacteristics = FlowControl.Internal.ControlValve.linearCharacteristics, + FlowControl.BasicControlValve basicControlValve(redeclare package Medium = + XRGMedia.R245fa_ph, + redeclare function valveCharacteristics = + FlowControl.Internal.ControlValve.linearCharacteristics, flowCoefficient=ThermofluidStream.FlowControl.Internal.Types.FlowCoefficientTypesBasic.m_flow_set, m_flow_ref_set=1) annotation (Placement(transformation(extent={{-4,-18},{16,-38}}))); - Processes.ConductionElement conductionElement1(redeclare package Medium = XRGMedia.R245fa_ph, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state) + Processes.ConductionElement conductionElement1(redeclare package Medium = + XRGMedia.R245fa_ph, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state) annotation (Placement(transformation( extent={{10,10},{-10,-10}}, rotation=180, @@ -161,7 +183,8 @@ model TestXRGMedia "Test for five XRG Media with various components" Processes.Pump pump( redeclare package Medium = XRGMedia.R134a_ph, omega_from_input=true, - redeclare function dp_tau_pump = Processes.Internal.TurboComponent.dp_tau_nominal_flow) + redeclare function dp_tau_pump = + Processes.Internal.TurboComponent.dp_tau_nominal_flow) annotation (Placement(transformation(extent={{-80,42},{-100,22}}))); Modelica.Blocks.Sources.Constant const(k=6300) annotation (Placement(transformation(extent={{-128,52},{-108,72}}))); Processes.FlowResistance flowResistance8( @@ -169,7 +192,8 @@ model TestXRGMedia "Test for five XRG Media with various components" initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, r(displayUnit="mm") = 0.02, l=1, - redeclare function pLoss = Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + redeclare function pLoss = + Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, diff --git a/ThermofluidStream/Media/myMedia.mo b/ThermofluidStream/Media/myMedia.mo index 817572ca..445dbc0f 100644 --- a/ThermofluidStream/Media/myMedia.mo +++ b/ThermofluidStream/Media/myMedia.mo @@ -2659,14 +2659,16 @@ points, e.g., when an isentropic reference state is computed. model DryAir1 "Example 1 for dry air" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare package + Medium = myMedia.Air.ReferenceAir.Air_pT); annotation (experiment_X(StopTime=1.01)); end DryAir1; model DryAir2 "Example 2 for dry air" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel2(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel2(redeclare package + Medium = myMedia.Air.ReferenceAir.Air_pT); annotation (experiment_X(StopTime=1.01)); end DryAir2; @@ -2717,14 +2719,16 @@ points, e.g., when an isentropic reference state is computed. model MoistAir1 "Example 1 for moist air" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare package + Medium = myMedia.Air.ReferenceMoistAir); annotation (experiment_X(StopTime=1.01)); end MoistAir1; model MoistAir2 "Example 2 for moist air" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel2(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel2(redeclare package + Medium = myMedia.Air.ReferenceMoistAir); annotation (experiment_X(StopTime=1.01)); end MoistAir2; @@ -2983,7 +2987,8 @@ output window. "Solve h = h_T(T), s = s_T(T) for T, if h or s is given for ideal gas NASA" extends Modelica.Icons.Example; - replaceable package Medium = myMedia.Air.DryAirNasa constrainedby myMedia.IdealGases.Common.SingleGasNasa + replaceable package Medium = myMedia.Air.DryAirNasa constrainedby + myMedia.IdealGases.Common.SingleGasNasa "Medium model" annotation (choicesAllMatching=true); @@ -3104,7 +3109,8 @@ output window. extends Modelica.Icons.Example; replaceable package Medium = - myMedia.IdealGases.MixtureGases.FlueGasLambdaOnePlus constrainedby myMedia.IdealGases.Common.MixtureGasNasa + myMedia.IdealGases.MixtureGases.FlueGasLambdaOnePlus constrainedby + myMedia.IdealGases.Common.MixtureGasNasa "Medium model" annotation (choicesAllMatching=true); parameter SI.Temperature T_min=300 @@ -4482,7 +4488,8 @@ no mass or energy is stored in the pipe. extends Modelica.Icons.ObsoleteModel; model SimpleAir "Test Modelica.Media.Air.SimpleAir" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.Air.SimpleAir); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4493,7 +4500,8 @@ no mass or energy is stored in the pipe. model DryAirNasa "Test Modelica.Media.Air.DryAirNasa" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.Air.DryAirNasa); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4504,7 +4512,8 @@ no mass or energy is stored in the pipe. model MoistAir "Test Modelica.Media.Air.MoistAir" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.Air.MoistAir); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4523,7 +4532,8 @@ no mass or energy is stored in the pipe. model Air "Test single gas Modelica.Media.IdealGases.SingleGases.Air" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.Air.DryAirNasa); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4535,7 +4545,8 @@ no mass or energy is stored in the pipe. model Nitrogen "Test single gas Modelica.Media.IdealGases.SingleGases.N2" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.IdealGases.SingleGases.N2); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4547,7 +4558,8 @@ no mass or energy is stored in the pipe. model SimpleNaturalGas "Test mixture gas Modelica.Media.IdealGases.MixtureGases.SimpleNaturalGas" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.IdealGases.MixtureGases.SimpleNaturalGas); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4559,7 +4571,8 @@ no mass or energy is stored in the pipe. model SimpleNaturalGasFixedComposition "Test mixture gas Modelica.Media.IdealGases.MixtureGases.SimpleNaturalGas" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.IdealGases.MixtureGases.SimpleNaturalGasFixedComposition); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4578,7 +4591,8 @@ no mass or energy is stored in the pipe. extends Modelica.Icons.ObsoleteModel; model Glycol47 "Test Modelica.Media.Incompressible.Examples.Glycol47" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.Incompressible.Examples.Glycol47 ( final singleState=true, final enthalpyOfT=true)); extends Modelica.Icons.ObsoleteModel; @@ -4591,7 +4605,8 @@ no mass or energy is stored in the pipe. model Essotherm650 "Test Modelica.Media.Incompressible.Examples.Essotherm65" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.Incompressible.Examples.Essotherm650); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4610,7 +4625,8 @@ no mass or energy is stored in the pipe. model ConstantPropertyLiquidWater "Test Modelica.Media.Water.ConstantPropertyLiquidWater" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.Water.ConstantPropertyLiquidWater); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4621,7 +4637,8 @@ no mass or energy is stored in the pipe. model IdealSteam "Test Modelica.Media.Water.IdealSteam" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.Water.IdealSteam); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4646,7 +4663,8 @@ no mass or energy is stored in the pipe. model WaterIF97_pT "Test Modelica.Media.Water.WaterIF97_pT" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.Water.WaterIF97_pT); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4679,7 +4697,8 @@ no mass or energy is stored in the pipe. model LinearColdWater "Test Modelica.Media.Incompressible.Examples.Glycol47" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.CompressibleLiquids.LinearColdWater); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -4691,7 +4710,8 @@ no mass or energy is stored in the pipe. model LinearWater_pT "Test Modelica.Media.Incompressible.Examples.Essotherm65" extends Modelica.Icons.Example; - extends myMedia.Examples.Utilities.PartialTestModel(redeclare package Medium = + extends myMedia.Examples.Utilities.PartialTestModel(redeclare + package Medium = myMedia.CompressibleLiquids.LinearWater_pT_Ambient); extends Modelica.Icons.ObsoleteModel; annotation (Documentation(info=" @@ -6222,7 +6242,8 @@ to the above list of assumptions partial package PartialRealCondensingGases "Base class for mixtures of real condensing and non-condensing gases" - extends myMedia.Interfaces.PartialMixtureMedium(redeclare replaceable record FluidConstants = + extends myMedia.Interfaces.PartialMixtureMedium(redeclare replaceable + record FluidConstants = myMedia.Interfaces.Types.TwoPhase.FluidConstants); replaceable partial function saturationPressure @@ -6314,8 +6335,8 @@ to the above list of assumptions partial package PartialTwoPhaseMedium "Base class for two phase medium of one substance" - extends PartialPureSubstance(redeclare replaceable record FluidConstants = - myMedia.Interfaces.Types.TwoPhase.FluidConstants); + extends PartialPureSubstance(redeclare replaceable record FluidConstants + = myMedia.Interfaces.Types.TwoPhase.FluidConstants); constant Boolean smoothModel=false "True if the (derived) model should not generate state events"; constant Boolean onePhase=false @@ -16228,7 +16249,8 @@ The thermodynamic model may be used for temperatures ranging fr protected function Tsub_res - extends Modelica.Math.Nonlinear.Interfaces.partialScalarFunction; + extends + Modelica.Math.Nonlinear.Interfaces.partialScalarFunction; input Modelica.SIunits.AbsolutePressure p "Pressure"; algorithm diff --git a/ThermofluidStream/Processes/Compressor.mo b/ThermofluidStream/Processes/Compressor.mo index 2e8d1618..a5ff7e69 100644 --- a/ThermofluidStream/Processes/Compressor.mo +++ b/ThermofluidStream/Processes/Compressor.mo @@ -6,7 +6,8 @@ model Compressor replaceable function dp_tau_compressor = Internal.TurboComponent.pleaseSelect_dp_tau - constrainedby Internal.TurboComponent.partial_dp_tau(redeclare package Medium=Medium) "Compressor characteristic curve" + constrainedby Internal.TurboComponent.partial_dp_tau(redeclare package + Medium = Medium) "Compressor characteristic curve" annotation(choices( choice=ThermofluidStream.Processes.Internal.TurboComponent.pleaseSelect_dp_tau "Please select function", choice=ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop "Fixed isentropic efficency"), diff --git a/ThermofluidStream/Processes/Fan.mo b/ThermofluidStream/Processes/Fan.mo index a347e442..6dedaada 100644 --- a/ThermofluidStream/Processes/Fan.mo +++ b/ThermofluidStream/Processes/Fan.mo @@ -3,7 +3,8 @@ model Fan "Fan under ideal gas assumption" extends Internal.PartialTurboComponent(redeclare function dp_tau=dp_tau_fan); replaceable function dp_tau_fan = Internal.TurboComponent.pleaseSelect_dp_tau - constrainedby Internal.TurboComponent.partial_dp_tau(redeclare package Medium=Medium) "Fan characteristic curve" + constrainedby Internal.TurboComponent.partial_dp_tau(redeclare package + Medium = Medium) "Fan characteristic curve" annotation(choices( choice=ThermofluidStream.Processes.Internal.TurboComponent.pleaseSelect_dp_tau "Please select function", choice=ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop "Fixed isentropic efficency"), diff --git a/ThermofluidStream/Processes/FlowResistance.mo b/ThermofluidStream/Processes/FlowResistance.mo index 594521e1..32ec0486 100644 --- a/ThermofluidStream/Processes/FlowResistance.mo +++ b/ThermofluidStream/Processes/FlowResistance.mo @@ -18,13 +18,17 @@ model FlowResistance "Flow resistance model" annotation ( choices( choice(redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.pleaseSelectPressureLoss "no function selected"), + ThermofluidStream.Processes.Internal.FlowResistance.pleaseSelectPressureLoss + "no function selected"), choice(redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss "linear-quadratic"), + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + "linear-quadratic"), choice(redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarPressureLoss "laminar"), + ThermofluidStream.Processes.Internal.FlowResistance.laminarPressureLoss + "laminar"), choice(redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss "laminar-turbulent")), + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + "laminar-turbulent")), Documentation(info="This function computes the pressure loss of the fluid depending on the massflow, some medium properties and the geometry of the pipe.
")); diff --git a/ThermofluidStream/Processes/Internal/PartialTurboComponent.mo b/ThermofluidStream/Processes/Internal/PartialTurboComponent.mo index ccb7de87..d4b3eab4 100644 --- a/ThermofluidStream/Processes/Internal/PartialTurboComponent.mo +++ b/ThermofluidStream/Processes/Internal/PartialTurboComponent.mo @@ -53,7 +53,8 @@ partial model PartialTurboComponent "Partial of components that exchange work beThis functions computes the pressure difference over the component, as well as the moment that leeds to stationary operation in the current state.
")); -function getQuantity = Sensors.Internal.getFlowQuantity(redeclare package Medium=Medium) "Function to compute a selectable quantitiy" +function getQuantity = Sensors.Internal.getFlowQuantity(redeclare package + Medium = Medium) "Function to compute a selectable quantitiy" annotation ( Documentation(info="Function to compute a selectable quantitiy to output. The quantity is associated to the mass flow.
diff --git a/ThermofluidStream/Processes/Pump.mo b/ThermofluidStream/Processes/Pump.mo index e1b0928d..6ce0651c 100644 --- a/ThermofluidStream/Processes/Pump.mo +++ b/ThermofluidStream/Processes/Pump.mo @@ -8,7 +8,8 @@ model Pump "A simple pump model" replaceable function dp_tau_pump = Internal.TurboComponent.pleaseSelect_dp_tau - constrainedby Internal.TurboComponent.partial_dp_tau(redeclare package Medium=Medium) "Pump characteristic curve" + constrainedby Internal.TurboComponent.partial_dp_tau(redeclare package + Medium = Medium) "Pump characteristic curve" annotation(choices( choice=ThermofluidStream.Processes.Internal.TurboComponent.pleaseSelect_dp_tau "Please select function", choice=ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_centrifugal "Centrifugal Pump", diff --git a/ThermofluidStream/Processes/Tests/Nozzle.mo b/ThermofluidStream/Processes/Tests/Nozzle.mo index 8517dd41..f4caca1d 100644 --- a/ThermofluidStream/Processes/Tests/Nozzle.mo +++ b/ThermofluidStream/Processes/Tests/Nozzle.mo @@ -3,8 +3,8 @@ model Nozzle extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.MoistAir - constrainedby Media.myMedia.Interfaces.PartialMedium - "Medium Model" + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium Model" annotation (choicesAllMatching=true,Documentation(info="Medium model for the test. Can be anything.
")); @@ -42,13 +42,17 @@ model Nozzle annotation (Placement(transformation(extent={{-90,-30},{-70,-10}}))); Boundaries.Sink sink1(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{70,-30},{90,-10}}))); - Boundaries.DynamicPressureInflow dynamicPressureInflow(redeclare package Medium = Medium, A_par=0.00015) + Boundaries.DynamicPressureInflow dynamicPressureInflow(redeclare package + Medium = Medium, A_par=0.00015) annotation (Placement(transformation(extent={{-60,10},{-40,30}}))); - Boundaries.DynamicPressureInflow dynamicPressureInflow1(redeclare package Medium = Medium, A_par=0.01) + Boundaries.DynamicPressureInflow dynamicPressureInflow1(redeclare package + Medium = Medium, A_par=0.01) annotation (Placement(transformation(extent={{-60,-30},{-40,-10}}))); - Boundaries.DynamicPressureOutflow dynamicPressureOutflow(redeclare package Medium = Medium, A_par=0.01) + Boundaries.DynamicPressureOutflow dynamicPressureOutflow(redeclare package + Medium = Medium, A_par=0.01) annotation (Placement(transformation(extent={{40,10},{60,30}}))); - Boundaries.DynamicPressureOutflow dynamicPressureOutflow1(redeclare package Medium = Medium, A_par=0.00015) + Boundaries.DynamicPressureOutflow dynamicPressureOutflow1(redeclare package + Medium = Medium, A_par=0.00015) annotation (Placement(transformation(extent={{40,-30},{60,-10}}))); inner ThermofluidStream.DropOfCommons dropOfCommons annotation ( Placement(visible = true, transformation(origin = {0, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); diff --git a/ThermofluidStream/Processes/Tests/Pump.mo b/ThermofluidStream/Processes/Tests/Pump.mo index eedea4a7..d5610dbe 100644 --- a/ThermofluidStream/Processes/Tests/Pump.mo +++ b/ThermofluidStream/Processes/Tests/Pump.mo @@ -5,8 +5,8 @@ model Pump "Test for pumps" import tf = ThermofluidStream; replaceable package Medium = tf.Media.myMedia.CompressibleLiquids.LinearWater_pT_Ambient - constrainedby tf.Media.myMedia.Interfaces.PartialMedium - "Medium model" + constrainedby + tf.Media.myMedia.Interfaces.PartialMedium "Medium model" annotation ( choicesAllMatching=true, Documentation(info=" @@ -65,7 +65,8 @@ model Pump "Test for pumps" omega_from_input=true, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, enableAccessHeatPort=true, - redeclare function dp_tau_pump = tf.Processes.Internal.TurboComponent.dp_tau_nominal_flow ( + redeclare function dp_tau_pump = + tf.Processes.Internal.TurboComponent.dp_tau_nominal_flow ( parametrizeByDesignPoint=false, k_p_input=1e7)) annotation (Placement(transformation(extent={{-2,-18},{18,2}}))); @@ -82,7 +83,8 @@ model Pump "Test for pumps" initOmega=ThermofluidStream.Utilities.Types.InitializationMethods.state, initPhi=true, phi_0=-1745.3292519943, - redeclare function dp_tau_pump = tf.Processes.Internal.TurboComponent.dp_tau_nominal_flow ( + redeclare function dp_tau_pump = + tf.Processes.Internal.TurboComponent.dp_tau_nominal_flow ( parametrizeByDesignPoint=false, V_r_input=0.0006, k_p_input=1e8)) @@ -101,7 +103,8 @@ model Pump "Test for pumps" J_p=10, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, phi_0=-1745.3292519943, - redeclare function dp_tau_pump = tf.Processes.Internal.TurboComponent.dp_tau_nominal_flow ( + redeclare function dp_tau_pump = + tf.Processes.Internal.TurboComponent.dp_tau_nominal_flow ( parametrizeByDesignPoint=true, omega_D(displayUnit="rad/s") = 100)) annotation (Placement(transformation(extent={{-10,130},{10,150}}))); diff --git a/ThermofluidStream/Processes/Tests/TransportDelay.mo b/ThermofluidStream/Processes/Tests/TransportDelay.mo index d94cb1b2..30bd9095 100644 --- a/ThermofluidStream/Processes/Tests/TransportDelay.mo +++ b/ThermofluidStream/Processes/Tests/TransportDelay.mo @@ -3,8 +3,8 @@ model TransportDelay "Test for transport delay " extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.DryAirNasa - constrainedby Media.myMedia.Interfaces.PartialMedium - "Medium Model" + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium Model" annotation (Documentation(info="Medium model for the test. Can be anything.
")); diff --git a/ThermofluidStream/Processes/Turbine.mo b/ThermofluidStream/Processes/Turbine.mo index 7aa09acb..1ed98349 100644 --- a/ThermofluidStream/Processes/Turbine.mo +++ b/ThermofluidStream/Processes/Turbine.mo @@ -1,9 +1,12 @@ within ThermofluidStream.Processes; model Turbine "Turbine under ideal gas assumption" - extends Internal.PartialTurboComponent(redeclare function dp_tau = dp_tau_turbine); + extends Internal.PartialTurboComponent(redeclare function dp_tau = + dp_tau_turbine); - replaceable function dp_tau_turbine = Internal.TurboComponent.pleaseSelect_dp_tau - constrainedby Internal.TurboComponent.partial_dp_tau(redeclare package Medium=Medium) "Compressor characteristic curve" + replaceable function dp_tau_turbine = + Internal.TurboComponent.pleaseSelect_dp_tau + constrainedby Internal.TurboComponent.partial_dp_tau(redeclare package + Medium = Medium) "Compressor characteristic curve" annotation(choices( choice=ThermofluidStream.Processes.Internal.TurboComponent.pleaseSelect_dp_tau "Please select function", choice=ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_const_isentrop(omega_ref=1e6) "Fixed isentropic efficency"), diff --git a/ThermofluidStream/Resources/Doku/ThermofluidStream.Topology.Internal.SplitterRatio.PNG b/ThermofluidStream/Resources/Doku/ThermofluidStream.Topology.Internal.SplitterRatio.PNG new file mode 100644 index 00000000..52f64dc9 Binary files /dev/null and b/ThermofluidStream/Resources/Doku/ThermofluidStream.Topology.Internal.SplitterRatio.PNG differ diff --git a/ThermofluidStream/Resources/Doku/ThermofluidStream.Topology.Internal.SplitterRatio2.PNG b/ThermofluidStream/Resources/Doku/ThermofluidStream.Topology.Internal.SplitterRatio2.PNG new file mode 100644 index 00000000..8fa5f09b Binary files /dev/null and b/ThermofluidStream/Resources/Doku/ThermofluidStream.Topology.Internal.SplitterRatio2.PNG differ diff --git a/ThermofluidStream/Sensors/SingleSensorX.mo b/ThermofluidStream/Sensors/SingleSensorX.mo index 6717d6a5..31d617b4 100644 --- a/ThermofluidStream/Sensors/SingleSensorX.mo +++ b/ThermofluidStream/Sensors/SingleSensorX.mo @@ -31,7 +31,8 @@ model SingleSensorX "Sensor for mass fraction of mixture" output Real value[Medium.nX](each unit="kg/kg") "Computed value of the selected Quantity"; output Real display_value(unit="kg/kg") = value[row] "Row of the value vector to display"; - function mfk = ThermofluidStream.Utilities.Functions.massFractionK(redeclare package Medium = Medium); + function mfk = ThermofluidStream.Utilities.Functions.massFractionK(redeclare + package Medium = Medium); protected outer DropOfCommons dropOfCommons; diff --git a/ThermofluidStream/Sensors/Tests/TestSensors.mo b/ThermofluidStream/Sensors/Tests/TestSensors.mo index e459707b..e2eabe3d 100644 --- a/ThermofluidStream/Sensors/Tests/TestSensors.mo +++ b/ThermofluidStream/Sensors/Tests/TestSensors.mo @@ -3,19 +3,22 @@ model TestSensors "Test model for all sensors." extends Modelica.Icons.Example; replaceable package Medium1 = Media.myMedia.Water.ConstantPropertyLiquidWater - constrainedby Media.myMedia.Interfaces.PartialMedium + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium Model 1" annotation (Documentation( info="Medium Model for the upper stream. It can be anything.
")); replaceable package Medium2 = Media.myMedia.Water.StandardWater - constrainedby Media.myMedia.Interfaces.PartialTwoPhaseMedium + constrainedby + Media.myMedia.Interfaces.PartialTwoPhaseMedium "Medium Model 2" annotation (Documentation(info="Medium Model for the lower stream. It must be a TwoPhaseMedium to test the vapor quantity sensors.
")); replaceable package Medium3 = - Media.myMedia.IdealGases.MixtureGases.FlueGasSixComponents constrainedby Media.myMedia.Interfaces.PartialMedium + Media.myMedia.IdealGases.MixtureGases.FlueGasSixComponents constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium Model 3" annotation (Documentation(info="Medium Model for the lower stream. It must be a TwoPhaseMedium to test the vapor quantity sensors.
")); diff --git a/ThermofluidStream/Topology/Internal.mo b/ThermofluidStream/Topology/Internal.mo new file mode 100644 index 00000000..93cb1e59 --- /dev/null +++ b/ThermofluidStream/Topology/Internal.mo @@ -0,0 +1,182 @@ +within ThermofluidStream.Topology; +package Internal + extends Modelica.Icons.InternalPackage; + + model SplitterRatio "Splits a flow into two subflows with prescribed ratio" + + replaceable package Medium = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium + "Medium model" annotation (choicesAllMatching=true, Documentation(info=" +Medium package used in the Component. Make sure it is the same one as all the components connected to all fluid ports are using.
+")); + parameter ThermofluidStream.Utilities.Units.Inertance L=dropOfCommons.L "Inertance on each Branch of Component" + annotation (Dialog(tab="Advanced")); + + parameter SI.Time TC = 0.1 "Time constant for RT massflow constraint" + annotation(Dialog(tab="Advanced")); + parameter SI.AbsolutePressure p_reg = 1e2 "Regularizaion pressure for pressure drop calculation" + annotation(Dialog(tab="Advanced")); + parameter SI.Density rho_min=dropOfCommons.rho_min "Minimum Density" + annotation(Dialog(tab="Advanced")); + + parameter SplitterModes mode = SplitterModes.pressureDrop "Mode of the splitter. See Doku."; + parameter Boolean invert = false "Invert split-ratio input?"; + parameter SI.Time TC_input = 0.05 "Time constnat for PT1 on split-ratio input" + annotation(Dialog(tab="Advanced")); + parameter SI.Power P_thresh = 1 "Power threshold for \"create-pressure-warning\"" + annotation(Dialog(tab="Advanced")); + + ThermofluidStream.Interfaces.Inlet inlet(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-120,-20},{-80,20}}), iconTransformation(extent={{-120,-20},{-80,20}}))); + ThermofluidStream.Interfaces.Outlet outletA(redeclare package Medium = Medium) annotation (Placement(transformation( + extent={{-20,-20},{20,20}}, + rotation=90, + origin={0,100}), iconTransformation( + extent={{-20,-20},{20,20}}, + rotation=90, + origin={0,100}))); + ThermofluidStream.Interfaces.Outlet outletB(redeclare package Medium = Medium) annotation (Placement(transformation( + extent={{-20,-20},{20,20}}, + rotation=0, + origin={100,0}), iconTransformation( + extent={{-20,-20},{20,20}}, + rotation=0, + origin={100,0}))); + + Modelica.Blocks.Interfaces.RealInput splitRatio(min=0, max=1) annotation (Placement(transformation(extent={{-20,-20},{20,20}}, + rotation=90, + origin={0,-100}), iconTransformation( + extent={{-20,-20},{20,20}}, + rotation=90, + origin={0,-30}))); + + SI.SpecificVolume v_in = 1/max(Medium.density(inlet.state), rho_min); + SI.SpecificVolume v_A = 1/max(Medium.density(outletA.state), rho_min); + SI.SpecificVolume v_B = 1/max(Medium.density(outletB.state), rho_min); + + SI.Power P_A = (v_in+v_A)/2*(-outletA.m_flow)*(p_A-p_in); + SI.Power P_B = (v_in+v_B)/2*(-outletB.m_flow)*(p_B-p_in); + + protected + outer ThermofluidStream.DropOfCommons dropOfCommons; + + SI.AbsolutePressure dp(stateSelect=StateSelect.always, start=0, fixed=true); + SI.AbsolutePressure p_A; + SI.AbsolutePressure p_B; + + SI.Pressure r_I; + SI.Pressure r_A; + SI.Pressure r_B; + + SI.Pressure r_corr_A; + SI.Pressure r_corr_B; + + SI.AbsolutePressure p_in = Medium.pressure(inlet.state); + SI.SpecificEnthalpy h_in = Medium.specificEnthalpy(inlet.state); + SI.MassFraction Xi_in[Medium.nXi] = Medium.massFraction(inlet.state); + + Real splitRatioLim(unit="1"); + parameter Real eps(unit="1") = 1e-5 "Numerical minimal distance of input to 0 and 1"; + + parameter SI.AbsolutePressure p_min = dropOfCommons.p_min; + + initial equation + splitRatioLim = min(1-eps, max(eps, if invert then 1-splitRatio else splitRatio)); + + equation + assert(P_A < P_thresh, + "Splitter enforces mass-flow constraint by artificially increasing pressure on outlet A", + AssertionLevel.warning); + + assert(P_B < P_thresh, + "Splitter enforces mass-flow constraint by artificially increasing pressure on outlet B", + AssertionLevel.warning); + + //conservation of mass + inlet.m_flow + outletA.m_flow + outletB.m_flow = 0; + + // inertances on input and output paths + der(inlet.m_flow) * L = inlet.r - r_I; + der(outletA.m_flow) * L = outletA.r - r_A; + der(outletB.m_flow) * L = outletB.r - r_B; + + // lowpass to disable input smoothness constraint + der(splitRatioLim)* TC_input = min(1-eps, max(eps, if invert then 1-splitRatio else splitRatio)) - splitRatioLim; + + //these replace the standard two r_out=r_in equations. see Zimmer: Real-Time Simulation of an Aircraft Electric Driven Environmental Control System for Virtual Testing Purposes Sec 3.4 + splitRatioLim*inlet.m_flow = -outletA.m_flow; + r_I = splitRatioLim*r_A + (1-splitRatioLim)*r_B; + + // integration of pressure so r->0 with anti-windup, when a output pressure is in lower bound + der(dp) * TC = r_B - r_A +1* (r_corr_A-r_corr_B); + + // set output pressures depending on splitter mode. see doku. + if mode == SplitterModes.A then + p_A = p_in - dp; + elseif mode == SplitterModes.B then + p_A = p_in; + elseif mode == SplitterModes.OneMinusS then + p_A = p_in- (1-splitRatioLim)*dp; + else + // apply dp fully to one side (regularized), such that pressure increase never happens + p_A = ThermofluidStream.Undirected.Internal.regStep(dp, p_in - dp, p_in, p_reg); + end if; + p_B = p_A + dp; + + // for anti-windwup of dp when p_out is clipped + r_corr_A = p_A - Medium.pressure(outletA.state); + r_corr_B = p_B - Medium.pressure(outletB.state); + + outletA.state = Medium.setState_phX(p= max(p_min,p_A), h=h_in, X=Xi_in); + outletB.state = Medium.setState_phX(p= max(p_min,p_B), h=h_in, X=Xi_in); + + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Line( + points={{-70,0},{0,0}}, + color={28,108,200}, + thickness=0.5), + Line( + points={{0,0},{80,0}}, + color={28,108,200}, + thickness=0.5), + Line( + points={{0,0},{0,80}}, + color={28,108,200}, + thickness=0.5), + Ellipse( + extent={{-6,6},{6,-6}}, + lineColor={28,108,200}, + fillColor={170,213,255}, + fillPattern=FillPattern.Solid, + lineThickness=0.5), + Text( + extent={{-60,100},{-20,60}}, + lineColor={175,175,175}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + textString="A"), + Text( + extent={{60,-20},{100,-60}}, + lineColor={175,175,175}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + textString="B"), + Text( + extent={{-94,38},{90,8}}, + lineColor={0,0,0}, + textString="SplitterRatio")}), + Diagram(coordinateSystem(preserveAspectRatio= + false)), + Documentation(info=" +
Splitter, that uses a directly set split ratio. In order to have stationary r that goes to zero, a pressure difference between outlet A and B is calculated, that is applied to one of the outlets, until r->0.
The idear builds on the splitter with an enforeced regime of Zimmer Real-Time Simulation of an Aircraft Electric Driven Environmental Control System for Virtual Testing Purposes Sec 3.4
A splitter with prescribed split ratio that acts as a pressure control valve on both outlets. Pressure is reduced on the outlets in order to follow the mass-flow split prescription.
+For reversed mass-flow the component might create work in form of increasing pressure of the fluid flowing from outlet to inlet.
+For SplitterRatio and JunctionRatio make to only prescribe mass-flow-split in Splitter or Junction.
+")); + end RatioControl; + + model RTSwitch "SplitterRatio in full switch mode" + extends Internal.SplitterRatio(final mode = Internal.SplitterModes.OneMinusS); + + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +A switch with a fixed split ratio that is indended as a switch between two paths. Therefore the input sould be 1 or 0 for the most part.
+
Otherwise will create work in the form of pressure on one of the two paths in order to fulfill the prescribed splitratio.
For SplitterRatio and JunctionRatio make to only prescribe mass-flow-split in Splitter or Junction.
+")); + end RTSwitch; + + model LeakageA "Leakage on path A to a lower pressure level" + extends Internal.SplitterRatio(final mode = Internal.SplitterModes.A); + + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +A splitter with prescribed mass-flow split, that changes (increases or reduces) pressure on outletA in order to fulfull the mass-flow prescription. In case an increase of pressure is nessesary for the mass-flow (or for reversed mass-flow), the component will create work in the form of increasing pressure on the A-path.
+For SplitterRatio and JunctionRatio make to only prescribe mass-flow-split in Splitter or Junction.
+")); + end LeakageA; + + model JunctionRatio "Split-ratio Junction for a bypass" + + replaceable package Medium = Media.myMedia.Interfaces.PartialMedium + "Medium model" + annotation (choicesAllMatching=true, Documentation(info=" +Medium package used in the Component. Make sure it is the same one as all the components connected to all fluid ports are using.
+")); + parameter Boolean assumeConstantDensity = true "If true only mass-flow rate will determine the mixing"; + parameter SI.MassFlowRate m_flow_eps = dropOfCommons.m_flow_reg "Regularization threshold for small mass flows" + annotation (Dialog(tab="Advanced")); + parameter Utilities.Units.Inertance L=dropOfCommons.L "Inertance on each Branch of Component" + annotation (Dialog(tab="Advanced")); + parameter SI.Time TC_input = 0.05; + parameter Boolean invert = false; + + Interfaces.Outlet outlet(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-20,-20},{20,20}}, rotation=180, origin={-100,0}), + iconTransformation(extent={{-20,-20},{20,20}},rotation=180,origin={-100,0}))); + Interfaces.Inlet inletA( redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-20,-20},{20,20}}, rotation=-90, origin={0,100}), + iconTransformation(extent={{-20,-20},{20,20}},rotation=270,origin={0,100}))); + Interfaces.Inlet inletB( redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-20,-20},{20,20}}, rotation=180, origin={100,0}), + iconTransformation(extent={{-20,-20},{20,20}},rotation=180,origin={100,0}))); + + Modelica.Blocks.Interfaces.RealInput splitRatio(min=0, max=1) annotation (Placement(transformation(extent={{-20,-20},{20,20}}, + rotation=90, + origin={0,-100}), iconTransformation( + extent={{-20,-20},{20,20}}, + rotation=90, + origin={0,-30}))); + + protected + outer DropOfCommons dropOfCommons; + + + // these are needed by DynamicJunctionN + Real w[2](each unit="1") "regularized weighting factor for specific enthalpy"; + SI.Density rho[2] = {Medium.density(inletA.state),Medium.density(inletB.state)} "density at inlets"; + + + SI.Pressure p[2] = {Medium.pressure(inletA.state),Medium.pressure(inletB.state)} "(steady mass-flow) pressure at inlets"; + SI.SpecificEnthalpy h[2] = {Medium.specificEnthalpy(inletA.state),Medium.specificEnthalpy(inletB.state)} "specific enthapy at inlets"; + Medium.MassFraction Xi[Medium.nXi,2] "mass factions at inlets"; + + SI.Pressure p_mix "(steady mass-flow) pressure at the outlet"; + SI.Pressure r_mix "inertial pressure at outlet"; + SI.SpecificEnthalpy h_mix "specific enthalpy at outlet"; + Medium.MassFraction Xi_mix[Medium.nXi] "medium composition at outlet"; + + Real w2[2](each unit="1") "regularized weighting factor for steady mass flow pressure"; + + SI.Pressure r_in[2]; + + function mfk = Utilities.Functions.massFractionK(redeclare package Medium + = Medium); + + Real splitRatioLim(unit="1"); + parameter Real eps(unit="1") = 1e-5 "Numerical minimal distance of input to 0 and 1"; + + initial equation + splitRatioLim = min(1-eps, max(eps, if invert then 1-splitRatio else splitRatio)); + + equation + inletA.m_flow + inletB.m_flow + outlet.m_flow = 0; + + der(inletA.m_flow) * L = inletA.r - r_in[1]; + der(inletB.m_flow) * L = inletB.r - r_in[2]; + der(outlet.m_flow) * L = outlet.r - r_mix; + + // OM_WORKAROUND + for j in 1:Medium.nXi loop + Xi[j,1] = mfk(inletA.state, j); + Xi[j,2] = mfk(inletB.state, j); + end for; + //instad of + /* Xi[:,i] = Medium.massFraction(inlets[i].state); */ + + //p[1] + r_in[2] = p_mix + r_mix; + //p[2] + r_in[1] = p_mix + r_mix; + + + // lowpass to disable input smoothness constraint + der(splitRatioLim)* TC_input = min(1-eps, max(eps, if invert then 1-splitRatio else splitRatio)) - splitRatioLim; + + inletA.m_flow = -splitRatioLim*outlet.m_flow; + r_mix = splitRatioLim*r_in[1] + (1-splitRatioLim)*r_in[2]; + + w[1] = (abs(inletA.m_flow)+m_flow_eps) / (abs(inletA.m_flow)+abs(inletB.m_flow)+2*m_flow_eps); + w[2] = (abs(inletB.m_flow)+m_flow_eps) / (abs(inletA.m_flow)+abs(inletB.m_flow)+2*m_flow_eps); + w2[1] = ((abs(inletA.m_flow) + m_flow_eps)/rho[1]) / ((abs(inletA.m_flow)+m_flow_eps)/rho[1]+(abs(inletB.m_flow)+m_flow_eps)/rho[2]); + w2[2] = ((abs(inletB.m_flow) + m_flow_eps)/rho[2]) / ((abs(inletA.m_flow)+m_flow_eps)/rho[1]+(abs(inletB.m_flow)+m_flow_eps)/rho[2]); + + if not assumeConstantDensity then + p_mix = sum(w2.*p); + else + p_mix = sum(w.*p); + end if; + h_mix = sum(w.*h); + Xi_mix = Xi*w; + + outlet.state = Medium.setState_phX(p_mix,h_mix,Xi_mix); + + + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Line( + points={{-70,0},{0,0}}, + color={28,108,200}, + thickness=0.5), + Line( + points={{0,0},{80,0}}, + color={28,108,200}, + thickness=0.5), + Line( + points={{0,0},{0,80}}, + color={28,108,200}, + thickness=0.5), + Ellipse( + extent={{-6,6},{6,-6}}, + lineColor={28,108,200}, + fillColor={170,213,255}, + fillPattern=FillPattern.Solid, + lineThickness=0.5), + Text( + extent={{-60,100},{-20,60}}, + lineColor={175,175,175}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + textString="A"), + Text( + extent={{80,-20},{120,-60}}, + lineColor={175,175,175}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + textString="B"), + Text( + extent={{-96,34},{88,4}}, + lineColor={0,0,0}, + textString="JunctionRatio")}), + Diagram(coordinateSystem(preserveAspectRatio= + false)), + Documentation(info=" +A junction with a fixed mass-flow split. It can be understood to use energy of the higher-pressure inlet to pull the lower-pressure stream (as in through dynamic pressure).
+For SplitterRatio and JunctionRatio make to only prescribe mass-flow-split in Splitter or Junction.
+")); + end JunctionRatio; + annotation (Documentation(info=" +This package contains topology elements that have non-physical assumtions or constraints like mass-flow splits.
+Although they are non-physical they can be used to model certain behaviour like a leakage or mass-flow-split controlled junction-valve combinations and simplify the model by not explicilty modeling the phenomena like a controlled valve.
+For SplitterRatio and JunctionRatio make to only prescribe mass-flow-split in Splitter or Junction.
+")); +end NonPhysical; diff --git a/ThermofluidStream/Topology/Tests/TestDynamicTopology.mo b/ThermofluidStream/Topology/Tests/TestDynamicTopology.mo index da9c0c36..bf482012 100644 --- a/ThermofluidStream/Topology/Tests/TestDynamicTopology.mo +++ b/ThermofluidStream/Topology/Tests/TestDynamicTopology.mo @@ -3,8 +3,8 @@ model TestDynamicTopology extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.MoistAir - constrainedby Media.myMedia.Interfaces.PartialMedium - "Medium Model" + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium Model" annotation (choicesAllMatching= true, Documentation(info = "Medium model for the test. Can be anything.
@@ -76,7 +76,8 @@ model TestDynamicTopology redeclare package Medium = Medium, A_par(displayUnit="cm2") = 0.0001, v_out_par=-1) annotation (Placement(transformation(extent={{50,70},{70,90}}))); - Boundaries.DynamicPressureOutflow dynamicPressureOutflow1(redeclare package Medium = Medium, A_par(displayUnit="cm2") = 0.0002) + Boundaries.DynamicPressureOutflow dynamicPressureOutflow1(redeclare package + Medium = Medium, A_par(displayUnit="cm2") = 0.0002) annotation (Placement(transformation(extent={{50,40},{70,60}}))); Boundaries.DynamicPressureOutflow dynamicPressureOutflow2( redeclare package Medium = Medium, @@ -152,7 +153,8 @@ model TestDynamicTopology redeclare package Medium = Medium, A_par(displayUnit="cm2") = 0.0001, v_out_par=-1) annotation (Placement(transformation(extent={{50,-30},{70,-10}}))); - Boundaries.DynamicPressureOutflow dynamicPressureOutflow4(redeclare package Medium = Medium, A_par(displayUnit="cm2") = 0.0002) + Boundaries.DynamicPressureOutflow dynamicPressureOutflow4(redeclare package + Medium = Medium, A_par(displayUnit="cm2") = 0.0002) annotation (Placement(transformation(extent={{50,-60},{70,-40}}))); Boundaries.DynamicPressureOutflow dynamicPressureOutflow5( redeclare package Medium = Medium, diff --git a/ThermofluidStream/Topology/Tests/TestJunction.mo b/ThermofluidStream/Topology/Tests/TestJunction.mo index 854b2fc5..8ef325aa 100644 --- a/ThermofluidStream/Topology/Tests/TestJunction.mo +++ b/ThermofluidStream/Topology/Tests/TestJunction.mo @@ -3,7 +3,8 @@ model TestJunction extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.SimpleAir - constrainedby Media.myMedia.Interfaces.PartialMedium; + constrainedby + Media.myMedia.Interfaces.PartialMedium; inner DropOfCommons dropOfCommons annotation (Placement(transformation(extent={{42,-74},{62,-54}}))); diff --git a/ThermofluidStream/Topology/Tests/TestJunctionNM.mo b/ThermofluidStream/Topology/Tests/TestJunctionNM.mo index e454339a..a672a34a 100644 --- a/ThermofluidStream/Topology/Tests/TestJunctionNM.mo +++ b/ThermofluidStream/Topology/Tests/TestJunctionNM.mo @@ -3,8 +3,8 @@ model TestJunctionNM extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.MoistAir - constrainedby Media.myMedia.Interfaces.PartialMedium - "Medium Model" + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium Model" annotation (choicesAllMatching= true, Documentation(info = "Medium model for the test. Can be anything.
diff --git a/ThermofluidStream/Topology/Tests/TestNonPhysical.mo b/ThermofluidStream/Topology/Tests/TestNonPhysical.mo new file mode 100644 index 00000000..9b208fcd --- /dev/null +++ b/ThermofluidStream/Topology/Tests/TestNonPhysical.mo @@ -0,0 +1,512 @@ +within ThermofluidStream.Topology.Tests; +model TestNonPhysical + extends Modelica.Icons.Example; + + replaceable package Medium = Media.myMedia.Water.StandardWater; + + NonPhysical.RatioControl ratioControl(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-130,50},{-110,70}}))); + NonPhysical.RTSwitch rTSwitch(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-130,0},{-110,20}}))); + NonPhysical.LeakageA leakageA(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-130,-50},{-110,-30}}))); + NonPhysical.JunctionRatio junctionRatio1(redeclare package Medium = Medium, + invert=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-70,-70}))); + JunctionT2 junctionT2_1(redeclare package Medium = Medium) annotation ( + Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-70,80}))); + JunctionT2 junctionT2_3(redeclare package Medium = Medium) annotation ( + Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-70,30}))); + JunctionT2 junctionT2_5(redeclare package Medium = Medium) annotation ( + Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-70,-20}))); + SplitterT2 splitterT2_1(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-130,-100},{-110,-80}}))); + Boundaries.Source source(redeclare package Medium = Medium, pressureFromInput= + true) + annotation (Placement(transformation(extent={{-160,50},{-140,70}}))); + Boundaries.Source source1(redeclare package Medium = Medium, + pressureFromInput=true) + annotation (Placement(transformation(extent={{-160,0},{-140,20}}))); + Boundaries.Source source2(redeclare package Medium = Medium, + pressureFromInput=true) + annotation (Placement(transformation(extent={{-160,-50},{-140,-30}}))); + Boundaries.Source source3(redeclare package Medium = Medium, + pressureFromInput=true) + annotation (Placement(transformation(extent={{-160,-100},{-140,-80}}))); + Boundaries.Sink sink(redeclare package Medium = Medium, p0_par=200000) + annotation (Placement(transformation(extent={{-20,70},{0,90}}))); + Boundaries.Sink sink1(redeclare package Medium = Medium, p0_par=200000) + annotation (Placement(transformation(extent={{-20,20},{0,40}}))); + Boundaries.Sink sink2(redeclare package Medium = Medium, p0_par=200000) + annotation (Placement(transformation(extent={{-20,-30},{0,-10}}))); + Boundaries.Sink sink3(redeclare package Medium = Medium, p0_par=200000) + annotation (Placement(transformation(extent={{-20,-80},{0,-60}}))); + Processes.FlowResistance flowResistance(redeclare package Medium = Medium, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( + k=100,k2=100)) + annotation (Placement(transformation(extent={{-100,50},{-80,70}}))); + Processes.FlowResistance flowResistance1(redeclare package Medium = Medium, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( + k=100,k2=100)) + annotation (Placement(transformation(extent={{-100,0},{-80,20}}))); + Processes.FlowResistance flowResistance2(redeclare package Medium = Medium, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( + k=100,k2=100)) + annotation (Placement(transformation(extent={{-100,-50},{-80,-30}}))); + Processes.FlowResistance flowResistance3(redeclare package Medium = Medium, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( + k=100,k2=100)) + annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}))); + NonPhysical.RatioControl ratioControl1(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{40,50},{60,70}}))); + NonPhysical.RTSwitch rTSwitch1(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{40,0},{60,20}}))); + NonPhysical.LeakageA leakageA1(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{40,-50},{60,-30}}))); + NonPhysical.JunctionRatio junctionRatio2(redeclare package Medium = Medium, + invert=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={100,-70}))); + JunctionT2 junctionT2_2(redeclare package Medium = Medium) annotation ( + Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={100,80}))); + JunctionT2 junctionT2_4(redeclare package Medium = Medium) annotation ( + Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={100,30}))); + JunctionT2 junctionT2_6(redeclare package Medium = Medium) annotation ( + Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={100,-20}))); + SplitterT2 splitterT2_2(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{40,-100},{60,-80}}))); + Boundaries.Source source4(redeclare package Medium = Medium, + pressureFromInput=true) + annotation (Placement(transformation(extent={{10,50},{30,70}}))); + Boundaries.Source source5(redeclare package Medium = Medium, + pressureFromInput=true) + annotation (Placement(transformation(extent={{10,0},{30,20}}))); + Boundaries.Source source6(redeclare package Medium = Medium, + pressureFromInput=true) + annotation (Placement(transformation(extent={{10,-50},{30,-30}}))); + Boundaries.Source source7(redeclare package Medium = Medium, + pressureFromInput=true) + annotation (Placement(transformation(extent={{10,-100},{30,-80}}))); + Boundaries.Sink sink4(redeclare package Medium = Medium, p0_par=200000) + annotation (Placement(transformation(extent={{150,70},{170,90}}))); + Boundaries.Sink sink5(redeclare package Medium = Medium, p0_par=200000) + annotation (Placement(transformation(extent={{150,20},{170,40}}))); + Boundaries.Sink sink6(redeclare package Medium = Medium, p0_par=200000) + annotation (Placement(transformation(extent={{150,-30},{170,-10}}))); + Boundaries.Sink sink7(redeclare package Medium = Medium, p0_par=200000) + annotation (Placement(transformation(extent={{150,-80},{170,-60}}))); + Processes.Pump pump(redeclare package Medium = Medium, + omega_from_input=true, + redeclare function dp_tau_pump = + Processes.Internal.TurboComponent.dp_tau_nominal_flow ( + parametrizeByDesignPoint=true, + dp_D=1000, + omega_D(displayUnit="rad/s"))) + annotation (Placement(transformation(extent={{70,50},{90,70}}))); + Processes.Pump pump2(redeclare package Medium = Medium, + omega_from_input=true, + redeclare function dp_tau_pump = + Processes.Internal.TurboComponent.dp_tau_nominal_flow ( + parametrizeByDesignPoint=true, dp_D=1000)) + annotation (Placement(transformation(extent={{70,0},{90,20}}))); + Processes.Pump pump3(redeclare package Medium = Medium, + omega_from_input=true, + redeclare function dp_tau_pump = + Processes.Internal.TurboComponent.dp_tau_nominal_flow ( + parametrizeByDesignPoint=true, dp_D=1000)) + annotation (Placement(transformation(extent={{70,-50},{90,-30}}))); + Processes.Pump pump1(redeclare package Medium = Medium, + omega_from_input=true, + redeclare function dp_tau_pump = + Processes.Internal.TurboComponent.dp_tau_nominal_flow ( + parametrizeByDesignPoint=true, dp_D=1000)) + annotation (Placement(transformation(extent={{70,-100},{90,-80}}))); + Modelica.Blocks.Sources.TimeTable timeTable(table=[0,0.3; 10,0.3; 20,1; 30,1; + 40,0.7; 50,0.7; 60,0; 70,0; 80,0.5; 90,0.5; 100,1; 110,1; 120,0.9; 10000, + 0.9]) + annotation (Placement(transformation(extent={{-190,40},{-170,60}}))); + Modelica.Blocks.Sources.Constant const(k=100) + annotation (Placement(transformation(extent={{186,34},{166,54}}))); + Processes.FlowResistance flowResistance4( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss (k=100, + k2=100)) + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + Processes.FlowResistance flowResistance5( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss (k=100, + k2=100)) + annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + Processes.FlowResistance flowResistance6( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss (k=100, + k2=100)) + annotation (Placement(transformation(extent={{-50,-30},{-30,-10}}))); + Processes.FlowResistance flowResistance7( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss (k=100, + k2=100)) + annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}))); + Processes.FlowResistance flowResistance8( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss (k=100, + k2=100)) + annotation (Placement(transformation(extent={{120,70},{140,90}}))); + Processes.FlowResistance flowResistance9( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss (k=100, + k2=100)) + annotation (Placement(transformation(extent={{120,20},{140,40}}))); + Processes.FlowResistance flowResistance10( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss (k=100, + k2=100)) + annotation (Placement(transformation(extent={{120,-30},{140,-10}}))); + Processes.FlowResistance flowResistance11( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + r(displayUnit="mm") = 0.01, + l=1, + computeL=false, + redeclare function pLoss = + Processes.Internal.FlowResistance.linearQuadraticPressureLoss (k=100, + k2=100)) + annotation (Placement(transformation(extent={{120,-80},{140,-60}}))); + inner DropOfCommons dropOfCommons(p_min(displayUnit="Pa") = 650) + annotation (Placement(transformation(extent={{170,-100},{190,-80}}))); + Modelica.Blocks.Sources.Step step( + height=4e3, + offset=2e5 - 2e3, + startTime=65) + annotation (Placement(transformation(extent={{-190,80},{-170,100}}))); +equation + connect(source.outlet, ratioControl.inlet) annotation (Line( + points={{-140,60},{-130,60}}, + color={28,108,200}, + thickness=0.5)); + connect(ratioControl.outletB, flowResistance.inlet) annotation (Line( + points={{-110,60},{-100,60}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionT2_1.inletB, ratioControl.outletA) annotation (Line( + points={{-80,80},{-120,80},{-120,70}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance.outlet, junctionT2_1.inletA) annotation (Line( + points={{-80,60},{-70,60},{-70,70}}, + color={28,108,200}, + thickness=0.5)); + connect(rTSwitch.inlet, source1.outlet) annotation (Line( + points={{-130,10},{-140,10}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance1.inlet, rTSwitch.outletB) annotation (Line( + points={{-100,10},{-110,10}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionT2_3.inletA, flowResistance1.outlet) annotation (Line( + points={{-70,20},{-70,10},{-80,10}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionT2_3.inletB, rTSwitch.outletA) annotation (Line( + points={{-80,30},{-120,30},{-120,20}}, + color={28,108,200}, + thickness=0.5)); + connect(source2.outlet, leakageA.inlet) annotation (Line( + points={{-140,-40},{-130,-40}}, + color={28,108,200}, + thickness=0.5)); + connect(leakageA.outletB, flowResistance2.inlet) annotation (Line( + points={{-110,-40},{-100,-40}}, + color={28,108,200}, + thickness=0.5)); + connect(leakageA.outletA, junctionT2_5.inletB) annotation (Line( + points={{-120,-30},{-120,-20},{-80,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance2.outlet, junctionT2_5.inletA) annotation (Line( + points={{-80,-40},{-70,-40},{-70,-30}}, + color={28,108,200}, + thickness=0.5)); + connect(source3.outlet, splitterT2_1.inlet) annotation (Line( + points={{-140,-90},{-130,-90}}, + color={28,108,200}, + thickness=0.5)); + connect(splitterT2_1.outletA, junctionRatio1.inletB) annotation (Line( + points={{-120,-80},{-120,-70},{-80,-70}}, + color={28,108,200}, + thickness=0.5)); + connect(splitterT2_1.outletB, flowResistance3.inlet) annotation (Line( + points={{-110,-90},{-100,-90}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance3.outlet, junctionRatio1.inletA) annotation (Line( + points={{-80,-90},{-70,-90},{-70,-80}}, + color={28,108,200}, + thickness=0.5)); + connect(source4.outlet, ratioControl1.inlet) annotation (Line( + points={{30,60},{40,60}}, + color={28,108,200}, + thickness=0.5)); + connect(ratioControl1.outletB, pump.inlet) annotation (Line( + points={{60,60},{70,60}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionT2_2.inletB, ratioControl1.outletA) annotation (Line( + points={{90,80},{50,80},{50,70}}, + color={28,108,200}, + thickness=0.5)); + connect(pump.outlet, junctionT2_2.inletA) annotation (Line( + points={{90,60},{100,60},{100,70}}, + color={28,108,200}, + thickness=0.5)); + connect(rTSwitch1.inlet, source5.outlet) annotation (Line( + points={{40,10},{30,10}}, + color={28,108,200}, + thickness=0.5)); + connect(pump2.inlet, rTSwitch1.outletB) annotation (Line( + points={{70,10},{60,10}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionT2_4.inletA, pump2.outlet) annotation (Line( + points={{100,20},{100,10},{90,10}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionT2_4.inletB, rTSwitch1.outletA) annotation (Line( + points={{90,30},{50,30},{50,20}}, + color={28,108,200}, + thickness=0.5)); + connect(source6.outlet, leakageA1.inlet) annotation (Line( + points={{30,-40},{40,-40}}, + color={28,108,200}, + thickness=0.5)); + connect(leakageA1.outletB, pump3.inlet) annotation (Line( + points={{60,-40},{70,-40}}, + color={28,108,200}, + thickness=0.5)); + connect(leakageA1.outletA, junctionT2_6.inletB) annotation (Line( + points={{50,-30},{50,-20},{90,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(pump3.outlet, junctionT2_6.inletA) annotation (Line( + points={{90,-40},{100,-40},{100,-30}}, + color={28,108,200}, + thickness=0.5)); + connect(source7.outlet, splitterT2_2.inlet) annotation (Line( + points={{30,-90},{40,-90}}, + color={28,108,200}, + thickness=0.5)); + connect(splitterT2_2.outletA, junctionRatio2.inletB) annotation (Line( + points={{50,-80},{50,-70},{90,-70}}, + color={28,108,200}, + thickness=0.5)); + connect(splitterT2_2.outletB, pump1.inlet) annotation (Line( + points={{60,-90},{70,-90}}, + color={28,108,200}, + thickness=0.5)); + connect(pump1.outlet, junctionRatio2.inletA) annotation (Line( + points={{90,-90},{100,-90},{100,-80}}, + color={28,108,200}, + thickness=0.5)); + connect(timeTable.y, ratioControl.splitRatio) + annotation (Line(points={{-169,50},{-120,50},{-120,57}}, + color={0,0,127})); + connect(ratioControl1.splitRatio, ratioControl.splitRatio) annotation (Line( + points={{50,57},{50,50},{-120,50},{-120,57}}, + color={0,0,127})); + connect(rTSwitch.splitRatio, ratioControl.splitRatio) annotation (Line(points={{-120,7}, + {-120,-2},{-160,-2},{-160,50},{-120,50},{-120,57}}, color={0,0,127})); + connect(rTSwitch1.splitRatio, ratioControl.splitRatio) annotation (Line( + points={{50,7},{50,-2},{-160,-2},{-160,50},{-120,50},{-120,57}}, + color={0,0, + 127})); + connect(leakageA.splitRatio, ratioControl.splitRatio) annotation (Line(points={{-120, + -43},{-120,-50},{-160,-50},{-160,50},{-120,50},{-120,57}}, color={0, + 0,127})); + connect(leakageA1.splitRatio, ratioControl.splitRatio) annotation (Line( + points={{50,-43},{50,-50},{-160,-50},{-160,50},{-120,50},{-120,57}}, + color={0,0,127})); + connect(junctionRatio1.splitRatio, ratioControl.splitRatio) annotation (Line( + points={{-70,-67},{-70,-50},{-160,-50},{-160,50},{-120,50},{-120,57}}, + color={0,0,127})); + connect(junctionRatio2.splitRatio, ratioControl.splitRatio) annotation (Line( + points={{100,-67},{100,-62},{20,-62},{20,-50},{-160,-50},{-160,50},{ + -120,50},{-120,57}}, + color={0,0,127})); + connect(const.y, pump.omega_input) + annotation (Line(points={{165,44},{80,44},{80,50}}, color={0,0,127})); + connect(pump2.omega_input, pump.omega_input) annotation (Line(points={{80,0},{ + 80,-6},{140,-6},{140,44},{80,44},{80,50}},color={0,0,127})); + connect(pump3.omega_input, pump.omega_input) annotation (Line(points={{80,-50}, + {80,-58},{140,-58},{140,44},{80,44},{80,50}}, color={0,0,127})); + connect(pump1.omega_input, pump.omega_input) annotation (Line(points={{80,-100}, + {80,-106},{140,-106},{140,44},{80,44},{80,50}}, + color={0,0,127})); + + connect(sink.inlet, flowResistance4.outlet) annotation (Line( + points={{-20,80},{-30,80}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance4.inlet, junctionT2_1.outlet) annotation (Line( + points={{-50,80},{-60,80}}, + color={28,108,200}, + thickness=0.5)); + connect(sink1.inlet, flowResistance5.outlet) annotation (Line( + points={{-20,30},{-30,30}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance5.inlet, junctionT2_3.outlet) annotation (Line( + points={{-50,30},{-60,30}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionT2_5.outlet, flowResistance6.inlet) annotation (Line( + points={{-60,-20},{-50,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance6.outlet, sink2.inlet) annotation (Line( + points={{-30,-20},{-20,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionRatio1.outlet, flowResistance7.inlet) annotation (Line( + points={{-60,-70},{-50,-70}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance7.outlet, sink3.inlet) annotation (Line( + points={{-30,-70},{-20,-70}}, + color={28,108,200}, + thickness=0.5)); + connect(sink4.inlet, flowResistance8.outlet) annotation (Line( + points={{150,80},{140,80}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance8.inlet, junctionT2_2.outlet) annotation (Line( + points={{120,80},{110,80}}, + color={28,108,200}, + thickness=0.5)); + connect(sink5.inlet, flowResistance9.outlet) annotation (Line( + points={{150,30},{140,30}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance9.inlet, junctionT2_4.outlet) annotation (Line( + points={{120,30},{110,30}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionT2_6.outlet, flowResistance10.inlet) annotation (Line( + points={{110,-20},{120,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance10.outlet, sink6.inlet) annotation (Line( + points={{140,-20},{150,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(junctionRatio2.outlet, flowResistance11.inlet) annotation (Line( + points={{110,-70},{120,-70}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance11.outlet, sink7.inlet) annotation (Line( + points={{140,-70},{150,-70}}, + color={28,108,200}, + thickness=0.5)); + connect(step.y, source.p0_var) annotation (Line(points={{-169,90},{-164,90},{ + -164,66},{-152,66}}, color={0,0,127})); + connect(source1.p0_var, source.p0_var) annotation (Line(points={{-152,16},{ + -164,16},{-164,66},{-152,66}}, + color={0,0,127})); + connect(source2.p0_var, source.p0_var) annotation (Line(points={{-152,-34},{ + -164,-34},{-164,66},{-152,66}}, + color={0,0,127})); + connect(source3.p0_var, source.p0_var) annotation (Line(points={{-152,-84},{ + -164,-84},{-164,66},{-152,66}}, + color={0,0,127})); + connect(source4.p0_var, source.p0_var) annotation (Line(points={{18,66},{8,66}, + {8,90},{-164,90},{-164,66},{-152,66}}, color={0,0,127})); + connect(source5.p0_var, source.p0_var) annotation (Line(points={{18,16},{8,16}, + {8,90},{-164,90},{-164,66},{-152,66}}, color={0,0,127})); + connect(source6.p0_var, source.p0_var) annotation (Line(points={{18,-34},{8, + -34},{8,90},{-164,90},{-164,66},{-152,66}}, + color={0,0,127})); + connect(source7.p0_var, source.p0_var) annotation (Line(points={{18,-84},{8, + -84},{8,90},{-164,90},{-164,66},{-152,66}}, + color={0,0,127})); + + annotation ( + experiment(StopTime=150), + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}})), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-200,-110},{200,110}})), + Documentation(info=" +")); +end TestNonPhysical; diff --git a/ThermofluidStream/Topology/Tests/TestSplitter.mo b/ThermofluidStream/Topology/Tests/TestSplitter.mo index 694882b9..44db73d7 100644 --- a/ThermofluidStream/Topology/Tests/TestSplitter.mo +++ b/ThermofluidStream/Topology/Tests/TestSplitter.mo @@ -3,7 +3,8 @@ model TestSplitter extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.SimpleAir - constrainedby Media.myMedia.Interfaces.PartialMedium; + constrainedby + Media.myMedia.Interfaces.PartialMedium; inner DropOfCommons dropOfCommons annotation (Placement(transformation(extent={{60,-80},{80,-60}}))); diff --git a/ThermofluidStream/Topology/Tests/package.order b/ThermofluidStream/Topology/Tests/package.order index 0f59bf96..cdce5106 100644 --- a/ThermofluidStream/Topology/Tests/package.order +++ b/ThermofluidStream/Topology/Tests/package.order @@ -2,3 +2,4 @@ TestJunction TestSplitter TestDynamicTopology TestJunctionNM +TestNonPhysical diff --git a/ThermofluidStream/Topology/package.order b/ThermofluidStream/Topology/package.order index b1768ee5..cac516ca 100644 --- a/ThermofluidStream/Topology/package.order +++ b/ThermofluidStream/Topology/package.order @@ -12,4 +12,6 @@ JunctionNM DynamicJunctionN DynamicSplitterN DynamicJunctionNM +NonPhysical Tests +Internal diff --git a/ThermofluidStream/Undirected/Boundaries/PhaseSeparator.mo b/ThermofluidStream/Undirected/Boundaries/PhaseSeparator.mo index d4b12da3..9e6af257 100644 --- a/ThermofluidStream/Undirected/Boundaries/PhaseSeparator.mo +++ b/ThermofluidStream/Undirected/Boundaries/PhaseSeparator.mo @@ -1,7 +1,8 @@ within ThermofluidStream.Undirected.Boundaries; model PhaseSeparator "Parent to Reciever and Accumulator models" extends Internal.PartialVolume( - redeclare replaceable package Medium = Media.myMedia.Interfaces.PartialTwoPhaseMedium, + redeclare replaceable package Medium = + Media.myMedia.Interfaces.PartialTwoPhaseMedium, useHeatport=false, final useRear=true, final useFore=true, diff --git a/ThermofluidStream/Undirected/Boundaries/Tests/PhaseSeperator.mo b/ThermofluidStream/Undirected/Boundaries/Tests/PhaseSeperator.mo index d003f0bd..c4cb833f 100644 --- a/ThermofluidStream/Undirected/Boundaries/Tests/PhaseSeperator.mo +++ b/ThermofluidStream/Undirected/Boundaries/Tests/PhaseSeperator.mo @@ -51,7 +51,8 @@ model PhaseSeperator l=1, computeL=false, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=5000)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=5000)) annotation (Placement(transformation(extent={{-60,10},{-40,30}}))); Processes.FlowResistance flowResistance2( redeclare package Medium = Medium, @@ -60,7 +61,8 @@ model PhaseSeperator l=1, computeL=false, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=5000)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=5000)) annotation (Placement(transformation(extent={{-70,-30},{-50,-10}}))); Processes.FlowResistance flowResistance( redeclare package Medium = Medium, @@ -69,7 +71,8 @@ model PhaseSeperator l=1, computeL=false, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=5000)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=5000)) annotation (Placement(transformation(extent={{60,10},{80,30}}))); Processes.FlowResistance flowResistance3( redeclare package Medium = Medium, @@ -78,7 +81,8 @@ model PhaseSeperator l=1, computeL=false, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=5000)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=5000)) annotation (Placement(transformation(extent={{72,-30},{92,-10}}))); ThermofluidStream.Sensors.TwoPhaseSensorSelect twoPhaseSensorSelect4( redeclare package Medium = Medium, @@ -138,10 +142,14 @@ model PhaseSeperator digits=2, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.p_bar) annotation (Placement(transformation(extent={{104,40},{124,60}}))); inner DropOfCommons dropOfCommons annotation (Placement(transformation(extent={{-130,-68},{-110,-48}}))); - Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,18},{-70,26}}))); - Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-30,18},{-10,26}}))); - Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,18},{50,26}}))); - Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{90,18},{110,26}}))); + Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-90,18},{-70,26}}))); + Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter1(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-30,18},{-10,26}}))); + Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter2(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{30,18},{50,26}}))); + Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter3(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{90,18},{110,26}}))); ThermofluidStream.Undirected.Boundaries.PhaseSeparator accumulator( redeclare package Medium = Medium, p_start=110000, @@ -151,10 +159,14 @@ model PhaseSeperator annotation (Placement(transformation(extent={{20,-30},{0,-10}}))); Topology.ConnectForeFore connectForeFore(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,-30},{40,-10}}))); Topology.ConnectRearRear connectRearRear(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-20,-30},{0,-10}}))); - Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter4(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-40,-18},{-20,-26}}))); - Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter5(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{40,-18},{60,-26}}))); - Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter6(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{100,-18},{120,-26}}))); - Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter7(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-100,-18},{-80,-26}}))); + Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter4(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-40,-18},{-20,-26}}))); + Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter5(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{40,-18},{60,-26}}))); + Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter6(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{100,-18},{120,-26}}))); + Sensors.UnidirectionalSensorAdapter unidirectionalSensorAdapter7(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-100,-18},{-80,-26}}))); equation connect(boundaryRear.h0_var, timeTable.y) annotation (Line(points={{-112,20},{-124,20},{-124,0},{-133,0}}, color={0,0,127})); connect(boundaryRear1.h0_var, timeTable.y) annotation (Line(points={{-122,-20},{-128,-20},{-128,0},{-133,0}}, color={0,0,127})); diff --git a/ThermofluidStream/Undirected/Boundaries/Tests/Reservoir.mo b/ThermofluidStream/Undirected/Boundaries/Tests/Reservoir.mo index 8498bfbf..9a8dceab 100644 --- a/ThermofluidStream/Undirected/Boundaries/Tests/Reservoir.mo +++ b/ThermofluidStream/Undirected/Boundaries/Tests/Reservoir.mo @@ -2,7 +2,8 @@ within ThermofluidStream.Undirected.Boundaries.Tests; model Reservoir "Test for Reservoir" extends Modelica.Icons.Example; - replaceable package Medium = Media.myMedia.CompressibleLiquids.LinearColdWater + replaceable package Medium = + Media.myMedia.CompressibleLiquids.LinearColdWater constrainedby Media.myMedia.Interfaces.PartialMedium "Medium Model" annotation(choicesAllMatching=true, Documentation(info=" @@ -30,8 +31,8 @@ model Reservoir "Test for Reservoir" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=100)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=100)) annotation (Placement(transformation(extent={{-30,-80},{-10,-60}}))); Processes.FlowResistance flowResistance2( redeclare package Medium = Medium, @@ -39,8 +40,8 @@ model Reservoir "Test for Reservoir" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=100)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=100)) annotation (Placement(transformation(extent={{30,-80},{50,-60}}))); ThermofluidStream.Boundaries.Reservoir reservoir2( redeclare package Medium = Medium, @@ -67,8 +68,8 @@ model Reservoir "Test for Reservoir" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=100)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=100)) annotation (Placement(transformation(extent={{-32,20},{-12,40}}))); ThermofluidStream.Processes.FlowResistance flowResistance5( redeclare package Medium = Medium, @@ -76,8 +77,8 @@ model Reservoir "Test for Reservoir" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=100)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=100)) annotation (Placement(transformation(extent={{30,20},{50,40}}))); inner DropOfCommons dropOfCommons(assertionLevel = AssertionLevel.warning) annotation (Placement(transformation(extent={{40,-20},{60,0}}))); diff --git a/ThermofluidStream/Undirected/Boundaries/Tests/TestBoundaries.mo b/ThermofluidStream/Undirected/Boundaries/Tests/TestBoundaries.mo index 0d5313b3..b88f881f 100644 --- a/ThermofluidStream/Undirected/Boundaries/Tests/TestBoundaries.mo +++ b/ThermofluidStream/Undirected/Boundaries/Tests/TestBoundaries.mo @@ -23,7 +23,8 @@ model TestBoundaries "Tests for the rear and fore boundary" offset=140000, startTime=5) annotation (Placement(transformation(extent={{60,34},{48,46}}))); - TerminalRear terminal_rear(redeclare package Medium = Media.myMedia.Air.SimpleAir) + TerminalRear terminal_rear(redeclare package Medium = + Media.myMedia.Air.SimpleAir) annotation (Placement(transformation(extent={{-40,-20},{-20,0}}))); BoundaryFore boundary_fore1( redeclare package Medium = Media.myMedia.Air.SimpleAir, @@ -43,7 +44,8 @@ model TestBoundaries "Tests for the rear and fore boundary" extent={{10,-10},{-10,10}}, rotation=180, origin={-30,-50}))); - TerminalFore terminal_fore(redeclare package Medium = Media.myMedia.Air.SimpleAir) + TerminalFore terminal_fore(redeclare package Medium = + Media.myMedia.Air.SimpleAir) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, diff --git a/ThermofluidStream/Undirected/Boundaries/Tests/TestVolumes.mo b/ThermofluidStream/Undirected/Boundaries/Tests/TestVolumes.mo index ab087dbb..9aa6f80a 100644 --- a/ThermofluidStream/Undirected/Boundaries/Tests/TestVolumes.mo +++ b/ThermofluidStream/Undirected/Boundaries/Tests/TestVolumes.mo @@ -2,7 +2,8 @@ within ThermofluidStream.Undirected.Boundaries.Tests; model TestVolumes "Test for undirected Volumes" extends Modelica.Icons.Example; - replaceable package Medium = Media.myMedia.Air.SimpleAir constrainedby Media.myMedia.Interfaces.PartialMedium "Medium package" + replaceable package Medium = Media.myMedia.Air.SimpleAir constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium package" annotation (Documentation(info="Medium package used in the Test.
")); @@ -44,7 +45,8 @@ model TestVolumes "Test for undirected Volumes" r=0.01, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.wood)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.wood)) annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); Processes.FlowResistance flowResistance1( redeclare package Medium = Medium, @@ -52,7 +54,8 @@ model TestVolumes "Test for undirected Volumes" r=0.01, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.wood)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.wood)) annotation (Placement(transformation(extent={{-140,-60},{-120,-40}}))); ThermofluidStream.Boundaries.Source source(redeclare package Medium = Medium, p0_par=200000) @@ -101,7 +104,8 @@ model TestVolumes "Test for undirected Volumes" r=0.01, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.wood)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.wood)) annotation (Placement(transformation(extent={{-80,30},{-60,50}}))); ThermofluidStream.Processes.FlowResistance flowResistance3( redeclare package Medium = Medium, @@ -109,7 +113,8 @@ model TestVolumes "Test for undirected Volumes" r=0.01, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.wood)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.wood)) annotation (Placement(transformation(extent={{-140,30},{-120,50}}))); BoundaryFore boundary_fore(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{-44,-60},{-24,-40}}))); BoundaryFore boundary_fore1(redeclare package Medium = Medium, @@ -145,8 +150,8 @@ model TestVolumes "Test for undirected Volumes" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1e5)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=1e5)) annotation (Placement(transformation(extent={{46,60},{66,80}}))); ThermofluidStream.Processes.FlowResistance flowResistance6( redeclare package Medium = MediumMix, @@ -154,8 +159,8 @@ model TestVolumes "Test for undirected Volumes" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=2e5)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=2e5)) annotation (Placement(transformation(extent={{46,20},{66,40}}))); VolumeMix volumeMix2( redeclare package Medium = MediumMix, @@ -180,8 +185,8 @@ model TestVolumes "Test for undirected Volumes" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1e5)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=1e5)) annotation (Placement(transformation(extent={{46,-30},{66,-10}}))); Processes.FlowResistance flowResistance7( redeclare package Medium = MediumMix, @@ -189,8 +194,8 @@ model TestVolumes "Test for undirected Volumes" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=2e5)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=2e5)) annotation (Placement(transformation(extent={{46,-70},{66,-50}}))); ThermofluidStream.Processes.FlowResistance flowResistance8( redeclare package Medium = MediumMix, @@ -198,8 +203,8 @@ model TestVolumes "Test for undirected Volumes" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=1e3)) annotation (Placement(transformation(extent={{116,40},{136,60}}))); Processes.FlowResistance flowResistance9( redeclare package Medium = MediumMix, @@ -207,8 +212,8 @@ model TestVolumes "Test for undirected Volumes" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=1e3)) annotation (Placement(transformation(extent={{120,-80},{100,-60}}))); Volume heatportVolume2( redeclare package Medium = Medium, @@ -226,7 +231,8 @@ model TestVolumes "Test for undirected Volumes" r=0.05, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.wood)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.wood)) annotation (Placement(transformation(extent={{-80,-120},{-60,-100}}))); BoundaryFore boundary_fore2(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{-44,-120},{-24,-100}}))); Processes.FlowResistance flowResistance11( @@ -235,7 +241,8 @@ model TestVolumes "Test for undirected Volumes" r=0.1, l=10, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.wood)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.wood)) annotation (Placement(transformation(extent={{40,-120},{60,-100}}))); BoundaryRear boundary_rear5(redeclare package Medium = Medium, p0_par=200000) annotation (Placement(transformation(extent={{10,-120},{30,-100}}))); Volume heatportVolume3( diff --git a/ThermofluidStream/Undirected/FlowControl/BasicControlValve.mo b/ThermofluidStream/Undirected/FlowControl/BasicControlValve.mo index f0aababc..f3242651 100644 --- a/ThermofluidStream/Undirected/FlowControl/BasicControlValve.mo +++ b/ThermofluidStream/Undirected/FlowControl/BasicControlValve.mo @@ -8,7 +8,9 @@ model BasicControlValve replaceable function valveCharacteristics = ThermofluidStream.FlowControl.Internal.ControlValve.linearCharacteristics - constrainedby ThermofluidStream.FlowControl.Internal.ControlValve.partialValveCharacteristics "Select valve characteristics" + constrainedby + ThermofluidStream.FlowControl.Internal.ControlValve.partialValveCharacteristics + "Select valve characteristics" annotation(choicesAllMatching = true, Dialog(group = "Valve parameters"), Documentation(info="Characterisic curve of the valve.
diff --git a/ThermofluidStream/Undirected/FlowControl/MCV.mo b/ThermofluidStream/Undirected/FlowControl/MCV.mo index bbfa3571..fa9cfa27 100644 --- a/ThermofluidStream/Undirected/FlowControl/MCV.mo +++ b/ThermofluidStream/Undirected/FlowControl/MCV.mo @@ -1,18 +1,10 @@ within ThermofluidStream.Undirected.FlowControl; model MCV "Massflow control valve" + extends Interfaces.SISOBiFlow(final clip_p_out=false, final L = 100, final p_min=p_min_par); - replaceable package Medium = Media.myMedia.Interfaces.PartialMedium - "Medium model" annotation (choicesAllMatching=true, Documentation(info=" -Medium package used in the Component. Make sure it is the same as the one both ports are connected to.
-")); + import Mode = ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode; - Interfaces.Fore fore(redeclare package Medium = Medium) - annotation (Placement(transformation(extent={{80,-20},{120,20}}), - iconTransformation(extent={{80,-20},{120,20}}))); - Interfaces.Rear rear(redeclare package Medium = Medium) - annotation (Placement(transformation(extent={{-120,-20},{-80,20}}), - iconTransformation(extent={{-120,-20},{-80,20}}))); - Modelica.Blocks.Interfaces.RealInput m_flow_set_var(unit="kg/s") = m_flow_set if massFlowFromInput "Desired mass-flow [kg/s]" + Modelica.Blocks.Interfaces.RealInput setpoint_var = setpoint if setpointFromInput "Desired mass-flow [kg/s or m3/s]" annotation (Placement( transformation(extent={{-20,-20},{20,20}}, rotation=270, @@ -21,45 +13,90 @@ model MCV "Massflow control valve" rotation=270, origin={0,80}))); - parameter Utilities.Units.Inertance L = dropOfCommons.L "Inertance of the flow" + Modelica.Blocks.Interfaces.RealOutput clippingOutput = (dp - dp_int) if enableClippingOutput "" + annotation (Placement( + transformation(extent={{-20,-20},{20,20}}, + rotation=270, + origin={0,-80}), iconTransformation( + extent={{-20,-20},{20,20}}, + rotation=270, + origin={0,-80}))); + + parameter Mode mode = Mode.mass_flow "Valve mode"; + parameter Boolean setpointFromInput = false "Enable desired massFlow input"; + parameter SI.MassFlowRate massFlow_set_par = 0 "Mass flow variable to set" + annotation(Dialog(enable=(not setpointFromInput) and mode == Mode.mass_flow)); + parameter SI.VolumeFlowRate volumeFlow_set_par = 0 "Mass flow variable to set" + annotation(Dialog(enable=(not setpointFromInput) and mode == Mode.volume_flow)); + parameter SI.Time TC = 0.1 "Time constant of setpoint dynamic"; + parameter Real k1(unit="1") = 100 "Timeconstant factor" annotation(Dialog(tab="Advanced")); - parameter Boolean massFlowFromInput = false "Enable desired massFlow input"; - parameter SI.MassFlowRate m_flow_set_par "Mass flow variable to set"; - parameter SI.MassFlowRate m_flow_ref = 0.1 "Reference mass flow"; - parameter SI.Pressure p_ref = 1e5 "Reference pressurre"; - parameter SI.Time TC = 0.1 "Time constant of pressure adaptation" + parameter Real k2(unit="1") = 100 "Integrator windup factor" annotation(Dialog(tab="Advanced")); + parameter SI.Pressure p_min_par = dropOfCommons.p_min "Minimal steady-state output pressure" + annotation(Dialog(tab="Advanced")); + parameter Boolean enableClippingOutput = false; + + SI.Density rho_rear_in = Medium.density(rear.state_forwards); + SI.Density rho_fore_in = Medium.density(fore.state_rearwards); + SI.Density rho_in = Undirected.Internal.regStep(m_flow, rho_rear_in, rho_fore_in, m_flow_reg); + + + SI.VolumeFlowRate V_flow_fore = m_flow/rho_rear_in; + SI.VolumeFlowRate V_flow_rear = m_flow/rho_fore_in; + SI.VolumeFlowRate V_flow = Undirected.Internal.regStep(m_flow, V_flow_fore, V_flow_rear, m_flow_reg); + + constant SI.Pressure eps = 1; + SI.Pressure dp = Undirected.Internal.regStep(m_flow, dp_fore, -dp_rear, m_flow_reg); protected - outer DropOfCommons dropOfCommons; + outer ThermofluidStream.DropOfCommons dropOfCommons; SI.MassFlowRate m_flow_set; - SI.MassFlowRate m_flow = rear.m_flow; + SI.VolumeFlowRate V_flow_set; + Real setpoint; - SI.SpecificEnthalpy h_in_rear = Medium.specificEnthalpy(rear.state_forwards); - SI.Pressure p_in_rear = Medium.pressure(rear.state_forwards); - Medium.MassFraction Xi_in_rear[Medium.nXi] = Medium.massFraction(rear.state_forwards); + SI.Pressure dr = fore.r - rear.r; + SI.Pressure dr_set; +public + SI.Pressure dp_int(start=-1e5); + SI.Pressure dp_corr_fore = k2*(dp_fore - dp_int); + SI.Pressure dp_corr_rear = k2*(dp_rear + dp_int); + SI.Pressure dp_corr = Undirected.Internal.regStep(m_flow, dp_corr_fore, -dp_corr_rear, m_flow_reg); - SI.SpecificEnthalpy h_in_fore = Medium.specificEnthalpy(fore.state_rearwards); - SI.Pressure p_in_fore = Medium.pressure(fore.state_rearwards); - Medium.MassFraction Xi_in_fore[Medium.nXi] = Medium.massFraction(fore.state_rearwards); - - SI.Pressure dp(start=0); - SI.Pressure dr_corr; +initial equation + dp_int = 0; equation - if not massFlowFromInput then - m_flow_set = m_flow_set_par; + if setpointFromInput then + m_flow_set = setpoint; + V_flow_set = setpoint; + else + setpoint = 0; + m_flow_set = massFlow_set_par; + V_flow_set = volumeFlow_set_par; end if; - dr_corr = min(dp,0); + // compute dr_set required for desired mass-flow or Volume-flow dynamic + if mode==Mode.mass_flow then + dr_set = - L/TC * (m_flow_set - m_flow); + else + dr_set = - L/TC*(V_flow_set*rho_in - m_flow); + end if; - rear.m_flow + fore.m_flow = 0; - rear.r - fore.r - dr_corr = (der(m_flow) + (m_flow-m_flow_set)/TC)*L; - der(dp)*TC = fore.r - rear.r; + // compute pressure drop dynamic very fast, so dr tracks dr_set. + // dr is limited, since it can be very high for non-smooth systms (e.g. a jump in input pressure) + TC/k1 * der(dp_int) = max(-1e8, min(1e8,dr)) - dr_set + dp_corr; - fore.state_forwards = Medium.setState_phX(p_in_rear-dp,h_in_rear,Xi_in_rear); - rear.state_rearwards = Medium.setState_phX(p_in_fore+dp,h_in_fore,Xi_in_fore); // + because of the inverted direction + // limit dp to a so that p_out > p_min and no pressure is created + dp_fore = max(p_min - p_rear_in, min(0, dp_int)); + dp_rear = max(p_min - p_fore_in, min(0, -dp_int)); + + h_fore_out = h_rear_in; + h_rear_out = h_fore_in; + + Xi_fore_out = Xi_rear_in; + Xi_rear_out = Xi_fore_in; annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ Ellipse( @@ -95,10 +132,16 @@ equation Line( points={{0,0},{0,60}}, color={28,108,200}, - thickness=0.5)}), Diagram(coordinateSystem(preserveAspectRatio=false)), + thickness=0.5), + Ellipse( + extent={{40,-60},{60,-80}}, + lineColor={0,0,0}, + fillColor = DynamicSelect({255,255,255}, if abs(dp - dp_int) <= eps then {0,140,72} else {238,46,47}), + fillPattern=FillPattern.Solid)}), + Diagram(coordinateSystem(preserveAspectRatio=false)), Documentation(info="Undirected implementation of MCV.
This component can be used to emulate a mass-flow regulated valve.
-Currently not working!
+It works similar to the directed MCV.
")); end MCV; diff --git a/ThermofluidStream/Undirected/FlowControl/SpecificValveType.mo b/ThermofluidStream/Undirected/FlowControl/SpecificValveType.mo index 602dd613..f0731402 100644 --- a/ThermofluidStream/Undirected/FlowControl/SpecificValveType.mo +++ b/ThermofluidStream/Undirected/FlowControl/SpecificValveType.mo @@ -7,7 +7,9 @@ model SpecificValveType "Specific technical valve types" replaceable record ZetaValueRecord = ThermofluidStream.FlowControl.Internal.Curves.SlideValveZetaCurve - constrainedby ThermofluidStream.FlowControl.Internal.Curves.PartialCharacteristicZetaCurves "Select Valve Type" + constrainedby + ThermofluidStream.FlowControl.Internal.Curves.PartialCharacteristicZetaCurves + "Select Valve Type" annotation(choicesAllMatching = true, Dialog(group = "Valve parameters")); parameter FlowCoeffType flowCoefficient = FlowCoeffType.Kvs "Select type of flow coefficient" annotation(Dialog(group = "Valve parameters")); diff --git a/ThermofluidStream/Undirected/FlowControl/Tests/BasicControlValve.mo b/ThermofluidStream/Undirected/FlowControl/Tests/BasicControlValve.mo index d0d81798..418334ba 100644 --- a/ThermofluidStream/Undirected/FlowControl/Tests/BasicControlValve.mo +++ b/ThermofluidStream/Undirected/FlowControl/Tests/BasicControlValve.mo @@ -30,16 +30,16 @@ model BasicControlValve "Test for undirected BasicControlValve" r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{-80,50},{-60,70}}))); Boundaries.BoundaryFore boundary_fore1(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{96,50},{116,70}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{-40,58},{-20,78}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{26,58},{46,78}}))); Modelica.Blocks.Sources.Ramp ramp( height=1, @@ -64,11 +64,11 @@ model BasicControlValve "Test for undirected BasicControlValve" Boundaries.BoundaryFore boundary_fore2(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{96,-10},{116,10}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{-40,-2},{-20,18}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{26,-2},{46,18}}))); Boundaries.BoundaryRear boundary_rear1( redeclare package Medium = Medium, @@ -85,11 +85,11 @@ model BasicControlValve "Test for undirected BasicControlValve" Boundaries.BoundaryFore boundary_fore(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{96,-70},{116,-50}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm7(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm7(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{-40,-62},{-20,-42}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm8(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm8(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{26,-62},{46,-42}}))); Modelica.Blocks.Sources.Pulse pulse( amplitude=2e4, @@ -101,35 +101,40 @@ model BasicControlValve "Test for undirected BasicControlValve" r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{60,50},{80,70}}))); Processes.FlowResistance flowResistance1( redeclare package Medium = Medium, r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{60,-10},{80,10}}))); Processes.FlowResistance flowResistance2( redeclare package Medium = Medium, r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{-80,-10},{-60,10}}))); Processes.FlowResistance flowResistance3( redeclare package Medium = Medium, r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{-80,-70},{-60,-50}}))); Processes.FlowResistance flowResistance4( redeclare package Medium = Medium, r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{60,-70},{80,-50}}))); equation connect(boundary_rear1.p0_var, pulse.y) annotation (Line(points={{-108,-54},{-140,-54},{-140,0},{-151,0}}, color={0,0,127})); diff --git a/ThermofluidStream/Undirected/FlowControl/Tests/MCV.mo b/ThermofluidStream/Undirected/FlowControl/Tests/MCV.mo new file mode 100644 index 00000000..8065b9ee --- /dev/null +++ b/ThermofluidStream/Undirected/FlowControl/Tests/MCV.mo @@ -0,0 +1,464 @@ +within ThermofluidStream.Undirected.FlowControl.Tests; +model MCV "Test for undirected MCV" + extends Modelica.Icons.Example; + + replaceable package Medium = Media.myMedia.Air.SimpleAir + constrainedby Media.myMedia.Interfaces.PartialMedium + "Medium package" + annotation (choicesAllMatching=true, Documentation(info=" +Medium package used in the Test.
+")); + + inner DropOfCommons dropOfCommons(assertionLevel= + AssertionLevel.warning) annotation (Placement(transformation(extent={{100,0}, + {120,20}}))); + Boundaries.BoundaryRear boundaryRear2( + redeclare package Medium = Medium, + pressureFromInput=false, + T0_par(displayUnit="K") = 300, + p0_par=200000) annotation (Placement(transformation(extent={{-30,30},{-10,50}}))); + Boundaries.BoundaryFore boundaryFore(redeclare package Medium = + Medium, p0_par=100000) + annotation (Placement(transformation(extent={{60,30},{80,50}}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.mass_flow, + setpointFromInput=true, + massFlow_set_par=0.1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{0,30},{20, + 50}}))); + + Boundaries.BoundaryRear boundaryRear3( + redeclare package Medium = Medium, + pressureFromInput=true, + T0_par(displayUnit="K") = 300, + p0_par=200000) annotation (Placement(transformation(extent={{-30,0},{-10,20}}))); + Boundaries.BoundaryFore boundaryFore2(redeclare package Medium = + Medium, p0_par=100000) + annotation (Placement(transformation(extent={{60,0},{80,20}}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV1( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.volume_flow, + massFlow_set_par=0.1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{0,0},{20, + 20}}))); + + Modelica.Blocks.Sources.Pulse pulse1( + amplitude=2e5, + period=2.5, + offset=0.5e5, + startTime=0) + annotation (Placement(transformation(extent={{-70,0},{-50,20}}))); + Boundaries.BoundaryFore boundaryFore6( + redeclare package Medium = Medium, + pressureFromInput=true, + T0_par(displayUnit="K") = 300, + p0_par=200000) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={-20,-20}))); + + Boundaries.BoundaryRear boundaryRear1(redeclare package Medium = + Medium, p0_par=100000) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={70,-20}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV2( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.volume_flow, + massFlow_set_par=0.1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{-10,10}, + {10,-10}}, + rotation=180, + origin={10,-20}))); + + Modelica.Blocks.Sources.Trapezoid + trapezoid( + amplitude=2e5, + rising=0.5, + width=0.75, + falling=0.5, + period=2.5, + offset=0.5e5, + startTime=0) + annotation (Placement(transformation(extent={{-70,-30},{-50,-10}}))); + Boundaries.BoundaryFore boundaryFore8( + redeclare package Medium = Medium, + pressureFromInput=true, + T0_par(displayUnit="K") = 300, + p0_par=200000) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={-20,-50}))); + + Boundaries.BoundaryRear boundaryRear5(redeclare package Medium = + Medium, p0_par=100000) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={70,-50}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV3( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.mass_flow, + massFlow_set_par=0.1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{-10,10}, + {10,-10}}, + rotation=180, + origin={10,-50}))); + + Modelica.Blocks.Sources.Pulse pulse3( + amplitude=2e5, + period=2.5, + offset=0.5e5, + startTime=0) + annotation (Placement(transformation(extent={{-70,-60},{-50,-40}}))); + Boundaries.BoundaryFore boundaryFore7( + redeclare package Medium = Medium, + pressureFromInput=false, + T0_par(displayUnit="K") = 300, + p0_par=100000) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={-20,-80}))); + + Boundaries.BoundaryRear boundaryRear4(redeclare package Medium = + Medium, + pressureFromInput=true, + T0_par=573.15, + p0_par=100000) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={70,-80}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV4( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.mass_flow, + massFlow_set_par=0.1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{-10,10}, + {10,-10}}, + rotation=180, + origin={10,-80}))); + + Modelica.Blocks.Sources.Trapezoid + trapezoid1( + amplitude=2e5, + rising=0.5, + width=1.5, + falling=0.5, + period=2.5, + offset=0.5e5, + startTime=0) + annotation (Placement(transformation(extent={{112,-88},{92,-68}}))); + Boundaries.BoundaryRear boundaryRear( + redeclare package Medium = Medium, + pressureFromInput=false, + T0_par(displayUnit="K") = 300, + p0_par=200000) annotation (Placement(transformation(extent={{-30,70},{-10,90}}))); + Boundaries.BoundaryFore boundaryFore1(redeclare package Medium = + Medium, p0_par=100000) + annotation (Placement(transformation(extent={{60,70},{80,90}}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV5( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.volume_flow, + setpointFromInput=true, + massFlow_set_par=0.1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{0,70},{20, + 90}}))); + + Modelica.Blocks.Sources.Pulse pulse5( + amplitude=0.2, + period=2.5, + offset=0.1, + startTime=0) + annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); + Modelica.Blocks.Sources.Trapezoid + trapezoid2( + amplitude=5, + rising=0.5, + width=0.75, + falling=0.5, + period=2.5, + offset=1, + startTime=0) + annotation (Placement(transformation(extent={{-70,90},{-50,110}}))); + Processes.FlowResistance flowResistance5( + redeclare package Medium = Medium, + r=0.1, + l=10, + L_value=0.01, + computeL=false, + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + annotation (Placement(transformation(extent={{28,70},{48,90}}))); + Processes.FlowResistance flowResistance( + redeclare package Medium = Medium, + r=0.1, + l=10, + L_value=0.01, + computeL=false, + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + annotation (Placement(transformation(extent={{30,30},{50,50}}))); + Processes.FlowResistance flowResistance1( + redeclare package Medium = Medium, + r=0.1, + l=10, + L_value=0.01, + computeL=false, + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + annotation (Placement(transformation(extent={{28,0},{48,20}}))); + Processes.FlowResistance flowResistance2( + redeclare package Medium = Medium, + r=0.1, + l=10, + L_value=0.01, + computeL=false, + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={40,-20}))); + Processes.FlowResistance flowResistance3( + redeclare package Medium = Medium, + r=0.1, + l=10, + L_value=0.01, + computeL=false, + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={40,-50}))); + Processes.FlowResistance flowResistance4( + redeclare package Medium = Medium, + r=0.1, + l=10, + L_value=0.01, + computeL=false, + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={40,-80}))); + Boundaries.BoundaryRear boundaryRear6( + redeclare package Medium = Medium, + pressureFromInput=false, + T0_par(displayUnit="K") = 300, + p0_par=200000) annotation (Placement(transformation(extent={{-32,158},{-12, + 178}}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV6( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.mass_flow, + + setpointFromInput=false, + massFlow_set_par=1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{-2,158}, + {18,178}}))); + Boundaries.BoundaryFore boundaryFore3(redeclare package Medium = + Medium, p0_par=200000) + annotation (Placement(transformation(extent={{30,158},{50,178}}))); + Boundaries.BoundaryRear boundaryRear7( + redeclare package Medium = Medium, + pressureFromInput=false, + T0_par(displayUnit="K") = 300, + p0_par=500000) annotation (Placement(transformation(extent={{-32,116},{-12, + 136}}))); + Boundaries.BoundaryFore boundaryFore4(redeclare package Medium = + Medium, p0_par=0.001) + annotation (Placement(transformation(extent={{30,116},{50,136}}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV7( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.mass_flow, + + setpointFromInput=false, + massFlow_set_par=1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{-2,116}, + {18,136}}))); + Boundaries.BoundaryFore boundaryFore10( + redeclare package Medium = Medium, + pressureFromInput=false, + T0_par(displayUnit="K") = 300, + p0_par=200000) annotation (Placement(transformation(extent={{-10,-10},{10, + 10}}, + rotation=180, + origin={64,168}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV8( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.mass_flow, + + setpointFromInput=false, + massFlow_set_par=1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{-10,10}, + {10,-10}}, + rotation=180, + origin={94,168}))); + Boundaries.BoundaryRear boundaryRear8(redeclare package Medium = + Medium, p0_par=200000) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={126,168}))); + Boundaries.BoundaryFore boundaryFore11( + redeclare package Medium = Medium, + pressureFromInput=false, + T0_par(displayUnit="K") = 300, + p0_par=500000) annotation (Placement(transformation(extent={{-10,-10},{10, + 10}}, + rotation=180, + origin={64,126}))); + Boundaries.BoundaryRear boundaryRear9(redeclare package Medium = + Medium, p0_par=0.001) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=180, + origin={126,126}))); + ThermofluidStream.Undirected.FlowControl.MCV + mCV9( + redeclare package Medium = Medium, + initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, + mode=ThermofluidStream.FlowControl.Internal.Types.MassflowControlValveMode.mass_flow, + + setpointFromInput=false, + massFlow_set_par=1, + volumeFlow_set_par=1) annotation (Placement(transformation(extent={{-10,10}, + {10,-10}}, + rotation=180, + origin={94,126}))); +equation + + connect(pulse1.y, boundaryRear3.p0_var) annotation (Line(points={{-49,10},{-30, + 10},{-30,16},{-22,16}}, color={0,0,127})); + connect(trapezoid.y, boundaryFore6.p0_var) annotation (Line(points={{-49,-20}, + {-30,-20},{-30,-26},{-22,-26}}, color={0,0,127})); + connect(pulse3.y, boundaryFore8.p0_var) annotation (Line(points={{-49,-50},{-30, + -50},{-30,-56},{-22,-56}}, color={0,0,127})); + connect(pulse5.y,mCV. setpoint_var) annotation (Line(points={{-49,60},{10,60}, + {10,48}}, color={0,0,127})); + connect(trapezoid2.y,mCV5. setpoint_var) annotation (Line(points={{-49,100},{10, + 100},{10,88}}, color={0,0,127})); + connect(boundaryRear.fore, mCV5.rear) annotation (Line( + points={{-10,80},{0,80}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryRear2.fore, mCV.rear) annotation (Line( + points={{-10,40},{0,40}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryRear3.fore, mCV1.rear) annotation (Line( + points={{-10,10},{0,10}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryFore6.rear, mCV2.fore) annotation (Line( + points={{-10,-20},{-1.77636e-15,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryFore8.rear, mCV3.fore) annotation (Line( + points={{-10,-50},{-1.77636e-15,-50}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryFore7.rear, mCV4.fore) annotation (Line( + points={{-10,-80},{0,-80}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV5.fore, flowResistance5.rear) annotation (Line( + points={{20,80},{28,80}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance5.fore, boundaryFore1.rear) annotation (Line( + points={{48,80},{60,80}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV.fore, flowResistance.rear) annotation (Line( + points={{20,40},{30,40}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance.fore, boundaryFore.rear) annotation (Line( + points={{50,40},{60,40}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV1.fore, flowResistance1.rear) annotation (Line( + points={{20,10},{28,10}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance1.fore, boundaryFore2.rear) annotation (Line( + points={{48,10},{60,10}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV2.rear, flowResistance2.fore) annotation (Line( + points={{20,-20},{30,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance2.rear, boundaryRear1.fore) annotation (Line( + points={{50,-20},{60,-20}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV3.rear, flowResistance3.fore) annotation (Line( + points={{20,-50},{30,-50}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance3.rear, boundaryRear5.fore) annotation (Line( + points={{50,-50},{60,-50}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV4.rear, flowResistance4.fore) annotation (Line( + points={{20,-80},{30,-80}}, + color={28,108,200}, + thickness=0.5)); + connect(flowResistance4.rear, boundaryRear4.fore) annotation (Line( + points={{50,-80},{60,-80}}, + color={28,108,200}, + thickness=0.5)); + connect(trapezoid1.y, boundaryRear4.p0_var) annotation (Line(points={{91,-78}, + {84,-78},{84,-86},{72,-86}}, color={0,0,127})); + connect(boundaryRear6.fore, mCV6.rear) annotation (Line( + points={{-12,168},{-2,168}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryRear7.fore, mCV7.rear) annotation (Line( + points={{-12,126},{-2,126}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV6.fore, boundaryFore3.rear) annotation (Line( + points={{18,168},{30,168}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV7.fore, boundaryFore4.rear) annotation (Line( + points={{18,126},{30,126}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryFore10.rear, mCV8.fore) annotation (Line( + points={{74,168},{84,168}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryFore11.rear, mCV9.fore) annotation (Line( + points={{74,126},{84,126}}, + color={28,108,200}, + thickness=0.5)); + connect(mCV8.rear, boundaryRear8.fore) annotation (Line( + points={{104,168},{116,168}}, + color={28,108,200}, + thickness=0.5)); + connect(boundaryRear9.fore, mCV9.rear) annotation (Line( + points={{116,126},{104,126}}, + color={28,108,200}, + thickness=0.5)); + annotation ( + experiment(StopTime=10, Tolerance=1e-6, Interval=0.001, __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +Owner: Michael Meißner
+")); +end MCV; diff --git a/ThermofluidStream/Undirected/FlowControl/Tests/SpecificValveType.mo b/ThermofluidStream/Undirected/FlowControl/Tests/SpecificValveType.mo index 952c8a68..a6ead9b7 100644 --- a/ThermofluidStream/Undirected/FlowControl/Tests/SpecificValveType.mo +++ b/ThermofluidStream/Undirected/FlowControl/Tests/SpecificValveType.mo @@ -19,7 +19,8 @@ model SpecificValveType "Test for undirected SpecificValveType" FlowControl.SpecificValveType slideValve( redeclare package Medium = Medium, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, - redeclare record ZetaValueRecord = ThermofluidStream.FlowControl.Internal.Curves.SlideValveZetaCurve, + redeclare record ZetaValueRecord = + ThermofluidStream.FlowControl.Internal.Curves.SlideValveZetaCurve, flowCoefficient=ThermofluidStream.FlowControl.Internal.Types.FlowCoefficientTypes.Kvs, Kvs=5) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); @@ -28,16 +29,16 @@ model SpecificValveType "Test for undirected SpecificValveType" r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{-80,50},{-60,70}}))); Boundaries.BoundaryFore boundary_fore1(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{96,50},{116,70}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{-40,58},{-20,78}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{26,58},{46,78}}))); Modelica.Blocks.Sources.Ramp ramp( height=1, @@ -53,7 +54,8 @@ model SpecificValveType "Test for undirected SpecificValveType" redeclare package Medium = Medium, initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, invertInput=true, - redeclare record ZetaValueRecord = ThermofluidStream.FlowControl.Internal.Curves.SlideValveZetaCurve, + redeclare record ZetaValueRecord = + ThermofluidStream.FlowControl.Internal.Curves.SlideValveZetaCurve, flowCoefficient=ThermofluidStream.FlowControl.Internal.Types.FlowCoefficientTypes.Kvs, d_valve=0.005, Kvs=5, @@ -62,11 +64,11 @@ model SpecificValveType "Test for undirected SpecificValveType" Boundaries.BoundaryFore boundary_fore(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{96,-10},{116,10}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm4(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{-40,-2},{-20,18}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package Medium = - Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm5(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{26,-2},{46,18}}))); Processes.FlowResistance flowResistance6( @@ -74,21 +76,24 @@ model SpecificValveType "Test for undirected SpecificValveType" r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{60,50},{80,70}}))); Processes.FlowResistance flowResistance1( redeclare package Medium = Medium, r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{60,-10},{80,10}}))); Processes.FlowResistance flowResistance2( redeclare package Medium = Medium, r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=1e3)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=1e3)) annotation (Placement(transformation(extent={{-80,-10},{-60,10}}))); Modelica.Blocks.Sources.Pulse pulse( amplitude=2e4, diff --git a/ThermofluidStream/Undirected/FlowControl/Tests/TanValve.mo b/ThermofluidStream/Undirected/FlowControl/Tests/TanValve.mo index 1debb362..34c7d23d 100644 --- a/ThermofluidStream/Undirected/FlowControl/Tests/TanValve.mo +++ b/ThermofluidStream/Undirected/FlowControl/Tests/TanValve.mo @@ -24,20 +24,26 @@ model TanValve "Test for undirected TanValve" r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); Boundaries.BoundaryFore boundary_fore1(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{96,26},{116,46}}))); Topology.JunctionRFF2 junctionRFF2_1( - redeclare package Medium = Medium) + redeclare package Medium + = Medium) annotation (Placement(transformation(extent={{-24,-10},{-4,10}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package Medium = Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{-78,-2},{-58,18}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package Medium = Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm1(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{26,-2},{46,18}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package Medium = Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm2(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{-12,34},{8,54}}))); - Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package Medium = Medium) + Sensors.MultiSensor_Tpm multiSensor_Tpm3(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{42,34},{62,54}}))); Modelica.Blocks.Sources.Ramp ramp( height=1, @@ -51,7 +57,8 @@ model TanValve "Test for undirected TanValve" r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{68,26},{88,46}}))); Processes.FlowResistance flowResistance2( redeclare package Medium = Medium, @@ -59,7 +66,8 @@ model TanValve "Test for undirected TanValve" r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{64,-10},{84,10}}))); Modelica.Blocks.Sources.Pulse pulse( amplitude=4e4, diff --git a/ThermofluidStream/Undirected/FlowControl/Tests/package.order b/ThermofluidStream/Undirected/FlowControl/Tests/package.order index b894112b..865945ed 100644 --- a/ThermofluidStream/Undirected/FlowControl/Tests/package.order +++ b/ThermofluidStream/Undirected/FlowControl/Tests/package.order @@ -2,3 +2,4 @@ CheckValve TanValve BasicControlValve SpecificValveType +MCV diff --git a/ThermofluidStream/Undirected/HeatExchangers/DiscretizedCounterFlowHEX.mo b/ThermofluidStream/Undirected/HeatExchangers/DiscretizedCounterFlowHEX.mo index 42f9c8a5..83438b20 100644 --- a/ThermofluidStream/Undirected/HeatExchangers/DiscretizedCounterFlowHEX.mo +++ b/ThermofluidStream/Undirected/HeatExchangers/DiscretizedCounterFlowHEX.mo @@ -1,12 +1,15 @@ within ThermofluidStream.Undirected.HeatExchangers; model DiscretizedCounterFlowHEX "Discretized heat exchanger for single- or two-phase fluids without pressure drop" - replaceable package MediumA = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" + replaceable package MediumA = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable package MediumB = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" + replaceable package MediumB = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable model ConductionElementA = Internal.ConductionElementHEX constrainedby Internal.PartialConductionElementHEX( + replaceable model ConductionElementA = Internal.ConductionElementHEX constrainedby + Internal.PartialConductionElementHEX( final A=A/nCells, final V=V_Hex/nCells, redeclare package Medium = MediumA, @@ -15,7 +18,8 @@ model DiscretizedCounterFlowHEX "Discretized heat exchanger for single- or two-p final h_0= h0_A) "Heat transfer element model for side A" annotation(choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable model ConductionElementB = Internal.ConductionElementHEX constrainedby Internal.PartialConductionElementHEX( + replaceable model ConductionElementB = Internal.ConductionElementHEX constrainedby + Internal.PartialConductionElementHEX( final A=A/nCells, final V=V_Hex/nCells, redeclare package Medium = MediumB, @@ -114,6 +118,9 @@ equation summary.dh_A = summary.hout_A - summary.hin_A; summary.dh_B = summary.hout_B - summary.hin_B; + summary.Q_flow_A = Q_flow_A; + summary.Q_flow_B = Q_flow_B; + //Connecting equations (to interconnect pipes) //Fluid Side B connect(rearB, thermalElementB[1].rear) annotation (Line(points={{-100,80},{-10,80}}, color={28,108,200})); diff --git a/ThermofluidStream/Undirected/HeatExchangers/DiscretizedCrossFlowHEX.mo b/ThermofluidStream/Undirected/HeatExchangers/DiscretizedCrossFlowHEX.mo index bd70d249..4ab6512b 100644 --- a/ThermofluidStream/Undirected/HeatExchangers/DiscretizedCrossFlowHEX.mo +++ b/ThermofluidStream/Undirected/HeatExchangers/DiscretizedCrossFlowHEX.mo @@ -1,12 +1,15 @@ within ThermofluidStream.Undirected.HeatExchangers; model DiscretizedCrossFlowHEX "Discretized Heat Exchanger for single- or two-phase working fluid without pressure drop" - replaceable package MediumA = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" + replaceable package MediumA = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side A" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable package MediumB = ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" + replaceable package MediumB = + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model side B" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable model ConductionElementA = Internal.ConductionElementHEX constrainedby Internal.PartialConductionElementHEX( + replaceable model ConductionElementA = Internal.ConductionElementHEX constrainedby + Internal.PartialConductionElementHEX( final A=A/nCells, final V=V_Hex/nCells, redeclare package Medium = MediumA, @@ -15,7 +18,8 @@ model DiscretizedCrossFlowHEX "Discretized Heat Exchanger for single- or two-pha final h_0= h0_A) "Heat transfer element model for side A" annotation(choicesAllMatching=true, Dialog(group = "Medium definitions")); - replaceable model ConductionElementB = Internal.ConductionElementHEX constrainedby Internal.PartialConductionElementHEX( + replaceable model ConductionElementB = Internal.ConductionElementHEX constrainedby + Internal.PartialConductionElementHEX( final A=A/nCells, final V=V_Hex/nCells, redeclare package Medium = MediumB, @@ -101,7 +105,9 @@ public redeclare package Medium = MediumA, each r(each displayUnit="mm") = 0.025, each l=1, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss (each k=50)) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( each k=50)) annotation (Placement(transformation(extent={{20,70},{40,90}}))); Topology.JunctionMN junctionMN(redeclare package Medium = MediumA, N=1, @@ -139,6 +145,8 @@ equation summary.dT_B = summary.Tout_B - summary.Tin_B; summary.dh_A = summary.hout_A - summary.hin_A; summary.dh_B = summary.hout_B - summary.hin_B; + summary.Q_flow_A = Q_flow_A; + summary.Q_flow_B = Q_flow_B; //Connecting equations (to interconnect pipes) diff --git a/ThermofluidStream/Undirected/HeatExchangers/Internal/ConductionElementHEX_twoPhase.mo b/ThermofluidStream/Undirected/HeatExchangers/Internal/ConductionElementHEX_twoPhase.mo index 9b0cb1b4..bee85733 100644 --- a/ThermofluidStream/Undirected/HeatExchangers/Internal/ConductionElementHEX_twoPhase.mo +++ b/ThermofluidStream/Undirected/HeatExchangers/Internal/ConductionElementHEX_twoPhase.mo @@ -1,6 +1,7 @@ within ThermofluidStream.Undirected.HeatExchangers.Internal; model ConductionElementHEX_twoPhase "ConductionElement for two-phase fluids" - extends PartialConductionElementHEX(redeclare replaceable package Medium = Media.myMedia.Interfaces.PartialTwoPhaseMedium); + extends PartialConductionElementHEX(redeclare replaceable package Medium = + Media.myMedia.Interfaces.PartialTwoPhaseMedium); import Modelica.Math; diff --git a/ThermofluidStream/Undirected/HeatExchangers/Tests/ConductionElementTwoPhase.mo b/ThermofluidStream/Undirected/HeatExchangers/Tests/ConductionElementTwoPhase.mo index 9dc32940..a45c9213 100644 --- a/ThermofluidStream/Undirected/HeatExchangers/Tests/ConductionElementTwoPhase.mo +++ b/ThermofluidStream/Undirected/HeatExchangers/Tests/ConductionElementTwoPhase.mo @@ -29,7 +29,8 @@ model ConductionElementTwoPhase r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-44,-10},{-24,10}}))); Sensors.MultiSensor_Tpm multiSensor_Tpm(redeclare package Medium = MediumRefrigerant, temperatureUnit="degC", diff --git a/ThermofluidStream/Undirected/HeatExchangers/Tests/TestDiscretizedHEX.mo b/ThermofluidStream/Undirected/HeatExchangers/Tests/TestDiscretizedHEX.mo index 2fac4a4e..052d24fd 100644 --- a/ThermofluidStream/Undirected/HeatExchangers/Tests/TestDiscretizedHEX.mo +++ b/ThermofluidStream/Undirected/HeatExchangers/Tests/TestDiscretizedHEX.mo @@ -4,11 +4,13 @@ model TestDiscretizedHEX extends Modelica.Icons.Example; replaceable package MediumAir = Media.myMedia.Air.MoistAir - constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium + constrainedby + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); replaceable package MediumRefrigerant = Media.myMedia.R134a.R134a_ph - constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium + constrainedby + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); Boundaries.BoundaryRear boundary_rear( @@ -50,7 +52,8 @@ model TestDiscretizedHEX r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-70,14},{-50,34}}))); inner DropOfCommons dropOfCommons annotation (Placement(transformation(extent={{74,74},{94,94}}))); Modelica.Blocks.Sources.Ramp ramp1( @@ -78,7 +81,8 @@ model TestDiscretizedHEX r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-52,-2},{-72,18}}))); Modelica.Blocks.Continuous.PI PI1( k=-10000, diff --git a/ThermofluidStream/Undirected/HeatExchangers/Tests/TestDiscretizedHEXvsDir.mo b/ThermofluidStream/Undirected/HeatExchangers/Tests/TestDiscretizedHEXvsDir.mo index 908cc358..3a2c2847 100644 --- a/ThermofluidStream/Undirected/HeatExchangers/Tests/TestDiscretizedHEXvsDir.mo +++ b/ThermofluidStream/Undirected/HeatExchangers/Tests/TestDiscretizedHEXvsDir.mo @@ -4,11 +4,13 @@ model TestDiscretizedHEXvsDir extends Modelica.Icons.Example; replaceable package MediumAir = Media.myMedia.Air.DryAirNasa - constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium + constrainedby + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); replaceable package MediumRefrigerant = Media.myMedia.R134a.R134a_ph - constrainedby ThermofluidStream.Media.myMedia.Interfaces.PartialMedium + constrainedby + ThermofluidStream.Media.myMedia.Interfaces.PartialMedium "Medium model" annotation (choicesAllMatching=true, Dialog(group = "Medium definitions")); Boundaries.BoundaryRear boundary_rear( @@ -49,7 +51,8 @@ model TestDiscretizedHEXvsDir r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-68,198},{-48,218}}))); Modelica.Blocks.Sources.Ramp rampPressure( height=1e5, @@ -80,7 +83,8 @@ model TestDiscretizedHEXvsDir r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-50,182},{-70,202}}))); Modelica.Blocks.Continuous.PI PI1( k=-10000, @@ -211,7 +215,8 @@ model TestDiscretizedHEXvsDir Modelica.Blocks.Nonlinear.Limiter limiter3(uMax=5e5, uMin=100) annotation (Placement(transformation(extent={{-76,-70},{-64,-58}}))); ThermofluidStream.HeatExchangers.DiscretizedCounterFlowHEX evaporator( - redeclare model ConductionElementB = ThermofluidStream.HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementB = + ThermofluidStream.HeatExchangers.Internal.ConductionElementHEX_twoPhase, redeclare package MediumA = MediumAir, redeclare package MediumB = MediumRefrigerant, initializeMassFlow=true, @@ -225,7 +230,8 @@ model TestDiscretizedHEXvsDir r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{90,-74},{70,-54}}))); ThermofluidStream.Processes.FlowResistance flowResistanceB1( redeclare package Medium = MediumRefrigerant, @@ -233,7 +239,8 @@ model TestDiscretizedHEXvsDir r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation( extent={{10,-10},{-10,10}}, rotation=270, @@ -347,7 +354,8 @@ model TestDiscretizedHEXvsDir ThermofluidStream.HeatExchangers.DiscretizedCounterFlowHEX condenser( redeclare package MediumA = MediumAir, redeclare package MediumB = MediumRefrigerant, - redeclare model ConductionElementB = ThermofluidStream.HeatExchangers.Internal.ConductionElementHEX_twoPhase, + redeclare model ConductionElementB = + ThermofluidStream.HeatExchangers.Internal.ConductionElementHEX_twoPhase, initializeMassFlow=true, nCells=10, k_wall=300) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, @@ -359,7 +367,8 @@ model TestDiscretizedHEXvsDir r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-84,-176},{-64,-156}}))); ThermofluidStream.Processes.FlowResistance flowResistanceB2( redeclare package Medium = MediumRefrigerant, @@ -368,7 +377,8 @@ model TestDiscretizedHEXvsDir r=0.05, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, diff --git a/ThermofluidStream/Undirected/Interfaces/Tests/Test_p_out_clipping.mo b/ThermofluidStream/Undirected/Interfaces/Tests/Test_p_out_clipping.mo index 45d62a80..976dacf0 100644 --- a/ThermofluidStream/Undirected/Interfaces/Tests/Test_p_out_clipping.mo +++ b/ThermofluidStream/Undirected/Interfaces/Tests/Test_p_out_clipping.mo @@ -3,8 +3,8 @@ model Test_p_out_clipping "Test for the lower limit of p_out in SISOFlow compone extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.SimpleAir - constrainedby Media.myMedia.Interfaces.PartialMedium - "Medium package" + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium package" annotation (Documentation(info="Medium package used in the Test.
")); @@ -21,7 +21,8 @@ model Test_p_out_clipping "Test for the lower limit of p_out in SISOFlow compone L_value=100, computeL=false, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=100, k2=50)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=100, k2=50)) annotation (Placement(transformation(extent={{-10,20},{10,40}}))); FlowControl.BasicControlValve basicControlValve( redeclare package Medium = Medium, @@ -58,7 +59,8 @@ model Test_p_out_clipping "Test for the lower limit of p_out in SISOFlow compone L_value=100, computeL=false, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( k=100, k2=50)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + ( k=100, k2=50)) annotation (Placement(transformation(extent={{-10,40},{10,60}}))); Boundaries.BoundaryRear boundary_rear1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,20},{-40,40}}))); Boundaries.BoundaryRear boundary_rear2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,0},{-40,20}}))); diff --git a/ThermofluidStream/Undirected/Processes/FlowResistance.mo b/ThermofluidStream/Undirected/Processes/FlowResistance.mo index cf23be72..2cfddf80 100644 --- a/ThermofluidStream/Undirected/Processes/FlowResistance.mo +++ b/ThermofluidStream/Undirected/Processes/FlowResistance.mo @@ -15,7 +15,8 @@ model FlowResistance "Flow resistance model" replaceable function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.pleaseSelectPressureLoss - constrainedby ThermofluidStream.Processes.Internal.FlowResistance.partialPressureLoss "Pressure loss function" + constrainedby + ThermofluidStream.Processes.Internal.FlowResistance.partialPressureLoss "Pressure loss function" annotation(choicesAllMatching=true, Documentation(info="Pressure loss function used in the flow resistance.
")); diff --git a/ThermofluidStream/Undirected/Processes/Tests/TestFlowResistance.mo b/ThermofluidStream/Undirected/Processes/Tests/TestFlowResistance.mo index efcb9360..9127972a 100644 --- a/ThermofluidStream/Undirected/Processes/Tests/TestFlowResistance.mo +++ b/ThermofluidStream/Undirected/Processes/Tests/TestFlowResistance.mo @@ -7,7 +7,8 @@ model TestFlowResistance "Test for the undirected flow resistance" initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, r=0.01, l=1, - redeclare function pLoss = .ThermofluidStream.Processes.Internal.FlowResistance.laminarPressureLoss) + redeclare function pLoss = + .ThermofluidStream.Processes.Internal.FlowResistance.laminarPressureLoss) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); Boundaries.BoundaryRear boundary_rear( redeclare package Medium = Media.myMedia.Air.SimpleAir, @@ -33,7 +34,8 @@ model TestFlowResistance "Test for the undirected flow resistance" initM_flow=ThermofluidStream.Utilities.Types.InitializationMethods.state, r=0.01, l=1, - redeclare function pLoss = ThermofluidStream.Processes.Internal.FlowResistance.laminarPressureLoss) + redeclare function pLoss = + ThermofluidStream.Processes.Internal.FlowResistance.laminarPressureLoss) annotation (Placement(transformation(extent={{-10,-50},{10,-30}}))); Boundaries.BoundaryRear boundary_rear1( redeclare package Medium = Media.myMedia.Air.SimpleAir, diff --git a/ThermofluidStream/Undirected/Processes/Tests/TransportDelay.mo b/ThermofluidStream/Undirected/Processes/Tests/TransportDelay.mo index f4d67e46..cfebad83 100644 --- a/ThermofluidStream/Undirected/Processes/Tests/TransportDelay.mo +++ b/ThermofluidStream/Undirected/Processes/Tests/TransportDelay.mo @@ -3,8 +3,8 @@ model TransportDelay "Test for transport delay" extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.DryAirNasa - constrainedby Media.myMedia.Interfaces.PartialMedium - "Medium Model" + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medium Model" annotation (Documentation(info="Medium model for the test. Can be anything.
")); @@ -20,8 +20,8 @@ model TransportDelay "Test for transport delay" r=100, l(displayUnit="mm") = 0.008, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1e4)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=1e4)) annotation (Placement(transformation(extent={{-10,30},{10,50}}))); ThermofluidStream.Boundaries.Sink sink(redeclare package Medium = Medium, @@ -62,8 +62,8 @@ model TransportDelay "Test for transport delay" r=100, l(displayUnit="mm") = 0.008, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1e4)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=1e4)) annotation (Placement(transformation(extent={{-10,-50},{10,-30}}))); Boundaries.BoundaryFore boundary_fore(redeclare package Medium = Medium, p0_par=100000) annotation (Placement(transformation(extent={{70,-50},{90,-30}}))); diff --git a/ThermofluidStream/Undirected/Sensors/SensorState.mo b/ThermofluidStream/Undirected/Sensors/SensorState.mo index 0f361dc6..a6e6c2ed 100644 --- a/ThermofluidStream/Undirected/Sensors/SensorState.mo +++ b/ThermofluidStream/Undirected/Sensors/SensorState.mo @@ -9,7 +9,8 @@ model SensorState "Sensor for whole state"Medium Model for the sensor. Make sure it is the same as for all lines the sensors input is connected.
")); - ThermofluidStream.Interfaces.StateOutput state_out(redeclare package Medium = Medium) "Measured value [variable]" + ThermofluidStream.Interfaces.StateOutput state_out(redeclare package Medium + = Medium) "Measured value [variable]" annotation (Placement(transformation(extent={{80,-20},{120,20}}))); equation diff --git a/ThermofluidStream/Undirected/Sensors/SingleFlowSensor.mo b/ThermofluidStream/Undirected/Sensors/SingleFlowSensor.mo index ebdbf825..13be5328 100644 --- a/ThermofluidStream/Undirected/Sensors/SingleFlowSensor.mo +++ b/ThermofluidStream/Undirected/Sensors/SingleFlowSensor.mo @@ -28,7 +28,8 @@ model SingleFlowSensor "Sensor for a selectable quantity associated with the mas protected Real direct_value(unit=ThermofluidStream.Sensors.Internal.getFlowUnit(quantity)); - function getQuantity = ThermofluidStream.Sensors.Internal.getFlowQuantity (redeclare package Medium=Medium) "Quantity compute function" + function getQuantity = ThermofluidStream.Sensors.Internal.getFlowQuantity (redeclare + package Medium = Medium) "Quantity compute function" annotation (Documentation(info="This function computes the selected quantity from state and massflow. rho_min is neddet for the computation of v.
")); diff --git a/ThermofluidStream/Undirected/Sensors/SingleSensorSelect.mo b/ThermofluidStream/Undirected/Sensors/SingleSensorSelect.mo index 89f3e298..554c7f9c 100644 --- a/ThermofluidStream/Undirected/Sensors/SingleSensorSelect.mo +++ b/ThermofluidStream/Undirected/Sensors/SingleSensorSelect.mo @@ -23,7 +23,8 @@ model SingleSensorSelect "Sensor with selectable measured quantity" transformation(extent={{80,-20},{120,20}}), iconTransformation(extent={{80,-20},{120,20}}))); - function getQuantity = ThermofluidStream.Sensors.Internal.getQuantity(redeclare package Medium=Medium) "Quantity compute function" + function getQuantity = ThermofluidStream.Sensors.Internal.getQuantity(redeclare + package Medium = Medium) "Quantity compute function" annotation (Documentation(info="This function computes the selected quantity from state. r and rho_min are neddet for the quantities r/p_total and v respectively.
")); diff --git a/ThermofluidStream/Undirected/Sensors/Tests/TestSensors.mo b/ThermofluidStream/Undirected/Sensors/Tests/TestSensors.mo index d271eda5..b67a8fc6 100644 --- a/ThermofluidStream/Undirected/Sensors/Tests/TestSensors.mo +++ b/ThermofluidStream/Undirected/Sensors/Tests/TestSensors.mo @@ -9,7 +9,8 @@ model TestSensors "Test for the undirected sensors"Replaceable package with the medium model. Due to the vaporQuality sensor it must be a TwoPhaseMedium.
")); - replaceable package Medium2 = Media.myMedia.IdealGases.MixtureGases.CombustionAir + replaceable package Medium2 = + Media.myMedia.IdealGases.MixtureGases.CombustionAir constrainedby Media.myMedia.Interfaces.PartialMedium "Medium model" annotation (Documentation(info=" @@ -22,7 +23,8 @@ model TestSensors "Test for the undirected sensors" r=0.01, l=100, redeclare function pLoss = - .ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + .ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-40,-8},{-20,12}}))); Boundaries.BoundaryRear boundary_rear( redeclare package Medium = Medium, @@ -51,9 +53,11 @@ model TestSensors "Test for the undirected sensors" SingleSensorSelect singleSensorSelect(redeclare package Medium = Medium, quantity=ThermofluidStream.Sensors.Internal.Types.Quantities.p_bar) annotation (Placement(transformation(extent={{-10,0},{10,20}}))); - UnidirectionalSensorAdapter unidirectionalSensorAdapter(redeclare package Medium = Medium) + UnidirectionalSensorAdapter unidirectionalSensorAdapter(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{20,0},{40,8}}))); - ThermofluidStream.Sensors.TwoPhaseSensorSelect sensor_vaporQuality1(redeclare package Medium = Medium, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) + ThermofluidStream.Sensors.TwoPhaseSensorSelect sensor_vaporQuality1(redeclare + package Medium = Medium, quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg) annotation (Placement(transformation(extent={{50,12},{70,32}}))); SingleFlowSensor singleFlowSensor(redeclare package Medium = Medium, quantity=ThermofluidStream.Sensors.Internal.Types.MassFlowQuantities.H_flow_Jps) annotation (Placement(transformation(extent={{-70,0},{-50,20}}))); @@ -67,7 +71,8 @@ model TestSensors "Test for the undirected sensors" r=0.01, l=100, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-40,52},{-20,72}}))); Boundaries.BoundaryRear boundary_rear1( redeclare package Medium = Medium, @@ -111,7 +116,8 @@ model TestSensors "Test for the undirected sensors" quantity=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities.x_kgpkg, filter_output=true, redeclare package Medium = Medium) annotation (Placement(transformation(extent={{50,60},{70,80}}))); - UnidirectionalSensorAdapter unidirectionalSensorAdapter1(redeclare package Medium = Medium) + UnidirectionalSensorAdapter unidirectionalSensorAdapter1(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{20,64},{40,56}}))); ThermofluidStream.Sensors.DifferenceTwoPhaseSensorSensorSelect differenceTwoPhaseSensorSensorSelect( redeclare package MediumA = Medium, @@ -139,7 +145,8 @@ model TestSensors "Test for the undirected sensors" r=0.01, l=100, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.steel)) + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.steel)) annotation (Placement(transformation(extent={{-38,-40},{-18,-20}}))); SingleSensorX singleSensorX(redeclare package Medium = Medium2) annotation (Placement(transformation(extent={{-100,-32},{-80,-12}}))); SingleSensorX singleSensorX1( diff --git a/ThermofluidStream/Undirected/Sensors/TwoPhaseSensorSelect.mo b/ThermofluidStream/Undirected/Sensors/TwoPhaseSensorSelect.mo index 50384d86..fb9c63c8 100644 --- a/ThermofluidStream/Undirected/Sensors/TwoPhaseSensorSelect.mo +++ b/ThermofluidStream/Undirected/Sensors/TwoPhaseSensorSelect.mo @@ -5,8 +5,8 @@ model TwoPhaseSensorSelect "Sensor for a selectable quantity of a twoPhaseMedium import Quantities=ThermofluidStream.Sensors.Internal.Types.TwoPhaseQuantities; import InitMode = ThermofluidStream.Sensors.Internal.Types.InitializationModelSensor; - replaceable package Medium2Phase = Media.myMedia.Interfaces.PartialTwoPhaseMedium - "Medium model" + replaceable package Medium2Phase = + Media.myMedia.Interfaces.PartialTwoPhaseMedium "Medium model" annotation (choicesAllMatching=true, Documentation(info="Replaceable medium package for the sensor. Medium must be a TwoPase Medium.
@@ -35,7 +35,8 @@ model TwoPhaseSensorSelect "Sensor for a selectable quantity of a twoPhaseMedium protected Real direct_value(unit=ThermofluidStream.Sensors.Internal.getTwoPhaseUnit(quantity)); - function getQuantity = ThermofluidStream.Sensors.Internal.getTwoPhaseQuantity(redeclare package Medium=Medium) "Quantity compute function" + function getQuantity = ThermofluidStream.Sensors.Internal.getTwoPhaseQuantity(redeclare + package Medium = Medium) "Quantity compute function" annotation (Documentation(info="This function computes the selected two-phase quantity from state.
")); diff --git a/ThermofluidStream/Undirected/Topology/ConnectForeOutlet.mo b/ThermofluidStream/Undirected/Topology/ConnectForeOutlet.mo index 6e93a202..729115c9 100644 --- a/ThermofluidStream/Undirected/Topology/ConnectForeOutlet.mo +++ b/ThermofluidStream/Undirected/Topology/ConnectForeOutlet.mo @@ -21,7 +21,8 @@ model ConnectForeOutlet annotation (Placement(transformation(extent={{0,-10},{20,10}}))); ConnectForeFore connectForeFore(redeclare package Medium=Medium, final L=L/2) annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); - ThermofluidStream.Interfaces.StateInput state_rear(redeclare package Medium=Medium) if not useDefaultStateAsRear + ThermofluidStream.Interfaces.StateInput state_rear(redeclare package Medium=Medium) + if not useDefaultStateAsRear annotation (Placement( transformation( extent={{-20,-20},{20,20}}, diff --git a/ThermofluidStream/Undirected/Topology/Tests/TestConnectors.mo b/ThermofluidStream/Undirected/Topology/Tests/TestConnectors.mo index 13496ed7..3ba5b416 100644 --- a/ThermofluidStream/Undirected/Topology/Tests/TestConnectors.mo +++ b/ThermofluidStream/Undirected/Topology/Tests/TestConnectors.mo @@ -3,7 +3,8 @@ model TestConnectors "Test for the connectors" extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.SimpleAir - constrainedby Media.myMedia.Interfaces.PartialMedium + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medum model for the Test" annotation (Documentation(info="This is the replaceable package that determines the medium of the Test.
")); @@ -99,8 +100,8 @@ model TestConnectors "Test for the connectors" annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0, origin={40,-50}))); - ThermofluidStream.Boundaries.CreateState createState(redeclare package Medium = - Medium, PFromInput=true) + ThermofluidStream.Boundaries.CreateState createState(redeclare package Medium + = Medium, PFromInput=true) annotation (Placement(transformation(extent={{38,-12},{32,-4}}))); ConnectorInletOutletFore connectorInletOutletFore(redeclare package Medium = Medium) annotation (Placement(transformation( diff --git a/ThermofluidStream/Undirected/Topology/Tests/TestJunction.mo b/ThermofluidStream/Undirected/Topology/Tests/TestJunction.mo index c80e8d39..ecc94e3e 100644 --- a/ThermofluidStream/Undirected/Topology/Tests/TestJunction.mo +++ b/ThermofluidStream/Undirected/Topology/Tests/TestJunction.mo @@ -3,14 +3,17 @@ model TestJunction "Test for the undirected junction" extends Modelica.Icons.Example; replaceable package Medium = Media.myMedia.Air.SimpleAir - constrainedby Media.myMedia.Interfaces.PartialMedium + constrainedby + Media.myMedia.Interfaces.PartialMedium "Medum model for the Test" annotation (Documentation(info="This is the replaceable package that determines the medium of the Test.
")); replaceable function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss ( material=ThermofluidStream.Processes.Internal.Material.wood) - constrainedby ThermofluidStream.Processes.Internal.FlowResistance.partialPressureLoss + ThermofluidStream.Processes.Internal.FlowResistance.laminarTurbulentPressureLoss + ( material=ThermofluidStream.Processes.Internal.Material.wood) + constrainedby + ThermofluidStream.Processes.Internal.FlowResistance.partialPressureLoss "Pressure loss function for all Flow resistances" annotation(choicesAllMatching = true, Documentation(info="This is the pressure loss function used for all resistances except the two on the outlets of the right two cases.
@@ -159,8 +162,8 @@ model TestJunction "Test for the undirected junction" r=0.1, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1000)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=1000)) annotation (Placement(transformation(extent={{116,-50},{136,-30}}))); ThermofluidStream.Processes.FlowResistance flowResistance7( redeclare package Medium = Medium, @@ -168,8 +171,8 @@ model TestJunction "Test for the undirected junction" r=0.1, l=1, redeclare function pLoss = - ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss ( - k=1000)) + ThermofluidStream.Processes.Internal.FlowResistance.linearQuadraticPressureLoss + (k=1000)) annotation (Placement(transformation(extent={{116,30},{136,50}}))); equation connect(sink.inlet, flowResistance.outlet) annotation (Line( diff --git a/ThermofluidStream/package.mo b/ThermofluidStream/package.mo index e16dad08..b8a80995 100644 --- a/ThermofluidStream/package.mo +++ b/ThermofluidStream/package.mo @@ -5,7 +5,7 @@ package ThermofluidStream "Library for the Modelling of Thermofluid Streams" import SI = Modelica.SIunits; annotation ( - version="0.3.1", + version="0.4.1", uses(Modelica(version="3.2.3")), conversion( from(