PyCustomBlock
The behavior of this block can be user-defined in Python language.
Library
Activate/CustomBlocks
Description
The Python Custom block provides a generic interface for specifying its properties and defining its simulation function. The simulation function is specified as an PY code and stored as a block parameter. The Python code is used during simulation.
For more details, see the Extended Definitions for Advanced Users.Parameters
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
nin | Number of input ports | Number | ||
inports | Input port parameters | Structure | ||
inports/inrow | Row size | Cell of scalars | ||
inports/incol | Column size | Cell of scalars | ||
inports/it | Type | Cell of strings | 'double' | |
inports/depu | Feedthrough | Cell of scalars | 0 | |
inports/name | Name | Cell of strings | ||
nevin | Number of input event ports | Number | ||
nout | Number of output ports | Number | ||
outports | Output port parameters | Structure | ||
outports/outrow | Row size | Cell of scalars | ||
outports/outcol | Column size | Cell of scalars | ||
outports/ot | Type | Cell of strings | 'double' | |
outports/name | Name | Cell of strings | ||
nevout | Number of output event ports | Number | ||
evoutports | Initial firing values | Structure | ||
evoutports/fir | Firing (<0 for no firing) | Cell of scalars |
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
xx | Initial continuous state | Vector | ||
xd | Initial state derivative | Vector | ||
z | Initial discrete state | Vector | ||
noz | Number of initial object states | Number | ||
ozparams | Initial object states | Structure | ||
ozparams/oztyp | Type | Cell of strings | 'double' | |
ozparams/ozvalue | Value | Cell of matrices | ||
ozparams/name | Name | Cell of strings |
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
rpar | Real parameters vector | Vector | ||
ipar | Integer parameters vector | Vector | ||
nopar | Number of object parameters | Number | ||
oparparams | Object parameters | Structure | ||
oparparams/opartyp | Type | Cell of strings | 'double' | |
oparparams/oparvalue | Value | |||
oparparams/name | Name | Cell of strings |
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
inlined | Inlined Python code | Number | 0 | |
code | Function code | String | ||
fcn | Function | Structure | ||
fcn/slib | Python file path | Cell of strings | ||
fcn/epoint | Python function name | Cell of strings | ||
impl | Implicit block (function) | Number | 0 |
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
nmode | Number of modes | Scalar | ||
nzcr | Number of zero-crossings | Scalar | ||
dept | Activation mode | String | 'Always |
Ports
Name | Type | Description | IO Type | Number |
---|---|---|---|---|
Port 1 | explicit | output | nout | |
Port 2 | explicit | input | nin | |
Port 3 | activation | input | nevin | |
Port 4 | activation | output | nevout |