lbl-srg / modelica-buildings

Modelica Buildings library
257 stars 159 forks source link

Failed to find variable AFlo in EnergyPlus.fmu #3945

Open hoxj180 opened 4 months ago

hoxj180 commented 4 months ago

Hi Spawn and MBL developers,

I am trying to run theBuildings.ThermalZones.EnergyPlus_9_6_0.Examples.SingleFamilyHouse.Unconditioned model (which I have duplicated and renamed to myUnconditioned ) with my own .idf file. I have chosen to simulate the zone GYM ZONE, one of four zones in my EnergyPlus model. I keep getting the following error message saying that the variable AFlo (the floor area of the zone) cannot be found. I have compared the example MBL idf file with my idf file for inconsistencies and still can't find the source of the error. I originally expected the error to be that I hadn't defined the floor area in my EP model, but the MBL idf file actually has blank inputs for Floor Area (Thermal Zones and Surfaces:Zone:Floor Area). I tested my idf file with blanks and 'autocalculate' in the Floor Area field, but got the same error. I also tried to trace where the model was reading Aflo from, and found a comment saying it was reading it from a modelDescription.xml file. However, I cannot find this file in the folder the Spawn model generates (spawn-myUnconditioned) or the EnergyPlus outputs that I run independently (and which simulate successfully).

My questions are: do you know where I can specify the floor area so that Spawn recognizes it? And are there any fields that must always be filled in an idf file for Spawn to simulate?

Both idf files are version 9.6.0. I am running Dymola v2023 with Modelica Buildings Library v10.0.0. I am using Windows 11.

Thank you so much. I would appreciate any insight.

Log-file of program ./dymosim
(generated: Fri Jul 12 11:51:02 2024)

dymosim started
... "phase1.Spawn.Examples.myUnconditioned" simulating
... "dsin.txt" loading (dymosim input file)
Error: The following error was detected at time: 0
myUnconditioned.building: Failed to find variable GYM ZONE_AFlo in C:/..../spawn-myUnconditioned/EnergyPlus.fmu.
The stack of functions is:
Buildings.ThermalZones.EnergyPlus_9_6_0.BaseClasses.initialize
Buildings.ThermalZones.EnergyPlus_9_6_0.BaseClasses.initialize(
zon.fmuZon.adapter, 
building.isSynchronized)

Error: Integrator failed to start model.

... Error message from dymosim

Note: I have removed the full path from the error message.

mwetter commented 4 months ago

When simulating an EnergyPlus model with the Spawn coupling, EnergyPlus will create an *.fmu file. For example, when you simulate Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.Unconditioned, there will be a file

spawn-Unconditioned.flo/EnergyPlus.fmu

If you unzip this file, you can see the modelDescription.xml file that EnergyPlus generated. Modelica will read that file to see how to request the value of the floor area. This file has entries "energyPlusZoneName"_AFlo, i.e., for the above example, Attic_AFlow, Core_ZN_AFlo etc. Please check if your model also has such entries with your zone names. There should not be anything special you need to enter.

You could also simulate the model with the debug flag set in buildings to see more diagnostics output.

hoxj180 commented 4 months ago

Hi @mwetter ,

Thanks so much for getting back to me. My .fmu file currently does not seem to be able to unzip. I have seen online that adding a certain .reg file to the Windows Registry Editor fixes this issue, but importing the .reg file to the Registry Editor requires elevated admin rights. Do you know if there is another way to unzip the FMU without adding a new .reg file to the Registry Editor?

mwetter commented 4 months ago

That I don't know, that is a Windows issue. On Linux or OS X you can simply unzip the fmu as it is a zip file. Perhaps you need to change the extension do this on Windows?

hoxj180 commented 4 months ago

Hi @mwetter ,

A few updates and more questions:

First, I was able to figure out the first issue. I embarrassingly was not typing the Zone name correctly into the Zone model, which was causing the error. Additionally, I found that the software 7 zip was able to unzip the FMU.

Second, I am back to being unable to simulate the model but with a different error. The error is coming from the *.spawn.idf file that is generated as part of the FMU. The error is long, but looks like this:

0.000 myUnconditioned.building: Error from EnergyPlus: BuildingSurface:Detailed="FACE 1", invalid Space Name="OFFICE 1" not found.
0.000 myUnconditioned.building: Error from EnergyPlus: BuildingSurface:Detailed="FACE 2", invalid Space Name="OFFICE 1" not found.
0.000 myUnconditioned.building: Error from EnergyPlus: BuildingSurface:Detailed="FACE 3", invalid Space Name="OFFICE 1" not found.
0.000 myUnconditioned.building: Error from EnergyPlus: BuildingSurface:Detailed="FACE 5", invalid Space Name="OFFICE 1" not found.
0.000 myUnconditioned.building: Error from EnergyPlus: BuildingSurface:Detailed="FACE 6", invalid Space Name="OFFICE 1" not found.
0.000 myUnconditioned.building: Error from EnergyPlus: BuildingSurface:Detailed="FACE 7", invalid Space Name="OFFICE 2" not found.

I compared the *.idf file that I am inputting to the Unconditioned.mo model with the *.spawn.idf file that is outputted with the FMU. I found that the *.spawn.idf file does not include a SpaceList. My original *.idf file SpaceList contains 24 different spaces. The *.spawn.idf file still references the 24 spaces in the elsewhere in the *.idf, but since they are undefined, it throws an error. Do you know why the *.spawn.idf is getting rid of the SpaceList? And is there a way to avoid this?

Thanks again.

mwetter commented 4 months ago

@kbenne : Do you have some insight into the reported issue above regarding the SpaceList?

kbenne commented 4 months ago

I'm sorry, Spawn does not support EnergyPlus Space. At least not yet. Perhaps this is a feature we should discuss moving forward.

hoxj180 commented 4 months ago

Okay. Thanks for the help!

hoxj180 commented 4 months ago

Hi @kbenne , this might be more of an EnergyPlus issue, but per your answer I am trying to get rid of all EnergyPlus Spaces in my model so I can run it in Spawn. I cannot figure out how to get rid of them while keeping the model's geometry information. I am using OpenStudio and FloorplanJS, but creating and modifying geometries seem to require space definitions. Do you know how I can avoid defining spaces but still define building geometries? And how did you create your EnergyPlus models for the Spawn examples in the MBL library?

Thanks so much.