Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Spawn diagnostics in case of Fatal Error #2521

Open
mwetter opened this issue Jun 1, 2021 · 0 comments
Open

Improve Spawn diagnostics in case of Fatal Error #2521

mwetter opened this issue Jun 1, 2021 · 0 comments
Assignees
Labels
enhancement spawn Development for Spawn of EnergyPlus

Comments

@mwetter
Copy link
Member

mwetter commented Jun 1, 2021

This issue is to improve the diagnostics message if EnergyPlus has a fatal error

The following model terminates with an error.

model TestModel
  extends Buildings.ThermalZones.EnergyPlus.Validation.OutputVariable.OneEnvironmentOutputVariable(
  building(
    idfName=Modelica.Utilities.Files.loadResource(
      "file:////home/mwetter/test/mbl-2512/tmp_idf_files/2ZoneDataCenterHVAC_wEconomizer.idf")));
  annotation (
    experiment(
      StopTime=86400,
      Tolerance=1e-06));
end TestModel;

The error message with the default logging is currently: Failed to get parameter values for TestModel.TEnePlu. This may be due to an error during the initialization or warm-up of EnergyPlus as the EnergyPlus FMU has been generated and loaded with no error.

The log file is

$ cat TestModel_log.txt
FMIL: module = FMILIB, log level = 4: Loading 'linux64' binary with 'default' platform types
FMIL: module = Model, log level = 4: [INFO][FMU status:OK] <JMIRuntime><value name="build_date">"Nov  2 2020"</value> <value name="build_time">"07:56:27"</value></JMIRuntime>
FMIL: module = Model, log level = 4: [INFO][FMU status:OK] <JMIRuntime>Using mathematical functions with domain checks.</JMIRuntime>
FMIL: module = FMI2XML, log level = 3: fmi2_xml_get_default_experiment_start: returning default value, since no attribute was defined in modelDescription
FMIL: module = FMI2XML, log level = 3: fmi2_xml_get_default_experiment_start: returning default value, since no attribute was defined in modelDescription
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Error from EnergyPlus: Invalid Output:Variable or Output:Meter Name =FACILITY TOTAL BUILDING ELECTRICITY DEMAND RATE&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Error from EnergyPlus: Entered in EnergyManagementSystem:Sensor=IT_EQUIP_POWER&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Error from EnergyPlus: Output:Variable Name not found&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Error from EnergyPlus: Invalid Output:Variable or Output:Meter Name =FACILITY TOTAL ELECTRICITY DEMAND RATE&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Error from EnergyPlus: Entered in EnergyManagementSystem:Sensor=WHOLE_BUILDING_POWER&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Error from EnergyPlus: Output:Variable Name not found&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Error from EnergyPlus: Invalid Output:Variable or Output:Meter Name =FACILITY TOTAL HVAC ELECTRICITY DEMAND RATE&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Error from EnergyPlus: Entered in EnergyManagementSystem:Sensor=WHOLE_HVAC_POWER&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Error from EnergyPlus: Output:Variable Name not found&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Fatal from EnergyPlus: Errors found in processing Energy Management System input. Preceding condition causes termination.&#10;"</value></ModelicaMessage>
FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]   <ModelicaError category="warning"><value name="msg">"Failed to get parameter values for TestModel.TEnePlu. This may be due to an error during the initialization or warm-up of EnergyPlus as the EnergyPlus FMU has been generated and loaded with no error.&#10;"</value></ModelicaError>
FMIL: module = Model, log level = 2: [INFO][FMU status:Error]   Initialization failed.
FMIL: module = �c��, log level = 3: [WARNING][FMU status:Warning]   <ModelicaMessage category="warning"><value name="msg">"0.000 TestModel.building: Fatal from EnergyPlus: EnergyPlus is not running&#10;"</value></ModelicaMessage

With logLevel=Buildings.ThermalZones.EnergyPlus.Types.LogLevels.Debug the message is in Dymola:

