GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 78.9% 30 / 0 / 38
Functions: 100.0% 1 / 0 / 1
Branches: 61.6% 45 / 0 / 73

src/energyplus/ForwardTranslator/ForwardTranslateCoilCoolingDXCurveFitPerformance.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 #include "../../model/Model.hpp"
8
9 #include "../../model/CoilCoolingDXCurveFitPerformance.hpp"
10
11 #include "../../model/Curve.hpp"
12 #include "../../model/Schedule.hpp"
13 #include "../../model/Schedule_Impl.hpp"
14 #include "../../model/CoilCoolingDXCurveFitOperatingMode.hpp"
15 #include "../../model/CoilCoolingDXCurveFitOperatingMode_Impl.hpp"
16
17 #include <utilities/idd/Coil_Cooling_DX_CurveFit_Performance_FieldEnums.hxx>
18 // #include "../../utilities/idd/IddEnums.hpp"
19 #include <utilities/idd/IddEnums.hxx>
20
21 using namespace openstudio::model;
22
23 namespace openstudio {
24
25 namespace energyplus {
26
27 16 boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingDXCurveFitPerformance(model::CoilCoolingDXCurveFitPerformance& modelObject) {
28 16 boost::optional<std::string> s;
29 16 boost::optional<double> value;
30
31 // BaseOperatingMode is required, so start with that
32
1/1
✓ Branch 1 taken 16 times.
16 CoilCoolingDXCurveFitOperatingMode baseOpMode = modelObject.baseOperatingMode();
33
2/3
✓ Branch 1 taken 16 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
32 if (boost::optional<IdfObject> _baseOpMode = translateAndMapModelObject(baseOpMode)) {
34
4/4
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
16 s = _baseOpMode->name().get();
35 } else {
36 ✗ LOG(Warn, modelObject.briefDescription() << " cannot be translated as its Base Operating Mode object cannot be translated: "
37 << baseOpMode.briefDescription() << ".");
38 ✗ return boost::none;
39 16 }
40
41
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Coil_Cooling_DX_CurveFit_Performance, modelObject);
42
43 // BaseOperatingMode
44
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 idfObject.setString(Coil_Cooling_DX_CurveFit_PerformanceFields::BaseOperatingMode, s.get());
45
46 // CrankcaseHeaterCapacity
47
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 idfObject.setDouble(Coil_Cooling_DX_CurveFit_PerformanceFields::CrankcaseHeaterCapacity, modelObject.crankcaseHeaterCapacity());
48
49
3/3
✓ Branch 1 taken 16 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 15 times.
32 if (auto crankCurve_ = modelObject.crankcaseHeaterCapacityFunctionofTemperatureCurve()) {
50
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto curve_ = translateAndMapModelObject(*crankCurve_)) {
51
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(Coil_Cooling_DX_CurveFit_PerformanceFields::CrankcaseHeaterCapacityFunctionofTemperatureCurveName, curve_->nameString());
52 1 }
53 16 }
54
55 // MinimumOutdoorDryBulbTemperatureforCompressorOperation
56
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 idfObject.setDouble(Coil_Cooling_DX_CurveFit_PerformanceFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation,
57 modelObject.minimumOutdoorDryBulbTemperatureforCompressorOperation());
58
59 // MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation
60
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 idfObject.setDouble(Coil_Cooling_DX_CurveFit_PerformanceFields::MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation,
61 modelObject.maximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation());
62
63 // UnitInternalStaticAirPressure
64
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 idfObject.setDouble(Coil_Cooling_DX_CurveFit_PerformanceFields::UnitInternalStaticAirPressure, modelObject.unitInternalStaticAirPressure());
65
66 // CapacityControlMethod
67
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 idfObject.setString(Coil_Cooling_DX_CurveFit_PerformanceFields::CapacityControlMethod, modelObject.capacityControlMethod());
68
69 // EvaporativeCondenserBasinHeaterCapacity
70
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 idfObject.setDouble(Coil_Cooling_DX_CurveFit_PerformanceFields::EvaporativeCondenserBasinHeaterCapacity,
71 modelObject.evaporativeCondenserBasinHeaterCapacity());
72
73 // EvaporativeCondenserBasinHeaterSetpointTemperature
74
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 idfObject.setDouble(Coil_Cooling_DX_CurveFit_PerformanceFields::EvaporativeCondenserBasinHeaterSetpointTemperature,
75 modelObject.evaporativeCondenserBasinHeaterSetpointTemperature());
76
77 // EvaporativeCondenserBasinHeaterOperatingScheduleName
78 16 idfObject.setString(Coil_Cooling_DX_CurveFit_PerformanceFields::EvaporativeCondenserBasinHeaterOperatingScheduleName,
79
4/4
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
16 modelObject.evaporativeCondenserBasinHeaterOperatingSchedule().name().get());
80
81 // CompressorFuelType
82
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 idfObject.setString(Coil_Cooling_DX_CurveFit_PerformanceFields::CompressorFuelType, modelObject.compressorFuelType());
83
84 // AlternativeOperatingMode1
85
1/1
✓ Branch 1 taken 16 times.
16 boost::optional<CoilCoolingDXCurveFitOperatingMode> alternativeOperatingMode1 = modelObject.alternativeOperatingMode1();
86
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (alternativeOperatingMode1) {
87 ✗ if (boost::optional<IdfObject> _opMode = translateAndMapModelObject(alternativeOperatingMode1.get())) {
88 ✗ idfObject.setString(Coil_Cooling_DX_CurveFit_PerformanceFields::AlternativeOperatingMode1, _opMode->nameString());
89 ✗ }
90 }
91
92 // AlternativeOperatingMode2
93
1/1
✓ Branch 1 taken 16 times.
16 boost::optional<CoilCoolingDXCurveFitOperatingMode> alternativeOperatingMode2 = modelObject.alternativeOperatingMode2();
94
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (alternativeOperatingMode2) {
95 ✗ if (boost::optional<IdfObject> _opMode = translateAndMapModelObject(alternativeOperatingMode2.get())) {
96 ✗ idfObject.setString(Coil_Cooling_DX_CurveFit_PerformanceFields::AlternativeOperatingMode2, _opMode->nameString());
97 ✗ }
98 }
99
100
1/1
✓ Branch 1 taken 16 times.
16 return boost::optional<IdfObject>(idfObject);
101 16 } // End of translate function
102
103 } // end namespace energyplus
104 } // end namespace openstudio
105