GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 76.4% 503 / 0 / 658
Functions: 86.7% 13 / 0 / 15
Branches: 53.8% 528 / 0 / 982

src/isomodel/UserModel.cpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #include "UserModel.hpp"
7
8 using namespace std;
9 namespace openstudio {
10 namespace isomodel {
11
12 1 SimModel UserModel::toSimModel() {
13 1 _valid = true;
14
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
1 if (!_weather) {
15 // weather file isn't loaded yet, let's try to
16 ✗ _weather = loadWeather();
17 }
18
19
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!_valid) {
20 ✗ throw std::runtime_error("UserModel is not valid, cannot create SimModel");
21 }
22
23 1 SimModel sim;
24
25
2/4
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 std::shared_ptr<Population> pop(new Population);
26 1 pop->setDaysStart(_buildingOccupancyFrom);
27 1 pop->setDaysEnd(_buildingOccupancyTo);
28 1 pop->setHoursEnd(_equivFullLoadOccupancyTo);
29 1 pop->setHoursStart(_equivFullLoadOccupancyFrom);
30 1 pop->setDensityOccupied(_peopleDensityOccupied);
31
32 1 pop->setDensityUnoccupied(_peopleDensityUnoccupied);
33 1 pop->setHeatGainPerPerson(_heatGainPerPerson);
34 1 sim.setPop(pop);
35
36
2/4
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 std::shared_ptr<Location> loc(new Location);
37 1 loc->setTerrain(_terrainClass);
38 1 loc->setWeatherData(_weather);
39 1 sim.setLocation(loc);
40
41
2/4
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 std::shared_ptr<Building> building(new Building);
42 1 building->setBuildingEnergyManagement(_bemType);
43 1 building->setConstantIllumination(_constantIlluminationControl);
44 1 building->setElectricApplianceHeatGainOccupied(_elecPowerAppliancesOccupied);
45 1 building->setElectricApplianceHeatGainUnoccupied(_elecPowerAppliancesUnoccupied);
46 1 building->setGasApplianceHeatGainOccupied(_gasPowerAppliancesOccupied);
47 1 building->setGasApplianceHeatGainUnoccupied(_gasPowerAppliancesUnoccupied);
48 1 building->setLightingOccupancySensor(_lightingOccupancySensorSystem);
49 1 sim.setBuilding(building);
50
51
2/4
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 std::shared_ptr<Cooling> cooling(new Cooling);
52 1 cooling->setCOP(_coolingSystemCOP);
53 1 cooling->setHvacLossFactor(_hvacCoolingLossFactor);
54 1 cooling->setPartialLoadValue(_coolingSystemIPLVToCOPRatio);
55 1 cooling->setPumpControlReduction(_coolingPumpControl);
56 1 cooling->setTemperatureSetPointOccupied(_coolingOccupiedSetpoint);
57 1 cooling->setTemperatureSetPointUnoccupied(_coolingUnoccupiedSetpoint);
58 1 sim.setCooling(cooling);
59
60
2/4
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 std::shared_ptr<Heating> heating(new Heating);
61 1 heating->setEfficiency(_heatingSystemEfficiency);
62 1 heating->setEnergyType(_heatingEnergyCarrier);
63 1 heating->setHotcoldWasteFactor(_hvacWasteFactor); //??
64 1 heating->setHotWaterDemand(_dhwDemand);
65 1 heating->setHotWaterDistributionEfficiency(_dhwDistributionEfficiency);
66 1 heating->setHotWaterEnergyType(_dhwEnergyCarrier);
67 1 heating->setHotWaterSystemEfficiency(_dhwEfficiency);
68 1 heating->setHvacLossFactor(_hvacHeatingLossFactor);
69 1 heating->setPumpControlReduction(_heatingPumpControl);
70 1 heating->setTemperatureSetPointOccupied(_heatingOccupiedSetpoint);
71 1 heating->setTemperatureSetPointUnoccupied(_heatingUnoccupiedSetpoint);
72 1 sim.setHeating(heating);
73
74
2/4
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 std::shared_ptr<Lighting> lighting(new Lighting);
75 1 lighting->setDimmingFraction(_daylightSensorSystem);
76 1 lighting->setExteriorEnergy(_exteriorLightingPower);
77 1 lighting->setPowerDensityOccupied(_lightingPowerIntensityOccupied);
78 1 lighting->setPowerDensityUnoccupied(_lightingPowerIntensityUnoccupied);
79 1 sim.setLights(lighting);
80
81
3/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
1 std::shared_ptr<Structure> structure(new Structure);
82 1 structure->setFloorArea(_floorArea);
83 1 structure->setBuildingHeight(_buildingHeight);
84 1 structure->setInfiltrationRate(_buildingAirLeakage);
85 1 structure->setInteriorHeatCapacity(_interiorHeatCapacity);
86 //directions in the order [S, SE, E, NE, N, NW, W, SW, roof/skylight]
87
1/1
✓ Branch 1 taken 1 time.
1 Vector wallArea(9);
88
1/1
✓ Branch 1 taken 1 time.
1 wallArea[0] = _wallAreaS;
89
1/1
✓ Branch 1 taken 1 time.
1 wallArea[1] = _wallAreaSE;
90
1/1
✓ Branch 1 taken 1 time.
1 wallArea[2] = _wallAreaE;
91
1/1
✓ Branch 1 taken 1 time.
1 wallArea[3] = _wallAreaNE;
92
1/1
✓ Branch 1 taken 1 time.
1 wallArea[4] = _wallAreaN;
93
1/1
✓ Branch 1 taken 1 time.
1 wallArea[5] = _wallAreaNW;
94
1/1
✓ Branch 1 taken 1 time.
1 wallArea[6] = _wallAreaW;
95
1/1
✓ Branch 1 taken 1 time.
1 wallArea[7] = _wallAreaSW;
96
1/1
✓ Branch 1 taken 1 time.
1 wallArea[8] = _roofArea;
97
1/1
✓ Branch 2 taken 1 time.
1 structure->setWallArea(wallArea); //vector
98 1 structure->setWallHeatCapacity(_exteriorHeatCapacity); //??
99
100
1/1
✓ Branch 1 taken 1 time.
1 Vector wallSolar(9);
101
1/1
✓ Branch 1 taken 1 time.
1 wallSolar[0] = _wallSolarAbsorptionS;
102
1/1
✓ Branch 1 taken 1 time.
1 wallSolar[1] = _wallSolarAbsorptionSE;
103
1/1
✓ Branch 1 taken 1 time.
1 wallSolar[2] = _wallSolarAbsorptionE;
104
1/1
✓ Branch 1 taken 1 time.
1 wallSolar[3] = _wallSolarAbsorptionNE;
105
1/1
✓ Branch 1 taken 1 time.
1 wallSolar[4] = _wallSolarAbsorptionN;
106
1/1
✓ Branch 1 taken 1 time.
1 wallSolar[5] = _wallSolarAbsorptionNW;
107
1/1
✓ Branch 1 taken 1 time.
1 wallSolar[6] = _wallSolarAbsorptionW;
108
1/1
✓ Branch 1 taken 1 time.
1 wallSolar[7] = _wallSolarAbsorptionSW;
109
1/1
✓ Branch 1 taken 1 time.
1 wallSolar[8] = _roofSolarAbsorption;
110
1/1
✓ Branch 2 taken 1 time.
1 structure->setWallSolarAbsorbtion(wallSolar); //vector
111
112
1/1
✓ Branch 1 taken 1 time.
1 Vector wallTherm(9);
113
1/1
✓ Branch 1 taken 1 time.
1 wallTherm[0] = _wallThermalEmissivityS;
114
1/1
✓ Branch 1 taken 1 time.
1 wallTherm[1] = _wallThermalEmissivitySE;
115
1/1
✓ Branch 1 taken 1 time.
1 wallTherm[2] = _wallThermalEmissivityE;
116
1/1
✓ Branch 1 taken 1 time.
1 wallTherm[3] = _wallThermalEmissivityNE;
117
1/1
✓ Branch 1 taken 1 time.
1 wallTherm[4] = _wallThermalEmissivityN;
118
1/1
✓ Branch 1 taken 1 time.
1 wallTherm[5] = _wallThermalEmissivityNW;
119
1/1
✓ Branch 1 taken 1 time.
1 wallTherm[6] = _wallThermalEmissivityW;
120
1/1
✓ Branch 1 taken 1 time.
1 wallTherm[7] = _wallThermalEmissivitySW;
121
1/1
✓ Branch 1 taken 1 time.
1 wallTherm[8] = _roofThermalEmissivity;
122
1/1
✓ Branch 2 taken 1 time.
1 structure->setWallThermalEmissivity(wallTherm); //vector
123
124
1/1
✓ Branch 1 taken 1 time.
1 Vector wallU(9);
125
1/1
✓ Branch 1 taken 1 time.
1 wallU[0] = _wallUvalueS;
126
1/1
✓ Branch 1 taken 1 time.
1 wallU[1] = _wallUvalueSE;
127
1/1
✓ Branch 1 taken 1 time.
1 wallU[2] = _wallUvalueE;
128
1/1
✓ Branch 1 taken 1 time.
1 wallU[3] = _wallUvalueNE;
129
1/1
✓ Branch 1 taken 1 time.
1 wallU[4] = _wallUvalueN;
130
1/1
✓ Branch 1 taken 1 time.
1 wallU[5] = _wallUvalueNW;
131
1/1
✓ Branch 1 taken 1 time.
1 wallU[6] = _wallUvalueW;
132
1/1
✓ Branch 1 taken 1 time.
1 wallU[7] = _wallUvalueSW;
133
1/1
✓ Branch 1 taken 1 time.
1 wallU[8] = _roofUValue;
134
1/1
✓ Branch 2 taken 1 time.
1 structure->setWallUniform(wallU); //vector
135
136
1/1
✓ Branch 1 taken 1 time.
1 Vector windowArea(9);
137
1/1
✓ Branch 1 taken 1 time.
1 windowArea[0] = _windowAreaS;
138
1/1
✓ Branch 1 taken 1 time.
1 windowArea[1] = _windowAreaSE;
139
1/1
✓ Branch 1 taken 1 time.
1 windowArea[2] = _windowAreaE;
140
1/1
✓ Branch 1 taken 1 time.
1 windowArea[3] = _windowAreaNE;
141
1/1
✓ Branch 1 taken 1 time.
1 windowArea[4] = _windowAreaN;
142
1/1
✓ Branch 1 taken 1 time.
1 windowArea[5] = _windowAreaNW;
143
1/1
✓ Branch 1 taken 1 time.
1 windowArea[6] = _windowAreaW;
144
1/1
✓ Branch 1 taken 1 time.
1 windowArea[7] = _windowAreaSW;
145
1/1
✓ Branch 1 taken 1 time.
1 windowArea[8] = _skylightArea;
146
1/1
✓ Branch 2 taken 1 time.
1 structure->setWindowArea(windowArea); //vector
147
148
1/1
✓ Branch 1 taken 1 time.
1 Vector winSHGC(9);
149
1/1
✓ Branch 1 taken 1 time.
1 winSHGC[0] = _windowSHGCS;
150
1/1
✓ Branch 1 taken 1 time.
1 winSHGC[1] = _windowSHGCSE;
151
1/1
✓ Branch 1 taken 1 time.
1 winSHGC[2] = _windowSHGCE;
152
1/1
✓ Branch 1 taken 1 time.
1 winSHGC[3] = _windowSHGCNE;
153
1/1
✓ Branch 1 taken 1 time.
1 winSHGC[4] = _windowSHGCN;
154
1/1
✓ Branch 1 taken 1 time.
1 winSHGC[5] = _windowSHGCNW;
155
1/1
✓ Branch 1 taken 1 time.
1 winSHGC[6] = _windowSHGCW;
156
1/1
✓ Branch 1 taken 1 time.
1 winSHGC[7] = _windowSHGCSW;
157
1/1
✓ Branch 1 taken 1 time.
1 winSHGC[8] = _skylightSHGC;
158
1/1
✓ Branch 2 taken 1 time.
1 structure->setWindowNormalIncidenceSolarEnergyTransmittance(winSHGC); //vector
159
160
1/1
✓ Branch 1 taken 1 time.
1 Vector winSCF(9);
161
1/1
✓ Branch 1 taken 1 time.
1 winSCF[0] = _windowSCFS;
162
1/1
✓ Branch 1 taken 1 time.
1 winSCF[1] = _windowSCFSE;
163
1/1
✓ Branch 1 taken 1 time.
1 winSCF[2] = _windowSCFE;
164
1/1
✓ Branch 1 taken 1 time.
1 winSCF[3] = _windowSCFNE;
165
1/1
✓ Branch 1 taken 1 time.
1 winSCF[4] = _windowSCFN;
166
1/1
✓ Branch 1 taken 1 time.
1 winSCF[5] = _windowSCFNW;
167
1/1
✓ Branch 1 taken 1 time.
1 winSCF[6] = _windowSCFW;
168
1/1
✓ Branch 1 taken 1 time.
1 winSCF[7] = _windowSCFSW;
169
1/1
✓ Branch 1 taken 1 time.
1 winSCF[8] = _windowSCFN;
170
1/1
✓ Branch 2 taken 1 time.
1 structure->setWindowShadingCorrectionFactor(winSCF); //vector
171 1 structure->setWindowShadingDevice(_windowSDFN);
172
173
1/1
✓ Branch 1 taken 1 time.
1 Vector winU(9);
174
1/1
✓ Branch 1 taken 1 time.
1 winU[0] = _windowUvalueS;
175
1/1
✓ Branch 1 taken 1 time.
1 winU[1] = _windowUvalueSE;
176
1/1
✓ Branch 1 taken 1 time.
1 winU[2] = _windowUvalueE;
177
1/1
✓ Branch 1 taken 1 time.
1 winU[3] = _windowUvalueNE;
178
1/1
✓ Branch 1 taken 1 time.
1 winU[4] = _windowUvalueN;
179
1/1
✓ Branch 1 taken 1 time.
1 winU[5] = _windowUvalueNW;
180
1/1
✓ Branch 1 taken 1 time.
1 winU[6] = _windowUvalueW;
181
1/1
✓ Branch 1 taken 1 time.
1 winU[7] = _windowUvalueSW;
182
1/1
✓ Branch 1 taken 1 time.
1 winU[8] = _skylightUvalue;
183
1/1
✓ Branch 2 taken 1 time.
1 structure->setWindowUniform(winU); //vector
184 1 sim.setStructure(structure);
185
186
2/4
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 std::shared_ptr<Ventilation> ventilation(new Ventilation);
187 1 ventilation->setExhaustAirRecirculated(_exhaustAirRecirculation);
188 1 ventilation->setFanControlFactor(_fanFlowControlFactor);
189 1 ventilation->setFanPower(_specificFanPower);
190 1 ventilation->setHeatRecoveryEfficiency(_heatRecovery);
191 1 ventilation->setSupplyDifference(_supplyExhaustRate);
192 1 ventilation->setSupplyRate(_freshAirFlowRate);
193 1 ventilation->setType(_ventilationType);
194 1 ventilation->setWasteFactor(_hvacWasteFactor); //??
195 1 sim.setVentilation(ventilation);
196 2 return sim;
197 1 }
198 //http://stackoverflow.com/questions/10051679/c-tokenize-string
199 258 std::vector<std::string> inline stringSplit(const std::string& source, char delimiter = ' ', bool keepEmpty = false) {
200 258 std::vector<std::string> results;
201
202 258 size_t prev = 0;
203 258 size_t next = 0;
204
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 256 times.
258 if (source.empty()) {
205 2 return results;
206 }
207
208
2/2
✓ Branch 1 taken 256 times.
✓ Branch 2 taken 256 times.
512 while ((next = source.find_first_of(delimiter, prev)) != std::string::npos) {
209
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 256 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
256 if (keepEmpty || (next - prev != 0)) {
210
2/2
✓ Branch 1 taken 256 times.
✓ Branch 4 taken 256 times.
256 results.push_back(source.substr(prev, next - prev));
211 }
212 256 prev = next + 1;
213 }
214
215
1/2
✓ Branch 1 taken 256 times.
✗ Branch 2 not taken.
256 if (prev < source.size()) {
216
2/2
✓ Branch 1 taken 256 times.
✓ Branch 4 taken 256 times.
256 results.push_back(source.substr(prev));
217 }
218
219 256 return results;
220 ✗ }
221
222 // trim from front
223 768 static inline std::string& ltrim(std::string& s) {
224
2/2
✓ Branch 3 taken 768 times.
✓ Branch 9 taken 768 times.
1786 s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int c) { return std::isspace(c) == 0; }));
225 768 return s;
226 }
227
228 // trim from back
229 768 static inline std::string& rtrim(std::string& s) {
230
2/2
✓ Branch 5 taken 768 times.
✓ Branch 10 taken 768 times.
1780 s.erase(std::find_if(s.rbegin(), s.rend(), [](int c) { return std::isspace(c) == 0; }).base(), s.end());
231 768 return s;
232 }
233
234 // trim from front and back ends
235 512 static inline std::string& trim(std::string& s) {
236 512 return ltrim(rtrim(s));
237 }
238
239 // trim from front and back ends
240 256 static inline std::string& lcase(std::string& s) {
241
2/2
✓ Branch 1 taken 4120 times.
✓ Branch 2 taken 256 times.
4376 for (unsigned int i = 0; i < s.size(); i++) {
242
2/2
✓ Branch 1 taken 904 times.
✓ Branch 2 taken 3216 times.
4120 if (s.at(i) < 91) {
243 904 s.at(i) = s.at(i) + 32;
244 }
245 }
246 256 return ltrim(rtrim(s));
247 }
248
249 112 void UserModel::parseStructure(const std::string& attributeName, const char* attributeValue) {
250 //Window&Wall Values
251
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 110 times.
112 if (attributeName == "windowuvaluen") {
252 2 _windowUvalueN = (atof(attributeValue));
253
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 108 times.
110 } else if (attributeName == "windowshgcn") {
254 2 _windowSHGCN = (atof(attributeValue));
255
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 106 times.
108 } else if (attributeName == "windowscfn") {
256 2 _windowSCFN = (atof(attributeValue));
257
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 104 times.
106 } else if (attributeName == "windowsdfn") {
258 2 _windowSDFN = (atof(attributeValue));
259
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 102 times.
104 } else if (attributeName == "walluvaluen") {
260 2 _wallUvalueN = (atof(attributeValue));
261
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 100 times.
102 } else if (attributeName == "wallsolarabsorptionn") {
262 2 _wallSolarAbsorptionN = (atof(attributeValue));
263
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 98 times.
100 } else if (attributeName == "wallthermalemissivityn") {
264 2 _wallThermalEmissivityN = (atof(attributeValue));
265 }
266
267
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 96 times.
98 else if (attributeName == "windowuvaluene") {
268 2 _windowUvalueNE = (atof(attributeValue));
269
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 94 times.
96 } else if (attributeName == "windowshgcne") {
270 2 _windowSHGCNE = (atof(attributeValue));
271
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 92 times.
94 } else if (attributeName == "windowscfne") {
272 2 _windowSCFNE = (atof(attributeValue));
273
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 90 times.
92 } else if (attributeName == "windowsdfne") {
274 2 _windowSDFNE = (atof(attributeValue));
275
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 88 times.
90 } else if (attributeName == "walluvaluene") {
276 2 _wallUvalueNE = (atof(attributeValue));
277
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 86 times.
88 } else if (attributeName == "wallsolarabsorptionne") {
278 2 _wallSolarAbsorptionNE = (atof(attributeValue));
279
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 84 times.
86 } else if (attributeName == "wallthermalemissivityne") {
280 2 _wallThermalEmissivityNE = (atof(attributeValue));
281 }
282
283
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 82 times.
84 else if (attributeName == "windowuvaluee") {
284 2 _windowUvalueE = (atof(attributeValue));
285
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 80 times.
82 } else if (attributeName == "windowshgce") {
286 2 _windowSHGCE = (atof(attributeValue));
287
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 78 times.
80 } else if (attributeName == "windowscfe") {
288 2 _windowSCFE = (atof(attributeValue));
289
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 76 times.
78 } else if (attributeName == "windowsdfe") {
290 2 _windowSDFE = (atof(attributeValue));
291
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 74 times.
76 } else if (attributeName == "walluvaluee") {
292 2 _wallUvalueE = (atof(attributeValue));
293
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 72 times.
74 } else if (attributeName == "wallsolarabsorptione") {
294 2 _wallSolarAbsorptionE = (atof(attributeValue));
295
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 70 times.
72 } else if (attributeName == "wallthermalemissivitye") {
296 2 _wallThermalEmissivityE = (atof(attributeValue));
297 }
298
299
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 68 times.
70 else if (attributeName == "windowuvaluese") {
300 2 _windowUvalueSE = (atof(attributeValue));
301
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 66 times.
68 } else if (attributeName == "windowshgcse") {
302 2 _windowSHGCSE = (atof(attributeValue));
303
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 64 times.
66 } else if (attributeName == "windowscfse") {
304 2 _windowSCFSE = (atof(attributeValue));
305
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 62 times.
64 } else if (attributeName == "windowsdfse") {
306 2 _windowSDFSE = (atof(attributeValue));
307
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 60 times.
62 } else if (attributeName == "walluvaluese") {
308 2 _wallUvalueSE = (atof(attributeValue));
309
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 58 times.
60 } else if (attributeName == "wallsolarabsorptionse") {
310 2 _wallSolarAbsorptionSE = (atof(attributeValue));
311
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 56 times.
58 } else if (attributeName == "wallthermalemissivityse") {
312 2 _wallThermalEmissivitySE = (atof(attributeValue));
313 }
314
315
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 54 times.
56 else if (attributeName == "windowuvalues") {
316 2 _windowUvalueS = (atof(attributeValue));
317
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 52 times.
54 } else if (attributeName == "windowshgcs") {
318 2 _windowSHGCS = (atof(attributeValue));
319
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 50 times.
52 } else if (attributeName == "windowscfs") {
320 2 _windowSCFS = (atof(attributeValue));
321
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 48 times.
50 } else if (attributeName == "windowsdfs") {
322 2 _windowSDFS = (atof(attributeValue));
323
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 46 times.
48 } else if (attributeName == "walluvalues") {
324 2 _wallUvalueS = (atof(attributeValue));
325
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 44 times.
46 } else if (attributeName == "wallsolarabsorptions") {
326 2 _wallSolarAbsorptionS = (atof(attributeValue));
327
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 42 times.
44 } else if (attributeName == "wallthermalemissivitys") {
328 2 _wallThermalEmissivityS = (atof(attributeValue));
329 }
330
331
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 40 times.
42 else if (attributeName == "windowuvaluesw") {
332 2 _windowUvalueSW = (atof(attributeValue));
333
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 38 times.
40 } else if (attributeName == "windowshgcsw") {
334 2 _windowSHGCSW = (atof(attributeValue));
335
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 36 times.
38 } else if (attributeName == "windowscfsw") {
336 2 _windowSCFSW = (atof(attributeValue));
337
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 34 times.
36 } else if (attributeName == "windowsdfsw") {
338 2 _windowSDFSW = (atof(attributeValue));
339
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 32 times.
34 } else if (attributeName == "walluvaluesw") {
340 2 _wallUvalueSW = (atof(attributeValue));
341
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 30 times.
32 } else if (attributeName == "wallsolarabsorptionsw") {
342 2 _wallSolarAbsorptionSW = (atof(attributeValue));
343
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 28 times.
30 } else if (attributeName == "wallthermalemissivitysw") {
344 2 _wallThermalEmissivitySW = (atof(attributeValue));
345 }
346
347
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 26 times.
28 else if (attributeName == "windowuvaluew") {
348 2 _windowUvalueW = (atof(attributeValue));
349
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 24 times.
26 } else if (attributeName == "windowshgcw") {
350 2 _windowSHGCW = (atof(attributeValue));
351
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 22 times.
24 } else if (attributeName == "windowscfw") {
352 2 _windowSCFW = (atof(attributeValue));
353
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 20 times.
22 } else if (attributeName == "windowsdfw") {
354 2 _windowSDFW = (atof(attributeValue));
355
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 18 times.
20 } else if (attributeName == "walluvaluew") {
356 2 _wallUvalueW = (atof(attributeValue));
357
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 16 times.
18 } else if (attributeName == "wallsolarabsorptionw") {
358 2 _wallSolarAbsorptionW = (atof(attributeValue));
359
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 14 times.
16 } else if (attributeName == "wallthermalemissivityw") {
360 2 _wallThermalEmissivityW = (atof(attributeValue));
361 }
362
363
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
14 else if (attributeName == "windowuvaluenw") {
364 2 _windowUvalueNW = (atof(attributeValue));
365
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 10 times.
12 } else if (attributeName == "windowshgcnw") {
366 2 _windowSHGCNW = (atof(attributeValue));
367
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 8 times.
10 } else if (attributeName == "windowscfnw") {
368 2 _windowSCFNW = (atof(attributeValue));
369
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 6 times.
8 } else if (attributeName == "windowsdfnw") {
370 2 _windowSDFNW = (atof(attributeValue));
371
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 4 times.
6 } else if (attributeName == "walluvaluenw") {
372 2 _wallUvalueNW = (atof(attributeValue));
373
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
4 } else if (attributeName == "wallsolarabsorptionnw") {
374 2 _wallSolarAbsorptionNW = (atof(attributeValue));
375
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 } else if (attributeName == "wallthermalemissivitynw") {
376 2 _wallThermalEmissivityNW = (atof(attributeValue));
377 }
378 112 }
379
380 258 void UserModel::parseLine(const string& line) {
381
1/1
✓ Branch 1 taken 258 times.
258 std::vector<std::string> linesplit = stringSplit(line, '=', true);
382
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 256 times.
258 if (linesplit.size() < 2) {
383 2 return;
384 }
385
2/2
✓ Branch 1 taken 512 times.
✓ Branch 2 taken 256 times.
768 for (unsigned int i = 0; i < linesplit.size(); i++) {
386
2/2
✓ Branch 2 taken 512 times.
✓ Branch 6 taken 512 times.
512 linesplit[i] = trim(linesplit[i]);
387 }
388
2/3
✓ Branch 2 taken 256 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 256 times.
256 if (linesplit[0].at(0) == '#') {
389 ✗ return;
390 }
391
2/2
✓ Branch 2 taken 256 times.
✓ Branch 5 taken 256 times.
256 string attributeName = lcase(linesplit[0]);
392
393 256 const char* attributeValue = linesplit[1].c_str();
394
3/3
✓ Branch 1 taken 256 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 254 times.
256 if (attributeName == "terrainclass") {
395 2 setTerrainClass(atof(attributeValue));
396
3/3
✓ Branch 1 taken 254 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 252 times.
254 } else if (attributeName == "buildingheight") {
397 2 setBuildingHeight(atof(attributeValue));
398
3/3
✓ Branch 1 taken 252 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 250 times.
252 } else if (attributeName == "floorarea") {
399 2 setFloorArea(atof(attributeValue));
400
3/3
✓ Branch 1 taken 250 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 248 times.
250 } else if (attributeName == "buildingoccupancyfrom") {
401 2 setBuildingOccupancyFrom(atof(attributeValue));
402
3/3
✓ Branch 1 taken 248 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 246 times.
248 } else if (attributeName == "buildingoccupancyto") {
403 2 setBuildingOccupancyTo(atof(attributeValue));
404
3/3
✓ Branch 1 taken 246 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 244 times.
246 } else if (attributeName == "equivfullloadoccupancyfrom") {
405 2 setEquivFullLoadOccupancyFrom(atof(attributeValue));
406
3/3
✓ Branch 1 taken 244 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 242 times.
244 } else if (attributeName == "equivfullloadoccupancyto") {
407 2 setEquivFullLoadOccupancyTo(atof(attributeValue));
408
3/3
✓ Branch 1 taken 242 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 240 times.
242 } else if (attributeName == "peopledensityoccupied") {
409 2 setPeopleDensityOccupied(atof(attributeValue));
410
3/3
✓ Branch 1 taken 240 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 238 times.
240 } else if (attributeName == "peopledensityunoccupied") {
411 2 setPeopleDensityUnoccupied(atof(attributeValue));
412
3/3
✓ Branch 1 taken 238 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 236 times.
238 } else if (attributeName == "lightingpowerintensityoccupied") {
413 2 setLightingPowerIntensityOccupied(atof(attributeValue));
414
3/3
✓ Branch 1 taken 236 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 234 times.
236 } else if (attributeName == "lightingpowerintensityunoccupied") {
415 2 setLightingPowerIntensityUnoccupied(atof(attributeValue));
416
3/3
✓ Branch 1 taken 234 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 232 times.
234 } else if (attributeName == "elecpowerappliancesoccupied") {
417 2 setElecPowerAppliancesOccupied(atof(attributeValue));
418
3/3
✓ Branch 1 taken 232 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 230 times.
232 } else if (attributeName == "elecpowerappliancesunoccupied") {
419 2 setElecPowerAppliancesUnoccupied(atof(attributeValue));
420
3/3
✓ Branch 1 taken 230 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 228 times.
230 } else if (attributeName == "gaspowerappliancesoccupied") {
421 2 setGasPowerAppliancesOccupied(atof(attributeValue));
422
3/3
✓ Branch 1 taken 228 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 226 times.
228 } else if (attributeName == "gaspowerappliancesunoccupied") {
423 2 setGasPowerAppliancesUnoccupied(atof(attributeValue));
424
3/3
✓ Branch 1 taken 226 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 224 times.
226 } else if (attributeName == "exteriorlightingpower") {
425 2 setExteriorLightingPower(atof(attributeValue));
426
3/3
✓ Branch 1 taken 224 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 222 times.
224 } else if (attributeName == "hvacwastefactor") {
427 2 setHvacWasteFactor(atof(attributeValue));
428
3/3
✓ Branch 1 taken 222 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 220 times.
222 } else if (attributeName == "hvacheatinglossfactor") {
429 2 setHvacHeatingLossFactor(atof(attributeValue));
430
3/3
✓ Branch 1 taken 220 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 218 times.
220 } else if (attributeName == "hvaccoolinglossfactor") {
431 2 setHvacCoolingLossFactor(atof(attributeValue));
432
3/3
✓ Branch 1 taken 218 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 216 times.
218 } else if (attributeName == "daylightsensorsystem") {
433 2 setDaylightSensorSystem(atof(attributeValue));
434
3/3
✓ Branch 1 taken 216 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 214 times.
216 } else if (attributeName == "lightingoccupancysensorsystem") {
435 2 setLightingOccupancySensorSystem(atof(attributeValue));
436
3/3
✓ Branch 1 taken 214 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 212 times.
214 } else if (attributeName == "constantilluminationcontrol") { //constantilluminaitoncontrol
437 2 setConstantIlluminationControl(atof(attributeValue));
438
3/3
✓ Branch 1 taken 212 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 210 times.
212 } else if (attributeName == "coolingsystemcop") {
439 2 setCoolingSystemCOP(atof(attributeValue));
440
3/3
✓ Branch 1 taken 210 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 208 times.
210 } else if (attributeName == "coolingsystemiplvtocopratio") {
441 2 setCoolingSystemIPLVToCOPRatio(atof(attributeValue));
442
3/3
✓ Branch 1 taken 208 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 206 times.
208 } else if (attributeName == "heatingenergycarrier") {
443 2 setHeatingEnergyCarrier(atof(attributeValue));
444
3/3
✓ Branch 1 taken 206 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 204 times.
206 } else if (attributeName == "heatingsystemefficiency") {
445 2 setHeatingSystemEfficiency(atof(attributeValue));
446
3/3
✓ Branch 1 taken 204 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 202 times.
204 } else if (attributeName == "ventilationtype") {
447 2 setVentilationType(atof(attributeValue));
448
3/3
✓ Branch 1 taken 202 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 200 times.
202 } else if (attributeName == "freshairflowrate") {
449 2 setFreshAirFlowRate(atof(attributeValue));
450
3/3
✓ Branch 1 taken 200 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 198 times.
200 } else if (attributeName == "supplyexhaustrate") {
451 2 setSupplyExhaustRate(atof(attributeValue));
452
3/3
✓ Branch 1 taken 198 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 196 times.
198 } else if (attributeName == "heatrecovery") {
453 2 setHeatRecovery(atof(attributeValue));
454
3/3
✓ Branch 1 taken 196 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 194 times.
196 } else if (attributeName == "exhaustairrecirculation") {
455 2 setExhaustAirRecirculation(atof(attributeValue));
456
3/3
✓ Branch 1 taken 194 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 192 times.
194 } else if (attributeName == "infiltration") {
457 2 setBuildingAirLeakage(atof(attributeValue));
458
3/3
✓ Branch 1 taken 192 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 190 times.
192 } else if (attributeName == "dhwdemand") {
459 2 setDhwDemand(atof(attributeValue));
460
3/3
✓ Branch 1 taken 190 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 188 times.
190 } else if (attributeName == "dhwsystemefficiency") {
461 2 setDhwEfficiency(atof(attributeValue));
462
3/3
✓ Branch 1 taken 188 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 186 times.
188 } else if (attributeName == "dhwdistributionefficiency") {
463 2 setDhwDistributionEfficiency(atof(attributeValue));
464
3/3
✓ Branch 1 taken 186 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 184 times.
186 } else if (attributeName == "dhwenergycarrier") {
465 2 setDhwEnergyCarrier(atof(attributeValue));
466
3/3
✓ Branch 1 taken 184 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 182 times.
184 } else if (attributeName == "bemtype") {
467 2 setBemType(atof(attributeValue));
468
3/3
✓ Branch 1 taken 182 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 180 times.
182 } else if (attributeName == "interiorheatcapacity") {
469 2 setInteriorHeatCapacity(atof(attributeValue));
470
3/3
✓ Branch 1 taken 180 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 178 times.
180 } else if (attributeName == "exteriorheatcapacity") {
471 2 setExteriorHeatCapacity(atof(attributeValue));
472
3/3
✓ Branch 1 taken 178 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 176 times.
178 } else if (attributeName == "heatingpumpcontrol") {
473 2 setHeatingPumpControl(atof(attributeValue));
474
3/3
✓ Branch 1 taken 176 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 174 times.
176 } else if (attributeName == "coolingpumpcontrol") {
475 2 setCoolingPumpControl(atof(attributeValue));
476
3/3
✓ Branch 1 taken 174 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 172 times.
174 } else if (attributeName == "heatgainperperson") {
477 2 setHeatGainPerPerson(atof(attributeValue));
478 //specificFanPower
479
3/3
✓ Branch 1 taken 172 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 170 times.
172 } else if (attributeName == "specificfanpower") {
480 2 setSpecificFanPower(atof(attributeValue));
481
3/3
✓ Branch 1 taken 170 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 168 times.
170 } else if (attributeName == "fanflowcontrolfactor") {
482 2 setFanFlowControlFactor(atof(attributeValue));
483
3/3
✓ Branch 1 taken 168 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 166 times.
168 } else if (attributeName == "roofuvalue") {
484 2 setRoofUValue(atof(attributeValue));
485
3/3
✓ Branch 1 taken 166 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 164 times.
166 } else if (attributeName == "roofsolarabsorption") {
486 2 setRoofSolarAbsorption(atof(attributeValue));
487
3/3
✓ Branch 1 taken 164 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 162 times.
164 } else if (attributeName == "roofthermalemissivity") {
488 2 setRoofThermalEmissivity(atof(attributeValue));
489
3/3
✓ Branch 1 taken 162 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 160 times.
162 } else if (attributeName == "skylightuvalue") {
490 2 setSkylightUvalue(atof(attributeValue));
491
3/3
✓ Branch 1 taken 160 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 158 times.
160 } else if (attributeName == "skylightshgc") {
492 2 setSkylightSHGC(atof(attributeValue));
493
3/3
✓ Branch 1 taken 158 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 156 times.
158 } else if (attributeName == "wallareas") {
494 2 setWallAreaS(atof(attributeValue));
495
3/3
✓ Branch 1 taken 156 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 154 times.
156 } else if (attributeName == "wallarease") {
496 2 setWallAreaSE(atof(attributeValue));
497
3/3
✓ Branch 1 taken 154 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 152 times.
154 } else if (attributeName == "wallareae") {
498 2 setWallAreaE(atof(attributeValue));
499
3/3
✓ Branch 1 taken 152 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 150 times.
152 } else if (attributeName == "wallareane") {
500 2 setWallAreaNE(atof(attributeValue));
501
3/3
✓ Branch 1 taken 150 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 148 times.
150 } else if (attributeName == "wallarean") {
502 2 setWallAreaN(atof(attributeValue));
503
3/3
✓ Branch 1 taken 148 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 146 times.
148 } else if (attributeName == "wallareanw") {
504 2 setWallAreaNW(atof(attributeValue));
505
3/3
✓ Branch 1 taken 146 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 144 times.
146 } else if (attributeName == "wallareaw") {
506 2 setWallAreaW(atof(attributeValue));
507
3/3
✓ Branch 1 taken 144 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 142 times.
144 } else if (attributeName == "wallareasw") {
508 2 setWallAreaSW(atof(attributeValue));
509
3/3
✓ Branch 1 taken 142 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 140 times.
142 } else if (attributeName == "roofarea") {
510 2 setRoofArea(atof(attributeValue));
511
3/3
✓ Branch 1 taken 140 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 138 times.
140 } else if (attributeName == "windowareas") {
512 2 setWindowAreaS(atof(attributeValue));
513
3/3
✓ Branch 1 taken 138 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 136 times.
138 } else if (attributeName == "windowarease") {
514 2 setWindowAreaSE(atof(attributeValue));
515
3/3
✓ Branch 1 taken 136 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 134 times.
136 } else if (attributeName == "windowareae") {
516 2 setWindowAreaE(atof(attributeValue));
517
3/3
✓ Branch 1 taken 134 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 132 times.
134 } else if (attributeName == "windowareane") {
518 2 setWindowAreaNE(atof(attributeValue));
519
3/3
✓ Branch 1 taken 132 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 130 times.
132 } else if (attributeName == "windowarean") {
520 2 setWindowAreaN(atof(attributeValue));
521
3/3
✓ Branch 1 taken 130 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 128 times.
130 } else if (attributeName == "windowareanw") {
522 2 setWindowAreaNW(atof(attributeValue));
523
3/3
✓ Branch 1 taken 128 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 126 times.
128 } else if (attributeName == "windowareaw") {
524 2 setWindowAreaW(atof(attributeValue));
525
3/3
✓ Branch 1 taken 126 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 124 times.
126 } else if (attributeName == "windowareasw") {
526 2 setWindowAreaSW(atof(attributeValue));
527
3/3
✓ Branch 1 taken 124 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 122 times.
124 } else if (attributeName == "skylightarea") {
528 2 setSkylightArea(atof(attributeValue));
529
3/3
✓ Branch 1 taken 122 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 120 times.
122 } else if (attributeName == "coolingoccupiedsetpoint") {
530 2 setCoolingOccupiedSetpoint(atof(attributeValue));
531
3/3
✓ Branch 1 taken 120 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 118 times.
120 } else if (attributeName == "coolingunoccupiedsetpoint") {
532 2 setCoolingUnoccupiedSetpoint(atof(attributeValue));
533
3/3
✓ Branch 1 taken 118 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 116 times.
118 } else if (attributeName == "heatingoccupiedsetpoint") {
534 2 setHeatingOccupiedSetpoint(atof(attributeValue));
535
3/3
✓ Branch 1 taken 116 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 114 times.
116 } else if (attributeName == "heatingunoccupiedsetpoint") { //weatherFilePath
536 2 setHeatingUnoccupiedSetpoint(atof(attributeValue));
537
3/3
✓ Branch 1 taken 114 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 112 times.
114 } else if (attributeName == "weatherfilepath") { //weatherFilePath
538
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 setWeatherFilePath(openstudio::toPath(linesplit[1]));
539
6/8
✓ Branch 2 taken 112 times.
✓ Branch 4 taken 48 times.
✓ Branch 5 taken 64 times.
✓ Branch 8 taken 48 times.
✓ Branch 10 taken 48 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 112 times.
✗ Branch 13 not taken.
112 } else if (boost::starts_with(attributeName.c_str(), "window") || boost::starts_with(attributeName.c_str(), "wall")) {
540
1/1
✓ Branch 1 taken 112 times.
112 parseStructure(attributeName, attributeValue); //avoid max nested ifs. Might be better to change to a map eventually
541 } else {
542 ✗ LOG(Error, "Unknown Attribute: " << attributeName << " = " << attributeValue);
543 }
544 258 }
545 2 void UserModel::loadBuilding(const openstudio::path& t_buildingFile) {
546
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 ifstream inputFile(openstudio::toSystemFilename(t_buildingFile));
547
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 if (inputFile.is_open()) {
548 2 std::string line;
549
3/3
✓ Branch 1 taken 260 times.
✓ Branch 3 taken 258 times.
✓ Branch 4 taken 2 times.
260 while (inputFile.good()) {
550
1/1
✓ Branch 1 taken 258 times.
258 getline(inputFile, line);
551
4/6
✓ Branch 1 taken 256 times.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 256 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 258 times.
258 if (!line.empty() && line[0] == '#') {
552 ✗ continue;
553 }
554
1/1
✓ Branch 1 taken 258 times.
258 parseLine(line);
555 }
556
1/1
✓ Branch 1 taken 2 times.
2 inputFile.close();
557 2 } else {
558 ✗ LOG(Error, "Unable to open file" << openstudio::toString(t_buildingFile));
559 }
560 2 }
561 ✗ int UserModel::weatherState(const std::string& header) {
562 ✗ if (header == "solar") {
563 ✗ return 1;
564 ✗ } else if (header == "hdbt") {
565 ✗ return 2;
566 ✗ } else if (header == "hEgh") {
567 ✗ return 3;
568 ✗ } else if (header == "mEgh") {
569 ✗ return 4;
570 ✗ } else if (header == "mdbt") {
571 ✗ return 5;
572 ✗ } else if (header == "mwind") {
573 ✗ return 6;
574 } else {
575 ✗ return -1;
576 }
577 }
578
579 4 std::shared_ptr<WeatherData> UserModel::loadWeather() {
580 4 openstudio::path weatherFilename;
581 //see if weather file path is absolute path
582 //if so, use it, else assemble relative path
583
2/3
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
4 if (openstudio::filesystem::exists(_weatherFilePath)) {
584 ✗ weatherFilename = _weatherFilePath;
585 } else {
586
1/1
✓ Branch 1 taken 4 times.
8 weatherFilename = _dataFile.parent_path() / _weatherFilePath;
587
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
4 if (!openstudio::filesystem::exists(weatherFilename)) {
588
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
1 LOG(Error, "Weather File Not Found: " << openstudio::toString(_weatherFilePath));
589 1 _valid = false;
590 1 return {};
591 }
592 }
593
1/1
✓ Branch 1 taken 3 times.
3 EpwData edata(weatherFilename);
594
595
1/1
✓ Branch 1 taken 3 times.
3 Matrix _msolar(12, 8, 0);
596
1/1
✓ Branch 1 taken 3 times.
3 Matrix _mhdbt(12, 24, 0);
597
1/1
✓ Branch 1 taken 3 times.
3 Matrix _mhEgh(12, 24, 0);
598
1/1
✓ Branch 1 taken 3 times.
3 Vector _mEgh(12);
599
1/1
✓ Branch 1 taken 3 times.
3 Vector _mdbt(12);
600
1/1
✓ Branch 1 taken 3 times.
3 Vector _mwind(12);
601
602
1/1
✓ Branch 1 taken 3 times.
3 edata.toISOData(_msolar, _mhdbt, _mhEgh, _mEgh, _mdbt, _mwind);
603
604
3/5
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
3 std::shared_ptr<WeatherData> wdata(new WeatherData);
605
2/2
✓ Branch 2 taken 3 times.
✓ Branch 5 taken 3 times.
3 wdata->setMdbt(_mdbt);
606
2/2
✓ Branch 2 taken 3 times.
✓ Branch 5 taken 3 times.
3 wdata->setMEgh(_mEgh);
607
1/1
✓ Branch 2 taken 3 times.
3 wdata->setMhdbt(_mhdbt);
608
1/1
✓ Branch 2 taken 3 times.
3 wdata->setMhEgh(_mhEgh);
609
1/1
✓ Branch 2 taken 3 times.
3 wdata->setMsolar(_msolar);
610
2/2
✓ Branch 2 taken 3 times.
✓ Branch 5 taken 3 times.
3 wdata->setMwind(_mwind);
611
612 3 return wdata;
613 4 }
614
615 3 void UserModel::load(const openstudio::path& t_buildingFile) {
616 3 _dataFile = t_buildingFile;
617 3 _valid = true;
618
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 2 times.
3 if (!openstudio::filesystem::exists(t_buildingFile)) {
619
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
1 LOG(Error, "ISO Model File Not Found: " << openstudio::toString(t_buildingFile));
620 1 _valid = false;
621 1 return;
622 }
623 2 loadBuilding(t_buildingFile);
624
1/1
✓ Branch 1 taken 2 times.
2 _weather = loadWeather();
625 }
626
627 ✗ void UserModel::save(const openstudio::path& t_buildingFile) const {
628
629 ✗ std::ofstream ofile(openstudio::toSystemFilename(t_buildingFile));
630
631 ✗ ofile << "terrainClass = " << _terrainClass << '\n';
632 ✗ ofile << "floorArea = " << _floorArea << '\n';
633 ✗ ofile << "buildingHeight = " << _buildingHeight << '\n';
634 ✗ ofile << "buildingOccupancyFrom = " << _buildingOccupancyFrom << '\n';
635 ✗ ofile << "buildingOccupancyTo = " << _buildingOccupancyTo << '\n';
636 ✗ ofile << "equivFullLoadOccupancyFrom = " << _equivFullLoadOccupancyFrom << '\n';
637 ✗ ofile << "equivFullLoadOccupancyTo = " << _equivFullLoadOccupancyTo << '\n';
638 ✗ ofile << "peopleDensityOccupied = " << _peopleDensityOccupied << '\n';
639 ✗ ofile << "peopleDensityUnoccupied = " << _peopleDensityUnoccupied << '\n';
640 ✗ ofile << "heatingOccupiedSetpoint = " << _heatingOccupiedSetpoint << '\n';
641 ✗ ofile << "heatingUnoccupiedSetpoint = " << _heatingUnoccupiedSetpoint << '\n';
642 ✗ ofile << "coolingOccupiedSetpoint = " << _coolingOccupiedSetpoint << '\n';
643 ✗ ofile << "coolingUnoccupiedSetpoint = " << _coolingUnoccupiedSetpoint << '\n';
644 ✗ ofile << "elecPowerAppliancesOccupied = " << _elecPowerAppliancesOccupied << '\n';
645 ✗ ofile << "elecPowerAppliancesUnoccupied = " << _elecPowerAppliancesUnoccupied << '\n';
646 ✗ ofile << "gasPowerAppliancesOccupied = " << _gasPowerAppliancesOccupied << '\n';
647 ✗ ofile << "gasPowerAppliancesUnoccupied = " << _gasPowerAppliancesUnoccupied << '\n';
648 ✗ ofile << "lightingPowerIntensityOccupied = " << _lightingPowerIntensityOccupied << '\n';
649 ✗ ofile << "lightingPowerIntensityUnoccupied = " << _lightingPowerIntensityUnoccupied << '\n';
650 ✗ ofile << "exteriorLightingPower = " << _exteriorLightingPower << '\n';
651 ✗ ofile << "daylightSensorSystem = " << _daylightSensorSystem << '\n';
652 ✗ ofile << "lightingOccupancySensorSystem = " << _lightingOccupancySensorSystem << '\n';
653 ✗ ofile << "constantIlluminationControl = " << _constantIlluminationControl << '\n';
654 ✗ ofile << "coolingSystemCOP = " << _coolingSystemCOP << '\n';
655 ✗ ofile << "coolingSystemIPLVToCOPRatio = " << _coolingSystemIPLVToCOPRatio << '\n';
656 ✗ ofile << "heatingEnergyCarrier = " << _heatingEnergyCarrier << '\n';
657 ✗ ofile << "heatingSystemEfficiency = " << _heatingSystemEfficiency << '\n';
658 ✗ ofile << "ventilationType = " << _ventilationType << '\n';
659 ✗ ofile << "freshAirFlowRate = " << _freshAirFlowRate << '\n';
660 ✗ ofile << "supplyExhaustRate = " << _supplyExhaustRate << '\n';
661 ✗ ofile << "heatRecovery = " << _heatRecovery << '\n';
662 ✗ ofile << "exhaustAirRecirculation = " << _exhaustAirRecirculation << '\n';
663 ✗ ofile << "buildingAirLeakage = " << _buildingAirLeakage << '\n';
664 ✗ ofile << "dhwDemand = " << _dhwDemand << '\n';
665 ✗ ofile << "dhwSystemEfficiency = " << _dhwEfficiency << '\n';
666 ✗ ofile << "dhwDistributionSystem = " << _dhwDistributionSystem << '\n';
667 ✗ ofile << "dhwEnergyCarrier = " << _dhwEnergyCarrier << '\n';
668 ✗ ofile << "bemType = " << _bemType << '\n';
669 ✗ ofile << "interiorHeatCapacity = " << _interiorHeatCapacity << '\n';
670 ✗ ofile << "specificFanPower = " << _specificFanPower << '\n';
671 ✗ ofile << "fanFlowControlFactor = " << _fanFlowControlFactor << '\n';
672 ✗ ofile << "roofSHGC = " << _roofSHGC << '\n';
673
674 ✗ ofile << "wallAreaS = " << _wallAreaS << '\n';
675 ✗ ofile << "wallAreaSE = " << _wallAreaSE << '\n';
676 ✗ ofile << "wallAreaE = " << _wallAreaE << '\n';
677 ✗ ofile << "wallAreaNE = " << _wallAreaNE << '\n';
678 ✗ ofile << "wallAreaN = " << _wallAreaN << '\n';
679 ✗ ofile << "wallAreaNW = " << _wallAreaNW << '\n';
680 ✗ ofile << "wallAreaW = " << _wallAreaW << '\n';
681 ✗ ofile << "wallAreaSW = " << _wallAreaSW << '\n';
682 ✗ ofile << "roofArea = " << _roofArea << '\n';
683
684 ✗ ofile << "wallUvalueS = " << _wallUvalueS << '\n';
685 ✗ ofile << "wallUvalueSE = " << _wallUvalueSE << '\n';
686 ✗ ofile << "wallUvalueE = " << _wallUvalueE << '\n';
687 ✗ ofile << "wallUvalueNE = " << _wallUvalueNE << '\n';
688 ✗ ofile << "wallUvalueN = " << _wallUvalueN << '\n';
689 ✗ ofile << "wallUvalueNW = " << _wallUvalueNW << '\n';
690 ✗ ofile << "wallUvalueW = " << _wallUvalueW << '\n';
691 ✗ ofile << "wallUvalueSW = " << _wallUvalueSW << '\n';
692 ✗ ofile << "roofUValue = " << _roofUValue << '\n';
693
694 ✗ ofile << "wallSolarAbsorptionS = " << _wallSolarAbsorptionS << '\n';
695 ✗ ofile << "wallSolarAbsorptionSE = " << _wallSolarAbsorptionSE << '\n';
696 ✗ ofile << "wallSolarAbsorptionE = " << _wallSolarAbsorptionE << '\n';
697 ✗ ofile << "wallSolarAbsorptionNE = " << _wallSolarAbsorptionNE << '\n';
698 ✗ ofile << "wallSolarAbsorptionN = " << _wallSolarAbsorptionN << '\n';
699 ✗ ofile << "wallSolarAbsorptionNW = " << _wallSolarAbsorptionNW << '\n';
700 ✗ ofile << "wallSolarAbsorptionW = " << _wallSolarAbsorptionW << '\n';
701 ✗ ofile << "wallSolarAbsorptionSW = " << _wallSolarAbsorptionSW << '\n';
702 ✗ ofile << "roofSolarAbsorption = " << _roofSolarAbsorption << '\n';
703
704 ✗ ofile << "wallThermalEmissivityS = " << _wallThermalEmissivityS << '\n';
705 ✗ ofile << "wallThermalEmissivitySE = " << _wallThermalEmissivitySE << '\n';
706 ✗ ofile << "wallThermalEmissivityE = " << _wallThermalEmissivityE << '\n';
707 ✗ ofile << "wallThermalEmissivityNE = " << _wallThermalEmissivityNE << '\n';
708 ✗ ofile << "wallThermalEmissivityN = " << _wallThermalEmissivityN << '\n';
709 ✗ ofile << "wallThermalEmissivityNW = " << _wallThermalEmissivityNW << '\n';
710 ✗ ofile << "wallThermalEmissivityW = " << _wallThermalEmissivityW << '\n';
711 ✗ ofile << "wallThermalEmissivitySW = " << _wallThermalEmissivitySW << '\n';
712 ✗ ofile << "roofThermalEmissivity = " << _roofThermalEmissivity << '\n';
713
714 ✗ ofile << "windowAreaS = " << _windowAreaS << '\n';
715 ✗ ofile << "windowAreaSE = " << _windowAreaSE << '\n';
716 ✗ ofile << "windowAreaE = " << _windowAreaE << '\n';
717 ✗ ofile << "windowAreaNE = " << _windowAreaNE << '\n';
718 ✗ ofile << "windowAreaN = " << _windowAreaN << '\n';
719 ✗ ofile << "windowAreaNW = " << _windowAreaNW << '\n';
720 ✗ ofile << "windowAreaW = " << _windowAreaW << '\n';
721 ✗ ofile << "windowAreaSW = " << _windowAreaSW << '\n';
722 ✗ ofile << "skylightArea = " << _skylightArea << '\n';
723
724 ✗ ofile << "windowUvalueS = " << _windowUvalueS << '\n';
725 ✗ ofile << "windowUvalueSE = " << _windowUvalueSE << '\n';
726 ✗ ofile << "windowUvalueE = " << _windowUvalueE << '\n';
727 ✗ ofile << "windowUvalueNE = " << _windowUvalueNE << '\n';
728 ✗ ofile << "windowUvalueN = " << _windowUvalueN << '\n';
729 ✗ ofile << "windowUvalueNW = " << _windowUvalueNW << '\n';
730 ✗ ofile << "windowUvalueW = " << _windowUvalueW << '\n';
731 ✗ ofile << "windowUvalueSW = " << _windowUvalueSW << '\n';
732 ✗ ofile << "skylightUvalue = " << _skylightUvalue << '\n';
733
734 ✗ ofile << "windowSHGCS = " << _windowSHGCS << '\n';
735 ✗ ofile << "windowSHGCSE = " << _windowSHGCSE << '\n';
736 ✗ ofile << "windowSHGCE = " << _windowSHGCE << '\n';
737 ✗ ofile << "windowSHGCNE = " << _windowSHGCNE << '\n';
738 ✗ ofile << "windowSHGCN = " << _windowSHGCN << '\n';
739 ✗ ofile << "windowSHGCNW = " << _windowSHGCNW << '\n';
740 ✗ ofile << "windowSHGCW = " << _windowSHGCW << '\n';
741 ✗ ofile << "windowSHGCSW = " << _windowSHGCSW << '\n';
742 ✗ ofile << "skylightSHGC = " << _skylightSHGC << '\n';
743
744 ✗ ofile << "windowSCFS = " << _windowSCFS << '\n';
745 ✗ ofile << "windowSCFSE = " << _windowSCFSE << '\n';
746 ✗ ofile << "windowSCFE = " << _windowSCFE << '\n';
747 ✗ ofile << "windowSCFNE = " << _windowSCFNE << '\n';
748 ✗ ofile << "windowSCFN = " << _windowSCFN << '\n';
749 ✗ ofile << "windowSCFNW = " << _windowSCFNW << '\n';
750 ✗ ofile << "windowSCFW = " << _windowSCFW << '\n';
751 ✗ ofile << "windowSCFSW = " << _windowSCFSW << '\n';
752
753 ✗ ofile << "windowSDFS = " << _windowSDFS << '\n';
754 ✗ ofile << "windowSDFSE = " << _windowSDFSE << '\n';
755 ✗ ofile << "windowSDFE = " << _windowSDFE << '\n';
756 ✗ ofile << "windowSDFNE = " << _windowSDFNE << '\n';
757 ✗ ofile << "windowSDFN = " << _windowSDFN << '\n';
758 ✗ ofile << "windowSDFNW = " << _windowSDFNW << '\n';
759 ✗ ofile << "windowSDFW = " << _windowSDFW << '\n';
760 ✗ ofile << "windowSDFSW = " << _windowSDFSW << '\n';
761
762 ✗ ofile << "exteriorHeatCapacity = " << _exteriorHeatCapacity << '\n';
763 ✗ ofile << "infiltration = " << _infiltration << '\n';
764 ✗ ofile << "hvacWasteFactor = " << _hvacWasteFactor << '\n';
765 ✗ ofile << "hvacHeatingLossFactor = " << _hvacHeatingLossFactor << '\n';
766 ✗ ofile << "hvacCoolingLossFactor = " << _hvacCoolingLossFactor << '\n';
767 ✗ ofile << "dhwDistributionEfficiency = " << _dhwDistributionEfficiency << '\n';
768 ✗ ofile << "heatingPumpControl = " << _heatingPumpControl << '\n';
769 ✗ ofile << "coolingPumpControl = " << _coolingPumpControl << '\n';
770 ✗ ofile << "heatGainPerPerson = " << _heatGainPerPerson << '\n';
771 ✗ }
772
773 } // namespace isomodel
774 } // namespace openstudio
775