diff --git a/IBPSA/BoundaryConditions/WeatherData/Examples/ReaderTMY3.mo b/IBPSA/BoundaryConditions/WeatherData/Examples/ReaderTMY3.mo index d3d860737b..5d46e21341 100644 --- a/IBPSA/BoundaryConditions/WeatherData/Examples/ReaderTMY3.mo +++ b/IBPSA/BoundaryConditions/WeatherData/Examples/ReaderTMY3.mo @@ -1,28 +1,20 @@ within IBPSA.BoundaryConditions.WeatherData.Examples; model ReaderTMY3 "Test model for reading weather data" extends Modelica.Icons.Example; - IBPSA.BoundaryConditions.WeatherData.ReaderTMY3 weaDat( - filNam=Modelica.Utilities.Files.loadResource("modelica://IBPSA/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos")) + IBPSA.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= + Modelica.Utilities.Files.loadResource( + "D://01_Projekte//03_Mitsubishi_HiL//TRY2015_Jahr_City_Aachen.mos")) "Weather data reader" annotation (Placement(transformation(extent={{-20,40},{0,60}}))); IBPSA.BoundaryConditions.WeatherData.ReaderTMY3 weaDatInpCon(filNam= - Modelica.Utilities.Files.loadResource("modelica://IBPSA/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"), - HSou=IBPSA.BoundaryConditions.Types.RadiationDataSource.Input_HGloHor_HDifHor) + Modelica.Utilities.Files.loadResource("D://01_Projekte//03_Mitsubishi_HiL//TRY2015_Jahr_City_Aachen_savecopy.mos"), + HSou=IBPSA.BoundaryConditions.Types.RadiationDataSource.File) "Weather data reader with radiation data obtained from input connector" annotation (Placement(transformation(extent={{-20,-60},{0,-40}}))); Modelica.Blocks.Sources.Constant HDifHor(k=0) "Diffuse horizontal radiation" annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); Modelica.Blocks.Sources.Constant HGloHor(k=0) "Horizontal global radiation" annotation (Placement(transformation(extent={{-80,-20},{-60,0}}))); -equation - connect(HGloHor.y, weaDatInpCon.HGloHor_in) - annotation (Line( - points={{-59,-10},{-28,-10},{-28,-63},{-21,-63}}, - color={0,0,127})); - connect(HDifHor.y, weaDatInpCon.HDifHor_in) - annotation (Line( - points={{-59,-50},{-40,-50},{-40,-57.6},{-21,-57.6}}, - color={0,0,127})); annotation (experiment(Tolerance=1e-6, StartTime=0, StopTime=8640000), __Dymola_Commands(file="modelica://IBPSA/Resources/Scripts/Dymola/BoundaryConditions/WeatherData/Examples/ReaderTMY3.mos" "Simulate and plot"), diff --git a/IBPSA/Fluid/HeatPumps/BlackBoxData/VCLibMap.mo b/IBPSA/Fluid/HeatPumps/BlackBoxData/VCLibMap.mo index 19b45d0cbf..4486e9f7bc 100644 --- a/IBPSA/Fluid/HeatPumps/BlackBoxData/VCLibMap.mo +++ b/IBPSA/Fluid/HeatPumps/BlackBoxData/VCLibMap.mo @@ -168,7 +168,7 @@ equation {-1.9984e-15,54},{92,54},{92,88},{110,88},{110,82}}, color={0,0,127})); connect(QScaling.y, product_scaling.u1) annotation (Line(points={{-50,59},{ - -50,50},{-44,50},{-44,42}}, + -50,48},{-44,48},{-44,42}}, color={0,0,127})); connect(Table_QCon.y, product_scaling.u2) annotation (Line(points={{-110,59}, {-110,48},{-56,48},{-56,42}}, @@ -183,8 +183,8 @@ equation connect(divisionPel.u2, max.y) annotation (Line(points={{104,2},{104,14},{110, 14},{110,19}}, color={0,0,127})); - connect(max.u1, Table_COP.y) annotation (Line(points={{116,42},{116,54},{110, - 54},{110,59}},color={0,0,127})); + connect(max.u1, Table_COP.y) annotation (Line(points={{116,42},{116,48},{110, + 48},{110,59}},color={0,0,127})); connect(const_minCOP.y, max.u2) annotation (Line(points={{70,59},{70,48},{104, 48},{104,42}}, color={0,0,127})); connect(multiplex3_1.u1[1], sigBus.ySet) annotation (Line(points={{7,82},{12, diff --git a/IBPSA/Fluid/HeatPumps/Examples/HeatPump.mo b/IBPSA/Fluid/HeatPumps/Examples/HeatPump.mo index 9e51602c78..eee35a27a9 100644 --- a/IBPSA/Fluid/HeatPumps/Examples/HeatPump.mo +++ b/IBPSA/Fluid/HeatPumps/Examples/HeatPump.mo @@ -7,6 +7,7 @@ model HeatPump "Example for the reversible heat pump model." replaceable package Medium_sou = IBPSA.Media.Water constrainedby Modelica.Media.Interfaces.PartialMedium annotation (choicesAllMatching=true); IBPSA.Fluid.Sources.MassFlowSource_T sourceSideMassFlowSource( + use_m_flow_in=true, use_T_in=true, m_flow=1, nPorts=1, @@ -26,7 +27,7 @@ model HeatPump "Example for the reversible heat pump model." startTime=500, height=25, offset=278) - "Ramp signal for the temperature input of the source side's ideal mass flow source" + "Ramp signal for the temperature input of the source side's ideal flow" annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}))); Modelica.Blocks.Sources.Constant T_amb_internal(k=291.15) annotation (Placement(transformation(extent={{10,-10},{-10,10}}, @@ -39,7 +40,7 @@ model HeatPump "Example for the reversible heat pump model." use_busConnectorOnly=false, QUse_flow_nominal=1000, cpCon=4184, - mEva_flow_nominal=sourceSideMassFlowSource.m_flow, + mEva_flow_nominal=mSouStep.offset, y_nominal=1, TCon_nominal=313.15, dTCon_nominal=7, @@ -61,12 +62,10 @@ model HeatPump "Example for the reversible heat pump model." cpEva=4184, redeclare model BlaBoxHPHeating = IBPSA.Fluid.HeatPumps.BlackBoxData.EuropeanNorm2D ( - QConBlackBox_flow_nominal=3315, redeclare IBPSA.Fluid.HeatPumps.BlackBoxData.Frosting.NoFrosting iceFacCalc, dataTable= - IBPSA.Fluid.HeatPumps.BlackBoxData.EuropeanNom2D.EN14511.Vitocal200AWO201 - ()), + IBPSA.Fluid.HeatPumps.BlackBoxData.EuropeanNom2D.EN14511.Vitocal200AWO201()), redeclare model BlaBoxHPCooling = IBPSA.Fluid.Chillers.BlackBoxData.BlackBox.LookUpTable2D (smoothness= Modelica.Blocks.Types.Smoothness.LinearSegments, dataTable= @@ -179,6 +178,14 @@ model HeatPump "Example for the reversible heat pump model." uLow=273.15 + 15, uHigh=273.15 + 19) annotation (Placement(transformation(extent={{40,60},{20,80}}))); + Modelica.Blocks.Sources.Pulse mSouStep( + amplitude=-1, + width=50, + period=500, + startTime=500, + offset=1) + "Step signal for the mass flow rate source side's ideal mass flow source" + annotation (Placement(transformation(extent={{-100,-60},{-80,-40}}))); equation connect(sourceSideMassFlowSource.ports[1], heatPump.port_a2) annotation (Line( @@ -229,6 +236,8 @@ equation connect(booleanToReal.y, heatPump.ySet) annotation (Line(points={{-10,-1},{ -10,-4},{4.83333,-4},{4.83333,-11.16}}, color={0,0,127})); + connect(mSouStep.y, sourceSideMassFlowSource.m_flow_in) + annotation (Line(points={{-79,-50},{-62,-50},{-62,-62}}, color={0,0,127})); annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}})), experiment(Tolerance=1e-6, StopTime=3600), diff --git a/IBPSA/Fluid/HeatPumps/HeatPump.mo b/IBPSA/Fluid/HeatPumps/HeatPump.mo index 78f0a7caa2..c2e1abcba5 100644 --- a/IBPSA/Fluid/HeatPumps/HeatPump.mo +++ b/IBPSA/Fluid/HeatPumps/HeatPump.mo @@ -41,6 +41,8 @@ model HeatPump "Safety control parameters" annotation (Dialog(enable=use_safetyControl, group="Safety Control"), choicesAllMatching=true); IBPSA.Fluid.HeatPumps.SafetyControls.SafetyControl safetyControl( + final mEva_flow_nominal=mEva_flow_nominal_final*scalingFactor, + final mCon_flow_nominal=mCon_flow_nominal_final*scalingFactor, safetyControlParameters=safetyControlParameters) if use_safetyControl annotation (Placement(transformation(extent={{-60,-20},{-40,0}}))); diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/AntiFreeze.mo b/IBPSA/Fluid/HeatPumps/SafetyControls/AntiFreeze.mo index bbacd8d0f2..e9c84f34c8 100644 --- a/IBPSA/Fluid/HeatPumps/SafetyControls/AntiFreeze.mo +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/AntiFreeze.mo @@ -1,6 +1,6 @@ within IBPSA.Fluid.HeatPumps.SafetyControls; model AntiFreeze "Model to prevent source from freezing" - extends BaseClasses.PartialSafetyControl; + extends BaseClasses.PartialSafetyControlWithErrors; parameter Boolean use_antFre=true "True if anti freeze control is part of safety control" annotation(choices(checkBox=true)); @@ -25,14 +25,6 @@ model AntiFreeze "Model to prevent source from freezing" equation connect(ySet,swiErr.u1) annotation (Line(points={{-136,20},{32,20},{32,8},{ 78,8}}, color={0,0,127})); - connect(booConAntFre.y, swiErr.u2) annotation (Line( - points={{21,-30},{42,-30},{42,0},{78,0}}, - color={255,0,255}, - pattern=LinePattern.Dash)); - connect(hysteresis.y, swiErr.u2) annotation (Line( - points={{-39,-10},{6,-10},{6,0},{78,0}}, - color={255,0,255}, - pattern=LinePattern.Dash)); connect(modeSet, modeOut) annotation (Line(points={{-136,-20},{-114,-20},{ -114,-64},{96,-64},{96,-20},{130,-20}}, color={255,0,255})); connect(min.y, hysteresis.u) annotation (Line(points={{-79,-10},{-62,-10}}, @@ -55,11 +47,14 @@ equation extent={{-6,3},{-6,3}}, horizontalAlignment=TextAlignment.Right)); - connect(hysteresis.y, not1.u) annotation (Line(points={{-39,-10},{-28,-10},{ - -28,-56},{-42,-56},{-42,-100}}, - color={255,0,255})); - connect(booConAntFre.y, not1.u) annotation (Line(points={{21,-30},{36,-30},{ - 36,-56},{-42,-56},{-42,-100}}, color={255,0,255})); + connect(booConAntFre.y, booleanPassThrough.u) annotation (Line( + points={{21,-30},{28,-30},{28,0},{38,0}}, + color={255,0,255}, + pattern=LinePattern.Dash)); + connect(hysteresis.y, booleanPassThrough.u) annotation (Line( + points={{-39,-10},{0,-10},{0,0},{38,0}}, + color={255,0,255}, + pattern=LinePattern.Dash)); annotation (Documentation(revisions="
- Given an input of the x and y-Axis, the block returns true if the - given point is outside of the given envelope. -
-- The maximal and minmal y-value depend on the x-Value and are defined - by the upper and lower boundaries in form of 1Ds-Tables. The maximal - and minimal x-values are obtained trough the table and are constant. -
-- Icon block used for the icon of the dynamic icon of the model - - BoundaryMap. Extending this model will display the used - operational envelope in the top-layer of the used models. -
-")); - end BoundaryMapIcon; - - partial block PartialSafetyControl "Base Block" - Modelica.Blocks.Interfaces.RealInput ySet - "Set value relative speed of compressor. Analog from 0 to 1" - annotation (Placement(transformation(extent={{-152,4},{-120,36}}))); - Modelica.Blocks.Interfaces.RealOutput yOut - "Relative speed of compressor. From 0 to 1" - annotation (Placement(transformation(extent={{120,10},{140,30}}))); - Modelica.Blocks.Logical.Switch swiErr - "If an error occurs, the value of the conZero block will be used(0)" - annotation (Placement(transformation(extent={{80,-10},{100,10}}))); - Modelica.Blocks.Sources.Constant conZer(final k=0) - "If an error occurs, the compressor speed is set to zero" - annotation (Placement(transformation(extent={{40,-40},{60,-20}}))); - Interfaces.VapourCompressionMachineControlBus sigBusHP - "Bus-connector for the heat pump" - annotation (Placement(transformation(extent={{-146,-84},{-112,-54}}))); - Modelica.Blocks.Interfaces.BooleanOutput modeOut - "Heat pump mode, =true: heating, =false: chilling" - annotation (Placement(transformation(extent={{120,-30},{140,-10}}))); - Modelica.Blocks.Interfaces.BooleanInput modeSet "Set value of heat pump mode" - annotation (Placement(transformation(extent={{-152,-36},{-120,-4}}))); - Modelica.Blocks.MathInteger.TriggeredAdd disErr( - y_start=0, - use_reset=false, - use_set=false) - "Used to show if the error was triggered" annotation (Placement( - transformation( - extent={{-10,-10},{10,10}}, - rotation=270, - origin={0,-100}))); - Modelica.Blocks.Interfaces.IntegerOutput ERR - "Integer for displaying number off Errors during simulation" - annotation (Placement( - transformation( - extent={{-10,-10},{10,10}}, - rotation=270, - origin={0,-130}))); - Modelica.Blocks.Logical.Not not1 annotation (Placement(transformation( - extent={{-10,-10},{10,10}}, - rotation=0, - origin={-30,-100}))); - Modelica.Blocks.Sources.IntegerConstant intConOne(final k=1) - "Used for display of current error" - annotation (Placement(transformation(extent={{60,-110},{40,-90}}))); - equation - connect(conZer.y,swiErr. u3) annotation (Line(points={{61,-30},{70,-30},{70, - -8},{78,-8}}, color={0,0,127})); - connect(swiErr.y,yOut) annotation (Line(points={{101,0},{110,0},{110,20},{ - 130,20}}, color={0,0,127})); - connect(disErr.y, ERR) annotation (Line(points={{-2.22045e-15,-112},{ - -2.22045e-15,-119},{0,-119},{0,-130}}, color={255,127,0})); - connect(not1.y, disErr.trigger) annotation (Line(points={{-19,-100},{-12, - -100},{-12,-94}}, color={255,0,255})); - connect(intConOne.y, disErr.u) annotation (Line(points={{39,-100},{20,-100}, - {20,-78},{0,-78},{0,-86}}, - color={255,127,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-120, - -120},{120,120}}), graphics={ - Polygon( - points={{-42,20},{0,62},{-42,20}}, - lineColor={28,108,200}, - fillColor={0,0,0}, - fillPattern=FillPattern.Solid), - Ellipse( - extent={{-48,-26},{48,66}}, - lineColor={0,0,0}, - fillColor={91,91,91}, - fillPattern=FillPattern.Solid), - Ellipse( - extent={{-36,-14},{36,54}}, - lineColor={0,0,0}, - fillColor={255,255,255}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-60,20},{60,-80}}, - lineColor={0,0,0}, - fillColor={91,91,91}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-10,-30},{10,-70}}, - lineColor={0,0,0}, - fillColor={255,255,255}, - fillPattern=FillPattern.Solid), - Ellipse( - extent={{-14,-40},{16,-12}}, - lineColor={0,0,0}, - fillColor={255,255,255}, - fillPattern=FillPattern.Solid), - Text( - extent={{-104,100},{106,76}}, - lineColor={28,108,200}, - lineThickness=0.5, - fillColor={255,255,255}, - fillPattern=FillPattern.None, - textString="%name"), - Rectangle( - extent={{-120,120},{120,-120}}, - lineColor={28,108,200}, - lineThickness=0.5, - fillColor={255,255,255}, - fillPattern=FillPattern.None)}), - Diagram(coordinateSystem( - preserveAspectRatio=false, extent={{-120,-120},{120,120}})), - Documentation(revisions="- Partial block for a safety control. Based on the signals in the - sigBusHP either the input signals are equal to the output signals or, - if an error occurs, set to 0. -
-- The Output ERR informs about the number of errors in the specific - safety block. -
-")); - end PartialSafetyControl; - - block RunPerHouBoundary "Checks if a maximal run per hour value is in boundary" - extends Modelica.Blocks.Interfaces.BooleanSISO; - parameter Integer maxRunPer_h "Number of maximal on/off cycles per hour"; - parameter Modelica.Units.SI.Time delayTime(displayUnit="h") = 3600 - "Delay time of output with respect to input signal"; - Modelica.Blocks.Logical.LessThreshold - runCouLesMax(threshold=maxRunPer_h) - "Checks if the count of total runs is lower than the maximal value" - annotation (Placement(transformation(extent={{70,-10},{90,10}}))); - Modelica.Blocks.MathInteger.TriggeredAdd triggeredAdd - annotation (Placement(transformation(extent={{-60,10},{-40,-10}}))); - Modelica.Blocks.Sources.IntegerConstant intConPluOne(final k=1) - "Value for counting" - annotation (Placement(transformation(extent={{-100,-30},{-80,-10}}))); - Modelica.Blocks.Math.IntegerToReal intToReal - annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); - Modelica.Blocks.Math.Add sub(k2=-1) - annotation (Placement(transformation(extent={{40,-10},{60,10}}))); - Modelica.Blocks.Nonlinear.FixedDelay fixedDelay(final delayTime(displayUnit= - "h") = delayTime) - annotation (Placement(transformation(extent={{10,-30},{30,-10}}))); - equation - connect(intConPluOne.y, triggeredAdd.u) - annotation (Line(points={{-79,-20},{-74,-20},{-74,0},{-64,0}}, - color={255,127,0})); - connect(intToReal.u, triggeredAdd.y) - annotation (Line(points={{-22,0},{-38,0}}, color={255,127,0})); - connect(intToReal.y, sub.u1) annotation (Line(points={{1,0},{30,0},{30,6},{ - 38,6}}, color={0,0,127})); - connect(intToReal.y, fixedDelay.u) - annotation (Line(points={{1,0},{6,0},{6,-20},{8,-20}}, color={0,0,127})); - connect(fixedDelay.y, sub.u2) annotation (Line(points={{31,-20},{31,-6},{38, - -6}}, color={0,0,127})); - connect(runCouLesMax.y, y) - annotation (Line(points={{91,0},{110,0}}, color={255,0,255})); - connect(u, triggeredAdd.trigger) annotation (Line(points={{-120,0},{-80,0}, - {-80,20},{-56,20},{-56,12}}, color={255,0,255})); - connect(sub.y, runCouLesMax.u) annotation (Line(points={{61,0},{68,0}}, - color={0,0,127})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ - Rectangle( - extent={{-100,-100},{100,100}}, - lineColor={0,0,127}, - fillColor={255,255,255}, - fillPattern=FillPattern.Solid), - Ellipse(extent={{-80,80},{80,-80}}, lineColor={160,160,164}), - Line(points={{0,80},{0,60}}, color={160,160,164}), - Line(points={{80,0},{60,0}}, color={160,160,164}), - Line(points={{0,-80},{0,-60}}, color={160,160,164}), - Line(points={{-80,0},{-60,0}}, color={160,160,164}), - Line(points={{37,70},{26,50}}, color={160,160,164}), - Line(points={{70,38},{49,26}}, color={160,160,164}), - Line(points={{71,-37},{52,-27}}, color={160,160,164}), - Line(points={{39,-70},{29,-51}}, color={160,160,164}), - Line(points={{-39,-70},{-29,-52}}, color={160,160,164}), - Line(points={{-71,-37},{-50,-26}}, color={160,160,164}), - Line(points={{-71,37},{-54,28}}, color={160,160,164}), - Line(points={{-38,70},{-28,51}}, color={160,160,164}), - Line( - points={{0,0},{-50,50}}, - thickness=0.5), - Line( - points={{0,0},{40,0}}, - thickness=0.5)}), Diagram( - coordinateSystem(preserveAspectRatio=false)), - Documentation(info="- Everytime the boolean input signal has a rising edge, a counter is - triggered and adds 1 to the total sum. This represents an on-turning - of a certain device. With a delay this number is being substracted - again, as this block counts the number of rising edges in a given - amount of time(e.g. 1 hour). If this value is higher than a given - maximal value, the output turns to false. -
-- When the input is true, a timer thats counting seconds until it is - false again. As long as the counted time is smaller than a given - minimal time, the block yields false. -
-- This block is used to check the mimimal run- or loctime of a device. -
-- This package contains base classes that are used to construct the - models in SafetyControls -
-")); -end BaseClasses; diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/BoundaryMap.mo b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/BoundaryMap.mo new file mode 100644 index 0000000000..3ac564b764 --- /dev/null +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/BoundaryMap.mo @@ -0,0 +1,102 @@ +within IBPSA.Fluid.HeatPumps.SafetyControls.BaseClasses; +block BoundaryMap + "Block which returns false if the input parameters are out of the given charasteristic map. +For the boundaries of the y-input value, a dynamic hysteresis is used to ensure a used device will stay off a certain time after shutdown." + extends IBPSA.Fluid.HeatPumps.SafetyControls.BaseClasses.BoundaryMapIcon( + final iconMin=-70, final iconMax=70); + parameter Real dx "Delta value used for both upper and lower hysteresis. Used to avoid state events when used as a safety control." + annotation (Dialog(tab="Safety Control", group="Operational Envelope")); + Modelica.Blocks.Interfaces.BooleanOutput noErr + "If an error occurs, this will be false" + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); + Modelica.Blocks.Interfaces.RealInput x_in "Current value of x-Axis" + annotation (Placement(transformation(extent={{-128,46},{-100,74}}))); + Modelica.Blocks.Interfaces.RealInput y_in "Current value on y-Axis" + annotation (Placement(transformation(extent={{-128,-74},{-100,-46}}))); + + Modelica.Blocks.Tables.CombiTable1Ds uppCombiTable1Ds( + final table=tableUpp_internal, + final smoothness= Modelica.Blocks.Types.Smoothness.LinearSegments, + final tableOnFile=false) + annotation (Placement(transformation(extent={{-60,60},{-40,80}}))); + Modelica.Blocks.MathBoolean.Nor + nor1( + nu=3) + annotation (Placement(transformation(extent={{60,-10},{80,10}}))); + IBPSA.Utilities.Logical.DynamicHysteresis lessUpp(final pre_y_start=false) + annotation (Placement(transformation(extent={{20,60},{40,80}}))); + Modelica.Blocks.Logical.Less lessLef + annotation (Placement(transformation(extent={{20,-40},{40,-20}}))); + Modelica.Blocks.Logical.Greater greaterRig + annotation (Placement(transformation(extent={{20,-80},{40,-60}}))); + Modelica.Blocks.Sources.Constant conXMin(k=xMin) + annotation (Placement(transformation(extent={{-60,-60},{-40,-40}}))); + Modelica.Blocks.Sources.Constant conXMax(k=xMax) + annotation (Placement(transformation(extent={{-58,-98},{-40,-80}}))); + + Modelica.Blocks.Math.Add addUpp(final k2=-1) + annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + Modelica.Blocks.Sources.Constant constDx(final k=dx) + annotation (Placement(transformation(extent={{-60,20},{-40,40}}))); + +equation + connect(x_in, uppCombiTable1Ds.u) + annotation (Line(points={{-114,60},{-70,60},{-70,70},{-62,70}}, + color={0,0,127})); + connect(nor1.y, noErr) + annotation (Line(points={{81.5,0},{110,0}}, color={255,0,255})); + connect(lessUpp.y, nor1.u[1]) annotation (Line(points={{41,70},{50,70},{50, + -2.33333},{60,-2.33333}}, + color={255,0,255})); + connect(lessLef.y, nor1.u[2]) annotation (Line(points={{41,-30},{50,-30},{ + 50,0},{60,0}}, color={255,0,255})); + connect(greaterRig.y, nor1.u[3]) annotation (Line(points={{41,-70},{50,-70}, + {50,2.33333},{60,2.33333}}, + color={255,0,255})); + connect(x_in, lessLef.u1) annotation (Line(points={{-114,60},{-72,60},{-72, + -30},{18,-30}}, + color={0,0,127})); + connect(x_in, greaterRig.u1) annotation (Line(points={{-114,60},{-72,60},{ + -72,-30},{-64,-30},{-64,-70},{18,-70}}, + color={0,0,127})); + connect(conXMax.y, greaterRig.u2) annotation (Line(points={{-39.1,-89},{10, + -89},{10,-78},{18,-78}}, + color={0,0,127})); + connect(conXMin.y, lessLef.u2) annotation (Line(points={{-39,-50},{-10,-50}, + {-10,-38},{18,-38}}, + color={0,0,127})); + connect(y_in, lessUpp.u) annotation (Line(points={{-114,-60},{-90,-60},{-90, + 94},{12,94},{12,70},{18,70}}, + color={0,0,127})); + connect(uppCombiTable1Ds.y[1], lessUpp.uHigh) annotation (Line(points={{-39,70}, + {8,70},{8,52},{33,52},{33,58}}, color={0,0,127})); + connect(lessUpp.uLow, addUpp.y) annotation (Line(points={{25,58},{24,58},{ + 24,50},{1,50}}, + color={0,0,127})); + connect(uppCombiTable1Ds.y[1], addUpp.u1) annotation (Line(points={{-39,70}, + {-34,70},{-34,56},{-22,56}}, + color={0,0,127})); + connect(addUpp.u2, constDx.y) annotation (Line(points={{-22,44},{-34,44},{ + -34,30},{-39,30}}, + color={0,0,127})); + annotation (Diagram( + coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}})), + Documentation(info="+ Given an input of the x and y-Axis, the block returns true if the + given point is outside of the given envelope. +
++ The maximal and minmal y-value depend on the x-Value and are defined + by the upper and lower boundaries in form of 1Ds-Tables. The maximal + and minimal x-values are obtained trough the table and are constant. +
++ Icon block used for the icon of the dynamic icon of the model + + BoundaryMap. Extending this model will display the used + operational envelope in the top-layer of the used models. +
+")); +end BoundaryMapIcon; diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/PartialSafetyControl.mo b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/PartialSafetyControl.mo new file mode 100644 index 0000000000..c820ce4c1d --- /dev/null +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/PartialSafetyControl.mo @@ -0,0 +1,82 @@ +within IBPSA.Fluid.HeatPumps.SafetyControls.BaseClasses; +partial block PartialSafetyControl "Safety control with I/O" + Modelica.Blocks.Interfaces.RealInput ySet + "Set value relative speed of compressor. Analog from 0 to 1" + annotation (Placement(transformation(extent={{-152,4},{-120,36}}))); + Modelica.Blocks.Interfaces.RealOutput yOut + "Relative speed of compressor. From 0 to 1" + annotation (Placement(transformation(extent={{120,10},{140,30}}))); + Interfaces.VapourCompressionMachineControlBus sigBusHP + "Bus-connector for the heat pump" + annotation (Placement(transformation(extent={{-146,-84},{-112,-54}}))); + Modelica.Blocks.Interfaces.BooleanOutput modeOut + "Heat pump mode, =true: heating, =false: chilling" + annotation (Placement(transformation(extent={{120,-30},{140,-10}}))); + Modelica.Blocks.Interfaces.BooleanInput modeSet "Set value of heat pump mode" + annotation (Placement(transformation(extent={{-152,-36},{-120,-4}}))); + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-120, + -120},{120,120}}), graphics={ + Polygon( + points={{-42,20},{0,62},{-42,20}}, + lineColor={28,108,200}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-48,-26},{48,66}}, + lineColor={0,0,0}, + fillColor={91,91,91}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-36,-14},{36,54}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-60,20},{60,-80}}, + lineColor={0,0,0}, + fillColor={91,91,91}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-10,-30},{10,-70}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-14,-40},{16,-12}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Text( + extent={{-104,100},{106,76}}, + lineColor={28,108,200}, + lineThickness=0.5, + fillColor={255,255,255}, + fillPattern=FillPattern.None, + textString="%name"), + Rectangle( + extent={{-120,120},{120,-120}}, + lineColor={28,108,200}, + lineThickness=0.5, + fillColor={255,255,255}, + fillPattern=FillPattern.None)}), + Diagram(coordinateSystem( + preserveAspectRatio=false, extent={{-120,-120},{120,120}})), + Documentation(revisions="+ Partial block for a safety control. Based on the signals in the + sigBusHP either the input signals are equal to the output signals or, + if an error occurs, set to 0. +
++ The Output ERR informs about the number of errors in the specific + safety block. +
+")); +end PartialSafetyControl; diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/PartialSafetyControlWithErrors.mo b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/PartialSafetyControlWithErrors.mo new file mode 100644 index 0000000000..a5084b998a --- /dev/null +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/PartialSafetyControlWithErrors.mo @@ -0,0 +1,117 @@ +within IBPSA.Fluid.HeatPumps.SafetyControls.BaseClasses; +partial block PartialSafetyControlWithErrors "Safety control which adds an error counter to the I/O" + extends PartialSafetyControl; + + Modelica.Blocks.Logical.Switch swiErr + "If an error occurs, the value of the conZero block will be used(0)" + annotation (Placement(transformation(extent={{80,-10},{100,10}}))); + Modelica.Blocks.Sources.Constant conZer(final k=0) + "If an error occurs, the compressor speed is set to zero" + annotation (Placement(transformation(extent={{40,-40},{60,-20}}))); + Modelica.Blocks.MathInteger.TriggeredAdd disErr( + y_start=0, + use_reset=false, + use_set=false) + "Used to show if the error was triggered" annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={0,-100}))); + Modelica.Blocks.Interfaces.IntegerOutput ERR + "Integer for displaying number off Errors during simulation" + annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={0,-130}))); + Modelica.Blocks.Logical.Not not1 annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,-100}))); + Modelica.Blocks.Sources.IntegerConstant intConOne(final k=1) + "Used for display of current error" + annotation (Placement(transformation(extent={{60,-110},{40,-90}}))); + Modelica.Blocks.Routing.BooleanPassThrough booleanPassThrough + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); +equation + connect(conZer.y,swiErr. u3) annotation (Line(points={{61,-30},{70,-30},{70, + -8},{78,-8}}, color={0,0,127})); + connect(disErr.y, ERR) annotation (Line(points={{-2.22045e-15,-112},{ + -2.22045e-15,-119},{0,-119},{0,-130}}, color={255,127,0})); + connect(not1.y, disErr.trigger) annotation (Line(points={{-19,-100},{-12, + -100},{-12,-94}}, color={255,0,255})); + connect(intConOne.y, disErr.u) annotation (Line(points={{39,-100},{20,-100}, + {20,-78},{0,-78},{0,-86}}, + color={255,127,0})); + connect(booleanPassThrough.y, swiErr.u2) + annotation (Line(points={{61,0},{78,0}}, color={255,0,255})); + connect(booleanPassThrough.y, not1.u) annotation (Line(points={{61,0},{66,0},{ + 66,-74},{-48,-74},{-48,-100},{-42,-100}}, color={255,0,255})); + connect(swiErr.y, yOut) annotation (Line(points={{101,0},{110,0},{110,20},{ + 130,20}}, color={0,0,127})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-120, + -120},{120,120}}), graphics={ + Polygon( + points={{-42,20},{0,62},{-42,20}}, + lineColor={28,108,200}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-48,-26},{48,66}}, + lineColor={0,0,0}, + fillColor={91,91,91}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-36,-14},{36,54}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-60,20},{60,-80}}, + lineColor={0,0,0}, + fillColor={91,91,91}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-10,-30},{10,-70}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-14,-40},{16,-12}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Text( + extent={{-104,100},{106,76}}, + lineColor={28,108,200}, + lineThickness=0.5, + fillColor={255,255,255}, + fillPattern=FillPattern.None, + textString="%name"), + Rectangle( + extent={{-120,120},{120,-120}}, + lineColor={28,108,200}, + lineThickness=0.5, + fillColor={255,255,255}, + fillPattern=FillPattern.None)}), + Diagram(coordinateSystem( + preserveAspectRatio=false, extent={{-120,-120},{120,120}})), + Documentation(revisions="+ Partial block for a safety control. Based on the signals in the + sigBusHP either the input signals are equal to the output signals or, + if an error occurs, set to 0. +
++ The Output ERR informs about the number of errors in the specific + safety block. +
+")); +end PartialSafetyControlWithErrors; diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/RunPerHouBoundary.mo b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/RunPerHouBoundary.mo new file mode 100644 index 0000000000..2021f1bf13 --- /dev/null +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/RunPerHouBoundary.mo @@ -0,0 +1,83 @@ +within IBPSA.Fluid.HeatPumps.SafetyControls.BaseClasses; +block RunPerHouBoundary "Checks if a maximal run per hour value is in boundary" + extends Modelica.Blocks.Interfaces.BooleanSISO; + parameter Integer maxRunPer_h "Number of maximal on/off cycles per hour"; + parameter Modelica.Units.SI.Time delayTime(displayUnit="h") = 3600 + "Delay time of output with respect to input signal"; + Modelica.Blocks.Logical.LessThreshold + runCouLesMax(threshold=maxRunPer_h) + "Checks if the count of total runs is lower than the maximal value" + annotation (Placement(transformation(extent={{70,-10},{90,10}}))); + Modelica.Blocks.MathInteger.TriggeredAdd triggeredAdd + annotation (Placement(transformation(extent={{-60,10},{-40,-10}}))); + Modelica.Blocks.Sources.IntegerConstant intConPluOne(final k=1) + "Value for counting" + annotation (Placement(transformation(extent={{-100,-30},{-80,-10}}))); + Modelica.Blocks.Math.IntegerToReal intToReal + annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); + Modelica.Blocks.Math.Add sub(k2=-1) + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + Modelica.Blocks.Nonlinear.FixedDelay fixedDelay(final delayTime(displayUnit= + "h") = delayTime) + annotation (Placement(transformation(extent={{10,-30},{30,-10}}))); +equation + connect(intConPluOne.y, triggeredAdd.u) + annotation (Line(points={{-79,-20},{-74,-20},{-74,0},{-64,0}}, + color={255,127,0})); + connect(intToReal.u, triggeredAdd.y) + annotation (Line(points={{-22,0},{-38,0}}, color={255,127,0})); + connect(intToReal.y, sub.u1) annotation (Line(points={{1,0},{30,0},{30,6},{ + 38,6}}, color={0,0,127})); + connect(intToReal.y, fixedDelay.u) + annotation (Line(points={{1,0},{6,0},{6,-20},{8,-20}}, color={0,0,127})); + connect(fixedDelay.y, sub.u2) annotation (Line(points={{31,-20},{31,-6},{38, + -6}}, color={0,0,127})); + connect(runCouLesMax.y, y) + annotation (Line(points={{91,0},{110,0}}, color={255,0,255})); + connect(u, triggeredAdd.trigger) annotation (Line(points={{-120,0},{-80,0}, + {-80,20},{-56,20},{-56,12}}, color={255,0,255})); + connect(sub.y, runCouLesMax.u) annotation (Line(points={{61,0},{68,0}}, + color={0,0,127})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle( + extent={{-100,-100},{100,100}}, + lineColor={0,0,127}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Ellipse(extent={{-80,80},{80,-80}}, lineColor={160,160,164}), + Line(points={{0,80},{0,60}}, color={160,160,164}), + Line(points={{80,0},{60,0}}, color={160,160,164}), + Line(points={{0,-80},{0,-60}}, color={160,160,164}), + Line(points={{-80,0},{-60,0}}, color={160,160,164}), + Line(points={{37,70},{26,50}}, color={160,160,164}), + Line(points={{70,38},{49,26}}, color={160,160,164}), + Line(points={{71,-37},{52,-27}}, color={160,160,164}), + Line(points={{39,-70},{29,-51}}, color={160,160,164}), + Line(points={{-39,-70},{-29,-52}}, color={160,160,164}), + Line(points={{-71,-37},{-50,-26}}, color={160,160,164}), + Line(points={{-71,37},{-54,28}}, color={160,160,164}), + Line(points={{-38,70},{-28,51}}, color={160,160,164}), + Line( + points={{0,0},{-50,50}}, + thickness=0.5), + Line( + points={{0,0},{40,0}}, + thickness=0.5)}), Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info="+ Everytime the boolean input signal has a rising edge, a counter is + triggered and adds 1 to the total sum. This represents an on-turning + of a certain device. With a delay this number is being substracted + again, as this block counts the number of rising edges in a given + amount of time(e.g. 1 hour). If this value is higher than a given + maximal value, the output turns to false. +
++ When the input is true, a timer thats counting seconds until it is + false again. As long as the counted time is smaller than a given + minimal time, the block yields false. +
++ This block is used to check the mimimal run- or loctime of a device. +
++ This package contains base classes that are used to construct the + models in SafetyControls +
+")); +end BaseClasses; diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/package.order b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/package.order new file mode 100644 index 0000000000..876f2c0dfb --- /dev/null +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/BaseClasses/package.order @@ -0,0 +1,6 @@ +BoundaryMap +BoundaryMapIcon +PartialSafetyControl +PartialSafetyControlWithErrors +RunPerHouBoundary +TimeControl diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/DefrostControl.mo b/IBPSA/Fluid/HeatPumps/SafetyControls/DefrostControl.mo index eb1ea667b0..bed44101a7 100644 --- a/IBPSA/Fluid/HeatPumps/SafetyControls/DefrostControl.mo +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/DefrostControl.mo @@ -1,7 +1,7 @@ within IBPSA.Fluid.HeatPumps.SafetyControls; block DefrostControl "Control block to ensure no frost limits heat flow at the evaporator" - extends IBPSA.Fluid.HeatPumps.SafetyControls.BaseClasses.PartialSafetyControl; + extends IBPSA.Fluid.HeatPumps.SafetyControls.BaseClasses.PartialSafetyControlWithErrors; parameter Real minIceFac "Minimal value above which no defrost is necessary"; parameter Boolean use_chiller=true "True if defrost operates by changing mode to cooling. False to use an electrical heater" annotation(choices(checkBox=true)); @@ -64,10 +64,10 @@ block DefrostControl Modelica.Blocks.Sources.BooleanConstant conFalseNotUseChi(final k=true) if not use_chiller "Just to omit warnings" - annotation (Placement(transformation(extent={{30,-100},{40,-90}}))); - Modelica.Blocks.Sources.BooleanConstant conTrueUseChi(final k=false) + annotation (Placement(transformation(extent={{20,-80},{40,-60}}))); + Modelica.Blocks.Sources.BooleanConstant conTrueUseChi(final k=not use_chiller) if use_chiller "Set mode to false to simulate the defrost cycle" - annotation (Placement(transformation(extent={{30,-88},{40,-78}}))); + annotation (Placement(transformation(extent={{20,-80},{40,-60}}))); equation connect(ySet, swiErr.u1) annotation (Line(points={{-136,20},{74,20},{74,8},{ 78,8}}, @@ -84,13 +84,8 @@ equation connect(Pel_deFro, swiPel.y) annotation (Line(points={{0,128},{0,111.5},{8.88178e-16,111.5},{8.88178e-16, 101}}, color={0,0,127})); - connect(conTrueNotUseChi.y, swiErr.u2) annotation (Line( - points={{-19,0},{78,0}}, - color={255,0,255}, - pattern=LinePattern.Dash)); connect(iceFacGreMinHea.y, swiPel.u2) annotation (Line( - points={{-17.95,-69.5},{-8,-69.5},{-8,-70},{0,-70},{0,4},{-6.66134e-16,4}, - {-6.66134e-16,78}}, + points={{-17.95,-69.5},{0,-69.5},{0,4},{-6.66134e-16,4},{-6.66134e-16,78}}, color={255,0,255}, pattern=LinePattern.Dash)); @@ -111,34 +106,29 @@ equation index=-1, extent={{-6,3},{-6,3}}, horizontalAlignment=TextAlignment.Right)); - connect(iceFacGreMinChi.y, swiErr.u2) annotation (Line( - points={{-17.95,-29.5},{-12,-29.5},{-12,0},{78,0}}, - color={255,0,255}, - pattern=LinePattern.Dash)); connect(logicalSwitch.y, modeOut) annotation (Line(points={{101,-50},{116,-50}, {116,-20},{130,-20}},color={255,0,255})); connect(modeSet, logicalSwitch.u1) annotation (Line(points={{-136,-20},{-110, -20},{-110,18},{12,18},{12,-42},{78,-42}}, color={255,0,255})); - connect(conTrueNotUseChi.y, logicalSwitch.u2) annotation (Line( - points={{-19,0},{72,0},{72,-36},{78,-36},{78,-50}}, + connect(conFalseNotUseChi.y, logicalSwitch.u3) annotation (Line( + points={{41,-70},{66,-70},{66,-58},{78,-58}}, color={255,0,255}, pattern=LinePattern.Dash)); - connect(conFalseNotUseChi.y, logicalSwitch.u3) annotation (Line( - points={{40.5,-95},{26,-95},{26,-58},{78,-58}}, + connect(conTrueUseChi.y, logicalSwitch.u3) annotation (Line( + points={{41,-70},{66,-70},{66,-58},{78,-58}}, color={255,0,255}, pattern=LinePattern.Dash)); - connect(iceFacGreMinChi.y, logicalSwitch.u2) annotation (Line( - points={{-17.95,-29.5},{-12,-29.5},{-12,0},{10,0},{10,-50},{78,-50}}, + connect(conTrueNotUseChi.y, booleanPassThrough.u) annotation (Line( + points={{-19,0},{38,0}}, color={255,0,255}, pattern=LinePattern.Dash)); - connect(conTrueUseChi.y, logicalSwitch.u3) annotation (Line( - points={{40.5,-83},{66,-83},{66,-58},{78,-58}}, + connect(iceFacGreMinChi.y, booleanPassThrough.u) annotation (Line( + points={{-17.95,-29.5},{20,-29.5},{20,0},{38,0}}, color={255,0,255}, pattern=LinePattern.Dash)); - connect(not1.u, logicalSwitch.y) annotation (Line(points={{-42,-100},{-48, - -100},{-48,-116},{108,-116},{108,-50},{101,-50}}, - color={255,0,255})); + connect(booleanPassThrough.y, logicalSwitch.u2) annotation (Line(points={{61,0}, + {66,0},{66,-50},{78,-50}}, color={255,0,255})); annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-120, -120},{120,120}}), graphics={ Rectangle( diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/MinimalVolumeFlowRateSafety.mo b/IBPSA/Fluid/HeatPumps/SafetyControls/MinimalVolumeFlowRateSafety.mo new file mode 100644 index 0000000000..2dc7cb7617 --- /dev/null +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/MinimalVolumeFlowRateSafety.mo @@ -0,0 +1,58 @@ +within IBPSA.Fluid.HeatPumps.SafetyControls; +block MinimalVolumeFlowRateSafety + "Safety control for minimal volume flow rate" + extends BaseClasses.PartialSafetyControlWithErrors; + parameter Boolean use_minFlowCtrl=true "=false to disable minimal mass flow rate requirements" + annotation(choices(checkBox=true)); + parameter Modelica.Units.SI.MassFlowRate m_flowEvaMin + "Minimal mass flow rate in evaporator required to operate the device" + annotation (Dialog(enable=use_minFlowCtrl)); + parameter Modelica.Units.SI.MassFlowRate m_flowConMin + "Minimal mass flow rate in condenser required to operate the device" + annotation (Dialog(enable=use_minFlowCtrl)); + Modelica.Blocks.Logical.Hysteresis hysteresisCon( + final uLow=m_flowConMin, + final uHigh=m_flowConMin*1.1, final pre_y_start=false) + if use_minFlowCtrl + "Check if condenser mass flow rate is high enough" + annotation (Placement(transformation(extent={{-60,40},{-40,60}}))); + Modelica.Blocks.Logical.Hysteresis hysteresisEva( + final uLow=m_flowEvaMin, + final uHigh=m_flowEvaMin*1.1, final pre_y_start=false) + if use_minFlowCtrl + "Check if evaporator mass flow rate is high enough" + annotation (Placement(transformation(extent={{-60,0},{-40,20}}))); + Modelica.Blocks.Logical.And and1 if use_minFlowCtrl + "Assure both are good" + annotation (Placement(transformation(extent={{-20,20},{0,40}}))); + + Modelica.Blocks.Sources.BooleanConstant + conBool(final k=true) if not use_minFlowCtrl + "Disable this safety control" + annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); +equation + connect(modeSet, modeOut) annotation (Line(points={{-136,-20},{-40,-20},{-40,-60}, + {100,-60},{100,-20},{130,-20}}, color={255,0,255})); + connect(hysteresisCon.y, and1.u1) annotation (Line(points={{-39,50},{-28,50},{ + -28,30},{-22,30}}, color={255,0,255})); + connect(hysteresisEva.y, and1.u2) annotation (Line(points={{-39,10},{-32,10},{ + -32,22},{-22,22}}, color={255,0,255})); + connect(and1.y, booleanPassThrough.u) annotation (Line(points={{1,30},{20,30}, + {20,0},{38,0}}, color={255,0,255})); + connect(hysteresisEva.u, sigBusHP.m_flowEvaMea) annotation (Line(points={{-62, + 10},{-88,10},{-88,-69},{-129,-69}}, color={0,0,127}), Text( + string="%second", + index=1, + extent={{-6,3},{-6,3}}, + horizontalAlignment=TextAlignment.Right)); + connect(hysteresisCon.u, sigBusHP.m_flowConMea) annotation (Line(points={{-62, + 50},{-98,50},{-98,-69},{-129,-69}}, color={0,0,127}), Text( + string="%second", + index=1, + extent={{-6,3},{-6,3}}, + horizontalAlignment=TextAlignment.Right)); + connect(ySet, swiErr.u1) annotation (Line(points={{-136,20},{-106,20},{-106,76}, + {72,76},{72,8},{78,8}}, color={0,0,127})); + connect(conBool.y, booleanPassThrough.u) + annotation (Line(points={{1,0},{38,0}}, color={255,0,255})); +end MinimalVolumeFlowRateSafety; diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/OnOffControl.mo b/IBPSA/Fluid/HeatPumps/SafetyControls/OnOffControl.mo index 000e12852f..83214f300e 100644 --- a/IBPSA/Fluid/HeatPumps/SafetyControls/OnOffControl.mo +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/OnOffControl.mo @@ -1,6 +1,7 @@ within IBPSA.Fluid.HeatPumps.SafetyControls; model OnOffControl "Controlls if the minimal runtime, stoptime and max. runs per hour are inside given boundaries" + extends BaseClasses.PartialSafetyControl; parameter Boolean use_minRunTime "False if minimal runtime of HP is not considered" annotation(choices(checkBox=true)); parameter Modelica.Units.SI.Time minRunTime(displayUnit="min") @@ -56,14 +57,6 @@ model OnOffControl Modelica.Blocks.Logical.And andIsOn "Check if both set and actual value are greater zero" annotation (Placement(transformation(extent={{0,0},{20,20}}))); - Modelica.Blocks.Interfaces.RealInput ySet - "Set value relative speed of compressor. Analog from 0 to 1" - annotation (Placement(transformation(extent={{-132,-16},{-100,16}}))); - Modelica.Blocks.Interfaces.RealOutput yOut - "Relative speed of compressor. From 0 to 1" - annotation (Placement(transformation(extent={{100,-10},{120,10}}))); - Interfaces.VapourCompressionMachineControlBus sigBusHP - annotation (Placement(transformation(extent={{-116,-88},{-82,-58}}))); Modelica.Blocks.Logical.Switch swinOutySet "If any of the orySet conditions is true, ySet will be passed. Else nOut will stay the same" annotation (Placement(transformation(extent={{72,-10},{92,10}}))); @@ -105,21 +98,12 @@ equation color={255,0,255}, pattern=LinePattern.Dash)); - connect(ySet,ySetGreaterZero. u) annotation (Line(points={{-116,0},{-94,0},{-94, - 34},{-88,34},{-88,70},{-82,70}}, - color={0,0,127})); connect(ySetGreaterZero.y, notSetOn.u) annotation (Line(points={{-59,70},{-52, 70},{-52,90},{-42,90}}, color={255,0,255})); connect(pre1.y, andIsOn.u2) annotation (Line(points={{-59,-90},{-52,-90},{-52, 6},{-10,6},{-10,2},{-2,2}}, color={255,0,255})); connect(ySetGreaterZero.y, andIsOn.u1) annotation (Line(points={{-59,70},{-52, 70},{-52,10},{-2,10}}, color={255,0,255})); - connect(yOut,yOut) - annotation (Line(points={{110,0},{110,0}}, color={0,0,127})); - connect(swinOutySet.y,yOut) - annotation (Line(points={{93,0},{110,0}}, color={0,0,127})); - connect(ySet, swinOutySet.u1) annotation (Line(points={{-116,0},{-94,0},{-94,34}, - {66,34},{66,8},{70,8}}, color={0,0,127})); connect(andTurnOff.y, andRun.u1) annotation (Line(points={{21,90},{58,90}}, color={255,0,255})); connect(orSetN.y, swinOutySet.u2) @@ -158,21 +142,28 @@ equation points={{-19,-50},{22,-50},{22,-30},{38,-30}}, color={255,0,255}, pattern=LinePattern.Dash)); - connect(pre1.u, sigBusHP.onOffMea) annotation (Line(points={{-82,-90},{-82,-72}, - {-84,-72},{-84,-74},{-86,-74},{-86,-73},{-99,-73}}, - color={255,0,255}), Text( + + connect(swinOutySet.y, yOut) annotation (Line(points={{93,0},{110,0},{110,20}, + {130,20}}, color={0,0,127})); + connect(modeSet, modeOut) annotation (Line(points={{-136,-20},{-114,-20},{ + -114,-116},{114,-116},{114,-20},{130,-20}}, color={255,0,255})); + connect(swinOutySet.u3, sigBusHP.ySet) annotation (Line(points={{70,-8},{64, + -8},{64,-18},{108,-18},{108,-114},{-108,-114},{-108,-69},{-129,-69}}, + color={0,0,127}), Text( string="%second", index=1, extent={{-6,3},{-6,3}}, horizontalAlignment=TextAlignment.Right)); - - connect(swinOutySet.u3, sigBusHP.ySet) annotation (Line(points={{70,-8},{58, - -8},{58,-14},{108,-14},{108,-114},{-99,-114},{-99,-73}}, color={0,0, - 127}), Text( + connect(pre1.u, sigBusHP.onOffMea) annotation (Line(points={{-82,-90},{-129, + -90},{-129,-69}}, color={255,0,255}), Text( string="%second", index=1, extent={{-6,3},{-6,3}}, horizontalAlignment=TextAlignment.Right)); + connect(ySetGreaterZero.u, ySet) annotation (Line(points={{-82,70},{-114,70}, + {-114,20},{-136,20}}, color={0,0,127})); + connect(swinOutySet.u1, ySet) annotation (Line(points={{70,8},{70,32},{-104, + 32},{-104,20},{-136,20}}, color={0,0,127})); annotation (Documentation(info="Checks if the ySet value is legal by checking if the device can either be turned on or off, depending on which state it was in. @@ -192,26 +183,6 @@ equation "), Diagram(coordinateSystem(extent={{-120,-120},{120,120}})), Icon(coordinateSystem(extent={{-120,-120},{120,120}}), graphics={ - Polygon( - points={{-42,20},{0,62},{-42,20}}, - lineColor={28,108,200}, - fillColor={0,0,0}, - fillPattern=FillPattern.Solid), - Ellipse( - extent={{-48,-26},{48,66}}, - lineColor={0,0,0}, - fillColor={91,91,91}, - fillPattern=FillPattern.Solid), - Ellipse( - extent={{-36,-14},{36,54}}, - lineColor={0,0,0}, - fillColor={255,255,255}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-60,20},{60,-80}}, - lineColor={0,0,0}, - fillColor={91,91,91}, - fillPattern=FillPattern.Solid), Rectangle( extent={{-10,-30},{10,-70}}, lineColor={0,0,0}, @@ -221,18 +192,5 @@ equation extent={{-14,-40},{16,-12}}, lineColor={0,0,0}, fillColor={255,255,255}, - fillPattern=FillPattern.Solid), - Text( - extent={{-104,100},{106,76}}, - lineColor={28,108,200}, - lineThickness=0.5, - fillColor={255,255,255}, - fillPattern=FillPattern.None, - textString="%name"), - Rectangle( - extent={{-100,100},{100,-100}}, - lineColor={28,108,200}, - lineThickness=0.5, - fillColor={255,255,255}, - fillPattern=FillPattern.None)})); + fillPattern=FillPattern.Solid)})); end OnOffControl; diff --git a/IBPSA/Fluid/HeatPumps/SafetyControls/OperationalEnvelope.mo b/IBPSA/Fluid/HeatPumps/SafetyControls/OperationalEnvelope.mo index 9a82611723..731d04c4db 100644 --- a/IBPSA/Fluid/HeatPumps/SafetyControls/OperationalEnvelope.mo +++ b/IBPSA/Fluid/HeatPumps/SafetyControls/OperationalEnvelope.mo @@ -1,7 +1,7 @@ within IBPSA.Fluid.HeatPumps.SafetyControls; block OperationalEnvelope "Block which computes an error if the current values are outside of the given operatinal envelope" - extends BaseClasses.PartialSafetyControl; + extends BaseClasses.PartialSafetyControlWithErrors; extends BaseClasses.BoundaryMapIcon(final iconMin=-70, final iconMax=70); parameter Boolean use_opeEnv "False to allow HP to run out of operational envelope" annotation(choices(checkBox=true)); @@ -28,15 +28,8 @@ block OperationalEnvelope annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); equation - connect(boundaryMap.noErr, swiErr.u2) annotation (Line(points={{5.2,70},{5.2, - 68},{54,68},{54,0},{78,0}}, - color={255,0,255})); connect(ySet,swiErr.u1) annotation (Line(points={{-136,20},{32,20},{32,8},{ 78,8}}, color={0,0,127})); - connect(booConOpeEnv.y, swiErr.u2) annotation (Line( - points={{1,-30},{34,-30},{34,0},{78,0}}, - color={255,0,255}, - pattern=LinePattern.Dash)); connect(modeSet, modeOut) annotation (Line(points={{-136,-20},{-114,-20},{ -114,-52},{110,-52},{110,-20},{130,-20}}, color={255,0,255})); @@ -62,12 +55,14 @@ equation index=-1, extent={{-6,3},{-6,3}}, horizontalAlignment=TextAlignment.Right)); - connect(boundaryMap.noErr, not1.u) annotation (Line(points={{5.2,70},{5.2,68}, - {16,68},{16,28},{-44,28},{-44,-102},{-46,-102},{-46,-100},{-42,-100}}, - color={255,0,255})); - connect(booConOpeEnv.y, not1.u) annotation (Line(points={{1,-30},{6,-30},{6, - -56},{-50,-56},{-50,-100},{-42,-100}}, - color={255,0,255})); + connect(booleanPassThrough.u, booConOpeEnv.y) annotation (Line( + points={{38,0},{6,0},{6,-30},{1,-30}}, + color={255,0,255}, + pattern=LinePattern.Dash)); + connect(boundaryMap.noErr, booleanPassThrough.u) annotation (Line( + points={{5.2,70},{24,70},{24,0},{38,0}}, + color={255,0,255}, + pattern=LinePattern.Dash)); annotation (Diagram(coordinateSystem(extent={{-120,-120},{120,120}})), Icon( coordinateSystem(extent={{-120,-120},{120,120}})), Documentation(revisions="