modelExchange
Test model for exchange function
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
This example calls various functions in the Python module testFunctions.py.
It tests whether arguments and return values are passed correctly.
The functions in testFunctions.py are very simple in order to test
whether they compute correctly, and whether the data conversion between Modelica and
Python is implemented correctly.
Each call to Python is followed by an assert statement which terminates
the simulation if the return value is different from the expected value.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | passPythonObject | false | Set to true if the Python function returns and receives an object, see User's Guide |
| Real[1] | yR1 | Real function value | |
| Integer[1] | yI1 | Integer function value | |
| Real[2] | yR2 | Real function value | |
| Integer[2] | yI2 | Integer function value |
Contents
| Name | Description |
|---|---|
| Mprotected | Class that contains the Python object |
Revisions
-
January 10, 2022, by Michael Wetter:
Updated to Python 3.8. -
December 11, 2021, by Michael Wetter:
Changed implementation to assigning parameters as opposed to variables because the assignment is made through impure function calls. This is for MSL 4.0.0. -
December 10, 2021, by Michael Wetter:
Removed call to impure functionremoveFile. This removal is required for MSL 4.0.0. -
April 10, 2020, by Jianjun Hu and Michael Wetter:
Updated to Python 3.6. -
February 2, 2016, by Michael Wetter:
Changed constant arguments of exchange function frominttodouble. This is required for OpenModelica. -
January 31, 2013, by Michael Wetter:
First implementation.