Appendix E. Physics-aware Simulation Reference
Continuous equations and discrete transitions describe different aspects of one system. This appendix separates what the SysML libraries express from the particular numerical experiment a tool performs.
E.1 The state-space representation pattern – [SPEC]
A state equation gives a derivative; an output equation gives the quantities to observe. GetDerivative, GetOutput and ContinuousStateSpaceDynamics in StateSpaceRepresentation supply the standard vocabulary (SysML §9.4.4). For a simple boiler, let T be water temperature, P input power, k the heat-loss coefficient, Ta ambient temperature, and C thermal capacity. The state equation is dT/dt = (P − k(T − Ta)) / C. A possible Boolean output is 90 <= T and T <= 96 when T is expressed in degrees Celsius.
Chapter 9 models a derivative for a simple linear loss term. Here temp in the loss term is the temperature relative to ambient, so lossCoeff * temp represents power leaving the vessel. The result is a rate, not a temperature reading:
private import StateSpaceRepresentation::*;
calc def HeaterRhs :> GetDerivative {
in t : Real;
in temp : Real;
in heaterPower : Real;
in lossCoeff : Real;
in thermalMass : Real;
return dT_dt : Real = (heaterPower - lossCoeff * temp) / thermalMass;
}
State the initial temperature and units as well as the equation. At T = Ta the heat-loss term vanishes. At P = k(T − Ta) the derivative is zero. These checks expose sign and unit mistakes before anyone chooses an integration step. Validating a derivative declaration or computing one slope does not numerically integrate the model. Chapter 16 supplies an executable estimate with constant net power.
E.2 Hybrid behavior
A thermostat is hybrid: the continuous state T exists in both heater on and heater off modes, while the input power changes when the controller switches. The two modes can share an equation with different inputs. A bouncing ball, by contrast, needs a reset of velocity at impact; a change in the mode name alone does not reverse it.
E.3 Change triggers and threshold crossings
accept when temperature >= limit describes the transition condition. A solver taking large time steps may report the crossing later than one which locates the event inside the step. Record step size, tolerances and event policy when interpreting results. To prevent chatter, specify separate on/off thresholds (for example 90 °C and 96 °C) and identify which state each transition leaves. A scheduled after in OpenSysML is a timer, not a zero-crossing detector.
E.4 Occurrences and Life – [SPEC]
The spec’s Occurrence model (Occurrences.kerml in the Kernel Semantic Library) gives every happening a temporal identity. A Life is the complete temporal extent of an occurrence; an occurrence’s snapshots are its instantaneous time slices; and the library defines temporal relations between occurrences – HappensBefore (one occurrence completes before another begins) and HappensDuring (one occurrence’s extent lies within another’s).
This is the lifecycle layer everything dynamic hangs off. A simulation trajectory is an occurrence unfolding; a verdict stream is a time-indexed reading of snapshots; “did the pump start before the valve opened?” is a HappensBefore question. Chapter 16 §16.A develops the run-as-occurrence framing; Appendix J covers the occurrence vocabulary in depth.
E.5 Spatial frames – [SPEC]
SpatialFrames.kerml (Kernel Semantic Library) supplies the spec’s spatial surface. A SpatialFrame is a three-dimensional body that provides a spatial extent for positions to be measured against, and the library defines functions such as PositionOf (the position of a point relative to a frame at a given time) and CurrentPositionOf (the same, against a clock’s current time).
A model that imports SpatialFrames::* can declare frames, place occurrences within them, and ask “where is X, in frame F, at time t?” as a model-level query. Spatial frames matter most for multi-body mechanical systems and any model that must switch between body-fixed and inertial coordinates.
E.6 Performances and Evaluation – [SPEC]
Performances.kerml (Kernel Semantic Library) defines a Performance as an execution of a behaviour – itself a kind of occurrence, so everything in E.4 applies to it. An Evaluation is the performance of a function: the act of computing a result, as an occurrence with its own temporal extent, with BooleanEvaluation as the predicate case. StatePerformances.kerml adds StatePerformance and StateTransitionPerformance – a state being occupied, a transition being taken – plus helpers such as allSubstatePerformances for walking a nested state machine’s performance record.
This is the layer verification ultimately reads: when a verification case runs against a simulation (Chapter 10), the constraint checks it performs over the trajectory are, in the library’s terms, boolean evaluations over performances.
E.7 Checking the physical assumptions
Derive a balance from the topology; write it as a constraint instead of assuming that a connection enforces it. Distinguish power (W) from energy (J), an absolute temperature from a temperature rise, and a measured trajectory from an estimate. The coffee-machine thermal analysis shows its inputs and equation so that a reader can reproduce the estimate without an external solver. A validated declaration is not heater calibration data.