GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 84.0% 21 / 0 / 25
Functions: 100.0% 1 / 0 / 1
Branches: 78.2% 43 / 0 / 55

src/energyplus/ForwardTranslator/ForwardTranslateLightsDefinition.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/LightsDefinition.hpp"
9 #include "../../model/LightsDefinition_Impl.hpp"
10
11 #include <utilities/idd/Lights_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 94 boost::optional<IdfObject> ForwardTranslator::translateLightsDefinition(LightsDefinition& modelObject) {
22
23
2/2
✓ Branch 1 taken 94 times.
✓ Branch 4 taken 94 times.
94 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Lights_Definition, modelObject);
24
25
2/2
✓ Branch 1 taken 94 times.
✓ Branch 4 taken 94 times.
94 idfObject.setString(Lights_DefinitionFields::DesignLevelCalculationMethod, modelObject.designLevelCalculationMethod());
26
27
3/3
✓ Branch 1 taken 94 times.
✓ Branch 3 taken 54 times.
✓ Branch 4 taken 40 times.
188 if (boost::optional<double> d = modelObject.lightingLevel()) {
28
2/2
✓ Branch 1 taken 54 times.
✓ Branch 4 taken 54 times.
54 idfObject.setDouble(Lights_DefinitionFields::LightingLevel, *d);
29 }
30
31
3/3
✓ Branch 1 taken 94 times.
✓ Branch 3 taken 40 times.
✓ Branch 4 taken 54 times.
188 if (boost::optional<double> d = modelObject.wattsperSpaceFloorArea()) {
32
2/2
✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
40 idfObject.setDouble(Lights_DefinitionFields::WattsperFloorArea, *d);
33 }
34
35
2/3
✓ Branch 1 taken 94 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 94 times.
188 if (boost::optional<double> d = modelObject.wattsperPerson()) {
36 ✗ idfObject.setDouble(Lights_DefinitionFields::WattsperPerson, *d);
37 }
38
39
3/3
✓ Branch 1 taken 94 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 87 times.
94 if (!modelObject.isReturnAirFractionDefaulted()) {
40
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(Lights_DefinitionFields::ReturnAirFraction, modelObject.returnAirFraction());
41 }
42
43
3/3
✓ Branch 1 taken 94 times.
✓ Branch 3 taken 47 times.
✓ Branch 4 taken 47 times.
94 if (!modelObject.isFractionRadiantDefaulted()) {
44
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
47 idfObject.setDouble(Lights_DefinitionFields::FractionRadiant, modelObject.fractionRadiant());
45 }
46
47
3/3
✓ Branch 1 taken 94 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 87 times.
94 if (!modelObject.isFractionVisibleDefaulted()) {
48
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(Lights_DefinitionFields::FractionVisible, modelObject.fractionVisible());
49 }
50
51
3/3
✓ Branch 1 taken 94 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 89 times.
94 if (!modelObject.isReturnAirFractionCalculatedfromPlenumTemperatureDefaulted()) {
52
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
5 if (modelObject.returnAirFractionCalculatedfromPlenumTemperature()) {
53 ✗ idfObject.setString(Lights_DefinitionFields::ReturnAirFractionCalculatedfromPlenumTemperature, "Yes");
54 } else {
55
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 idfObject.setString(Lights_DefinitionFields::ReturnAirFractionCalculatedfromPlenumTemperature, "No");
56 }
57 }
58
59
2/3
✓ Branch 1 taken 94 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 94 times.
94 if (!modelObject.isReturnAirFractionFunctionofPlenumTemperatureCoefficient1Defaulted()) {
60 ✗ idfObject.setDouble(Lights_DefinitionFields::ReturnAirFractionFunctionofPlenumTemperatureCoefficient1,
61 modelObject.returnAirFractionFunctionofPlenumTemperatureCoefficient1());
62 }
63
64
2/3
✓ Branch 1 taken 94 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 94 times.
94 if (!modelObject.isReturnAirFractionFunctionofPlenumTemperatureCoefficient2Defaulted()) {
65 ✗ idfObject.setDouble(Lights_DefinitionFields::ReturnAirFractionFunctionofPlenumTemperatureCoefficient2,
66 modelObject.returnAirFractionFunctionofPlenumTemperatureCoefficient2());
67 }
68
69
1/1
✓ Branch 1 taken 94 times.
188 return idfObject;
70 94 }
71
72 } // namespace energyplus
73
74 } // namespace openstudio
75