Validating System Models

Sergio Vargas, Wolfram MathCore

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf

ABSTRACT

This talk will showcase the functionality to validate requirements and temporal assessments in system models with uncertainty. Applications and examples are explored.

Overview

SystemModels

Requirements

Handle uncertainty: SystemModelUncertaintyPlot

Plot expressions: SystemModelPlot

Validate requirements with uncertainty: SystemModelValidate

A validation language

Conclusions

Initialization

SystemModel;
Quiet[Unprotect[SystemModelValidate,SystemModelValidationData,TemporalAlways,TemporalSometimes,TemporalBecomes,TemporalBetween,TemporalDelay,TemporalUntil,WhenTrigger]];

SystemModelValidate=WSM`SystemModelValidate;
SystemModelValidationData=WSM`SystemModelValidationData;

TemporalAlways=WSM`TemporalAlways;
TemporalSometimes=WSM`TemporalSometimes;
TemporalBecomes=WSM`TemporalBecomes;
TemporalBetween=WSM`TemporalBetween;
TemporalDelay=WSM`TemporalDelay;
TemporalUntil=WSM`TemporalUntil;
WhenTrigger=WSM`WhenTrigger;

Attributes[TemporalAlways]=Attributes[WSM`TemporalAlways];
Attributes[TemporalSometimes]=Attributes[WSM`TemporalSometimes];
Attributes[TemporalBecomes]=Attributes[WSM`TemporalBecomes];
Attributes[TemporalBetween]=Attributes[WSM`TemporalBetween];
Attributes[TemporalDelay]=Attributes[WSM`TemporalDelay];
Attributes[TemporalUntil]=Attributes[WSM`TemporalUntil];
Attributes[WhenTrigger]=Attributes[WSM`WhenTrigger];

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

SystemModelValidate is typically used to validate system requirements and report validation results.

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

model=CreateSystemModel[]

smv=SystemModelValidate[model,TemporalAlways[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,TemporalAlways[t,-0.02<"xce"[t]<0.02],Join[uncertainty,simulation],]

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"]//Short

A validation language

TemporalAlways

TemporalSometimes

TemporalBecomes: rising edge

TemporalBetween: duration

TemporalDelay: time uncertainty

TemporalUntil: time ordering

WhenTrigger: causal relation

TemporalAlways

TemporalAlways[t,]⟹False

TemporalAlways[t,texpr]
TemporalAlways[t,tmin<=t<=tmax,texpr]

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

model=ConnectSystemModelComponents[]

Use TemporalAlways to validate a condition that must always be satisfied:

SystemModelValidate[model,TemporalAlways[t,"InFlight.y"[t]&&"EngineOff.y"[t]\[Implies]"NominalPerformance.y"[t]]]

TemporalAlways[t,cond[t,(Subscript[p, 1]),...],texpr[t,(Subscript[p, 1]),...,(Subscript[v, 1])[t],...,(Subscript[v, i])[f[t,(Subscript[p, 1]),...]]]]

Validate a physical requirement in a model of a RC circuit, “The voltage must be above v0/E for all times before the RC time constant, R × C.”:

model=CreateSystemModel["RCCircuit",{v[t]+r c v'[t]==0,v[0]==v0,v0==1,r==10,c==1/5},t]

Validate the requirement:

SystemModelValidate[model,TemporalAlways[t,t<r c,v0/E<v[t]],<|"SimulationInterval"->10|>]

SystemModelValidate[model,TemporalAlways[t,t<r c,v[r c]<v[t]],<|"SimulationInterval"->10|>]

Plot the voltage and the bound:

SystemModelPlot[model,{v,v0/E},10]

TemporalSometimes

TemporalSometimes[t,texpr]
TemporalSometimes[t,tmin<=t<=tmax,texpr]

TemporalSometimes[t,]⟹True

Validate the requirement “The aircraft must reach an operational service life of 150 flight cycles or 800 flight hours, whichever is more stringent.”:

model=ConnectSystemModelComponents[]

Use TemporalSometimes to validate a condition that must be satisfied at least once:

smv=SystemModelValidate[model,TemporalSometimes[t,"FlightCycles.y"[t]≥150||"FlightTime.y"[t]≥800* 3600]]

TemporalSometimes[t,cond[t,(Subscript[p, 1]),...],texpr[t,(Subscript[p, 1]),...,(Subscript[v, 1])[t],...,(Subscript[v, i])[f[t,(Subscript[p, 1]),...]]]]

TemporalBecomes

Validate the requirement “The angular velocity of a body in an actuator must not become larger than 0.3 rad/s.”:

smv=SystemModelValidate[,TemporalAlways[t,!WSM`TemporalBecomes["inertia1.w"[t]>0.3]]]

Plot the results for the failure configuration:

smv["FailurePlot",1]

TemporalBetween

Validate the requirement “At no time the control signal should exceed 1.5 for more than 0.2 seconds.”:

model=CreateSystemModel[]

Use  TemporalBetween to validate a condition that has a constrained duration:

smv=SystemModelValidate[model,TemporalAlways[t,!WSM`TemporalBetween[y[t]>1.5,{0.2,Infinity}]]]

Plot the results for the failure configuration:

smv["FailurePlot",1]

TemporalDelay

Validate the requirement “Whenever the controller is turned on, within 220 seconds, the room temperature must be at a value between 19.5 °C and 20.6 °C.”:

smv=SystemModelValidate[,TemporalAlways[t,WSM`TemporalDelay["thermostat.onOffController.y"[t],220]\[Implies]19.5<"temperatureSensor1.T"[t]<20.6],<|"SimulationInterval"->2000|>]

Plot the results for the failure configuration:

smv["FailurePlot",1]

TemporalUntil

Validate the requirement “Whenever the controller is turned on, until the room temperature reaches a value between 19.5 °C and 20.6 °C, the floor must input at least 7.6 W of heat into the room.”:

smv=SystemModelValidate[,TemporalAlways[t,WSM`TemporalUntil["thermostat.onOffController.y"[t],19.5<"temperatureSensor1.T"[t]<20.5]\[Implies]"room.floor.Q_flow"[t]>7.6],<|"SimulationInterval"->2000|>]

Plot the results for the failure configuration:

smv["FailurePlot",1]

WhenTrigger

Validate the requirement “The instant the controller is turned off, the floor must input less than 7.6 W of heat into the room.”:

smv=SystemModelValidate[,TemporalAlways[t,WSM`WhenTrigger[!"thermostat.onOffController.y"[t],"room.floor.Q_flow"[t]<7.6]],<|"SimulationInterval"->2000|>]

Plot the results for the failure configuration:

smv["FailurePlot",1]

Conclusions

Multiple approaches to SystemModel validation

Adaptable to different workflows

Focus on comprehensive support and ease of use