Model Data Structure
|
Description
|
|
•
|
The Import and SimplifyModel commands of the BlockImporter package return a Maple record that describes a converted Simulink model. This help page describes the elements of that record. The first major section, Variables, describes the syntax of the variables used in the fields of the record. The second major section, Fields, describes the format of each of the fields (slots) of the record.
|
|
Variables
|
|
•
|
Indexed names are used in the generated equations to represent signals, variables, and parameters in the diagram. The base of the indexed name identifies the type of the signal: u is an input signal, y is an output signal, x is a state-variable, fn is a function, Source is a source signal, Sink is a sink signal, and K is a parameter.
|
|
Input/Output Signals
|
|
•
|
Input/output signals are the inputs/outputs of the blocks in the diagram.
|
•
|
The base symbol u identifies input signals; the base symbol y identifies output signals.
|
•
|
The first index is the block identifier for the block to which the signal is referenced.
|
•
|
The second index is the port number.
|
•
|
The remaining indices specify the port index of a vector/matrix port.
|
•
|
For example, the signal u[3,2,1,1] is an input to block 3; it connects to the second inport port, which is a matrix port, this is the (1,1) index of the matrix.
|
|
|
Functions
|
|
•
|
Unevaluated function calls represent expressions too complicated to be readily represented by algebraic expressions.
|
•
|
The base symbol fn identifies a function.
|
•
|
The first index is a name corresponding to the type of block that the function represents; MATLABFcn and Lookup are two possibilities.
|
|
|
Parameters
|
|
•
|
Parameters correspond to mask parameters and MATLAB global parameters used in the block equations.
|
•
|
The base symbol K identifies parameters.
|
•
|
The first index is the block identifier corresponding to the subsystem block in which the mask parameter is defined. A MATLAB global variable is assigned a block identifier of 0.
|
•
|
The second index is a string corresponding to the name of the MATLAB parameter.
|
•
|
The values of mask parameters are given in the parameters field (see below).
|
•
|
For example, K[3,"A0"] is the Simulink mask parameter A0 defined in subsystem 3. K[0,"x"] is the MATLAB global variable x.
|
|
|
Sink Signals
|
|
•
|
A sink signal is a signal that is terminated by a sink block, such as a Scope or Display.
|
•
|
The base symbol Sink identifies sink signals.
|
•
|
The first index is the name of the type of block.
|
•
|
The second index is the block identifier.
|
•
|
The third index is the port number.
|
•
|
The remaining indices specify the port index of a vector/matrix port.
|
•
|
For example, the signal Sink[Scope,3,2,1] is a connection to the Scope with block identifier 3; it connects to the second inport port, which is a vector port, this is the (1) index of the vector.
|
|
|
Source Signals
|
|
•
|
A source signal is a signal that is generated by a source block, such as a Ramp or Step.
|
•
|
The base symbol Source identifies source signals.
|
•
|
The first index is the name of the type of block.
|
•
|
The second index is the block identifier.
|
•
|
The third index is the port number.
|
•
|
The remaining indices specify the port index of a vector/matrix port.
|
•
|
For example, the signal Source[Step,3,2,1] is a connection to the Scope with block identifier 3; it connects to the second inport port, which is a vector port, this is the (1) index of the vector.
|
•
|
The Maple expression for the source is contained in the inputeqs field.
|
|
|
State Variables
|
|
•
|
A state variable corresponds to a dependent variable in a differential equation.
|
•
|
The base symbol x identifies state variables.
|
•
|
The first index is the block identifier for the block in which the state variable is associated.
|
•
|
The remaining indices specify the particular variable; they generally correspond to the port index of the input signal to which the state variable is associated. For example, the state variables for an integrator with block identifier 3 and a port width of two might be x[3,1,1] and x[3,1,2].
|
|
|
|
Fields
|
|
The data structure consists of a record with the following fields:
•
|
equations = list(equation)
|
|
Contains the equations that define (1) the outputs of the blocks of the system, (2) the state equations (if any) of the blocks, and (3) the links between blocks. The left side of each equation should be an output. For equations that define the outputs of a block, these are the names of the output signal, for example, y[4,1,1] = 3*u[4,1,1]. For link equations, these are the inputs of the destination block, for example, u[5,1,1] = y[4,1,1].
|
•
|
initialeqs = list(function = anything)
|
|
Defines the initial values of the state variables of the system. The left side of each equation is an unevaluated function call with the form x[num, ix](0), where num is the block identifier of the functional block in which the state variable appeared; and ix is a sequence of integers that uniquely identify that state variable in the block. The right side of the equation is the initial value of the state variable. It may be a numeric value or a parameter.
|
•
|
inputvars = list(indexed)
|
|
The names of the inputs of the system or subsystem. These are connected to the outputs of source blocks (Sin, Ramp, etc) and Inport blocks of subsystems.
|
•
|
linkeqs = list(indexed = indexed)
|
|
Equations that identify the outputs of blocks with the inputs of the blocks they connect. For example, the equation u[2,1,1] = y[3,1,2] indicates that the
|
•
|
outputvars = list(indexed)
|
|
The names of the output of the system or subsystem. These are connected to the inputs of sink blocks and Outport blocks of subsystems.
|
•
|
parameters = list(indexed = anything)
|
|
Specifies the values of subsystem mask and MATLAB global parameters used in equations. The left side of each equation consists of an indexed name K[num,str], where num is the block identifier of the subsystem in which parameter was defined (0 if the parameter is a MATLAB global), and str is a string corresponding to the parameter name. The right side of the equation is the value of the name. It may be expressed in terms of other block parameters.
|
|
A table whose indices consist of indexed names and whose entries are corresponding procedures.
|
•
|
sourceeqs = list(indexed = algebraic)
|
|
Equations that define the time-behavior of sources. The left side is source symbol (see above). The right side is the definition of the source.
|
•
|
statevars = list(indexed)
|
|
The state-variables of the system. State variables are the dependent variables in differential equations.
|
|
|
|