Running the simulation from OMedit works just fine. But, when I export the model as FMU to a python script thru the pyfmi module, I get the following error:
The default linear solver fails, the fallback solver with total pivoting is started at time 0.000000. That might raise performance issues, for more information use -lv LOG_LS
Here is the code:
import numpy as np
from matplotlib import pyplot as plt
import pyfmi
fmodel = pyfmi.load_fmu('/tmp/OpenModelica_alexandre/OMEdit/AIMC_Inverter/AIMC_Inverter.fmu')
#Define input ramp signal:
def freq(time):
if time <= 60:
f = time
else:
f = 60
return f
#CS parameters
dt = 0.5 #simulation step
tf = 10.0 # final instant
ts = 0.1 # initial instant
x = []
y = []
t = []
while ts <= tf:
#Calculates an integration step
try:
status = fmodel.do_step(ts, dt)
except Exception as e:
print('erro: ' + e.args)
#checks integrations step completed
if status is not pyfmi.fmi.FMI_OK:
break
#set next step input value:
fmodel.set( 'f', freq(ts) )
x.append( fmodel.get( 'currentQuasiRMSSensor.I' ) )
y.append( fmodel.get( 'aimc.wMechanical' ) )
t.append( ts )
ts += dt
plt.grid()
plt.xlabel('time[s]')
plt.ylabel('y')
plt.plot(t,y,'r+')
plt.show()
Note: I have tried exporting the model using different solvers, such as: Dassl, Euler, Ida, CVode. But I keep getting the same error message. The error mentions a "default linear solver" which I imagine it to be the Dassl one, so It seems as though I change the solver in the OMEdit simulation setup, the model is still being exported as FMU using the Dassl solver.
Could anyone help me?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…