Replies: 2 comments 1 reply
-
Hi, It’s strange that the FMU works with your script, but not with the fmpy GUI. Just a couple of questions
I wonder if the discussions in NTNU-IHB/PythonFMU#110 are of any use? Have you tried using just the simple example in https://github.com/StephenSmith25/PythonFMU3/blob/master/examples/demoslave.py. You should be able to run this with both the GUI, using
And a simple script,
Can you share more about the FMU you are running and whether it has any dependencies? |
Beta Was this translation helpful? Give feedback.
-
Okay so the problem with FMPy was, as you suggested, that I was running in 2 different environments. But I am still not able to run it with Simulink. I have tried to generate the example above (the Demoslave) and here it works. But when I try to import numpy, it either crashes Matlab, or it fails to instasiate the FMU. I have tried using the PythonFMU to generate with the 2.0 standard and it has the same issue. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have generated a FMU and i'm not able to run it with Matlab or FMPy GUI. When I run a custom script using FMPy, i get the expected results. When trying to run the FMU with Matlab of FMPy GUI it says that there is some error with the fmi3InstantiateCoSimulation. But what I don't understand is why it then works with the custom script where I run the .instantiate() function on the FMU that (as far as I can se in the documentation) also run the fmi3InstantiateCoSimulation works, but dosen't work elsewhere.
FMPy GUI Bug log:
fmi3InstantiateCoSimulation(instanceName="PythonSlave", instantiationToken="834f38c2-d15c-11ee-abb3-98597af38661", resourcePath="C:\Users\mela\AppData\Local\Temp\tmpakwicwne\resources\", visible=True, loggingOn=True, eventModeUsed=False, earlyReturnAllowed=False, requiredIntermediateVariables=NULL, nRequiredIntermediateVariables=0, instanceEnvironment=0x0, logMessage=<CFunctionType object at 0x0000029857A8DCC0>, intermediateUpdate=<CFunctionType object at 0x000002987F9EB520>) -> 0x0
:Custom script I test the code with:
`from fmpy import read_model_description, extract
from fmpy.fmi3 import FMU3Slave
from fmpy.util import plot_result, download_test_file
import numpy as np
import shutil
import math
def simulate_custom_input(show_plot=True):
if name == 'main':
Beta Was this translation helpful? Give feedback.
All reactions