- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Division by zero error when exporting...
Division by zero error when exporting model example as FMU to python
Division by zero error when exporting model example as FMU to python
Exporting the AIMC_Inverter example model as FMU to python through FMI and trying to simulate throws a division by zero error. On the other hand, simulating from OMedit GUI works fine!
code:
import numpy as np
from matplotlib import pyplot as plt
import pyfmi
fmodel = pyfmi.load_fmu('.../path/to/Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMC_Inverter.fmu')
# co-simulation parameters
dt = 50e-6 # simulation step
tf = 10.0 # end time
ts = 0.1 # begin time
x = []
y = []
t = []
while ts <= tf:
# Calculate integration step
try:
status = fmodel.do_step(ts, dt)
except Exception as e:
print('error: ' + e.args)
# check integration step completed
if status is not pyfmi.fmi.FMI_OK:
break
# store target variables values
x.append( fmodel.get( 'currentQuasiRMSSensor.I' ) )
y.append( fmodel.get( 'aimc.wMechanical' ) )
t.append( ts )
# Increments simulation step
ts += dt
plt.grid()
plt.xlabel('time[s]')
plt.ylabel('y')
plt.plot(t,y,'r+')
plt.show()
Error:
assert | debug | division by zero at time 0, (a=0) / (b=0), where divisor b expression is: vfController.fNominal
getBestJumpBuffer got mmc_jumper=(nil), globalJumpBuffer=(nil)
Aborted (core dumped)
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Division by zero error when exporting...