SM_CTRL
1.0
Управление генератором сигналов
|
#include <baseblock.h>
Public Member Functions | |
void | start () |
void | outputs () |
void | derivatives () |
void | zeroCrossings () |
void | update () |
void | terminate () |
Static Public Member Functions | |
static void | setSimStruct (SimStruct *S) |
static void | initializeParameterPortSizes () |
static void | initializeInputPortSizes () |
static void | initializeOutputPortSizes () |
static void | initializeStatePortSizes () |
static void | initializeNumberSampleTimes () |
static void | initializeOptions () |
static void | setInputPortDimensionInfo (int port, const DimsInfo_T *dimsInfo) |
static void | setOutputPortDimensionInfo (int port, const DimsInfo_T *dimsInfo) |
static void | checkParameters () |
static void | initializeSampleTimes () |
static double | getInputDouble (int port) |
static double | getInputInt (int port) |
static Array | getInputArray (int port) |
static int | getInputWidth (int port) |
static int | getInputNRows (int port) |
static int | getInputNCols (int port) |
static void | setInputPortDimensions (int port, int nrows, int ncols) |
static void | setOutputDouble (int port, double value) |
static void | setOutputArray (int port, Array &array) |
static Array | getOutputArray (int port) |
static int | getOutputWidth (int port) |
static int | getOutputNRows (int port) |
static int | getOutputNCols (int port) |
static void | setOutputPortDimensions (int port, int nrows, int ncols) |
static double | getParameterDouble (int port) |
static int | getParameterInt (int port) |
static string | getParameterString (int port) |
static Array | getParameterArray (int port) |
static int | getParameterWidth (int port) |
static int | getParameterNRows (int port) |
static int | getParameterNCols (int port) |
static Array | getContinuousStateArray () |
static int | getContinuousStateWidth (int port) |
static void | setDerivativeStateArray (Array &array) |
static Array | getDiscreteStateArray () |
static int | getDiscreteStateWidth (int port) |
static void | setDiscreteStateArray (Array &array) |
static void | setContinuousStatesNumber (int num) |
static void | setDiscreteStatesNumber (int num) |
static time_T | getCurrentTime () |
Static Protected Attributes | |
static SimStruct * | simStruct =NULL |
BaseBlock is the basis class for designing new S-functions.
Use the file sfun_offset.cpp as a template to write a new S-function.
Definition at line 48 of file baseblock.h.
|
inlinestatic |
This static method is called with candidate parameter values. If the proposed dimensions or types are unacceptable, the method must throw an exception.
The possible types of the paramaters are:
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlcheckparameters.html
Definition at line 201 of file baseblock.h.
References getParameterString(), isIdentifier(), PARAMETER_NUMBER, parameterCols, parameterRows, parameterType, simStruct, and toString().
Referenced by mdlCheckParameters().
|
inline |
The Simulink engine invokes this optional method at each time step to compute the derivatives of the S-function's continuous states. This method should store the derivatives in the S-function's state derivatives array using derivativesArray.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlderivatives.html
Definition at line 279 of file baseblock.h.
Referenced by mdlDerivatives().
|
inlinestatic |
Returns the continuous state Array.
Definition at line 522 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the continuous state number of elements (1-D array).
Definition at line 530 of file baseblock.h.
References simStruct.
|
inlinestatic |
Get the current simulation time
Definition at line 596 of file baseblock.h.
References simStruct.
Referenced by mdlOutputs().
|
inlinestatic |
|
inlinestatic |
Returns the discrete state number of elements (1-D array).
Definition at line 560 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the input port Array.
Definition at line 343 of file baseblock.h.
References simStruct, and toString().
|
inlinestatic |
Returns the scalar value of an input port.
Definition at line 326 of file baseblock.h.
References simStruct.
Referenced by Block::outputs().
|
inlinestatic |
Returns the integer value of an input port
Definition at line 334 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the input port number of cols.
Definition at line 369 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the input port number of rows.
Definition at line 361 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the input port number of elements. If the input port is a 1-D array with w elements, this function returns w. If the input port is an M-by-N array, this function returns m*n.
Definition at line 353 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the output port Array.
Definition at line 413 of file baseblock.h.
References simStruct, and toString().
|
inlinestatic |
Returns the output port number of cols.
Definition at line 439 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the output port number of rows.
Definition at line 431 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the output port number of elements. If the output port is a 1-D array with w elements, this function returns w. If the output port is an M-by-N array, this function returns m*n.
Definition at line 423 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns an Array connected to a parameter port.
Definition at line 486 of file baseblock.h.
References simStruct, and toString().
|
inlinestatic |
Returns the double value of a parameter port.
Definition at line 460 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the int value of a parameter port.
Definition at line 468 of file baseblock.h.
References simStruct.
Referenced by Block::start().
|
inlinestatic |
Returns the parameter port number of cols.
Definition at line 513 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the parameter port number of rows.
Definition at line 505 of file baseblock.h.
References simStruct.
|
inlinestatic |
Returns the string value of a parameter port.
Definition at line 476 of file baseblock.h.
References simStruct.
Referenced by checkParameters(), and Block::start().
|
inlinestatic |
Returns the parameter port number of elements.
If the parameter port is a 1-D array with w elements, this function returns w. If the parameter port is an M-by-N array, this function returns m*n.
Definition at line 497 of file baseblock.h.
References simStruct.
|
inlinestatic |
This is the second static method that the Simulink engine calls within mdlInitializeSizes. This method specifies the number of input ports and their dimensions. All ports are set to direct feedthrough by default.
Use -1 to specify dynamically dimensioned input signals.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlinitializesizes.html
Definition at line 95 of file baseblock.h.
References INPUT_PORT_NUMBER, inputPortCols, inputPortRows, setInputPortDimensions(), simStruct, and toString().
Referenced by mdlInitializeSizes().
|
inlinestatic |
This is the fifth static method that the Simulink engine calls within mdlInitializeSizes. This method specifies the number of sample time (i.e., sample rates) at which the block operates.
The default value is 1
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlinitializesizes.html
Definition at line 148 of file baseblock.h.
References simStruct.
Referenced by mdlInitializeSizes().
|
inlinestatic |
This is the sixth static method that the Simulink engine calls within mdlInitializeSizes. This method specifies the simulation options that this block implements, using ssSetOptions.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlinitializesizes.html
Definition at line 162 of file baseblock.h.
Referenced by mdlInitializeSizes().
|
inlinestatic |
This is the third static method that the Simulink engine calls within mdlInitializeSizes. This method specifies the number of output ports and their dimensions.
Use -1 to specify dynamically dimensioned output signals.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlinitializesizes.html
Definition at line 116 of file baseblock.h.
References OUTPUT_PORT_NUMBER, outputPortCols, outputPortRows, setOutputPortDimensions(), simStruct, and toString().
Referenced by mdlInitializeSizes().
|
inlinestatic |
This is the first static method that the Simulink engine calls within mdlInitializeSizes. This method specifies the number of parameters and wheter or not they are tunable. A parameter is tunable if its value can change during simulation.
Use -1 to specify dynamically dimensioned parameters.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlinitializesizes.html
Definition at line 73 of file baseblock.h.
References PARAMETER_NUMBER, parameterTunable, simStruct, and toString().
Referenced by mdlInitializeSizes().
|
inlinestatic |
This static method should specify the sample time and offset time for each sample rate at which this S-function operates.
The default values are INHERITED_SAMPLE_TIME and FIXED_IN_MINOR_STEP_OFFSET
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlinitializesampletimes.html
Definition at line 243 of file baseblock.h.
References simStruct.
Referenced by mdlInitializeSampleTimes(), and Block::outputs().
|
inlinestatic |
This is the fourth static method that the Simulink engine calls within mdlInitializeSizes. This method specifies the number of continuous and discrete states.
The default values are zero continuous states and zero discrete states.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlinitializesizes.html
Definition at line 133 of file baseblock.h.
References simStruct.
Referenced by mdlInitializeSizes().
|
inline |
The Simulink engine invokes this method at each simulation time step. The method should compute the S-function's outputs at the current time step and store the results using outputArray or using writeOutput.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdloutputs.html
Definition at line 268 of file baseblock.h.
|
inlinestatic |
Sets the number of continuous states. Must be used in lastMinuteSizeChanges.
Definition at line 582 of file baseblock.h.
References simStruct.
|
inlinestatic |
Writes the derivative state Array.
Definition at line 538 of file baseblock.h.
References Array::getData(), Array::getName(), Array::getNCols(), Array::getNRows(), Array::getWidth(), and simStruct.
|
inlinestatic |
Writes the discrete state Array.
Definition at line 568 of file baseblock.h.
References Array::getData(), Array::getName(), Array::getNCols(), Array::getNRows(), Array::getWidth(), and simStruct.
|
inlinestatic |
Sets the number of discrete states. Must be used in lastMinuteSizeChanges.
Definition at line 590 of file baseblock.h.
References simStruct.
|
inlinestatic |
This static method is called with candidate dimensions for input port. If the proposed dimensions are unacceptable for the port, the method must throw an exception.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlsetinputportdimensioninfo.html
Definition at line 172 of file baseblock.h.
References simStruct.
Referenced by mdlSetInputPortDimensionInfo().
|
inlinestatic |
Sets the input port dimensions. Must be used only in initializeInputPortSizes
Definition at line 378 of file baseblock.h.
References simStruct.
Referenced by initializeInputPortSizes().
|
inlinestatic |
Writes an Array to an output port. Dimensions must agree.
Definition at line 399 of file baseblock.h.
References Array::getData(), Array::getName(), Array::getNCols(), Array::getNRows(), Array::getWidth(), simStruct, and toString().
Referenced by Block::outputs().
|
inlinestatic |
Writes a double or int value to an output port.
Definition at line 390 of file baseblock.h.
References simStruct.
Referenced by Block::outputs().
|
inlinestatic |
This static method is called with candidate dimensions for output port. If the proposed dimensions are unacceptable for the port, the method must throw an exception.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlsetoutputportdimensioninfo.html
Definition at line 183 of file baseblock.h.
References simStruct.
Referenced by mdlSetOutputPortDimensionInfo().
|
inlinestatic |
Sets the output port dimensions. Must be used only in initializeOutputPortSizes
Definition at line 448 of file baseblock.h.
References simStruct.
Referenced by initializeOutputPortSizes().
|
inlinestatic |
Definition at line 58 of file baseblock.h.
References simStruct.
Referenced by mdlCheckParameters(), mdlDerivatives(), mdlInitializeSampleTimes(), mdlInitializeSizes(), mdlOutputs(), mdlSetInputPortDimensionInfo(), mdlSetOutputPortDimensionInfo(), mdlStart(), mdlTerminate(), mdlUpdate(), and mdlZeroCrossings().
|
inline |
The Simulink engine invokes this method at the beginning of a simulation right after contructing the class. The method should perform initialization activities that this S-function requires only once, such as allocating memory, setting up user data, or initializing states.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlstart.html
Definition at line 258 of file baseblock.h.
|
inline |
The Simulink engine invokes this method when the simulation is terminated right before deleting the class. This method should perform any terminal actions, such as freeing of memory.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlterminate.html
Definition at line 318 of file baseblock.h.
|
inline |
The Simulink engine invokes this optional method at each major simulation time step. The method should compute the S-function's states at the current time step and store the states in the S-function's state vector. The method can also perform any other tasks that the S-function needs to perform at each major time step.
Use this code if your S-function has one or more discrete states or does not have direct feedthrough.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlupdate.html
Definition at line 307 of file baseblock.h.
Referenced by mdlUpdate().
|
inline |
An S-function needs to provide this optional method only if it does zero-crossing detection. Implementing zero-crossing detection typically requires using the zero-crossing and mode work vectors to determine when a zero crossing occurs and how the S-function's outputs should respond to this event. The zeroCrossings method should update the S-function's zero-crossing vector, using nonSampledZCsArray.
For more information, see: http://www.mathworks.fr/fr/help/simulink/sfg/mdlzerocrossings.html
Definition at line 292 of file baseblock.h.
Referenced by mdlZeroCrossings().
|
staticprotected |
SimStruct data structure allocated for the S-function. Can be used to call simulink macros.
Definition at line 54 of file baseblock.h.
Referenced by checkParameters(), getContinuousStateArray(), getContinuousStateWidth(), getCurrentTime(), getDiscreteStateArray(), getDiscreteStateWidth(), getInputArray(), getInputDouble(), getInputInt(), getInputNCols(), getInputNRows(), getInputWidth(), getOutputArray(), getOutputNCols(), getOutputNRows(), getOutputWidth(), getParameterArray(), getParameterDouble(), getParameterInt(), getParameterNCols(), getParameterNRows(), getParameterString(), getParameterWidth(), initializeInputPortSizes(), initializeNumberSampleTimes(), initializeOutputPortSizes(), initializeParameterPortSizes(), initializeSampleTimes(), initializeStatePortSizes(), setContinuousStatesNumber(), setDerivativeStateArray(), setDiscreteStateArray(), setDiscreteStatesNumber(), setInputPortDimensionInfo(), setInputPortDimensions(), setOutputArray(), setOutputDouble(), setOutputPortDimensionInfo(), setOutputPortDimensions(), and setSimStruct().