The purpose of the
equations section in a component file is to establish the mathematical relationships between the variables, parameters, inputs, and outputs of the component, the simulation time, and the time derivatives of each of these entities.
equations section in a domain file serves to establish the mathematical relationships between the domain Across variables, parameters, and intermediates. Domain equations propagate to the nodes of the corresponding domain type.
The syntax of component and domain equations is the same. Defining Component Equations provides generic information on writing equations in Simscape™ language. Domain Equations provides information specific to domain equations.
Sintassi del linguaggio
|Program customized run-time errors and warnings|
|Return past value of operand|
|Return time derivative of operand|
|Define component or domain equations|
|Reuse expressions in component equations and in member declarations of domains and components|
|Perform time integration of expression|
|Define intermediate terms for use in equations|
|Return value based on interpolating unstructured set of data points|
|Return value based on interpolating set of data points|
|Access global simulation time|
|Convert variable or parameter to unitless value with specified unit conversion|
- Defining Component Equations
The purpose of the
equationssection in a component file is to establish the mathematical relationships between the variables, parameters, inputs, and outputs of the component, the simulation time, and the time derivatives of each of these entities.
- Simple Algebraic System
This example shows implementation for a simple algebraic system.
- Use Simulation Time in Equations
This example shows how you can access global simulation time from the equation section.
- Using Conditional Expressions in Equations
You can specify conditional equations by using
- Using Intermediate Terms in Equations
Textbooks often define certain equation terms in separate equations, and then substitute these intermediate equations into the main one.
- Using Lookup Tables in Equations
You can use the
tablelookupfunction in the
equationssection of the Simscape file to interpolate input values based on a set of data points in a one-dimensional, two-dimensional, three-dimensional, or four-dimensional table.
- Programming Run-Time Errors and Warnings
assertconstruct to implement run-time error and warning messages for a custom block.
- Initial Equations
Specify additional equations to be executed during model initialization only.
- Simscape Functions
Use Simscape functions to reuse expressions in equations and member declarations of multiple components.
- Import Symbolic Math Toolbox Equations
Example of using Symbolic Math Toolbox™ software to solve the physical equations, generate code in the format appropriate for the Simscape language equation section, and incorporate the generated code into the equation section of a component file.
- Domain Equations
Specify additional equations to propagate to all the components that have nodes of the corresponding domain type.