-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Spawn to EnergyPlus 24.2.0 (#4018)
* Implemented support for RunPeriod for #2926 * Updated EnergyPlus coupling to add EnergyPlus 24.2.0 for #3911
- Loading branch information
Showing
321 changed files
with
38,368 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
155 changes: 155 additions & 0 deletions
155
Buildings/Resources/C-Sources/EnergyPlus_24_2_0_Wrapper.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
#ifndef Spawn_declared | ||
#define Spawn_declared | ||
|
||
#include "EnergyPlus_24_2_0_Wrapper.h" | ||
|
||
/* ********************************************************* | ||
Wrapper functions that connect to the library which | ||
generates and loads the EnergyPlus fmu. | ||
Note that ModelicaMessage, ModelicaError, | ||
ModelicaFormatMessage and ModelicaFormatError are passed | ||
as function pointers. These functions are provided by, | ||
and may differ among, the Modelica environments. | ||
Using function pointers allows the library to load the | ||
correct version provided by the Modelica simulation | ||
environment that compiles the Modelica model. | ||
********************************************************* */ | ||
|
||
/* Custom implementation of ModelicaFormatMessage that prints to stdout | ||
#define my_printf(...) MyModelicaFormatMessage(__VA_ARGS__) | ||
void my_printf(const char *fmt, ...) { | ||
va_list args; | ||
va_start(args, fmt); | ||
vprintf(fmt, args); | ||
va_end(args); | ||
fflush(stdout); | ||
} | ||
*/ | ||
|
||
void* allocate_Modelica_EnergyPlus_24_2_0( | ||
const int objectType, | ||
double startTime, | ||
const char* modelicaNameBuilding, | ||
const char* modelicaNameThermalZone, | ||
const char* spawnExe, | ||
const char* idfVersion, | ||
const char* idfName, | ||
const char* epwName, | ||
int runPeriod_dayOfWeekForStartDay, | ||
int runPeriod_applyWeekEndHolidayRule, | ||
int runPeriod_use_weatherFileDaylightSavingPeriod, | ||
int runPeriod_use_weatherFileHolidaysAndSpecialDays, | ||
int runPeriod_use_weatherFileRainIndicators, | ||
int runPeriod_use_weatherFileSnowIndicators, | ||
double relativeSurfaceTolerance, | ||
const char* epName, | ||
int usePrecompiledFMU, | ||
const char* fmuName, | ||
const char* buildingsRootFileLocation, | ||
const int logLevel, | ||
const int printUnit, | ||
const char* jsonName, | ||
const char* jsonKeysValues, | ||
const char** parOutNames, | ||
const size_t nParOut, | ||
const char** parOutUnits, | ||
const size_t nParOutUni, | ||
const char** inpNames, | ||
const size_t nInp, | ||
const char** inpUnits, | ||
const size_t nInpUni, | ||
const char** outNames, | ||
const size_t nOut, | ||
const char** outUnits, | ||
const size_t nOutUni, | ||
const int* derivatives_structure, | ||
size_t k, | ||
size_t n, | ||
const double* derivatives_delta, | ||
const size_t nDer){ | ||
|
||
|
||
runPeriod runPer; | ||
runPer.dayOfWeekForStartDay = runPeriod_dayOfWeekForStartDay; | ||
runPer.applyWeekEndHolidayRule = runPeriod_applyWeekEndHolidayRule; | ||
runPer.use_weatherFileDaylightSavingPeriod = runPeriod_use_weatherFileDaylightSavingPeriod; | ||
runPer.use_weatherFileHolidaysAndSpecialDays = runPeriod_use_weatherFileHolidaysAndSpecialDays; | ||
runPer.use_weatherFileRainIndicators = runPeriod_use_weatherFileRainIndicators; | ||
runPer.use_weatherFileSnowIndicators = runPeriod_use_weatherFileSnowIndicators; | ||
|
||
|
||
return allocate_Spawn_EnergyPlus_24_2_0( | ||
objectType, | ||
startTime, | ||
modelicaNameBuilding, | ||
modelicaNameThermalZone, | ||
spawnExe, | ||
idfVersion, | ||
idfName, | ||
epwName, | ||
&runPer, | ||
relativeSurfaceTolerance, | ||
epName, | ||
usePrecompiledFMU, | ||
fmuName, | ||
buildingsRootFileLocation, | ||
logLevel, | ||
printUnit, | ||
jsonName, | ||
jsonKeysValues, | ||
parOutNames, | ||
nParOut, | ||
parOutUnits, | ||
nParOutUni, | ||
inpNames, | ||
nInp, | ||
inpUnits, | ||
nInpUni, | ||
outNames, | ||
nOut, | ||
outUnits, | ||
nOutUni, | ||
derivatives_structure, | ||
k, /* k = 2 in Modelica */ | ||
n, | ||
derivatives_delta, | ||
nDer, | ||
ModelicaMessage, | ||
ModelicaError, | ||
ModelicaFormatMessage, | ||
ModelicaFormatError); | ||
} | ||
|
||
void initialize_Modelica_EnergyPlus_24_2_0( | ||
void* object, | ||
double isSynchronized, | ||
int *nObj){ | ||
initialize_Spawn_EnergyPlus_24_2_0(object, nObj); | ||
} | ||
|
||
void getParameters_Modelica_EnergyPlus_24_2_0( | ||
void* object, | ||
double isSynchronized, | ||
double *parOut){ | ||
getParameters_Spawn_EnergyPlus_24_2_0(object, parOut); | ||
} | ||
|
||
void exchange_Modelica_EnergyPlus_24_2_0( | ||
void* object, | ||
const double* u, | ||
double dummy, | ||
double* y){ | ||
|
||
exchange_Spawn_EnergyPlus_24_2_0( | ||
object, | ||
0, /* Argument initialCall is hard-coded to false, and can be removed when binaries need to be recompiled. */ | ||
u, | ||
y); | ||
} | ||
|
||
void free_Modelica_EnergyPlus_24_2_0(void* object){ | ||
free_Spawn_EnergyPlus_24_2_0(object); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#ifndef EnergyPlus_24_2_0_Wrapper_h | ||
#define EnergyPlus_24_2_0_Wrapper_h | ||
|
||
#include <stdint.h> | ||
|
||
|
||
/* Check for 64 bit */ | ||
/* Windows */ | ||
#if _WIN32 || _WIN64 | ||
#if _WIN64 | ||
#define ENVIRONMENT64 | ||
#else | ||
#define ENVIRONMENT32 | ||
#endif | ||
#endif | ||
|
||
/* gcc */ | ||
#if __GNUC__ | ||
#if __x86_64__ || __ppc64__ | ||
#define ENVIRONMENT64 | ||
#else | ||
#define ENVIRONMENT32 | ||
#endif | ||
#endif | ||
|
||
#ifndef ENVIRONMENT64 | ||
#error Modelica Spawn coupling is only supported for Windows and Linux 64 bit. Your operating system is not 64 bit. | ||
#endif | ||
|
||
#include "ModelicaUtilities.h" | ||
|
||
typedef struct { | ||
int dayOfWeekForStartDay; /* Day of week from Buildings.ThermalZones.EnergyPlus_24_2_0.Types.WeekDays */ | ||
int applyWeekEndHolidayRule; | ||
int use_weatherFileDaylightSavingPeriod; | ||
int use_weatherFileHolidaysAndSpecialDays; | ||
int use_weatherFileRainIndicators; | ||
int use_weatherFileSnowIndicators; | ||
} runPeriod; | ||
|
||
/* ********************************************************* */ | ||
/* Thermal zone */ | ||
extern void* allocate_Spawn_EnergyPlus_24_2_0( | ||
const int objectType, | ||
double startTime, | ||
const char* modelicaNameBuilding, | ||
const char* modelicaNameThermalZone, | ||
const char* spawnExe, | ||
const char* idfVersion, | ||
const char* idfName, | ||
const char* epwName, | ||
const runPeriod* runPer, | ||
double relativeSurfaceTolerance, | ||
const char* epName, | ||
int usePrecompiledFMU, | ||
const char* fmuName, | ||
const char* buildingsRootFileLocation, | ||
const int logLevel, | ||
const int printUnit, | ||
const char* jsonName, | ||
const char* jsonKeysValues, | ||
const char** parOutNames, | ||
const size_t nParOut, | ||
const char** parOutUnits, | ||
const size_t nParOutUni, | ||
const char** inpNames, | ||
const size_t nInp, | ||
const char** inpUnits, | ||
const size_t nInpUni, | ||
const char** outNames, | ||
const size_t nOut, | ||
const char** outUnits, | ||
const size_t nOutUni, | ||
const int* derivatives_structure, | ||
const size_t k, | ||
const size_t n, | ||
const double* derivatives_delta, | ||
const size_t nDer, | ||
void (*SpawnMessage)(const char *string), | ||
void (*SpawnError)(const char *string), | ||
void (*SpawnFormatMessage)(const char *string, ...), | ||
void (*SpawnFormatError)(const char *string, ...)); | ||
|
||
extern void initialize_Spawn_EnergyPlus_24_2_0(void* object, int *nObj); | ||
|
||
extern void getParameters_Spawn_EnergyPlus_24_2_0(void* object, double *parOut); | ||
|
||
extern void exchange_Spawn_EnergyPlus_24_2_0( | ||
void* object, | ||
int initialCall, | ||
const double* u, | ||
double* y); | ||
|
||
extern void free_Spawn_EnergyPlus_24_2_0(void* object); | ||
|
||
#endif |
Oops, something went wrong.