-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpackage.mo
More file actions
25 lines (23 loc) · 740 Bytes
/
package.mo
File metadata and controls
25 lines (23 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
within OMCallPythonAdvanced;
package Examples
extends Modelica.Icons.ExamplesPackage;
import OMCallPythonAdvanced.Py;
model Test
extends Modelica.Icons.Example;
Py.PythonHandle pyHandle = Py.PythonHandle() "Initialize Python";
String pyProgram =
"def multiply(x, y):
print(\"Will compute\", x, \"times\", y)
print('Time: " + String(time) + "')
return x * y
";
parameter String pyModuleName = "__main__";
parameter String pyFunctionName = "multiply";
parameter Real a = -1.0;
Real x(start = 1.0, fixed = true);
initial algorithm
Py.initialize(pyHandle);
equation
der(x) = Py.twoRealArgumentsReturnReal(pyHandle, x, a, pyProgram, pyModuleName, pyFunctionName);
end Test;
end Examples;