Skip to content

Commit

Permalink
Enabled support for multiple EnergyPlus versions (#2958)
Browse files Browse the repository at this point in the history
* Renamed EnergyPlus to EnergyPlus_9_6_0

* Moved idf files to Resources/Data/ThermalZones/EnergyPlus_9_6_0

* Moved source code

* Renamed C functions to have version number

* Updated install script

* Added missing slash

* Updated tests

* Updated version number

* Update .gitattributes
  • Loading branch information
mwetter committed Apr 13, 2022
1 parent fee9120 commit 3f9b735
Show file tree
Hide file tree
Showing 310 changed files with 895 additions and 826 deletions.
7 changes: 4 additions & 3 deletions .gitattributes
Expand Up @@ -6,6 +6,7 @@ libfmilib*.* filter=lfs diff=lfs merge=lfs -text
fmilib_shared*.* filter=lfs diff=lfs merge=lfs -text
epfmi*.* filter=lfs diff=lfs merge=lfs -text
VCRUNTIME*.dll filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/src/ThermalZones/EnergyPlus/FMUs/Zones1.fmu filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/src/ThermalZones/EnergyPlus/FMUs/Zones3.fmu filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/bin/spawn-*/bin/spawn* filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/src/ThermalZones/EnergyPlus*/FMUs/Zones1.fmu filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/src/ThermalZones/EnergyPlus*/FMUs/Zones3.fmu filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/bin/spawn-*/linux64/bin/spawn* filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/bin/spawn-*/win64/bin/spawn* filter=lfs diff=lfs merge=lfs -text
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -45,9 +45,9 @@ env:
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.{Air,Examples}\""
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.{Air,Examples}\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.{Air,Examples}\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.EnergyPlus\""
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.ThermalZones.EnergyPlus\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.EnergyPlus\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.EnergyPlus_9_6_0\""
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.ThermalZones.EnergyPlus_9_6_0\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.EnergyPlus_9_6_0\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.Detailed.{BaseClasses,Constructions,Examples}\""
- TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.ThermalZones.Detailed.{BaseClasses,Constructions,Examples}\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.Detailed.{BaseClasses,Constructions,Examples}\""
Expand Down
16 changes: 8 additions & 8 deletions Buildings/Examples/VAVReheat/package.mo
Expand Up @@ -11,11 +11,11 @@ for office buildings.
<h4>Note</h4>
<p>
The models
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.ASHRAE2006Winter\">
Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.ASHRAE2006Winter</a>
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.ASHRAE2006Winter\">
Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.ASHRAE2006Winter</a>
and
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.Guideline36Winter\">
Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.Guideline36Winter</a>
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.Guideline36Winter\">
Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.Guideline36Winter</a>
appear to be quite similar to
<a href=\"modelica://Buildings.Examples.VAVReheat.ASHRAE2006\">
Buildings.Examples.VAVReheat.ASHRAE2006</a>
Expand All @@ -25,8 +25,8 @@ Buildings.Examples.VAVReheat.Guideline36</a>,
respectively, because they all have the same HVAC system, control sequences,
and all have five thermal zones.
However, the models in
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice\">
Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice</a>
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice\">
Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice</a>
are from the
<i>DOE Commercial Reference Building,
Small Office, new construction, ASHRAE 90.1-2004,
Expand All @@ -39,8 +39,8 @@ are from the
Medium Office, new construction, ASHRAE 90.1-2004,
version 1.2_4.0</i>.
Therefore, the dimensions of the thermal zones in
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice\">
Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice</a>
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice\">
Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice</a>
are considerably smaller than in
<a href=\"modelica://Buildings.Examples.VAVReheat\">
Buildings.Examples.VAVReheat</a>.
Expand Down
Expand Up @@ -12,7 +12,7 @@ model BuildingSpawnZ1
"Load side medium";
parameter Integer nZon=1
"Number of thermal zones";
parameter String idfName="modelica://Buildings/Resources/Data/ThermalZones/EnergyPlus/Examples/RefBldgSmallOffice/RefBldgSmallOfficeNew2004_Chicago.idf"
parameter String idfName="modelica://Buildings/Resources/Data/ThermalZones/EnergyPlus_9_6_0/Examples/RefBldgSmallOffice/RefBldgSmallOfficeNew2004_Chicago.idf"
"Name of the IDF file";
parameter String epwName="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"
"Name of the weather file";
Expand All @@ -32,13 +32,13 @@ model BuildingSpawnZ1
k=0)
"Latent heat gain"
annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
Buildings.ThermalZones.EnergyPlus.ThermalZone zon(
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone zon(
redeclare package Medium=Medium2,
zoneName="Core_ZN",
nPorts=2)
"Thermal zone"
annotation (Placement(transformation(extent={{40,-20},{80,20}})));
inner Buildings.ThermalZones.EnergyPlus.Building building(
inner Buildings.ThermalZones.EnergyPlus_9_6_0.Building building(
idfName=Modelica.Utilities.Files.loadResource(
idfName),
epwName=Modelica.Utilities.Files.loadResource(
Expand Down Expand Up @@ -176,5 +176,5 @@ First implementation.
graphics={
Bitmap(
extent={{-108,-100},{92,100}},
fileName="modelica://Buildings/Resources/Images/ThermalZones/EnergyPlus/EnergyPlusLogo.png")}));
fileName="modelica://Buildings/Resources/Images/ThermalZones/EnergyPlus_9_6_0/EnergyPlusLogo.png")}));
end BuildingSpawnZ1;
Expand Up @@ -26,7 +26,7 @@ model BuildingSpawnZ6
nZon) ./ facMulTerUni
"Design cooling heat flow rate (single terminal unit)"
annotation (Dialog(group="Nominal condition"));
parameter String idfName="modelica://Buildings/Resources/Data/ThermalZones/EnergyPlus/Examples/RefBldgSmallOffice/RefBldgSmallOfficeNew2004_Chicago.idf"
parameter String idfName="modelica://Buildings/Resources/Data/ThermalZones/EnergyPlus_9_6_0/Examples/RefBldgSmallOffice/RefBldgSmallOfficeNew2004_Chicago.idf"
"Name of the IDF file";
parameter String epwName="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"
"Name of the weather file";
Expand Down Expand Up @@ -62,42 +62,42 @@ model BuildingSpawnZ6
k=0)
"Latent heat gain"
annotation (Placement(transformation(extent={{-60,64},{-40,84}})));
Buildings.ThermalZones.EnergyPlus.ThermalZone znAttic(
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znAttic(
redeclare package Medium=Medium2,
zoneName="Attic")
"Thermal zone"
annotation (Placement(transformation(extent={{24,84},{64,124}})));
Buildings.ThermalZones.EnergyPlus.ThermalZone znCore_ZN(
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znCore_ZN(
redeclare package Medium=Medium2,
zoneName="Core_ZN",
nPorts=2)
"Thermal zone"
annotation (Placement(transformation(extent={{24,42},{64,82}})));
Buildings.ThermalZones.EnergyPlus.ThermalZone znPerimeter_ZN_1(
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znPerimeter_ZN_1(
redeclare package Medium=Medium2,
zoneName="Perimeter_ZN_1",
nPorts=2)
"Thermal zone"
annotation (Placement(transformation(extent={{24,0},{64,40}})));
Buildings.ThermalZones.EnergyPlus.ThermalZone znPerimeter_ZN_2(
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znPerimeter_ZN_2(
redeclare package Medium=Medium2,
zoneName="Perimeter_ZN_2",
nPorts=2)
"Thermal zone"
annotation (Placement(transformation(extent={{24,-40},{64,0}})));
Buildings.ThermalZones.EnergyPlus.ThermalZone znPerimeter_ZN_3(
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znPerimeter_ZN_3(
redeclare package Medium=Medium2,
zoneName="Perimeter_ZN_3",
nPorts=2)
"Thermal zone"
annotation (Placement(transformation(extent={{24,-80},{64,-40}})));
Buildings.ThermalZones.EnergyPlus.ThermalZone znPerimeter_ZN_4(
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znPerimeter_ZN_4(
redeclare package Medium=Medium2,
zoneName="Perimeter_ZN_4",
nPorts=2)
"Thermal zone"
annotation (Placement(transformation(extent={{24,-120},{64,-80}})));
inner Buildings.ThermalZones.EnergyPlus.Building building(
inner Buildings.ThermalZones.EnergyPlus_9_6_0.Building building(
idfName=Modelica.Utilities.Files.loadResource(
idfName),
epwName=Modelica.Utilities.Files.loadResource(
Expand Down Expand Up @@ -280,5 +280,5 @@ First implementation.
graphics={
Bitmap(
extent={{-108,-100},{92,100}},
fileName="modelica://Buildings/Resources/Images/ThermalZones/EnergyPlus/EnergyPlusLogo.png")}));
fileName="modelica://Buildings/Resources/Images/ThermalZones/EnergyPlus_9_6_0/EnergyPlusLogo.png")}));
end BuildingSpawnZ6;
Expand Up @@ -85,8 +85,8 @@ secondary pumps.
<p>
Simulation with Dymola requires minimum version 2020x and setting
<code>Hidden.AvoidDoubleComputation=true</code>, see
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus.UsersGuide\">
Buildings.ThermalZones.EnergyPlus.UsersGuide</a>.
<a href=\"modelica://Buildings.ThermalZones.EnergyPlus_9_6_0.UsersGuide\">
Buildings.ThermalZones.EnergyPlus_9_6_0.UsersGuide</a>.
</p>
</html>",
revisions="<html>
Expand Down
@@ -1,7 +1,7 @@
#ifndef Spawn_declared
#define Spawn_declared

#include "EnergyPlusWrapper.h"
#include "EnergyPlus_9_6_0_Wrapper.h"

/* *********************************************************
Wrapper functions that connect to the library which
Expand All @@ -27,12 +27,13 @@ void my_printf(const char *fmt, ...) {
}
*/

void* ModelicaSpawnAllocate(
void* allocate_Modelica_EnergyPlus_9_6_0(
const int objectType,
double startTime,
const char* modelicaNameBuilding,
const char* modelicaNameThermalZone,
const char* spawnExe,
const char* idfVersion,
const char* idfName,
const char* epwName,
double relativeSurfaceTolerance,
Expand Down Expand Up @@ -62,12 +63,13 @@ void* ModelicaSpawnAllocate(
const double* derivatives_delta,
const size_t nDer){

return EnergyPlusSpawnAllocate(
return allocate_Spawn_EnergyPlus_9_6_0(
objectType,
startTime,
modelicaNameBuilding,
modelicaNameThermalZone,
spawnExe,
idfVersion,
idfName,
epwName,
relativeSurfaceTolerance,
Expand Down Expand Up @@ -102,36 +104,36 @@ void* ModelicaSpawnAllocate(
ModelicaFormatError);
}

void ModelicaSpawnInitialize(
void initialize_Modelica_EnergyPlus_9_6_0(
void* object,
double isSynchronized,
int *nObj){
EnergyPlusSpawnInitialize(object, nObj);
initialize_Spawn_EnergyPlus_9_6_0(object, nObj);
}

void ModelicaSpawnGetParameters(
void getParameters_Modelica_EnergyPlus_9_6_0(
void* object,
double isSynchronized,
double *parOut){
EnergyPlusSpawnGetParameters(object, parOut);
getParameters_Spawn_EnergyPlus_9_6_0(object, parOut);
}

void ModelicaSpawnExchange(
void exchange_Modelica_EnergyPlus_9_6_0(
void* object,
int initialCall,
const double* u,
double dummy,
double* y){

EnergyPlusSpawnExchange(
exchange_Spawn_EnergyPlus_9_6_0(
object,
initialCall,
u,
y);
}

void ModelicaSpawnFree(void* object){
EnergyPlusSpawnObjectFree(object);
void free_Modelica_EnergyPlus_9_6_0(void* object){
free_Spawn_EnergyPlus_9_6_0(object);
}

#endif
@@ -1,5 +1,5 @@
#ifndef EnergyPlusWrapper_h
#define EnergyPlusWrapper_h
#ifndef EnergyPlus_9_6_0_Wrapper_h
#define EnergyPlus_9_6_0_Wrapper_h

#include <stdint.h>

Expand Down Expand Up @@ -31,12 +31,13 @@

/* ********************************************************* */
/* Thermal zone */
extern void* EnergyPlusSpawnAllocate(
extern void* allocate_Spawn_EnergyPlus_9_6_0(
const int objectType,
double startTime,
const char* modelicaNameBuilding,
const char* modelicaNameThermalZone,
const char* spawnExe,
const char* idfVersion,
const char* idfName,
const char* epwName,
double relativeSurfaceTolerance,
Expand Down Expand Up @@ -70,16 +71,16 @@ extern void* EnergyPlusSpawnAllocate(
void (*SpawnFormatMessage)(const char *string, ...),
void (*SpawnFormatError)(const char *string, ...));

extern void EnergyPlusSpawnInitialize(void* object, int *nObj);
extern void initialize_Spawn_EnergyPlus_9_6_0(void* object, int *nObj);

extern void EnergyPlusSpawnGetParameters(void* object, double *parOut);
extern void getParameters_Spawn_EnergyPlus_9_6_0(void* object, double *parOut);

extern void EnergyPlusSpawnExchange(
extern void exchange_Spawn_EnergyPlus_9_6_0(
void* object,
int initialCall,
const double* u,
double* y);

extern void EnergyPlusSpawnObjectFree(void* object);
extern void free_Spawn_EnergyPlus_9_6_0(void* object);

#endif
Git LFS file not shown

This file was deleted.

This file was deleted.

Git LFS file not shown
Git LFS file not shown
22 changes: 11 additions & 11 deletions Buildings/Resources/Scripts/BuildingsPy/conf.yml
Expand Up @@ -311,64 +311,64 @@
optimica:
comment: Tolerance of 1E-7 would lead to very slow progress with commit fabaa64231692a2a2b6c044aff34f5ae6b3be868
rtol: 1.0e-08
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.ASHRAE2006Spring
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.ASHRAE2006Spring
openmodelica:
comment: timed out after 300 seconds
simulate: false
optimica:
rtol: 1.0e-07
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.ASHRAE2006Summer
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.ASHRAE2006Summer
openmodelica:
comment: timed out after 300 seconds
simulate: false
optimica:
comment: This causes a timeout on travis, but works locally. See https://travis-ci.com/github/lbl-srg/modelica-buildings/jobs/501193509#L635
simulate: false
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.ASHRAE2006Winter
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.ASHRAE2006Winter
openmodelica:
comment: timed out after 300 seconds
simulate: false
optimica:
comment: This causes a timeout on travis, but works locally. See https://travis-ci.com/github/lbl-srg/modelica-buildings/jobs/501193509#L635
simulate: false
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.Guideline36Spring
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.Guideline36Spring
openmodelica:
comment: timed out after 300 seconds
simulate: false
optimica:
rtol: 1.0e-07
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.Guideline36Summer
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.Guideline36Summer
openmodelica:
comment: timed out after 300 seconds
simulate: false
optimica:
rtol: 1.0e-07
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.Guideline36Winter
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.Guideline36Winter
openmodelica:
comment: timed out after 300 seconds
simulate: false
optimica:
rtol: 1.0e-07
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.IdealHeatingCoolingSpring
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.IdealHeatingCoolingSpring
openmodelica:
comment: returned non-zero exit status 255.
simulate: false
optimica:
rtol: 1.0e-08
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.IdealHeatingCoolingSummer
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.IdealHeatingCoolingSummer
openmodelica:
comment: returned non-zero exit status 255.
simulate: false
optimica:
rtol: 1.0e-08
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.IdealHeatingCoolingWinter
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.IdealHeatingCoolingWinter
optimica:
rtol: 1.0e-08
- model_name: Buildings.ThermalZones.EnergyPlus.Examples.SmallOffice.Unconditioned
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Examples.SmallOffice.Unconditioned
optimica:
comment: 'Failed with RuntimeError: Process timeout after 300 seconds. Since oct-r26446.'
simulate: false
- model_name: Buildings.ThermalZones.EnergyPlus.Validation.MultipleBuildings.TwoIdenticalTwoZoneBuildings
- model_name: Buildings.ThermalZones.EnergyPlus_9_6_0.Validation.MultipleBuildings.TwoIdenticalTwoZoneBuildings
openmodelica:
comment: returned non-zero exit status 139.
simulate: false
Expand Down

0 comments on commit 3f9b735

Please sign in to comment.