Error executing FMU model with pyFMI: "pyfmi.fmi.FMUException: Failed to get the Boolean values"

358 views Asked by At

I am using the code below to simulate a model.

def run_demo(with_plots=True):
    traj = np.array([[start_time,2.25]])
    input_object = ('input_1[1]', traj)
    model = load_fmu('[pyfmimodel.fmu',log_level=7)
    opts = model.simulate_options ()
    opts['ncp']=266
    # Simulate
    res = model.simulate(options=opts, input=input_object,final_time=stop_time )

This is the error I am getting. I need help to resolve this error.

Traceback (most recent call last):
  File "D:\Projects\Python\DOCKER\model_2.py", line 55, in <module>
    run_demo()
  File "D:\Projects\Python\DOCKER\model_2.py", line 38, in run_demo
    res = model.simulate(options=opts, input=input_object,final_time=stop_time )
  File "src\pyfmi\fmi.pyx", line 7519, in pyfmi.fmi.FMUModelCS2.simulate
  File "src\pyfmi\fmi.pyx", line 378, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
  File "src\pyfmi\fmi.pyx", line 372, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
  File "C:\Users\tcto5k\Miniconda3\lib\site-packages\pyfmi\fmi_algorithm_drivers.py", line 984, in __init__
    self.result_handler.simulation_start()
  File "C:\Users\tcto5k\Miniconda3\lib\site-packages\pyfmi\common\io.py", line 2553, in simulation_start
    [parameter_data, sorted_vars_real_vref, sorted_vars_int_vref, sorted_vars_bool_vref]  = fmi_util.prepare_data_info(data_info, sorted_vars,
  File "src\pyfmi\fmi_util.pyx", line 257, in pyfmi.fmi_util.prepare_data_info
  File "src\pyfmi\fmi_util.pyx", line 337, in pyfmi.fmi_util.prepare_data_info
  File "src\pyfmi\fmi.pyx", line 4377, in pyfmi.fmi.FMUModelBase2.get_boolean
pyfmi.fmi.FMUException: Failed to get the Boolean values.

This is the FMU model variable definition which accepts 1D array as input:

<ScalarVariable name="input_1[1]" valueReference="0" description="u" causality="input" variability="continuous">
      <Real start="2.0"/>
   </ScalarVariable>
   <!-- 2 -->
   <ScalarVariable name="dense_3[1]" valueReference="614" description="y (1st order)" causality="output" variability="continuous" initial="calculated">
      <Real/>
   </ScalarVariable>
0

There are 0 answers