IEA EBC Annex 60 EBC logo

Annex60.ThermalZones.ReducedOrder.Validation.VDI6007.BaseClasses

Base classes for VDI 6007 validation cases

Information

This package contains base classes that are used to construct the models in Annex60.ThermalZones.ReducedOrder.Validation.VDI6007.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Annex60.ThermalZones.ReducedOrder.Validation.VDI6007.BaseClasses.VerifyDifferenceThreePeriods VerifyDifferenceThreePeriods Assert when condition is violated

Annex60.ThermalZones.ReducedOrder.Validation.VDI6007.BaseClasses.VerifyDifferenceThreePeriods Annex60.ThermalZones.ReducedOrder.Validation.VDI6007.BaseClasses.VerifyDifferenceThreePeriods

Assert when condition is violated

Annex60.ThermalZones.ReducedOrder.Validation.VDI6007.BaseClasses.VerifyDifferenceThreePeriods

Information

Block that outputs satisfied = false if abs(u1-u2) > threShold within the prescribed time intervals, or satisfied = true otherwise.

Implementation

The test uses a hysteresis of plus/minus 1% in order to avoid chattering if abs(u1-u2) is near threShold.

Extends from Annex60.Utilities.Diagnostics.BaseClasses.PartialInputCheck (Assert when condition is violated).

Parameters

TypeNameDefaultDescription
TimestartTime0Start time for activating the assert [s]
RealthreShold1E-2Threshold for equality comparison
Stringmessage"Inputs differ by more than ... 
TimeendTime0Start time for deactivating the assert (period one) [s]
TimestartTime20Start time for activating the assert (period two) [s]
TimeendTime20Start time for deactivating the assert (period two) [s]
TimestartTime30Start time for activating the assert (period three) [s]
TimeendTime30Start time for deactivating the assert (period three) [s]

Connectors

TypeNameDescription
input RealInputu1Value to check
input RealInputu2Value to check
output BooleanOutputsatisfied 
output RealOutputdiffDifference u1-u2

Modelica definition

block VerifyDifferenceThreePeriods "Assert when condition is violated" extends Annex60.Utilities.Diagnostics.BaseClasses.PartialInputCheck( message="Inputs differ by more than threShold.\n Check output 'satisfied' for when violation(s) happened."); parameter Modelica.SIunits.Time endTime = 0 "Start time for deactivating the assert (period one)"; parameter Modelica.SIunits.Time startTime2 = 0 "Start time for activating the assert (period two)"; parameter Modelica.SIunits.Time endTime2 = 0 "Start time for deactivating the assert (period two)"; parameter Modelica.SIunits.Time startTime3 = 0 "Start time for activating the assert (period three)"; parameter Modelica.SIunits.Time endTime3 = 0 "Start time for deactivating the assert (period three)"; Modelica.Blocks.Interfaces.BooleanOutput satisfied(start=true, fixed=true); Modelica.Blocks.Interfaces.RealOutput diff "Difference u1-u2"; protected parameter Modelica.SIunits.Time t1(fixed=false) "Simulation end time period one"; parameter Modelica.SIunits.Time t3(fixed=false) "Simulation end time period two"; parameter Modelica.SIunits.Time t5(fixed=false) "Simulation end time period three"; parameter Modelica.SIunits.Time t2(fixed=false) "Simulation start time period two"; parameter Modelica.SIunits.Time t4(fixed=false) "Simulation start time period three"; Integer nFai "Number of test violations"; initial equation t1 = time + endTime; t2 = time + startTime2; t3 = time + endTime2; t4 = time + startTime3; t5 = time + endTime3; nFai = 0; equation if (time >= t0) and (time <= t1) or (time >= t2) and (time <= t3) or (time >= t4) and (time <= t5) then diff = abs(u1 - u2); else diff = 0; // Test is not needed in this time domain end if; // Output whether test is satisfied, using a small hysteresis that is scaled using threShold satisfied = not ( (pre(satisfied) and diff > 1.01*threShold) or (not pre(satisfied) and diff >= 0.99*threShold)); // Count the number of failures and raise an assertion in the terminal section. // This ensures that if the model is in an FMU, no asserts are triggered during // the solver iterations. when not satisfied then nFai = pre(nFai) + 1; end when; when terminal() then assert(nFai == 0, message); end when; end VerifyDifferenceThreePeriods;

http://iea-annex60.org