MoCustomComponent

This blocks allows users to define a component behavior in Modelica language.

CustomBlocks

Description

This block provides a generic interface for specifying its properties and defining its simulation function. The simulation function is specified as a Modelica code and stored as a block parameter.

The custom component, with implicit ports, can then be connected to other Modelica blocks.For more details, please refer to the section on Physical Component Modeling in the Extended Definitions for Advanced Users.

For the parameters, 3 options are offered in Modelica language:

"Fixed" means that this is a constant and cannot change during simulation. In Modelica, this is expressed as: Parameter Real R=1;

"Fixed only at initialization" means that this value can change during simulation, but when the compiler tried to find the initial value this value must not change. In Modelica, this is expressed as: Parameter Real R(start = 1,fixed=true);

"Variable" means that this value can change during the simulation and during the initialization phase. In Modelica, this is epxressed as: Parameter Real R(start=1); or Parameter Real R(start=1,fixed=false);

Parameters

NameLabelDescriptionData TypeValid Values

nin

Number of left ports

Number

inports

Left ports

Structure

inports/name

Name

Cell of strings

nout

Number of right ports

Number

outports

Right ports

Structure

outports/name

Name

Cell of strings

NameLabelDescriptionData TypeValid Values

nparams

Number of scalar parameters

Number

params

Parameters

Structure

params/name

Name

Cell of strings

params/value

Value

Cell of scalars

params/typ

Type

Cell of strings

'Fixed'
'Fixed
only
at
initialization'
'Variable'

nparamsvec

Number of vector parameters

Number

paramsvec

Parameters

Structure

paramsvec/name

Name

Cell of strings

paramsvec/value

Value

Cell of vectors

paramsvec/typ

Type

Cell of strings

'Fixed'
'Fixed
only
at
initialization'
'Variable'

nparamsmat

Number of matrix parameters

Number

paramsmat

Parameters

Structure

paramsmat/name

Name

Cell of strings

paramsmat/value

Value

Cell of matrices

paramsmat/typ

Type

Cell of strings

'Fixed'
'Fixed
only
at
initialization'
'Variable'

NameLabelDescriptionData TypeValid Values

codename

Function name

Name of the model as it appears in the Function code.

String

code

Function code

Modelica code describing the behavior of the component.

String

nlibs

Number of external libraries

Number

libs

Libs

Structure

libs/path

Lib name

Cell of strings

Ports

NameTypeDescriptionIO TypeNumber

Port 1

implicit

output

nout

Port 2

implicit

input

nin