SBlock - MapleSim Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


MapleSimConnector

  

SBlock

  

generate Simulink® source files to create a Simulink® block

 

Calling Sequence

Parameters

Description

Calling Sequence

SBlock(system, in_vars, out_vars, ModelName, param_opts)

Parameters

system

-

list; model equations

in_vars

-

list; input variables with respect to time

out_vars

-

list; output variables with respect to time

ModelName

-

(optional) string; name of the library

opts

-

(optional) equation(s) of the form option = value; specify options for SBlock

Description

• 

The SBlock command returns a string that contains a library of the C procedures required to create a Simulink® block for a continuous system using a solver that you provide. A MATLAB® M script is also provided to generate ports for the system.

  

Before the functions are generated, the system tries to perform index 1 reduction to obtain an ordinary differential equation (ODE) system to reduce the amount of time required to compute the system.

  

The input and output variables must be functions with respect to time, for example, y(t) and u(t).

The opts arguments are optional arguments of the form option = value, where option is one of the names listed below. These arguments correspond to keyword parameters; the left side of an equation is the keyword, the right side is the value. Each keyword parameter has a default value that is assigned if the parameter is not passed.

The following paragraphs describe each of the keyword parameters. The first line of each paragraph specifies the format of the argument: the left side is the keyword and the right side specifies the type of the value. If the type is truefalse, then passing just the keyword is equivalent to passing keyword = true.

• 

initialconditions = list(equation)

  

Specifies the initial values of the states in the system.

• 

parameters = list(equation)

  

Specifies the values of parameters in the system during initialization.

• 

librarymodel = truefalse

  

Specifies whether Simulink® creates a Model or a Library diagram.

• 

projectionmodel = truefalse

  

Specifies whether constraint projection is used in the resulting Simulink® block.

• 

iterationonProjection = numeric, nonnegative

  

Specify the maximum number of iterations for projection code when a fixed-step solver is used.

• 

tolonProjection = numeric, nonnegative

  

Specify the error tolerance for projection code when a variable step solver is used.

• 

opt(tvar, name) Defines the time variable used in the procedure. The default value is the variable t.

• 

functions = list Specify the user defined procedures for code generation.

• 

optimization = truefalse

  

Specifies the level of simplification applied to the model equations and the level of optimization applied to the generated C library. This option allows you to reduce the amount of time required to generate code.

See Also

MapleSim

MapleSimConnector