This block is used to verify a requirement. The input signal "property" can have the three values Violated, Undecided, or Satisfied (= elements of enumeration Property). A requirement is violated, if property = Violated, it is untested, if property = Undecided, and it is satisfied, if property = Satisfied. If a required property is naturally defined as Boolean, use block BooleanRequirement instead.
With parameter text a textual description of the required property should be defined in natural language. This description is, for example, shown when a requirement is violated at the end of a simulation.
In the top level of a model, block PrintViolations has to be dragged. This block prints an information message at the end of a simulation, whether a Requirement has been violated, untested, or satisfied in the current simulation run (the amount of output can be configured). Furthermore, all Requirement instances store information about the Requirement in a log file (the default name is "<root-name>_log.txt"; this name can be changed via parameter logFile in the instance of PrintViolations. Exactly one line is printed in the log file with the status for every instance of a Requirement block.
This block is demonstrated with the following example:
results in
simulation result |
In a textual definition, the Requirements block can be used as shown in this example:
vimport Modelica_Requirements.LogicalFunctions.*; import Modelica_Requirements.Types.Property; Requirement R_Violated (property = PropertyToBoolean(check)); Requirement R_Undecided(property = Property.Undecided); Requirement R_Satisfied(property = during(check, check));