dymosim started
... "TestModel" simulating
... "dsin.txt" loading (dymosim input file)
0.000 TestModel.TEnePlu: Entered EnergyPlusSpawnAllocate.
0.000 TestModel.TEnePlu: Buildings library root is at /home/mwetter/test/mbl-2512/Buildings
0.000 TestModel.TEnePlu: First call for this instance.
0.000 TestModel.TEnePlu: Initializing memory for object.
0.000 TestModel.TEnePlu: Allocated parameters 0x55c5ee9a0cb0
0.000 TestModel.building: Allocating data structure for building, nFMU=0
0.000 TestModel.building: AllocateBuildingDataStructure: Leaving allocating data structure for building number 0, ptr 0x55c5ee9a0a40
0.000 TestModel.building: Adding object 0 with name TestModel.TEnePlu in AddSpawnObjectToBuilding.
0.000 TestModel.building: Number of exchange objects at end of AddSpawnObjectToBuilding: nExcObj = 1
0.000 TestModel.TEnePlu: Building TestModel.building is at address 0x55c5ee9a0a40
0.000 TestModel.TEnePlu: Exchange ptr is at 0x55c5ee9a2ea0
0.000 TestModel.TEnePlu: Exiting allocation with Spawn object ptr at 0x55c5ee9a2ea0 and building ptr at 0x55c5ee9a0a40
0.000 TestModel.TEnePlu: Entered EnergyPlusSpawnInitialize.
0.000 TestModel.building: Entered EnergyPlusSpawnAllocateAndInstantiateBuilding.
0.000 TestModel.building: Entered generateFMU with FMUPath = /home/mwetter/test/mbl-2512/tmp-simulation-TestModel.building/TestModel.building.fmu.
0.000 TestModel.building: Executing "/home/mwetter/test/mbl-2512/Buildings/Resources/bin/spawn-linux64/bin/spawn" --no-compress  --output-path "/home/mwetter/test/mbl-2512/tmp-simulation-TestModel.building/TestModel.building.fmu" --create "/home/mwetter/test/mbl-2512/tmp-simulation-TestModel.building/ModelicaBuildingsEnergyPlus.json"
0.000 TestModel.building: Calling fmi_import_allocate_context(callbacks = 0x7f9c97418fc0)
0.000 TestModel.building: Getting fmi version, FMUPath = /home/mwetter/test/mbl-2512/tmp-simulation-TestModel.building/TestModel.building.fmu, tmpPath = /home/mwetter/test/mbl-2512/tmp-simulation-TestModel.building.
0.000 TestModel.building: Parsing xml file /home/mwetter/test/mbl-2512/tmp-simulation-TestModel.building
0.000 TestModel.building: Loading dllfmu.
0.000 TestModel.building: Instantiating fmu.
0.000 TestModel.building: Returned from instantiating fmu.
0.000 TestModel.building: Setting debug logging.
0.000 TestModel.building: FMU is at 0x55c5ee999310.
0.000 TestModel.building: Setting variable references for ptrSpaObj.
0.000 TestModel.building: Setting variable reference for Site Outdoor Air Drybulb Temperature_Environment.
0.000 TestModel.building: Variable with name Site Outdoor Air Drybulb Temperature_Environment has unit = K and valRef= 0.
0.000 TestModel.building: FMU returns from generateAndInstantiateBuilding.
0.000 TestModel.building: Instantiate building.
0.000 TestModel.building: Switching to mode instantiation
0.000 TestModel.building: Calling fmi2_import_setup_experiment: Setting up experiment building at 0x55c5ee9a0a40 with startTime = 0.000000.
0.000 TestModel.building: Returned from setting up experiment with status OK.
0.000 TestModel.building: fmi2_import_enter_initialization_mode: Enter initialization mode of FMU with name /home/mwetter/test/mbl-2512/tmp-simulation-TestModel.building/TestModel.building.fmu.
0.000 TestModel.building: Switching to mode initialization
0.000 TestModel.TEnePlu: Getting parameters from EnergyPlus, bui at 0x55c5ee9a0a40, Spawn object at 0x55c5ee9a2ea0, parameter at 0x55c5ee9a0cb0.
0.000 TestModel.TEnePlu: Getting real variables from EnergyPlus, mode = initialization.
0.000 TestModel.building: Info from EnergyPlus: Testing Individual Branch Integrity
0.000 TestModel.building: Info from EnergyPlus: All Branches passed integrity testing
0.000 TestModel.building: Info from EnergyPlus: Testing Individual Supply Air Path Integrity
0.000 TestModel.building: Info from EnergyPlus: All Supply Air Paths passed integrity testing
0.000 TestModel.building: Info from EnergyPlus: Testing Individual Return Air Path Integrity
0.000 TestModel.building: Info from EnergyPlus: All Return Air Paths passed integrity testing
0.000 TestModel.building: Info from EnergyPlus: No node connection errors were found.
0.000 TestModel.building: Error from EnergyPlus: Invalid Output:Variable or Output:Meter Name =FACILITY TOTAL BUILDING ELECTRICITY DEMAND RATE
0.000 TestModel.building: Error from EnergyPlus: Entered in EnergyManagementSystem:Sensor=IT_EQUIP_POWER
0.000 TestModel.building: Error from EnergyPlus: Output:Variable Name not found
0.000 TestModel.building: Error from EnergyPlus: Invalid Output:Variable or Output:Meter Name =FACILITY TOTAL ELECTRICITY DEMAND RATE
0.000 TestModel.building: Error from EnergyPlus: Entered in EnergyManagementSystem:Sensor=WHOLE_BUILDING_POWER
0.000 TestModel.building: Error from EnergyPlus: Output:Variable Name not found
0.000 TestModel.building: Error from EnergyPlus: Invalid Output:Variable or Output:Meter Name =FACILITY TOTAL HVAC ELECTRICITY DEMAND RATE
0.000 TestModel.building: Error from EnergyPlus: Entered in EnergyManagementSystem:Sensor=WHOLE_HVAC_POWER
0.000 TestModel.building: Error from EnergyPlus: Output:Variable Name not found
0.000 TestModel.building: Fatal from EnergyPlus: Errors found in processing Energy Management System input. Preceding condition causes termination.
0.000 TestModel.building: Info from EnergyPlus: Warning:  Node connection errors not checked - most system input has not been read (see previous warning).
0.000 TestModel.building: Info from EnergyPlus: Fatal error -- final processing.  Program exited before simulations began.  See previous error messages.
0.000 TestModel.building: Info from EnergyPlus: EnergyPlus Warmup Error Summary. During Warmup: 0 Warning; 0 Severe Errors.
0.000 TestModel.building: Info from EnergyPlus: EnergyPlus Sizing Error Summary. During Sizing: 0 Warning; 0 Severe Errors.
0.000 TestModel.building: Info from EnergyPlus: EnergyPlus Terminated--Fatal Error Detected. 0 Warning; 3 Severe Errors; Elapsed Time=00hr 00min  0.24sec
Error: The following error was detected at time: 0
Failed to get parameter values for TestModel.TEnePlu. This may be due to an error during the initialization or warm-up of EnergyPlus as the EnergyPlus FMU has been generated and loaded with no error.

The stack of functions is:
Buildings.ThermalZones.EnergyPlus.BaseClasses.initialize
Buildings.ThermalZones.EnergyPlus.BaseClasses.initialize(
TEnePlu.adapter, 
building.isSynchronized)

Error: Integrator failed to start model.
0.000 TestModel.building: Entered FMUBuildingFree.
0.000 TestModel.building: In FMUBuildingFree, 0x55c5ee9a0a40, nExcObj = 0
0.000 TestModel.building: Calling fmi2_import_terminate to terminate EnergyPlus.
0.000 TestModel.building: Fatal from EnergyPlus: EnergyPlus is not running
0.000 TestModel.building: fmi2_import_destroy_dllfmu: destroying dll fmu.

ERROR: The simulation of TestModel FAILED

Thus, the error message for the user could probably be improved by storing the last "Fatal from EnergyPlus" and appending this to the string sent to ModelicaFormatError. A further improvement would be to point to the EnergyPlus error file.

@mwetter mwetter added enhancement spawn Development for Spawn of EnergyPlus labels Jun 1, 2021
@mwetter mwetter self-assigned this Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement spawn Development for Spawn of EnergyPlus
Projects
None yet
Development

No branches or pull requests

1 participant