Hi all,
I'm new to the FMI standard and FMUs. I'm trying to export a FMU of a simple Simulink model, the Ohm's law in my case, to test the funcionality of the FMI standard in Python.
This is my Simulink model:
In the previous model I'm defining 2 inputs (Voltage and Resistance), a division and 1 output (Current). Then, I export the FMU by clicking on Save As > Export Model To > Standalone FMU. Note I'm configuring fixed-step size in the model settings. I've also tested exporting the FMU from the Command Window with the following line:
The FMU is exported correctly, but when I go to test it in Python 3 with a Jupyter notebook, I'm not obtaining the expected output. As shown below, for the input values V=10 and R=2, the simulation returns I=NaN. I'm pasting also the minimal code:
from pyfmi import load_fmu
model = load_fmu('OhmLaw.fmu')
model.set('Resistance', 2)
res = model.simulate(final_time=1, input=(), options={'ncp': 1})
I've tested with different data types in all blocks (auto, int32 and double), but I'm still not able to achieve the correct result.
I've tried to check for a similar problem in forums, but I haven't found anything similar. Does anyone know how to solve this issue? I'm using MATLAB R2022a in Windows 10.
Thank you,
Jon