Buildings.Utilities.IO.Python_3_8.Functions.Examples
Collection of models that illustrate model use and test models
Information
This package contains examples for the use of models that can be found in Buildings.Utilities.IO.Python_3_8.Functions.
The examples demonstrate how to call Python functions from Modelica.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
Name | Description |
---|---|
Exchange | Test model for exchange function |
ExchangeWithPassPythonObject | Test model for exchange function with memory |
Buildings.Utilities.IO.Python_3_8.Functions.Examples.Exchange
Test model for exchange function
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.
Extends from Modelica.Icons.Example (Icon for runnable examples).
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 | yR1[1] | Real function value | |
Integer | yI1[1] | Integer function value | |
Real | yR2[2] | Real function value | |
Integer | yI2[2] | Integer function value |
Modelica definition
Buildings.Utilities.IO.Python_3_8.Functions.Examples.ExchangeWithPassPythonObject
Test model for exchange function with memory
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.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
---|---|---|---|
Boolean | passPythonObject | true | Set to true if the Python function returns and receives an object, see User's Guide |
Real | yR1[1] | Real function value | |
Real | yR2[1] | Real function value |
Modelica definition
Buildings.Utilities.IO.Python_3_8.Functions.Examples.Exchange.M
Class that contains the Python object