[FMPy, EnergyPlus] Exception: Failed to instantiate model

asked 2024-04-03 04:41:10 -0500

Burns's avatar

updated 2024-04-03 06:06:17 -0500

Hii there!

Does anyone maybe knows and can please tell me how and where to fix this error "Exception: Failed to instantiate model" and [ERROR] fmi2Instantiate: Failed to parse the model description, which occurs in the FMPy generated notebook, when running:

[OK] fmi2Instantiate: The Resource location of FMU with instance name in_AC5 is file:///tmp/tmpvd7e2sjz/resources.

[OK] The current working directory is /home/user/PycharmProjects/notebooks/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5

[OK] fmi2Instantiate: Path to fmuUnzipLocation ///tmp/tmpvd7e2sjz//

[OK] fmi2Instantiate: Path to fmuResourceLocation ///tmp/tmpvd7e2sjz//resources//

[OK] Command executes to copy content of resources folder: cp -f "///tmp/tmpvd7e2sjz//resources//"variables.cfg "/home/user/PycharmProjects/notebooks/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5/Output_EPExport_in_AC5//Output_EPExport_in_AC5//"

[OK] fmi2Instantiate: Path to model description file is ///tmp/tmpvd7e2sjz//modelDescription.xml.

[ERROR] fmi2Instantiate: Failed to parse the model description found in directory ///tmp/tmpvd7e2sjz//modelDescription.xml. Instantiation of in_AC5 failed

[OK] freeInstanceResources: in_AC5 will be freed.

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
Cell In[8], line 18
      7 start_values = {
      8     # variable    start   unit      description 
      9     # 'TRooMea': (22.0, 'C'),
     10     'TRooMea': (22.0, 'C'),
     11 
     12 }
     14 output = [
     15     'TMeanAir',  # IDF line 10754
     16 ]
---> 18 result = simulate_fmu(filename, start_values=start_values, output=output, stop_time=86400)
     20 plot_result(result)

File ~/.local/lib/python3.10/site-packages/fmpy/simulation.py:741, in simulate_fmu(filename, validate, start_time, stop_time, solver, step_size, relative_tolerance, output_interval, record_events, fmi_type, start_values, apply_default_start_values, input, output, timeout, debug_logging, visible, logger, fmi_call_logger, step_finished, model_description, fmu_instance, set_input_derivatives, remote_platform, early_return_allowed, use_event_mode, initialize, terminate, fmu_state, set_stop_time)
    738     add_remoting(unzipdir, host_platform=platform, remote_platform=remote_platform)
    740 if fmu_instance is None:
--> 741     fmu = instantiate_fmu(unzipdir, model_description, fmi_type, visible, debug_logging, logger, fmi_call_logger, None, early_return_allowed, use_event_mode, None, validate)
    742 else:
    743     fmu = fmu_instance

File ~/.local/lib/python3.10/site-packages/fmpy/simulation.py:824, in instantiate_fmu(unzipdir, model_description, fmi_type, visible, debug_logging, logger, fmi_call_logger, library_path, early_return_allowed, event_mode_used, intermediate_update, require_functions)
    822 elif is_fmi2:
    823     fmu = FMU2Slave(**fmu_args)
--> 824     fmu.instantiate(visible=visible, callbacks=callbacks, loggingOn=debug_logging)
    825 else:
    826     fmu = fmi3.FMU3Slave(**fmu_args)

File ~/.local/lib/python3.10/site-packages/fmpy/fmi2.py:254, in _FMU2.instantiate(self, visible, callbacks, loggingOn)
    245 self.component = self.fmi2Instantiate(self.instanceName.encode('utf-8'),
    246                                       kind,
    247                                       self.guid.encode('utf-8'),
   (...)
    250                                       fmi2True if visible else fmi2False,
    251                                       fmi2True if loggingOn else fmi2False)
    253 if self.component is None:
--> 254     raise Exception("Failed to instantiate model")

Exception: Failed to instantiate model

Thx in advance and looking forward!

nice greets burns

edit retag flag offensive close merge delete

Comments

Could you share any *.err, *.log files, from the FMU run? Also, have you considered using another master algorithm (e.g. PyFMI) just to see if you can reproduce the problem?

Thierry Nouidui's avatar Thierry Nouidui  ( 2024-04-18 06:50:54 -0500 )edit