From Requirement to Validated Design

Sergio Vargas, Wolfram MathCore

#WolframTechConf

ABSTRACT

Turn your design requirements into automated, verifiable checks with Wolfram System Modeler. In this session, you’ll learn how to translate specifications directly into the SystemModelValidate function, enabling large-scale scenario testing without manual scripting.

We’ll demonstrate how the built-in requirement specification language makes it easy to express conditions such as “for how long” or “at what time,” then automatically evaluate thousands of simulation cases to uncover failure modes.

By streamlining post-processing and validation, this approach helps you catch edge-case issues early and ensure your designs meet performance and safety targets—no matter the operating conditions.

Overview

SystemModels

Requirements

Handle uncertainty: SystemModelUncertaintyPlot

Plot expressions: SystemModelPlot

Validate requirements with uncertainty: SystemModelValidate

A validation language

Application example: Electrical vehicle

More application examples

Conclusions

SystemModels

Multiple domains:

SystemModel["Modelica","Children"]

Modeling based on connections:

SystemModel["ChuaCircuit"]

Differential-algebraic system of equations:

F[x[t],x'[t],t]==0

See a robot:

SystemModeler[,"Modeling"]

Requirements

A condition that must be satisfied in a system.

Physical requirements

Safety requirements

Design constraints

Performance requirements

“In flight, when one engine is off, the air distribution circuit must provide nominal performance.”

“Whenever the heating is turned on, within 300 seconds, the room temperature must be between 19 °C and 21 °C.”

Handle uncertainty: SystemModelUncertaintyPlot

SystemModelUncertaintyPlot is typically used to visualize the uncertainty of key signals in a system model resulting from uncertainty in parameters, initial values or noisy inputs.

The results of multiple simulations for a given variable are aggregated as temporal data for which quantiles are computed for each time point.

Validate the requirement “A stabilized camera that is disturbed by a force must not move move than 2 cm.”:

model=;

Set a noisy input and simulation count:

uncertainty=<|"Inputs"->{"fw"->WhiteNoiseProcess[1000]}|>;
simulation=<|"SimulationCount"->50|>;

Plot the uncertainty in the position of the camera together with the bounds:

SystemModelUncertaintyPlot[model,Join[<|"Outputs"->"xce"|>,uncertainty,simulation],SamplingPeriod->2.5,]

Plot expressions: SystemModelPlot

Validate the requirement “At no time the control signal should exceed 1.5.”:

model=CreateSystemModel[]

Plot the control signal and the bound:

SystemModelPlot[model,{"y",1.5}]

Plot the condition itself:

SystemModelPlot[model,{"y"<=1.5}]

Validate requirements with uncertainty: SystemModelValidate

(RefLink[SystemModelValidate, paclet:ref/SystemModelValidate]) is used to validate system behaviors related either to safety or performance requirements.

Validate the requirement “At no time the control signal should exceed 1.5.”:

model=CreateSystemModel[]

smv=SystemModelValidate[model,SystemModelAlways[t,y[t]<=1.5]]

Plot the results for the failure configuration:

smv["FailurePlot",1]

Extract the failure intervals:

smv["FailureIntervals",1]

Compute the total failure time:

ArcLength/@smv["FailureIntervals",1]//Total

Plot the the failure intervals:

smv["FailureIntervalsPlot",1]

Validate requirements with uncertainty: SystemModelValidate

Validate the requirement “A stabilized camera that is disturbed by a force must not move move than 2 cm.”:

model=;

Set a noisy input and simulation count:

uncertainty=<|"Inputs"->{"fw"->WhiteNoiseProcess[1000]}|>;
simulation=<|"SimulationCount"->50|>;

Validate the requirement:

smv=SystemModelValidate[model,SystemModelAlways[t,-0.02<"xce"[t]<0.02],Join[uncertainty,simulation],SamplingPeriod->2.5]

Retrieve the success probability:

smv["SuccessProbability"]

Extract the reported failure configurations:

fail=smv["Configuration"]

Plot the position of the camera for the stored failure configuration and the bounds:

SystemModelPlot[model,{"xce",-0.02,0.02},First[fail]]//Quiet

Extract success configurations:

smv["SuccessConfigurations"]//Shallow

A validation language

The requirement is specified using the following temporal scoping constructs:

Grid[{{SystemModelAlways[t,texpr],"texpr is always true for (Subscript[t, min]) ≤ t ≤ (Subscript[t, max])"},{SystemModelEventually[t,texpr],"texpr is eventually true for (Subscript[t, min]) ≤ t ≤ (Subscript[t, max])"}},Alignment->Left]

The global values (Subscript[t, min]) and (Subscript[t, max]) are given by the simulation interval of the system by default.

The temporal expression texpr is a Boolean-valued function of time t and can be given as:

Grid[{{"(Subscript[f, 1])[t]≤(Subscript[f, 2])[t], (Subscript[f, 1])[t]≥(Subscript[f, 2])[t], …","with (Subscript[f, 1])[t] and (Subscript[f, 2])[t] real valued"},{"(Subscript[b, 1])[t]&&(Subscript[b, 2])[t], (Subscript[b, 1])[t]||(Subscript[b, 2])[t], …","with (Subscript[b, 1])[t] and (Subscript[b, 2])[t] Boolean valued"},{SystemModelSustain[texpr,{min,max}],"when texpr is True at least min and at most max time units"},{SystemModelUntil[(Subscript[texpr, 1]),(Subscript[texpr, 2])],"when (Subscript[texpr, 1]) is True until (Subscript[texpr, 2]) first becomes True"},{SystemModelDelay[texpr,δ],"when texpr[t-δ] is True"}},Alignment->Left]

SystemModelSustain: Circuit Design:

Validate the requirement, “The DC voltage in the rectifier should not exceed 540 V for more than 0.002 s.”:

req=SystemModelAlways[t,!SystemModelSustain["uDC"[t]>540,{0.002,∞}]];

val=SystemModelValidate[,req]

Show the failure plot:

val["FailurePlot",1]

The DC voltage goes above 540 for 0.00252 s:

ArcLength/@val["FailureIntervals",1]

SystemModelDelay: Industrial Manufacturing:

Start with a model of a tank system and simulate it for 30 s:

sim=SystemModelSimulate[,30];

Validate the requirement, “Whenever the water level in the first tank is above 1.2 m, and for at least 6 s more, the water level in the second tank should be above 0.6 m.”:

req=SystemModelAlways[t,SystemModelDelay[1.2<"tank1.h"[t],{0,6}]\[Implies]0.6<"tank2.h"[t]];

val=SystemModelValidate[sim,req]

Show the failure plot:

val["FailurePlot",1]

The water level in the second tank goes below 0.6 m too early:

SystemModelPlot[sim,{"tank2.h",0.6}]

SystemModelUntil: Controlled System:

Start with a model of a controlled inverted pendulum system:

model=;

Validate the requirement, “Whenever the angular velocity in the motor is below 700 rad/s until the position of the cart reaches 0.9 m, the angle of the pendulum must be between -0.1` and 0.1 rad.”:

req=SystemModelAlways[t,SystemModelUntil["extendedSystem.dcMotor.w"[t]<700,0.9≤"x"[t]]\[Implies]Abs["phi"[t]]<0.1];

Specify uncertainty for the resistance in the motor and set a number of simulations:

spec=<|"ParameterValues"-><|"extendedSystem.dcMotor.R"->(Quantity[(10"to"15), "Ω", ohms, "Ohms"])|>,"SimulationCount"->50|>;

The model fails the requirement in all simulations:

val=SystemModelValidate[model,req,spec]

Show the failure plot for the stored failure configuration:

val["FailurePlot",1]

Simulate with the failure configuration:

sim=SystemModelSimulate[model,val["Configuration",1]]

The angle of the pendulum fails this control specification:

SystemModelPlot[sim,{-0.1,"phi",0.1},PlotRange->All]

Application example: Electrical vehicle

Start with a simple model of an electrical vehicle following the US EPA Highway Fuel Economy Driving Schedule (HWFET):

model=;

Simulate the model:

sim=SystemModelSimulate[model]

Validate the requirement, “The temperature in the battery can only be above 28 ºC for an interval of at most 8.5 minutes.”:

reqTTime=SystemModelAlways[t,!SystemModelSustain["T"[t]>28+273.15,{(Quantity[8.5, "min", minutes, "Minutes"]),Infinity}]];

valTTime=SystemModelValidate[sim,reqTTime]

Show the failure plot:

valTTime["FailurePlot",1]

Plot the temperature with the bound:

SystemModelPlot[sim,{"T",28+273.15},GridLines->{MinMax[valTTime["FailureIntervals",1]]/3600,None},GridLinesStyle->Directive[Thick,Darker[Red],Dashed]]

Adjust the resistance in the battery and simulate:

simR=SystemModelSimulate[model,<|"ParameterValues"->{"cellData.Ri"->7.1}|>]

Validate the temperature requirement:

SystemModelValidate[simR,reqTTime]

Plot the temperature with the bound:

SystemModelPlot[simR,{"T",28+273.15},PlotRange->All]

While the new resistance still leads to temperatures higher that the bound, the battery does not stay hot for longer than 8.5 minutes. To see this validate the requirement “The temperature in the battery can reach at most 28 ºC” for the two values of the resistance:

reqT=SystemModelAlways[t,"T"[t]≤28+273.15];

valTRs=SystemModelValidate[{sim,simR},reqT,<|"MaxFailureIntervals"->2|>]

Compute the failure interval lengths for both configurations:

(ArcLength/@valTRs["FailureIntervals",All])/60

Less electrical power is produced with the new value of the resistance:

SystemModelPlot[{sim,simR},{"sensor.power"},PlotRange->{All,{3000,4500}}]

More application examples

Validating high-G aerobatics with System Modeler and Wolfram Language

Validating performance of electrical vehicles with System Modeler and Wolfram Language

Thermal runaway in validation of industrial manufacturing with System Modeler and Wolfram Language

Validating safety in commercial aircraft trajectories with System Modeler and Wolfram Language

Conclusions

Multiple approaches to SystemModel validation

Adaptable to different workflows

Focus on comprehensive support and ease of use