EasyLink
EasyLink is a C++ software development kit for developing blocks for SIMULINK (S-functions)
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
BaseBlock Class Reference

#include <BaseBlock.h>

Inherited by Block, Block, Block, Block, Block, Block, Block, Block, and Block.

Public Member Functions

void start ()
 
void outputs ()
 
void derivatives ()
 
void zeroCrossings ()
 
void update ()
 
void terminate ()
 

Static Public Member Functions

static void assertParameterPortsCount (int portsCount)
 
static void assertParameterPort (int port, bool tunable, int nRows, int nCols, mxClassID type=mxDOUBLE_CLASS, mxComplexity complexFlag=mxREAL)
 
static void checkParametersSizes ()
 
static void setInputPortsCount (int portsCount)
 
static void setInputPort (int port, int nRows, int nCols, DTypeId type=SS_DOUBLE, bool directFeedThrough=true)
 
static void initializeInputPortSizes ()
 
static void setOutputPortsCount (int portsCount)
 
static void setOutputPort (int port, int nRows, int nCols, DTypeId type=SS_DOUBLE)
 
static void initializeOutputPortSizes ()
 
static void setContinuousStatesWidth (int num)
 
static void setDiscreteStatesWidth (int num)
 
static void initializeStatePortSizes ()
 
static void initializeNumberSampleTimes ()
 
static void initializeOptions ()
 
static void setInputPortFinalSizes (int port, int nRows, int nCols)
 
static void checkInputPortFinalSizes (int port, int nRows, int nCols)
 
static void setOutputPortFinalSizes (int port, int nRows, int nCols)
 
static void checkOutputPortFinalSizes (int port, int nRows, int nCols)
 
static void initializeSampleTimes ()
 
static double getInputDouble (int port)
 
template<typename _Scalar >
static _Scalar getInputScalar (int port)
 
template<typename _Scalar >
static Array< _Scalar > getInputArray (int port)
 
static void * getInputData (int port)
 
static int getInputWidth (int port)
 
static int getInputNRows (int port)
 
static int getInputNCols (int port)
 
static void setOutputDouble (int port, double value)
 
template<typename _Scalar >
static void setOutputScalar (int port, _Scalar value)
 
template<typename _Scalar >
static Array< _Scalar > getOutputArray (int port)
 
static void * getOutputData (int port)
 
static int getOutputWidth (int port)
 
static int getOutputNRows (int port)
 
static int getOutputNCols (int port)
 
static double getParameterDouble (int port)
 
template<typename _Scalar >
static _Scalar getParameterScalar (int port)
 
static std::string getParameterString (int port)
 
template<typename _Scalar >
static Array< _Scalar > getParameterArray (int port)
 
static int getParameterWidth (int port)
 
static int getParameterNRows (int port)
 
static int getParameterNCols (int port)
 
static void * getParameterData (int port)
 
static Array< double > getContinuousStateArray ()
 
static double * getContinuousStateData ()
 
static int getContinuousStateWidth ()
 
static Array< double > getDerivativeStateArray ()
 
static double * getDerivativeStateData ()
 
static void setDerivativeStateArray (Array< double > &array)
 
static Array< double > getDiscreteStateArray ()
 
static double * getDiscreteStateData ()
 
static int getDiscreteStateWidth (int port)
 
static void setDiscreteStateArray (Array< double > &array)
 
static time_T getSimulationTime ()
 

Static Protected Attributes

static SimStruct * simStruct = NULL
 

Detailed Description

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 21 of file BaseBlock.h.

Member Function Documentation

◆ assertParameterPort()

static void BaseBlock::assertParameterPort ( int  port,
bool  tunable,
int  nRows,
int  nCols,
mxClassID  type = mxDOUBLE_CLASS,
mxComplexity  complexFlag = mxREAL 
)
inlinestatic

This method checks the dimensions and the type of a parameter port.

This method allows also to set a parameter port not tunable. A parameter is tunable if its value can be changed by users during the simulation.

Use -1 to specify dynamically dimensioned parameter arrays.

Definition at line 57 of file BaseBlock.h.

◆ assertParameterPortsCount()

static void BaseBlock::assertParameterPortsCount ( int  portsCount)
inlinestatic

This method checks the number of parameters.

Definition at line 42 of file BaseBlock.h.

◆ getSimulationTime()

static time_T BaseBlock::getSimulationTime ( )
inlinestatic

Get the current simulation time

Definition at line 704 of file BaseBlock.h.

◆ setInputPort()

static void BaseBlock::setInputPort ( int  port,
int  nRows,
int  nCols,
DTypeId  type = SS_DOUBLE,
bool  directFeedThrough = true 
)
inlinestatic

This method sets the dimensions and the type of an input port.

Use -1 to specify dynamically dimensioned intput arrays.

Definition at line 116 of file BaseBlock.h.

◆ setInputPortFinalSizes()

static void BaseBlock::setInputPortFinalSizes ( int  port,
int  nRows,
int  nCols 
)
inlinestatic

This method sets the final dimensions of an input port.

Definition at line 251 of file BaseBlock.h.

◆ setInputPortsCount()

static void BaseBlock::setInputPortsCount ( int  portsCount)
inlinestatic

This method sets the number of input ports.

Definition at line 104 of file BaseBlock.h.

◆ setOutputPort()

static void BaseBlock::setOutputPort ( int  port,
int  nRows,
int  nCols,
DTypeId  type = SS_DOUBLE 
)
inlinestatic

This method sets the dimensions and the type of an output port.

Use -1 to specify dynamically dimensioned intput arrays.

Definition at line 164 of file BaseBlock.h.

◆ setOutputPortFinalSizes()

static void BaseBlock::setOutputPortFinalSizes ( int  port,
int  nRows,
int  nCols 
)
inlinestatic

This method sets the final dimensions of an output port.

Definition at line 279 of file BaseBlock.h.

◆ setOutputPortsCount()

static void BaseBlock::setOutputPortsCount ( int  portsCount)
inlinestatic

This method sets the number of output ports.

Definition at line 152 of file BaseBlock.h.

Member Data Documentation

◆ simStruct

SimStruct * BaseBlock::simStruct = NULL
staticprotected

SimStruct data structure allocated for the S-function. Can be used to call simulink macros.

Definition at line 26 of file BaseBlock.h.


The documentation for this class was generated from the following file:

Copyright (c) 2014 FEMTO-ST / ENSMM / UFC / UTBM, Besançon, France. Generated by Doxygen.