modelReal_Real
Extends from Modelica.Blocks.Interfaces.DiscreteBlock (Base class of discrete control blocks).
Information
Block that exchanges data with a Python function that does not need to pass an object from one call to the next.
For each element in the input vector uR[nDblWri],
the value of the flag flaDblWri[nDblWri] determines whether
the current value, the average over the sampling interval or the integral
over the sampling interval is sent to Python. The following three options are allowed:
| flaDblWri[i] | Value sent to Python |
| 0 | Current value of uR[i] |
| 1 | Average value of uR[i] over the sampling interval |
| 2 | Integral of uR[i] over the sampling interval |
If the function needs to pass an object from one invocation to the
next, set passPythonObject = true.
Otherwise, leave it at its default value passPythonObject = false.
Note that the model is same as Buildings.Utilities.IO.Python_3_12.Real_Real, except the model propagates the parameters for strings writing to Python.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| SI.Time | samplePeriod (from DiscreteBlock) | Sample period of component | |
| SI.Time | startTime (from DiscreteBlock) | 0 | First sample time instant |
| String | moduleName | Name of the python module that contains the function | |
| String | functionName | moduleName | Name of the python function |
| Integer | nDblWri | Number of double values to write to Python | |
| Integer | nDblRea | Number of double values to be read from the Python | |
| Integer | nStrWri | 1 | Number of strings to write to Python |
| String[max(1, nStrWri)] | strWri | {""} | String values to write |
| Integer | flag | 0 | Flag for double values (0: use current value, 1: use average over interval, 2: use integral over interval) |
| Integer[nDblWri] | flaDblWri | fill(flag, nDblWri) | Flag for double values (0: use current value, 1: use average over interval, 2: use integral over interval) |
| Boolean | passPythonObject | false | Set to true if the Python function returns and receives an object, see User's Guide |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Blocks.Interfaces.RealInput[nDblWri] | uR | Real inputs to be sent to Python | |
| Modelica.Blocks.Interfaces.RealOutput[nDblRea] | yR | Real outputs received from Python |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Real[nDblWri] | uRInt | Value of integral | |
| Real[nDblWri] | uRIntPre | Value of integral at previous sampling instance | |
| Real[nDblWri] | uRWri | Value to be sent to Python | |
| Real[nDblWri] | uRWri_temp | Internal value |
Revisions
-
June 23, 2026, by Jianjun Hu:
First implementation.