Name | Description |
---|---|
PartialInputCheck | Assert when condition is violated |
Partial model that can be used to check whether its inputs satisfy a certain condition such as equality within a prescribed threshold.
Type | Name | Default | Description |
---|---|---|---|
Time | startTime | 0 | Start time for activating the assert, set to -1 to disable [s] |
Real | threShold | 1E-2 | Threshold for equality comparison |
String | message | "Inputs differ by more than ... |
Type | Name | Description |
---|---|---|
input RealInput | u1 | Value to check, equal to 0 if unconnected |
input RealInput | u2 | Value to check, equal to 0 if unconnected |
block PartialInputCheck "Assert when condition is violated" extends Modelica.Blocks.Interfaces.BlockIcon; parameter Modelica.SIunits.Time startTime = 0 "Start time for activating the assert, set to -1 to disable"; parameter Real threShold(min=0)=1E-2 "Threshold for equality comparison"; parameter String message = "Inputs differ by more than threShold"; protected parameter Modelica.SIunits.Time t0( fixed=false) "Simulation start time"; public Modelica.Blocks.Interfaces.RealInput u1 "Value to check, equal to 0 if unconnected"; Modelica.Blocks.Interfaces.RealInput u2 "Value to check, equal to 0 if unconnected"; initial equation t0 = time + startTime; equation if cardinality(u1)==0 then u1 = 0; end if; if cardinality(u2)==0 then u2 = 0; end if; end PartialInputCheck;