GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 96.7% 29 / 0 / 30
Functions: 100.0% 1 / 0 / 1
Branches: 78.6% 55 / 0 / 70

src/energyplus/ForwardTranslator/ForwardTranslatePeopleDefinition.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/PeopleDefinition.hpp"
9 #include "../../model/PeopleDefinition_Impl.hpp"
10
11 #include <utilities/idd/People_Definition_FieldEnums.hxx>
12 #include "../../utilities/idd/IddEnums.hpp"
13 #include <utilities/idd/IddEnums.hxx>
14
15 using namespace openstudio::model;
16
17 namespace openstudio {
18
19 namespace energyplus {
20
21 61 boost::optional<IdfObject> ForwardTranslator::translatePeopleDefinition(PeopleDefinition& modelObject) {
22
23
2/2
✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
61 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::People_Definition, modelObject);
24
25
2/2
✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
61 idfObject.setString(People_DefinitionFields::NumberofPeopleCalculationMethod, modelObject.numberofPeopleCalculationMethod());
26
27
3/3
✓ Branch 1 taken 61 times.
✓ Branch 3 taken 22 times.
✓ Branch 4 taken 39 times.
122 if (boost::optional<double> d = modelObject.numberofPeople()) {
28
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(People_DefinitionFields::NumberofPeople, *d);
29 }
30
31
3/3
✓ Branch 1 taken 61 times.
✓ Branch 3 taken 33 times.
✓ Branch 4 taken 28 times.
122 if (boost::optional<double> d = modelObject.peopleperSpaceFloorArea()) {
32
2/2
✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
33 idfObject.setDouble(People_DefinitionFields::PeopleperFloorArea, *d);
33 }
34
35
3/3
✓ Branch 1 taken 61 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 55 times.
122 if (boost::optional<double> d = modelObject.spaceFloorAreaperPerson()) {
36
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 idfObject.setDouble(People_DefinitionFields::FloorAreaperPerson, *d);
37 }
38
39
2/2
✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
61 idfObject.setDouble(People_DefinitionFields::FractionRadiant, modelObject.fractionRadiant());
40
41
3/3
✓ Branch 1 taken 61 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 60 times.
122 if (boost::optional<double> d = modelObject.sensibleHeatFraction()) {
42
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(People_DefinitionFields::SensibleHeatFraction, *d);
43 }
44
45
3/3
✓ Branch 1 taken 61 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 55 times.
61 if (!modelObject.isCarbonDioxideGenerationRateDefaulted()) {
46
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 idfObject.setDouble(People_DefinitionFields::CarbonDioxideGenerationRate, modelObject.carbonDioxideGenerationRate());
47 }
48
49
3/3
✓ Branch 1 taken 61 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 55 times.
61 if (!modelObject.isEnableASHRAE55ComfortWarningsDefaulted()) {
50
3/3
✓ Branch 1 taken 6 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 5 times.
6 if (modelObject.enableASHRAE55ComfortWarnings()) {
51
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(People_DefinitionFields::EnableASHRAE55ComfortWarnings, "Yes");
52 } else {
53
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 idfObject.setString(People_DefinitionFields::EnableASHRAE55ComfortWarnings, "No");
54 }
55 }
56
57
3/3
✓ Branch 1 taken 61 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 51 times.
61 if (!modelObject.isMeanRadiantTemperatureCalculationTypeDefaulted()) {
58
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 idfObject.setString(People_DefinitionFields::MeanRadiantTemperatureCalculationType, modelObject.meanRadiantTemperatureCalculationType());
59 }
60
61 // As of 22.2.0, this is no longer possible to make this an extensible field
62 // because E+ added 3 regular fields at the end (eg: Ankle Level Velocity Schedule Name) on the (legacy) People object.
63 // People:Definition doesn't have that constraint, but we keep the same 7-model limit for consistency with the legacy translation.
64
3/3
✓ Branch 1 taken 70 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 61 times.
70 for (int i = 0, numComfortModelTypes = 0; i < modelObject.numThermalComfortModelTypes(); ++i) {
65
1/1
✓ Branch 1 taken 9 times.
9 boost::optional<std::string> s = modelObject.getThermalComfortModelType(i);
66
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 if (s) {
67 9 ++numComfortModelTypes;
68
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if (numComfortModelTypes > 7) {
69 ✗ LOG(Warn, "For " << modelObject.briefDescription() << ", only 7 Thermal Comfort Model Types are supported by EnergyPlus, number "
70 << numComfortModelTypes << " [=" << *s << "] will be ignored.");
71 } else {
72
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setString(People_DefinitionFields::ThermalComfortModel1Type + i, *s);
73 }
74 }
75 9 }
76
77
1/1
✓ Branch 1 taken 61 times.
122 return idfObject;
78 61 }
79
80 } // namespace energyplus
81
82 } // namespace openstudio
83