GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 86.3% 177 / 0 / 205
Functions: 100.0% 3 / 0 / 3
Branches: 65.4% 405 / 0 / 619

src/energyplus/ForwardTranslator/ForwardTranslatePeople.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 "../ForwardTranslator.hpp"
7
8 #include "../../model/Model.hpp"
9 #include "../../model/People.hpp"
10 #include "../../model/People_Impl.hpp"
11 #include "../../model/PeopleDefinition.hpp"
12 #include "../../model/PeopleDefinition_Impl.hpp"
13 #include "../../model/ComfortViewFactorAngles.hpp"
14 #include "../../model/Space.hpp"
15 #include "../../model/Space_Impl.hpp"
16 #include "../../model/SpaceType.hpp"
17 #include "../../model/SpaceType_Impl.hpp"
18 #include "../../model/ThermalZone.hpp"
19 #include "../../model/ThermalZone_Impl.hpp"
20 #include "../../model/Schedule.hpp"
21 #include "../../model/Schedule_Impl.hpp"
22 #include "../../model/Surface.hpp"
23 #include "../../model/Surface_Impl.hpp"
24 #include "../../model/SubSurface.hpp"
25 #include "../../model/SubSurface_Impl.hpp"
26 #include "../../model/InternalMass.hpp"
27 #include "../../model/InternalMass_Impl.hpp"
28 #include "../../model/ComfortViewFactorAngles.hpp"
29 #include "../../model/ComfortViewFactorAngles_Impl.hpp"
30 #include "../../model/LifeCycleCost.hpp"
31
32 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
33
34 #include <utilities/idd/People_FieldEnums.hxx>
35 #include <utilities/idd/People_Definition_FieldEnums.hxx>
36 #include <utilities/idd/People_Instance_FieldEnums.hxx>
37 #include "../../utilities/idd/IddEnums.hpp"
38 #include <utilities/idd/IddEnums.hxx>
39
40 using namespace openstudio::model;
41
42 using namespace std;
43
44 namespace openstudio {
45
46 namespace energyplus {
47
48 119 boost::optional<IdfObject> ForwardTranslator::translatePeople(People& modelObject) {
49
2/2
✓ Branch 1 taken 17 times.
✓ Branch 2 taken 102 times.
119 if (m_forwardTranslatorOptions.excludeSpaceLoadInstances()) {
50 17 return translatePeopleLegacy(modelObject);
51 }
52 102 return translatePeopleInstance(modelObject);
53 }
54
55 17 boost::optional<IdfObject> ForwardTranslator::translatePeopleLegacy(People& modelObject) {
56
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 IdfObject idfObject(openstudio::IddObjectType::People);
57
1/1
✓ Branch 1 taken 17 times.
17 m_idfObjects.push_back(idfObject);
58
59
2/4
✓ Branch 1 taken 17 times.
✗ Branch 7 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 17 times.
17 for (LifeCycleCost lifeCycleCost : modelObject.lifeCycleCosts()) {
60 ✗ translateAndMapModelObject(lifeCycleCost);
61 17 }
62
63
1/1
✓ Branch 1 taken 17 times.
17 PeopleDefinition definition = modelObject.peopleDefinition();
64
65
3/3
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
17 idfObject.setString(PeopleFields::Name, modelObject.name().get());
66
67
1/1
✓ Branch 1 taken 17 times.
17 IdfObject parentIdfObject = getSpaceLoadParent(modelObject);
68
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 idfObject.setString(PeopleFields::ZoneorZoneListorSpaceorSpaceListName, parentIdfObject.nameString());
69
70
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 14 times.
34 if (boost::optional<Schedule> schedule = modelObject.numberofPeopleSchedule()) {
71
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 auto idf_schedule_ = translateAndMapModelObject(*schedule);
72
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
3 OS_ASSERT(idf_schedule_);
73
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 idfObject.setString(PeopleFields::NumberofPeopleScheduleName, idf_schedule_->nameString());
74 20 }
75
76
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 idfObject.setString(PeopleFields::NumberofPeopleCalculationMethod, definition.numberofPeopleCalculationMethod());
77
78
1/1
✓ Branch 1 taken 17 times.
17 double multiplier = modelObject.multiplier();
79
80
1/1
✓ Branch 1 taken 17 times.
17 OptionalDouble d = definition.numberofPeople();
81
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 4 times.
17 if (d) {
82
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
13 idfObject.setDouble(PeopleFields::NumberofPeople, (*d) * multiplier);
83 }
84
85
1/1
✓ Branch 1 taken 17 times.
17 d = definition.peopleperSpaceFloorArea();
86
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 14 times.
17 if (d) {
87
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 idfObject.setDouble(PeopleFields::PeopleperFloorArea, (*d) * multiplier);
88 }
89
90
1/1
✓ Branch 1 taken 17 times.
17 d = definition.spaceFloorAreaperPerson();
91
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 16 times.
17 if (d) {
92
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(PeopleFields::FloorAreaperPerson, (*d) * multiplier);
93 }
94
95
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 d = definition.fractionRadiant();
96
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
17 if (d) {
97
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 idfObject.setDouble(PeopleFields::FractionRadiant, *d);
98 }
99
100
1/1
✓ Branch 1 taken 17 times.
17 d = definition.sensibleHeatFraction();
101
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 16 times.
17 if (d) {
102
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(PeopleFields::SensibleHeatFraction, *d);
103 }
104
105
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 14 times.
34 if (boost::optional<Schedule> schedule_ = modelObject.activityLevelSchedule()) {
106
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
6 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
107
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 idfObject.setString(PeopleFields::ActivityLevelScheduleName, idf_schedule_->nameString());
108 3 }
109 17 }
110
111
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 16 times.
17 if (!definition.isCarbonDioxideGenerationRateDefaulted()) {
112
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(PeopleFields::CarbonDioxideGenerationRate, definition.carbonDioxideGenerationRate());
113 }
114
115
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 16 times.
17 if (!definition.isEnableASHRAE55ComfortWarningsDefaulted()) {
116
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 if (definition.enableASHRAE55ComfortWarnings()) {
117
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(PeopleFields::EnableASHRAE55ComfortWarnings, "Yes");
118 } else {
119 ✗ idfObject.setString(PeopleFields::EnableASHRAE55ComfortWarnings, "No");
120 }
121 }
122
123
1/1
✓ Branch 1 taken 17 times.
17 std::string mrtType = definition.meanRadiantTemperatureCalculationType();
124
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 9 times.
34 if (auto target = modelObject.surfaceNameAngleFactorListName()) {
125
19/26
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 3 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 4 times.
✓ Branch 17 taken 1 time.
✓ Branch 19 taken 4 times.
✓ Branch 22 taken 4 times.
✓ Branch 25 taken 1 time.
✓ Branch 26 taken 3 times.
✓ Branch 27 taken 4 times.
✓ Branch 28 taken 4 times.
✓ Branch 30 taken 5 times.
✓ Branch 31 taken 3 times.
✓ Branch 33 taken 8 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 5 times.
✓ Branch 37 taken 3 times.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
25 if (target->optionalCast<Surface>() || target->optionalCast<SubSurface>() || target->optionalCast<InternalMass>()) {
126
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 4 times.
10 if (!istringEqual(mrtType, "SurfaceWeighted")) {
127
13/13
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 33 taken 1 time.
✓ Branch 36 taken 1 time.
✓ Branch 39 taken 1 time.
1 LOG(Warn, modelObject.briefDescription() << " references " << target->briefDescription()
128 << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType
129 << "'. Using 'SurfaceWeighted'.");
130 }
131
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (auto idfTarget = translateAndMapModelObject(*target)) {
132
1/1
✓ Branch 1 taken 5 times.
5 mrtType = "SurfaceWeighted";
133
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 idfObject.setString(PeopleFields::SurfaceName_AngleFactorListName, idfTarget->nameString());
134 } else {
135 ✗ LOG(Warn, "Could not translate " << target->briefDescription() << " referenced by " << modelObject.briefDescription()
136 << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type.");
137 ✗ mrtType = "EnclosureAveraged";
138 5 }
139
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
6 } else if (target->optionalCast<ComfortViewFactorAngles>()) {
140
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 3 times.
6 if (!istringEqual(mrtType, "AngleFactor")) {
141 ✗ LOG(Warn, modelObject.briefDescription() << " references " << target->briefDescription()
142 << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType
143 << "'. Using 'AngleFactor'.");
144 }
145
4/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 1 time.
6 if (auto idfTarget = translateAndMapModelObject(*target)) {
146
1/1
✓ Branch 1 taken 2 times.
2 mrtType = "AngleFactor";
147
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 idfObject.setString(PeopleFields::SurfaceName_AngleFactorListName, idfTarget->nameString());
148 } else {
149
12/12
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 30 taken 1 time.
✓ Branch 33 taken 1 time.
✓ Branch 36 taken 1 time.
1 LOG(Warn, "Could not translate " << target->briefDescription() << " referenced by " << modelObject.briefDescription()
150 << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type.");
151
1/1
✓ Branch 1 taken 1 time.
1 mrtType = "EnclosureAveraged";
152 3 }
153 } else {
154 ✗ LOG(Warn, modelObject.briefDescription() << " references unsupported Surface Name/Angle Factor List Name object "
155 << target->briefDescription() << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type.");
156 ✗ mrtType = "EnclosureAveraged";
157 }
158
4/4
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 7 times.
18 } else if (!istringEqual(mrtType, "EnclosureAveraged")) {
159
9/9
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 20 taken 2 times.
✓ Branch 23 taken 2 times.
✓ Branch 26 taken 2 times.
2 LOG(Warn, modelObject.briefDescription() << " has Mean Radiant Temperature Calculation Type '" << mrtType
160 << "' but no Surface Name/Angle Factor List Name; using 'EnclosureAveraged'.");
161
1/1
✓ Branch 1 taken 2 times.
2 mrtType = "EnclosureAveraged";
162 17 }
163
164
12/17
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 10 times.
✓ Branch 6 taken 7 times.
✓ Branch 9 taken 7 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 7 times.
✓ Branch 13 taken 7 times.
✓ Branch 14 taken 10 times.
✓ Branch 16 taken 7 times.
✓ Branch 17 taken 10 times.
✓ Branch 18 taken 10 times.
✓ Branch 19 taken 7 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
31 if (!definition.isMeanRadiantTemperatureCalculationTypeDefaulted() || !istringEqual(mrtType, "EnclosureAveraged")) {
165
1/1
✓ Branch 1 taken 10 times.
10 idfObject.setString(PeopleFields::MeanRadiantTemperatureCalculationType, mrtType);
166 }
167
168
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 16 times.
34 if (boost::optional<Schedule> schedule_ = modelObject.workEfficiencySchedule()) {
169
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
170
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(PeopleFields::WorkEfficiencyScheduleName, idf_schedule_->nameString());
171 1 }
172 17 }
173
174 // Clothing Insulation
175 // ---
176 // ClothingInsulationSchedule: Only Clothing Insulation Schedule Name should be filled.
177 // DynamicClothingModelASHRAE55: Neither should be filled.
178 // CalculationMethodSchedule: Both Clothing Insulation Calculation Method Schedule Name and Clothing Insulation Schedule Name should be filled.
179
180 // Clothing Insulation Calculation Method
181
1/1
✓ Branch 1 taken 17 times.
17 const std::string clothingInsulationCalculationMethod = modelObject.clothingInsulationCalculationMethod();
182
1/1
✓ Branch 1 taken 17 times.
17 idfObject.setString(PeopleFields::ClothingInsulationCalculationMethod, clothingInsulationCalculationMethod);
183
184 // Clothing Insulation Calculation Method Schedule Name
185
3/4
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 17 times.
34 if (istringEqual(clothingInsulationCalculationMethod, "CalculationMethodSchedule")) {
186 ✗ if (boost::optional<Schedule> schedule_ = modelObject.clothingInsulationCalculationMethodSchedule()) {
187 ✗ if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
188 ✗ idfObject.setString(PeopleFields::ClothingInsulationCalculationMethodScheduleName, idf_schedule_->nameString());
189 ✗ }
190 ✗ }
191 }
192
193 // Clothing Insulation Schedule Name
194
3/9
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 17 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
51 if (istringEqual(clothingInsulationCalculationMethod, "ClothingInsulationSchedule")
195
5/17
✓ Branch 1 taken 17 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17 times.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 17 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 17 times.
✓ Branch 18 taken 17 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
34 || istringEqual(clothingInsulationCalculationMethod, "CalculationMethodSchedule")) {
196
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 16 times.
34 if (boost::optional<Schedule> schedule_ = modelObject.clothingInsulationSchedule()) {
197
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
198
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(PeopleFields::ClothingInsulationScheduleName, idf_schedule_->nameString());
199 1 }
200 17 }
201 }
202
203
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 16 times.
34 if (boost::optional<Schedule> schedule_ = modelObject.airVelocitySchedule()) {
204
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
205
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(PeopleFields::AirVelocityScheduleName, idf_schedule_->nameString());
206 1 }
207 17 }
208
209 // As of 22.2.0, this is no longer possible to make this an extensible field
210 // because E+ added 3 regular fields at the end (eg: Ankle Level Velocity Schedule Name)
211
3/3
✓ Branch 1 taken 19 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 17 times.
19 for (int i = 0, numComfortModelTypes = 0; i < definition.numThermalComfortModelTypes(); ++i) {
212
1/1
✓ Branch 1 taken 2 times.
2 OptionalString s = definition.getThermalComfortModelType(i);
213
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (s) {
214 2 ++numComfortModelTypes;
215
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (numComfortModelTypes > 7) {
216 ✗ LOG(Warn, "For " << definition.briefDescription() << ", only 7 Thermal Comfort Model Types are supported by EnergyPlus, number "
217 << numComfortModelTypes << " [=" << *s << "] will be ignored.");
218 } else {
219
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idfObject.setString(PeopleFields::ThermalComfortModel1Type + i, *s);
220 }
221 }
222 2 }
223
224
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 16 times.
34 if (boost::optional<Schedule> schedule_ = modelObject.ankleLevelAirVelocitySchedule()) {
225
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
226
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(PeopleFields::AnkleLevelAirVelocityScheduleName, idf_schedule_->nameString());
227 1 }
228 17 }
229
230
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 16 times.
17 if (!modelObject.isColdStressTemperatureThresholdDefaulted()) {
231
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(PeopleFields::ColdStressTemperatureThreshold, modelObject.coldStressTemperatureThreshold());
232 }
233
234
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 16 times.
17 if (!modelObject.isHeatStressTemperatureThresholdDefaulted()) {
235
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(PeopleFields::HeatStressTemperatureThreshold, modelObject.heatStressTemperatureThreshold());
236 }
237
238
1/1
✓ Branch 1 taken 17 times.
34 return idfObject;
239 17 }
240
241 102 boost::optional<IdfObject> ForwardTranslator::translatePeopleInstance(People& modelObject) {
242
243
2/2
✓ Branch 1 taken 102 times.
✓ Branch 4 taken 102 times.
102 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::People_Instance, modelObject);
244
245
2/4
✓ Branch 1 taken 102 times.
✗ Branch 7 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 102 times.
102 for (LifeCycleCost lifeCycleCost : modelObject.lifeCycleCosts()) {
246 ✗ translateAndMapModelObject(lifeCycleCost);
247 102 }
248
249
1/1
✓ Branch 1 taken 102 times.
102 PeopleDefinition definition = modelObject.peopleDefinition();
250
1/1
✓ Branch 1 taken 102 times.
102 std::string mrtType = definition.meanRadiantTemperatureCalculationType();
251
3/3
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 97 times.
204 if (boost::optional<ModelObject> target = modelObject.surfaceNameAngleFactorListName()) {
252
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 3 times.
10 if (target->optionalCast<Surface>()) {
253
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 1 time.
4 if (!istringEqual(mrtType, "SurfaceWeighted")) {
254
13/13
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 33 taken 1 time.
✓ Branch 36 taken 1 time.
✓ Branch 39 taken 1 time.
1 LOG(Warn, modelObject.briefDescription() << " references " << target->briefDescription()
255 << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType
256 << "'. Using 'SurfaceWeighted'.");
257 }
258
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 if (auto idfTarget = translateAndMapModelObject(*target)) {
259
1/1
✓ Branch 1 taken 2 times.
2 mrtType = "SurfaceWeighted";
260
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 idfObject.setString(People_InstanceFields::SurfaceName_AngleFactorListName, idfTarget->nameString());
261 } else {
262 ✗ LOG(Warn, "Could not translate " << target->briefDescription() << " referenced by " << modelObject.briefDescription()
263 << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type.");
264 ✗ mrtType = "EnclosureAveraged";
265 2 }
266
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
6 } else if (target->optionalCast<ComfortViewFactorAngles>()) {
267
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 3 times.
6 if (!istringEqual(mrtType, "AngleFactor")) {
268 ✗ LOG(Warn, modelObject.briefDescription() << " references " << target->briefDescription()
269 << ", but its PeopleDefinition has Mean Radiant Temperature Calculation Type '" << mrtType
270 << "'. Using 'AngleFactor'.");
271 }
272
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
6 if (auto idfTarget = translateAndMapModelObject(*target)) {
273 ✗ mrtType = "AngleFactor";
274 ✗ idfObject.setString(People_InstanceFields::SurfaceName_AngleFactorListName, idfTarget->nameString());
275 } else {
276
12/12
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
✓ Branch 19 taken 3 times.
✓ Branch 22 taken 3 times.
✓ Branch 25 taken 3 times.
✓ Branch 30 taken 3 times.
✓ Branch 33 taken 3 times.
✓ Branch 36 taken 3 times.
3 LOG(Warn, "Could not translate " << target->briefDescription() << " referenced by " << modelObject.briefDescription()
277 << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type.");
278
1/1
✓ Branch 1 taken 3 times.
3 mrtType = "EnclosureAveraged";
279 3 }
280 } else {
281 ✗ LOG(Warn, modelObject.briefDescription() << " references unsupported Surface Name/Angle Factor List Name object "
282 << target->briefDescription() << "; using 'EnclosureAveraged' for Mean Radiant Temperature Calculation Type.");
283 ✗ mrtType = "EnclosureAveraged";
284 }
285
3/4
✓ Branch 1 taken 97 times.
✓ Branch 4 taken 97 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 97 times.
194 } else if (!istringEqual(mrtType, "EnclosureAveraged")) {
286 ✗ LOG(Warn, modelObject.briefDescription() << " has Mean Radiant Temperature Calculation Type '" << mrtType
287 << "' but no Surface Name/Angle Factor List Name; using 'EnclosureAveraged'.");
288 ✗ mrtType = "EnclosureAveraged";
289 102 }
290
291
1/1
✓ Branch 1 taken 102 times.
102 auto definitionIdfObject_ = translateAndMapModelObject(definition);
292
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
✗ Branch 4 not taken.
102 OS_ASSERT(definitionIdfObject_);
293
12/17
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 92 times.
✓ Branch 4 taken 10 times.
✓ Branch 6 taken 92 times.
✓ Branch 9 taken 92 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 92 times.
✓ Branch 13 taken 92 times.
✓ Branch 14 taken 10 times.
✓ Branch 16 taken 92 times.
✓ Branch 17 taken 10 times.
✓ Branch 18 taken 10 times.
✓ Branch 19 taken 92 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
286 if (!definition.isMeanRadiantTemperatureCalculationTypeDefaulted() || !istringEqual(mrtType, "EnclosureAveraged")) {
294 // The instance target determines the effective MRT type, so override the definition's original value in the translated IDF.
295
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 definitionIdfObject_->setString(People_DefinitionFields::MeanRadiantTemperatureCalculationType, mrtType);
296 }
297
3/3
✓ Branch 1 taken 102 times.
✓ Branch 4 taken 102 times.
✓ Branch 7 taken 102 times.
102 idfObject.setString(People_InstanceFields::PeopleDefinitionName, definitionIdfObject_->nameString());
298
299
1/1
✓ Branch 1 taken 102 times.
102 IdfObject parentIdfObject = getSpaceLoadParent(modelObject);
300
2/2
✓ Branch 1 taken 102 times.
✓ Branch 4 taken 102 times.
102 idfObject.setString(People_InstanceFields::ZoneorZoneListorSpaceorSpaceListName, parentIdfObject.nameString());
301
302
3/3
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 89 times.
✓ Branch 4 taken 13 times.
204 if (boost::optional<Schedule> schedule = modelObject.numberofPeopleSchedule()) {
303
2/2
✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
89 auto idf_schedule_ = translateAndMapModelObject(*schedule);
304
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 89 times.
✗ Branch 4 not taken.
89 OS_ASSERT(idf_schedule_);
305
3/3
✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
✓ Branch 7 taken 89 times.
89 idfObject.setString(People_InstanceFields::NumberofPeopleScheduleName, idf_schedule_->nameString());
306 191 }
307
308
3/3
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 89 times.
✓ Branch 4 taken 13 times.
204 if (boost::optional<Schedule> schedule_ = modelObject.activityLevelSchedule()) {
309
3/4
✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
✓ Branch 6 taken 89 times.
✗ Branch 7 not taken.
178 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
310
3/3
✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
✓ Branch 7 taken 89 times.
89 idfObject.setString(People_InstanceFields::ActivityLevelScheduleName, idf_schedule_->nameString());
311 89 }
312 102 }
313
314
3/3
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 96 times.
204 if (boost::optional<Schedule> schedule_ = modelObject.workEfficiencySchedule()) {
315
3/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
12 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
316
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
6 idfObject.setString(People_InstanceFields::WorkEfficiencyScheduleName, idf_schedule_->nameString());
317 6 }
318 102 }
319
320 // Clothing Insulation
321 // ---
322 // ClothingInsulationSchedule: Only Clothing Insulation Schedule Name should be filled.
323 // DynamicClothingModelASHRAE55: Neither should be filled.
324 // CalculationMethodSchedule: Both Clothing Insulation Calculation Method Schedule Name and Clothing Insulation Schedule Name should be filled.
325
326 // Clothing Insulation Calculation Method
327
1/1
✓ Branch 1 taken 102 times.
102 const std::string clothingInsulationCalculationMethod = modelObject.clothingInsulationCalculationMethod();
328
1/1
✓ Branch 1 taken 102 times.
102 idfObject.setString(People_InstanceFields::ClothingInsulationCalculationMethod, clothingInsulationCalculationMethod);
329
330 // Clothing Insulation Calculation Method Schedule Name
331
3/4
✓ Branch 1 taken 102 times.
✓ Branch 4 taken 102 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 102 times.
204 if (istringEqual(clothingInsulationCalculationMethod, "CalculationMethodSchedule")) {
332 ✗ if (boost::optional<Schedule> schedule_ = modelObject.clothingInsulationCalculationMethodSchedule()) {
333 ✗ if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
334 ✗ idfObject.setString(People_InstanceFields::ClothingInsulationCalculationMethodScheduleName, idf_schedule_->nameString());
335 ✗ }
336 ✗ }
337 }
338
339 // Clothing Insulation Schedule Name
340
3/9
✓ Branch 1 taken 102 times.
✓ Branch 4 taken 102 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 102 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
306 if (istringEqual(clothingInsulationCalculationMethod, "ClothingInsulationSchedule")
341
5/17
✓ Branch 1 taken 102 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 102 times.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 102 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 102 times.
✓ Branch 18 taken 102 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
204 || istringEqual(clothingInsulationCalculationMethod, "CalculationMethodSchedule")) {
342
3/3
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 96 times.
204 if (boost::optional<Schedule> schedule_ = modelObject.clothingInsulationSchedule()) {
343
3/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
12 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
344
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
6 idfObject.setString(People_InstanceFields::ClothingInsulationScheduleName, idf_schedule_->nameString());
345 6 }
346 102 }
347 }
348
349
3/3
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 96 times.
204 if (boost::optional<Schedule> schedule_ = modelObject.airVelocitySchedule()) {
350
3/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
12 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
351
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
6 idfObject.setString(People_InstanceFields::AirVelocityScheduleName, idf_schedule_->nameString());
352 6 }
353 102 }
354
355
2/2
✓ Branch 1 taken 102 times.
✓ Branch 4 taken 102 times.
102 idfObject.setDouble(People_InstanceFields::Multiplier, modelObject.multiplier());
356
357
3/3
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 101 times.
204 if (boost::optional<Schedule> schedule_ = modelObject.ankleLevelAirVelocitySchedule()) {
358
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto idf_schedule_ = translateAndMapModelObject(schedule_.get())) {
359
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(People_InstanceFields::AnkleLevelAirVelocityScheduleName, idf_schedule_->nameString());
360 1 }
361 102 }
362
363
3/3
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 101 times.
102 if (!modelObject.isColdStressTemperatureThresholdDefaulted()) {
364
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(People_InstanceFields::ColdStressTemperatureThreshold, modelObject.coldStressTemperatureThreshold());
365 }
366
367
3/3
✓ Branch 1 taken 102 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 101 times.
102 if (!modelObject.isHeatStressTemperatureThresholdDefaulted()) {
368
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(People_InstanceFields::HeatStressTemperatureThreshold, modelObject.heatStressTemperatureThreshold());
369 }
370
371
1/1
✓ Branch 1 taken 102 times.
204 return idfObject;
372 102 }
373
374 } // namespace energyplus
375
376 } // namespace openstudio
377