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

add model to interface with EnergyPlus thermal zone model #1129

Closed
mwetter opened this issue Feb 14, 2018 · 6 comments · Fixed by #2212
Closed

add model to interface with EnergyPlus thermal zone model #1129

mwetter opened this issue Feb 14, 2018 · 6 comments · Fixed by #2212
Assignees
Labels
spawn Development for Spawn of EnergyPlus
Milestone

Comments

@mwetter
Copy link
Member

mwetter commented Feb 14, 2018

This branch is to add the Modelica code to interface with the EnergyPlus thermal zone model.
See https://lbl-srg.github.io/soep/softwareArchitecture.html#coupling-of-energyplus-envelope-and-room-with-modelica-based-hvac-and-control

To connect to HVAC, the model Buildings.Fluid.FMI.ExportContainers.HVACZone may be used.

@mwetter mwetter self-assigned this Feb 14, 2018
@mwetter mwetter changed the title add model to interface with EnergyPlus room model add model to interface with EnergyPlus thermal zone model Feb 14, 2018
mwetter added a commit that referenced this issue Feb 15, 2018
mwetter added a commit that referenced this issue Feb 22, 2018
mwetter added a commit that referenced this issue Feb 22, 2018
mwetter added a commit that referenced this issue Feb 22, 2018
@tsnouidui
Copy link
Member

tsnouidui commented May 30, 2018

Few open issues

  • Pass the simulation start time in the initial equation so it can be used to setup the experiment.
    This will be needed in https://github.com/lbl-srg/modelica-buildings/tree/issue1129_energyPlus_zone/Buildings/Resources/C-Sources/FMUZoneInitialize.c (after approval of Issue1129 energyplus zone refactor #1177).
  • Expand the number of exchanges variables. Currently, T is sent and QConSen_flow, V, AFlo, mSenFac are received.
  • Change the inputs of FMUZonExchange to only receive the positive sum of the mass flow rates along with the average inlet temperature.
  • Sum the positive mass flow rates in Modelica in the when() statement (in Buildings.ThermalZones.EnergyPlus.BaseClasses.FMUZoneAdapter) which triggers the data exchange between Modelica and E+. Consider the case where there is no HVAC connected to E+.
  • When computing the average inlet mass flow rate and average inlet temperature, consider the case where there is no HVAC connected to E+.
  • Currently, the path to the EnergyPlus library is passed in Buildings.ThermalZones.EnergyPlus.BaseClasses.FMUZoneAdapter. The path is required by E+ so it can load the E+ library and have access to the library functions. To support multiple operating systems, this approach requires to figure the operating system (Win32 or Win64, ...) and pass the path to the correct library to the epLibName.
    An alternative approach is to have the E+ library in the Library folder. This will cause the tool to load the library in memory so the library can be called directly. It is however not clear how multiple IDFs will need to be handled in such cases as they will all have the same library function names
  • To load the E+ library, the current code uses dlopen. This function is setup so that multiple calls to the same library will return the same handle (a reference to the same building). This works well for multiple zones of the same building and might work with multiple buildings it the paths to the E+ libraries are different.
  • The current code doesn't handle multiple buildings. This is potentially because of global variables in E+ which influence different instances of E+. This has been verified by loading two different E+ building libraries and trying to call setupExperiment() on one building afterwards.

@mwetter
Copy link
Member Author

mwetter commented Sep 11, 2018

  • In FMUZoneExchange.c, the call to result = zone->ptrBui->fmu->getNextEventTime(&eventInfo, NULL); jumps one event. Simulating
simulateModel("Buildings.Experimental.EnergyPlus.Validation.OneZone", stopTime=3600, method="Cvode", tolerance=1e-06, resultFile="OneZone");

produces the following output, where tNextEP=600 is missing:

Start time is set to 0.000000.
Time = 0	 tNextEP = 1200	 tNext = 1200
Time = 1200	 tNextEP = 1800	 tNext = 1800
Time = 1800	 tNextEP = 2400	 tNext = 2400
Time = 2400	 tNextEP = 3000	 tNext = 3000
Time = 3000	 tNextEP = 3600	 tNext = 3600
Time = 3600	 tNextEP = 4200	 tNext = 4200
Integration terminated successfully at T = 3600

@mwetter
Copy link
Member Author

mwetter commented Oct 15, 2018

  • When multiple buildings are supported, enable two buildings in Buildings.Experimental.EnergyPlus.Validation.ThreeZonesTwoBuildings by changing the value for idfName2 to RefBldgSmallOfficeNew2004_Chicago2.idf

@mwetter
Copy link
Member Author

mwetter commented Feb 12, 2019

  • The following command fails in Dymola 2019FD01 with a segmentation fault:
simulateModel("Buildings.Experimental.EnergyPlus.Validation.RefBldgSmallOffice", stopTime=604800, method="dassl", tolerance=1e-06, resultFile="RefBldgSmallOffice");
 = false
simulateModel("Buildings.Experimental.EnergyPlus.Validation.OneZone", stopTime=86400, tolerance=1e-06, resultFile="OneZone");
 = false

If the solver is changed to CVode, the simulation works:

simulateModel("Buildings.Experimental.EnergyPlus.Validation.OneZone", stopTime=86400, method="Cvode", tolerance=1e-06, resultFile="OneZone");
 = true

Update
This works in Dymola 2020x beta3:

Hidden.AvoidDoubleComputation=true;
simulateModel("Buildings.Experimental.EnergyPlus.Validation.RefBldgSmallOffice", stopTime=604800, method="dassl", tolerance=1e-06, resultFile="RefBldgSmallOffice");
 = true
simulateModel("Buildings.Experimental.EnergyPlus.Validation.OneZone", stopTime=86400, tolerance=1e-06, resultFile="OneZone");
 = true

@AntoineGautier
Copy link
Contributor

@mwetter Is this the correct branch that I should merge with issue1442_loadCoupling for URBANopt Modelica developments?

@mwetter
Copy link
Member Author

mwetter commented Sep 13, 2019

@AntoineGautier : Please merge issue1129_energyPlus_zone_fmiSignature into the URBANopt branch. I already updated issue1129_energyPlus_zone_fmiSignature with the master this morning.

Once the E+ FMU works, this will be merged into issue1129_energyPlus_zone and deleted, but for now, please use issue1129_energyPlus_zone_fmiSignature.

@mwetter mwetter added the spawn Development for Spawn of EnergyPlus label Sep 25, 2019
@mwetter mwetter added this to the Release 8.0 milestone Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spawn Development for Spawn of EnergyPlus
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants