I want to load a 'fmu' in Linux by pyfmi.load_fmu, but I get a error.
error1 in env1:
Could not find GLIMDA. Traceback (most recent call last): File "/home/user/Documents/hdh/paper/ling_min_du.py", line 12, in model = pyfmi.load_fmu(fmu_path) File "src/pyfmi/fmi.pyx", line 7899, in pyfmi.fmi.load_fmu File "src/pyfmi/fmi.pyx", line 2558, in pyfmi.fmi.FMUModelCS1.init File "src/pyfmi/fmi.pyx", line 1167, in pyfmi.fmi.FMUModelBase.init File "src/pyfmi/fmi.pyx", line 45, in pyfmi.fmi.encode TypeError: latin_1_encode() argument 1 must be str, not bytes
error in env2:
Traceback (most recent call last): File "ling_min_du.py", line 26, in model = pyfmi.load_fmu(fmu_path) File "src/pyfmi/fmi.pyx", line 7898, in pyfmi.fmi.load_fmu File "src/pyfmi/fmi.pyx", line 2553, in pyfmi.fmi.FMUModelCS1.init File "src/pyfmi/fmi.pyx", line 1225, in pyfmi.fmi.FMUModelBase.init pyfmi.fmi.FMUException: The FMU contains no binary for this platform.
env1: I have installed the FMILibrary and import pyfmi successfully. pip list:
Package Version
-------------------- ---------
absl-py 0.7.1
Assimulo 3.0
astor 0.7.1
astroid 2.0.4
certifi 2019.6.16
cycler 0.10.0
Cython 0.29.11
gast 0.2.2
google-pasta 0.1.7
grpcio 1.22.0
h5py 2.9.0
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
kiwisolver 1.1.0
lazy-object-proxy 1.4.1
lxml 4.2.3
Markdown 3.1.1
matplotlib 2.2.2
numpy 1.16.4
pandas 0.23.4
Pillow 6.1.0
pip 19.1.1
protobuf 3.8.0
PyFMI 2.5
pyparsing 2.4.0
python-dateutil 2.8.0
pytz 2019.1
scikit-learn 0.20.0
scipy 1.3.0
setuptools 41.0.1
sip 4.19.8
six 1.12.0
tensorboard 1.14.0
tensorflow 1.14.0
tensorflow-estimator 1.14.0rc1
termcolor 1.1.0
tornado 6.0.3
typed-ast 1.4.0
Werkzeug 0.15.4
wheel 0.32.2
wrapt 1.11.2
env2: I try to reinstall pyfmi by conda install, get a new error. pip list:
Package Version
--------------- ---------
Assimulo 3.0
certifi 2019.6.16
cycler 0.10.0
kiwisolver 1.1.0
lxml 4.3.4
matplotlib 3.1.0
numpy 1.16.4
pandas 0.24.2
pip 19.1.1
PyFMI 2.5.3
pyparsing 2.4.0
python-dateutil 2.8.0
pytz 2019.1
scipy 1.3.0
setuptools 41.0.1
six 1.12.0
tornado 6.0.3
wheel 0.33.4
import numpy as np
import pyfmi
import matplotlib.pyplot as plt
fmu_path = './fmu/FeedSystem_Examples_current_2.fmu'
start_time = 0.
final_time = 10.
sample_period = 0.001
simulation_steps = int((final_time - start_time) / sample_period)
model = pyfmi.load_fmu(fmu_path)
opts = model.simulate_options()
opts["ncp"] = simulation_steps
result = model.simulate(start_time=start_time, final_time=final_time, options=opts)
result = np.array(result["massWithStopAndFriction.s"]).reshape(-1, )
plt.figure()
plt.plot(result)
plt.show()