Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Model Exchange FMU fails to Enter Event Mode

Model Exchange FMU fails to Enter Event Mode

I could not find anything related to this exception. Can someone help me ?

Code:

from pyfmi import load_fmu
import matplotlib.pyplot as plt
import numpy as N

# Simulation parameters:

dt = 0.0001 
tf = 15 
ts = 0 

model="AIMC_Inverter.fmu"
generate_plot = False

# Load model
mod = load_fmu(model, log_level=4) # default setting is 2
mod.set_max_log_size(2073741824) # = 2*1024^3 (about 2GB)

# Get Continuous States and nominal values
x = mod.continuous_states
x_nominal = mod.nominal_continuous_states

mod.setup_experiment(start_time = ts) # Set the start time to ts
mod.initialize()

eInfo = mod.get_event_info()
eInfo.newDiscreteStatesNeeded = True

#Event iteration
while eInfo.newDiscreteStatesNeeded == True:
  mod.enter_event_mode()
  mod.event_update()
  eInfo = mod.get_event_info()

mod.enter_continuous_time_mode()

Error:

  File "src/pyfmi/fmi.pyx", line 7512, in pyfmi.fmi.FMUModelME2.enter_event_mode
pyfmi.fmi.FMUException: Failed to enter event mode.

There are 0 guests and 0 other users also viewing this topic
You are here: