-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathEnergyPlus_24_2_0_Wrapper.c
More file actions
157 lines (142 loc) · 4.19 KB
/
EnergyPlus_24_2_0_Wrapper.c
File metadata and controls
157 lines (142 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#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,
const char* epName,
const char* hvacZone,
int runPeriod_dayOfWeekForStartDay,
int runPeriod_applyWeekEndHolidayRule,
int runPeriod_use_weatherFileDaylightSavingPeriod,
int runPeriod_use_weatherFileHolidaysAndSpecialDays,
int runPeriod_use_weatherFileRainIndicators,
int runPeriod_use_weatherFileSnowIndicators,
double relativeSurfaceTolerance,
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,
epName,
hvacZone,
&runPer,
relativeSurfaceTolerance,
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