Main Content

La traducción de esta página aún no se ha actualizado a la versión más reciente. Haga clic aquí para ver la última versión en inglés.

Ecuaciones

Escriba ecuaciones para representar el comportamiento personalizado

El objetivo de la sección equations en un archivo de componente es establecer relaciones matemáticas entre las variables, parámetros, entradas y salidas del componente, el tempo de simulación y las derivadas de tiempo de cada una de estas entidades.

Del mismo modo, la sección equations en un archivo de dominio sirve para establecer las relaciones matemáticas entre las variables Across, parámetros, y valores intermedios del dominio. Las ecuaciones de dominio se propagan a los nodos del tipo de dominio correspondiente.

La sintaxis de las ecuaciones de componente y de dominio es la misma. Defining Component Equations proporciona información genérica sobre cómo escribir ecuaciones en lenguaje de Simscape™. Domain Equations proporciona información específica sobre ecuaciones de dominio.

Sintaxis del lenguaje

assertProgram customized run-time errors and warnings
delayReturn past value of operand
derReturn time derivative of operand
equationsDefine component or domain equations
functionReuse expressions in component equations and in member declarations of domains and components
integPerform time integration of expression
intermediatesDefine intermediate terms for use in equations
scatteredlookupReturn value based on interpolating unstructured set of data points (desde R2023a)
tablelookupReturn value based on interpolating set of data points
timeAccess global simulation time
valueConvert variable or parameter to unitless value with specified unit conversion

Temas

  • 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.

  • Sistema algebraico simple

    En este ejemplo se muestra la implementación para un sistema algebraico simple.

  • Utilizar tiempo de simulación en ecuaciones

    En este ejemplo se muestra cómo acceder al tiempo de simulación global desde la sección de ecuaciones.

  • Utilizar expresiones condicionales en ecuaciones

    Puede especificar ecuaciones condicionales utilizando declaraciones if.

  • 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 tablelookup function in the equations 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.

  • Programming Run-Time Errors and Warnings

    Use the assert construct 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.