diff --git a/AixLib/FastHVAC/Pumps/Examples/FluidSource.mo b/AixLib/FastHVAC/Pumps/Examples/FluidSource.mo index 23b39ebdf7..567052864d 100644 --- a/AixLib/FastHVAC/Pumps/Examples/FluidSource.mo +++ b/AixLib/FastHVAC/Pumps/Examples/FluidSource.mo @@ -7,32 +7,57 @@ model FluidSource Modelica.Blocks.Sources.Constant T_source(k=333.15) annotation (Placement(transformation(extent={{-84,-22},{-64,-2}}))); AixLib.FastHVAC.Pumps.FluidSource fluidSource - annotation (Placement(transformation(extent={{-36,-34},{-16,-14}}))); - AixLib.FastHVAC.Pumps.FluidSource fluidSource1 - annotation (Placement(transformation(extent={{-40,-96},{-20,-76}}))); - Modelica.Blocks.Sources.Constant T_source1(k=310.15) - annotation (Placement(transformation(extent={{-88,-84},{-68,-64}}))); - Modelica.Blocks.Sources.Constant dotm_source1(k=2) - annotation (Placement(transformation(extent={{-88,-114},{-68,-94}}))); - Sinks.Vessel vessel2 + annotation (Placement(transformation(extent={{-42,-34},{-22,-14}}))); + Sinks.Vessel vessel annotation (Placement(transformation(extent={{80,-18},{100,2}}))); - BaseClasses.WorkingFluid workingFluid(T0=293.15, m_fluid=1) - annotation (Placement(transformation(extent={{-6,-34},{14,-14}}))); + Sinks.Vessel vessel1 + annotation (Placement(transformation(extent={{78,-44},{98,-24}}))); + Valves.Splitter splitterNew(nOut=3, nIn=2) + annotation (Placement(transformation(extent={{12,-30},{32,-10}}))); + Sinks.Vessel vessel2 + annotation (Placement(transformation(extent={{80,-72},{100,-52}}))); + Sensors.TemperatureSensor temperature + annotation (Placement(transformation(extent={{50,-20},{70,0}}))); + Sensors.TemperatureSensor temperature1 + annotation (Placement(transformation(extent={{54,-46},{74,-26}}))); + Sensors.TemperatureSensor temperature2 + annotation (Placement(transformation(extent={{54,-72},{74,-52}}))); + AixLib.FastHVAC.Pumps.FluidSource fluidSource1 + annotation (Placement(transformation(extent={{-34,-98},{-14,-78}}))); + Modelica.Blocks.Sources.Constant T_source1(k=313.15) + annotation (Placement(transformation(extent={{-82,-86},{-62,-66}}))); + Modelica.Blocks.Sources.Constant dotm_source1(k=5) + annotation (Placement(transformation(extent={{-82,-116},{-62,-96}}))); equation connect(T_source.y, fluidSource.T_fluid) annotation (Line(points={{-63,-12},{ - -48,-12},{-48,-19.8},{-34,-19.8}}, color={0,0,127})); + -48,-12},{-48,-19.8},{-40,-19.8}}, color={0,0,127})); connect(dotm_source.y, fluidSource.m_flow) annotation (Line(points={{-63,-42}, - {-50,-42},{-50,-26.6},{-34,-26.6}}, color={0,0,127})); - connect(dotm_source1.y, fluidSource1.m_flow) annotation (Line(points={{-67, - -104},{-54,-104},{-54,-88.6},{-38,-88.6}}, color={0,0,127})); - connect(T_source1.y, fluidSource1.T_fluid) annotation (Line(points={{-67,-74}, - {-52,-74},{-52,-81.8},{-38,-81.8}}, color={0,0,127})); - connect(fluidSource.enthalpyPort_b, workingFluid.enthalpyPort_a) annotation ( - Line(points={{-17,-22},{-12,-22},{-12,-24},{-5,-24}}, color={176,0,0})); - connect(fluidSource1.enthalpyPort_b, workingFluid.enthalpyPort_a) annotation - (Line(points={{-21,-84},{-14,-84},{-14,-24},{-5,-24}}, color={176,0,0})); - connect(workingFluid.enthalpyPort_b, vessel2.enthalpyPort_a) annotation (Line( - points={{13,-24},{48,-24},{48,-8},{83,-8}}, color={176,0,0})); + {-50,-42},{-50,-26.6},{-40,-26.6}}, color={0,0,127})); + connect(temperature.enthalpyPort_b, vessel.enthalpyPort_a) annotation (Line( + points={{69,-10.1},{76.5,-10.1},{76.5,-8},{83,-8}}, color={176,0,0})); + connect(splitterNew.enthalpyPort_b[1], temperature.enthalpyPort_a) + annotation (Line(points={{32,-20.6667},{42,-20.6667},{42,-10.1},{51.2,-10.1}}, + color={176,0,0})); + connect(temperature2.enthalpyPort_b, vessel2.enthalpyPort_a) annotation (Line( + points={{73,-62.1},{77.5,-62.1},{77.5,-62},{83,-62}}, color={176,0,0})); + connect(temperature1.enthalpyPort_b, vessel1.enthalpyPort_a) annotation (Line( + points={{73,-36.1},{77.5,-36.1},{77.5,-34},{81,-34}}, color={176,0,0})); + connect(splitterNew.enthalpyPort_b[2], temperature1.enthalpyPort_a) + annotation (Line(points={{32,-20},{44,-20},{44,-36.1},{55.2,-36.1}}, color= + {176,0,0})); + connect(splitterNew.enthalpyPort_b[3], temperature2.enthalpyPort_a) + annotation (Line(points={{32,-19.3333},{44,-19.3333},{44,-62.1},{55.2,-62.1}}, + color={176,0,0})); + connect(dotm_source1.y, fluidSource1.m_flow) annotation (Line(points={{-61, + -106},{-48,-106},{-48,-90.6},{-32,-90.6}}, color={0,0,127})); + connect(T_source1.y, fluidSource1.T_fluid) annotation (Line(points={{-61,-76}, + {-46,-76},{-46,-83.8},{-32,-83.8}}, color={0,0,127})); + connect(fluidSource.enthalpyPort_b, splitterNew.enthalpyPort_a[1]) + annotation (Line(points={{-23,-22},{-6,-22},{-6,-20.5},{12,-20.5}}, color={ + 176,0,0})); + connect(fluidSource1.enthalpyPort_b, splitterNew.enthalpyPort_a[2]) + annotation (Line(points={{-15,-86},{-2,-86},{-2,-19.5},{12,-19.5}}, color={ + 176,0,0})); annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Rectangle( diff --git a/AixLib/FastHVAC/Pumps/Examples/Pump.mo b/AixLib/FastHVAC/Pumps/Examples/Pump.mo index 30363a3c5d..261b86ab64 100644 --- a/AixLib/FastHVAC/Pumps/Examples/Pump.mo +++ b/AixLib/FastHVAC/Pumps/Examples/Pump.mo @@ -34,6 +34,8 @@ model Pump extent={{-10,-10},{10,10}}, rotation=180, origin={84,46}))); + Valves.Splitter splitterNew + annotation (Placement(transformation(extent={{44,-2},{64,18}}))); equation connect(boilerBase.enthalpyPort_b1, pump.enthalpyPort_a) annotation (Line( points={{-51.5,7},{-13.52,7}}, @@ -44,8 +46,8 @@ equation points={{112,-73.18},{112,-20},{-62.5,-20},{-62.5,6.78}}, color={176,0,0}, smooth=Smooth.None)); - connect(mdot.y, pump.dotm_setValue) annotation (Line( - points={{-5,26},{-2,26},{-2,15.8}}, + connect(mdot.y, pump.m_flowSet) annotation (Line( + points={{-5,26},{-2,26},{-2,7}}, color={0,0,127}, smooth=Smooth.None)); connect(dotQ_rel.y, boilerBase.dotQ_rel) annotation (Line( @@ -64,13 +66,17 @@ equation ={{102.6,24.22},{102.6,26},{70,26},{70,46},{74,46}}, color={191,0,0})); connect(radiator_ML1.RadiativeHeat, idealSink1.port) annotation (Line(points= {{113.6,24.4},{113.6,30},{74,30},{74,46}}, color={95,95,95})); - connect(pump.enthalpyPort_b, radiator_ML1.enthalpyPort_a1) annotation (Line( - points={{9.52,7},{53.76,7},{53.76,18.82},{100,18.82}}, color={176,0,0})); connect(radiator_ML1.enthalpyPort_b1, boilerBase.enthalpyPort_a1) annotation (Line(points={{116,18.82},{122,18.82},{122,18},{126,18},{126,-94},{-84,-94}, {-84,6.78},{-62.5,6.78}}, color={176,0,0})); - connect(pump.enthalpyPort_b, radiator_ML.enthalpyPort_a1) annotation (Line( - points={{9.52,7},{52.76,7},{52.76,-73.18},{96,-73.18}}, color={176,0,0})); + connect(splitterNew.enthalpyPort_b[1], radiator_ML1.enthalpyPort_a1) + annotation (Line(points={{64,8},{82,8},{82,18.82},{100,18.82}}, color={176, + 0,0})); + connect(splitterNew.enthalpyPort_b[2], radiator_ML.enthalpyPort_a1) + annotation (Line(points={{64,8},{80,8},{80,-73.18},{96,-73.18}}, color={176, + 0,0})); + connect(pump.enthalpyPort_b, splitterNew.enthalpyPort_a[1]) annotation (Line( + points={{9.52,7},{26.76,7},{26.76,8},{44,8}}, color={176,0,0})); annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Rectangle( diff --git a/AixLib/FastHVAC/Pumps/Pump.mo b/AixLib/FastHVAC/Pumps/Pump.mo index ab5d6c965e..1a36d79765 100644 --- a/AixLib/FastHVAC/Pumps/Pump.mo +++ b/AixLib/FastHVAC/Pumps/Pump.mo @@ -17,15 +17,9 @@ protected ******************************************************************* */ public - Modelica.Blocks.Interfaces.RealInput dotm_setValue( unit="kg/s") + Modelica.Blocks.Interfaces.RealInput m_flowSet(unit="kg/s") "External real input to set the mass flow rate" annotation (Placement( - transformation( - extent={{-27,-27},{27,27}}, - rotation=270, - origin={3,67}), iconTransformation( - extent={{-20,-20},{20,20}}, - rotation=270, - origin={0,80}))); + transformation(extent={{-27,-27},{27,27}}, rotation=270))); FastHVAC.Interfaces.EnthalpyPort_a enthalpyPort_a "Thermal port for input values (temperature, mass flow rate, specific enthalpy, constant specific heat capacity)" annotation (Placement(transformation(extent={{-86,-10},{-66,10}}), @@ -35,12 +29,7 @@ public annotation (Placement(transformation(extent={{64,-12},{84,8}}), iconTransformation(extent={{76,-20},{116,20}}))); equation - // balances - enthalpyPort_b.m_flow = dotm_setValue " set value of outlet port "; -// enthalpyPort_b.c_outflow = cp " set value of outlet port "; - - // constant values - + enthalpyPort_b.m_flow =-m_flowSet "set value of outlet port"; enthalpyPort_b.h_outflow = inStream(enthalpyPort_a.h_outflow); enthalpyPort_a.h_outflow = 0; enthalpyPort_b.dummy_potential = 1; diff --git a/AixLib/FastHVAC/Valves/Splitter.mo b/AixLib/FastHVAC/Valves/Splitter.mo index 866398c67a..bcdc06e716 100644 --- a/AixLib/FastHVAC/Valves/Splitter.mo +++ b/AixLib/FastHVAC/Valves/Splitter.mo @@ -1,27 +1,29 @@ within AixLib.FastHVAC.Valves; model Splitter - parameter Integer n(min=1) = 1 "Number of output flows"; - parameter Real dummy_potential_start = 1; - Modelica.SIunits.MassFlowRate m_flow; - Interfaces.EnthalpyPort_a enthalpyPort_a + + parameter Integer nOut = 2 "Number of splitter outputs"; + parameter Integer nIn = 1 "Number of splitter inputs"; + parameter Real splitFactor[nOut, nIn]= fill(1/nOut, nOut, nIn) + "Matrix of split factor for outputs (between 0 and 1 for each row)"; + Modelica.SIunits.SpecificEnthalpy h_outflow_mixed + "mixed specific enthalpy leaving port b"; + Interfaces.EnthalpyPort_a enthalpyPort_a[nIn] annotation (Placement(transformation(extent={{-110,-10},{-90,10}}))); - Interfaces.EnthalpyPort_b enthalpyPort_b[n] + Interfaces.EnthalpyPort_b enthalpyPort_b[nOut] "1-dimensional imput port n-dimensional output port" annotation (Placement(transformation(extent={{90,-10},{110,10}}))); -// Real dummy_potential = if n > 0 then enthalpyPort_b[1].dummy_potential else dummy_potential_start; equation - - // sum(enthalpyPort_b.dummy_potential)/n = enthalpyPort_a.dummy_potential; -// enthalpyPort_b[1].dummy_potential = enthalpyPort_a.dummy_potential; -dummy_potential = enthalpyPort_a.dummy_potential; - for k in 1:n loop - enthalpyPort_a.m_flow / n = - enthalpyPort_b[k].m_flow; - enthalpyPort_b[k].h_outflow = inStream(enthalpyPort_a.h_outflow); - enthalpyPort_a.h_outflow = 0; - end for; + enthalpyPort_b.m_flow = - enthalpyPort_a.m_flow * transpose(splitFactor) + "Connecting the output vector according to desired dimension"; + enthalpyPort_a.dummy_potential = enthalpyPort_b.dummy_potential * splitFactor + "Equivalent building temperature rerouted to SignalInput"; + h_outflow_mixed = + sum(inStream(enthalpyPort_a.h_outflow) * enthalpyPort_a.m_flow) + / sum(enthalpyPort_a.m_flow); + enthalpyPort_a.h_outflow = fill(0, nIn); + enthalpyPort_b.h_outflow = fill(h_outflow_mixed, nOut); annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100, - -100},{100,100}}), - graphics), Icon(coordinateSystem(preserveAspectRatio= + -100},{100,100}})), Icon(coordinateSystem(preserveAspectRatio= false, extent={{-100,-100},{100,100}}), graphics={Polygon( points={{-100,20},{-20,20},{20,60},{100,60},{100,60},{100,40},{30,40}, {0,10},{100,10},{100,-10},{96,-10},{0,-10},{30,-40},{100,-40},{