このページの翻訳は最新ではありません。ここをクリックして、英語の最新版を参照してください。
コンポーネントの方程式
この方程式セクションの目的は、コンポーネントの変数、パラメーター、入力、出力、時間、およびそれらのエンティティの時間微分の数学的な関係を設定することです。このページの各トピックでは、コンポーネントの方程式の定義、および関連するタスクの詳細情報を提供しています。
言語構文
assert | Program customized run-time errors and warnings |
delay | Return past value of operand |
der | Return time derivative of operand |
equations | Define component or domain equations |
function | Reuse expressions in component equations and in member declarations of domains and components |
integ | Perform time integration of expression |
intermediates | Define intermediate terms for use in equations |
tablelookup | Return value based on interpolating set of data points |
time | グローバルなシミュレーション時間へのアクセス |
value | Convert variable or parameter to unitless value with specified unit conversion |
トピック
- Defining Component Equations
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. Theequations
section of a Simscape™ file is executed throughout the simulation. - 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
if
statements. - Using Intermediate Terms in Equations
Textbooks often define certain equation terms in separate equations, and then substitute these intermediate equations into the main one. For example, for fully developed flow in ducts, the Darcy friction factor can be used to compute pressure loss:
- Using Lookup Tables in Equations
You can use the
tablelookup
function in theequations
section 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. This functionality is similar to that of the Simulink® and Simscape Lookup Table blocks. It allows you to incorporate table-driven modeling directly in your custom block, without the need of connecting an external Lookup Table block to your model. - Programming Run-Time Errors and Warnings
Use the
assert
construct to implement run-time error and warning messages for a custom block. In the component file, you specify the condition to be evaluated, as well as the error message to be output if this condition is violated. When the custom block based on this component file is used in a model, it will output this message if the condition is violated during simulation. The optionalAction
attribute of theassert
construct specifies whether simulation stops when the predicate condition is violated, continues with a warning, or ignores the violation. - 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.