Version_0_12_0 class

Requirements.UsersGuide.ReleaseNotes.Version_0_12_0  ยท source

Icon of Version_0_12_0

Version 0.12.0 (Oct. 19, 2026)

Extends Modelica.Icons.ReleaseNotes

Violation statistics. For a long run a verdict is not enough: a requirement violated once for a second and one violated every summer afternoon are both violated. The new block Verify.ViolationStatistics answers three questions per requirement: how often was it violated, what was the worst violation and when, and what was the longest violation. No existing output, log line or regression reference changed.

The block

  • Inputs: the check's property, and optionally its margin (new connector Interfaces.MarginInput).
  • Outputs: nViolations, totalDuration, violatedFraction, longestDuration and tLongestStart, worstMargin and tWorst, the same for the current episode, and currentDuration. Every output holds its final value without terminal().
  • A violation is a phase with property = Violated, not one with a negative margin. A margin is provisional while the check is Undecided, so the worst margin is taken over the decided phases only. This is the rule the verdict follows.
  • mergeGap and minDuration stop a signal that hovers at its limit from counting as hundreds of violations. They change the count and the longest episode, never the total.
  • Counting and timing cost no extra events: the property only changes at events the check produces anyway.

The worst margin

  • Continuous (default): Internal.ContinuousWorst extends Modelica.Blocks.Math.ContinuousSignalExtrema. A state event fires at every local extremum of the margin, without sampling. Three changes from the MSL block:
    • only the decided phases count;
    • the worst value is also tracked per episode;
    • the final value does not depend on terminal(), which Modelon Impact evaluates to false.
    The filter time constant T defaults to 0.01 s, not the MSL block's 1 µs. At 1 µs the event indicator near an extremum is below the solver tolerance, and the solver reports chattering. Choose T as about a thousandth of the margin's time scale (60 s for a year).
  • Ratchet: an event only when the margin falls a resolution (default 0.01) below the least value so far. The result is within resolution of the exact value. Modelica.Blocks.Math.SignalExtrema was considered and not used: it samples, and is no more accurate than the stored result.
  • Measured on Impact, a year with hourly output and a 0.1 K, 10-minute ripple on a room temperature (Examples.Elementary.ViolationStatistics.YearRipple*):
    ModelRun timeState eventsEpisodesWorst margin
    no statistics9.0 s2,804——
    continuous96.7 s219,103374−3.0844
    ratchet31.1 s64,991374−3.0800
    On a smooth margin the continuous method is cheap: two events a day. On an oscillating one the ratchet is three times cheaper.

Statistics in the log

  • Verify.Requirement and BooleanRequirement have a new tab Statistics: computeStatistics (default false), useMargin with a conditional margin input, and the block's parameters.
  • A requirement with statistics writes a second line to the log file beside its verdict: Statistics,<observation>,<requirement>,<n>,<total>,<fraction>,<longest>,<longest from>,<worst>,<worst at>,<minDuration>,<mergeGap>. The worst-margin fields are empty without margin. The two filters are included so that a reader can recompute the statistics from the stored result. It is a separate line, not columns added to the verdict line, because the verdict line ends with free text, and a reader would take any added columns for part of the text.
  • PrintViolations prints a Violation statistics section in its summary, on the console and in the HTML report.
  • Internal.printViolationsToLogFile no longer takes a Statistics line of the same requirement for its own verdict line when it checks whether that line is already written.

Examples

Examples.Elementary.ViolationStatistics:

  • Sine, Episodes and Gating assert every output against closed-form values.
  • RequirementLog shows the log and the summary.
  • The Year* models run a year and measure the cost of the two methods.

The first four are cases in the Impact regression list, with Impact's own references. YearSmooth is in the list but disabled: its stored result has every event row and would be as large as the rest of the list. Full Impact suite afterwards: 563/563 checks, every existing case unchanged.

Changes

  • New: Verify.ViolationStatistics, Interfaces.MarginInput, Types.WorstMarginMethod, Internal.ContinuousWorst, Internal.RatchetWorst, Internal.StatisticsLogger, Internal.printStatisticsToLogFile, Examples.Elementary.ViolationStatistics.
  • Interfaces.PartialRequirement: the Statistics tab (no change while computeStatistics = false).
  • Internal.printViolationsToLogFile, Internal.printViolationsToOutput: as above.
  • conversion(noneFromVersion="0.11.1"): no model needs conversion.