diff --git a/IBPSA/ThermalZones/ISO13790/Validation/BESTEST/Cases6xx/Case600.mo b/IBPSA/ThermalZones/ISO13790/Validation/BESTEST/Cases6xx/Case600.mo index e6aff01797..f34e1ebe2e 100644 --- a/IBPSA/ThermalZones/ISO13790/Validation/BESTEST/Cases6xx/Case600.mo +++ b/IBPSA/ThermalZones/ISO13790/Validation/BESTEST/Cases6xx/Case600.mo @@ -93,10 +93,10 @@ model Case600 u(unit="W"), y(unit="J", displayUnit="J")) "Cooling energy in Joules" annotation (Placement(transformation(extent={{54,74},{66,86}}))); - MovingAverage PHea(delta=3600) + IBPSA.Controls.OBC.CDL.Reals.MovingAverage PHea(delta=3600) "Hourly averaged heating power" annotation (Placement(transformation(extent={{34,84},{42,92}}))); - MovingAverage PCoo(delta=3600) "Hourly averaged cooling power" + IBPSA.Controls.OBC.CDL.Reals.MovingAverage PCoo(delta=3600) "Hourly averaged cooling power" annotation (Placement(transformation(extent={{38,22},{46,30}}))); Modelica.Blocks.Sources.CombiTimeTable TSetCoo(table=[0.0,273.15 + 27]) @@ -107,196 +107,6 @@ model Case600 Modelica.Blocks.Sources.Constant latGai(k=0) "Internal heat gains" annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); -protected - -block MovingAverage "Block to output moving average" - parameter Real delta( - final quantity="Time", - final unit="s", - min=1E-5) - "Time horizon over which the input is averaged"; - Modelica.Blocks.Interfaces.RealInput u - "Connector of Real input signal" - annotation (Placement(transformation(extent={{-140,-20},{-100,20}}))); - Modelica.Blocks.Interfaces.RealOutput y - "Connector of Real output signal" - annotation (Placement(transformation(extent={{100,-20},{140,20}}))); - -protected - parameter Real tStart( - final quantity="Time", - final unit="s", - fixed=false) - "Start time"; - Real mu - "Internal integrator variable"; - Real muDel - "Internal integrator variable with delay"; - Boolean mode( - start=false, - fixed=true) - "Calculation mode"; - -initial equation - tStart=time; - mu=0; - -equation - u=der(mu); - muDel=delay( - mu, - delta); - // Compute the mode so that Dymola generates - // time and not state events as it would with - // an if-then construct - when time >= tStart+delta then - mode=true; - end when; - if mode then - y=(mu-muDel)/delta; - else - y=(mu-muDel)/(time-tStart+1E-3); - end if; - annotation ( - defaultComponentName="movAve", - Icon( - graphics={ - Rectangle( - extent={{-100,-100},{100,100}}, - lineColor={0,0,127}, - fillColor={255,255,255}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-78,90},{-86,68},{-70,68},{-78,90}}, - lineColor={192,192,192}, - fillColor={192,192,192}, - fillPattern=FillPattern.Solid), - Line( - points={{-78,68},{-78,-80}}, - color={192,192,192}), - Line( - points={{-88,0},{70,0}}, - color={192,192,192}), - Polygon( - points={{92,0},{70,8},{70,-8},{92,0}}, - lineColor={192,192,192}, - fillColor={192,192,192}, - fillPattern=FillPattern.Solid), - Line( - points={{-78,-31},{-64,-31},{-64,-15},{-56,-15},{-56,-63},{-48,-63}, - {-48,-41},{-40,-41},{-40,43},{-32,43},{-32,11},{-32,11},{-32,-49}, - {-22,-49},{-22,-31},{-12,-31},{-12,-59},{-2,-59},{-2,23},{4,23}, - {4,37},{10,37},{10,-19},{20,-19},{20,-7},{26,-7},{26,-37}, - {36,-37},{36,35},{46,35},{46,1},{54,1},{54,-65},{64,-65}}, - color={215,215,215}), - Line( - points={{-78,-24},{68,-24}}), - Text( - extent={{-140,152},{160,112}}, - textString="%name", - textColor={0,0,255}), - Text( - extent={{-42,-63},{41,-106}}, - textColor={192,192,192}, - textString="%delta s"), - Text( - extent={{226,60},{106,10}}, - textColor={0,0,0}, - textString=DynamicSelect("",String(y, - leftJustified=false, - significantDigits=3)))}), - Documentation( - info=" -

-This block outputs the mean value of its input signal as -

-
-      1  t
-y =   -  ∫   u(s) ds
-      δ  t-δ
-
-

-where δ is a parameter that determines the time window over -which the input is averaged. -For - t < δ seconds, it outputs -

-
-           1      t
-y =   --------    ∫   u(s) ds
-      t-t0+10-10   t0
-
-

-where t0 is the initial time. -

-

-This block can for example be used to output the moving -average of a noisy measurement signal. -

-

-See - -IBPSA.Controls.OBC.CDL.Continuous.Validation.MovingAverage -and - -IBPSA.Controls.OBC.CDL.Continuous.Validation.MovingAverage_nonZeroStart -for example. -

-", -revisions=" - -")); -end MovingAverage; - - equation connect(sumHeaCoo.y,preHeaCoo. Q_flow) annotation (Line(points={{62.4,60},{68,60}}, color={0,0,127})); @@ -355,6 +165,13 @@ for heating and 27°C for cooling. The room has no shade and a window

", revisions="