|On this page…|
This section describes important characteristics of the mathematical representations of physical systems, and how Simscape™ software implements such representations. You might find this overview helpful if you:
Require details of such representations to improve your model fidelity or simulation performance.
Are constructing your Simscape model or its components with the Simscape language.
Need to troubleshoot Simscape modeling or simulation failures.
Mathematical representations are the foundation for physical simulation. For more information about simulation, see How Simscape Simulation Works.
The mathematical representation of a physical system contains ordinary differential equations (ODEs), algebraic equations, or both.
ODEs govern the rates of change of system variables and contain some or all of the time derivatives of the system variables.
Algebraic equations specify functional constraints among system variables, but contain no time derivatives of system variables.
Without algebraic constraints, the system is differential (ODEs).
Without ODEs, the system is algebraic.
With ODEs and algebraic constraints, the system is mixed differential-algebraic (DAEs).
A system variable is differential or algebraic, depending on whether or not its time derivative appears in the system equations.
A mathematical problem is stiff if the solution you are seeking varies slowly, but there are other solutions within the error tolerances that vary rapidly. A stiff system has several intrinsic time scales of very different magnitude .
A stiff physical system has one or more components that behave "stiffly" in the ordinary sense, such as a spring with a large spring constant. Mathematical equivalents include quasi-incompressible fluids and low electrical inductance. Such systems often exhibit high frequency oscillations in some of their components or modes.
Events are discontinuous changes in system state or dynamics as the system evolves in time; for example, a valve opening, or a hard stop.
A zero crossing is a specific event type, represented by the value of a mathematical function changing sign.
A Simscape model is equivalent to a set of equations representing one or more physical systems as physical networks.
Start by assuming that your physical network is a DAE system: a mix of differential and algebraic equations and variables.
Remember that some physical networks are represented by ODEs only.
Physical networks may contain stiff differential equations.
Identify discrete and continuous components that might change discontinuously during a simulation.
Simulink® and Simscape software have specific methods for detecting and locating zero-crossing events. For general information, see Zero-Crossing Detection in the Simulink documentation.
Your model can contain zero-crossing conditions arising from several sources:
Simscape and normal Simulink blocks copied from their respective block libraries
Expressions programmed in the Simscape language
You can disable zero-crossing detection on individual blocks, or globally across the entire model. Zero-crossing detection often improves simulation accuracy, but can slow simulation speed.
Tip If the exact times of zero crossings are important in your model, then keep zero-crossing detection enabled. Disabling it can lead to major simulation inaccuracies.
Enabling and Disabling Zero-Crossing Conditions in Simscape Language. In the Simscape language, you can create or avoid Simulink zero-crossing conditions in your model by switching between different implementations of discontinuous conditional expressions. You can:
Use relational operators, which create zero-crossing conditions. For example, programming the operator relation: a < b creates a zero-crossing condition.
Use relational functions, which do not create zero-crossing conditions. For example, programming the functional relation: lt(a,b) does not create a zero-crossing condition.