GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 85.4% 35 / 0 / 41
Functions: 100.0% 1 / 0 / 1
Branches: 66.7% 48 / 0 / 72

src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingGas.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/CoilHeatingGas.hpp"
8 #include "../../model/Curve.hpp"
9 #include "../../model/Schedule.hpp"
10 #include <utilities/idd/Coil_Heating_Fuel_FieldEnums.hxx>
11 #include <utilities/idd/IddEnums.hxx>
12
13 using namespace openstudio::model;
14
15 using namespace std;
16
17 namespace openstudio {
18
19 namespace energyplus {
20
21 45 boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingGas(CoilHeatingGas& modelObject) {
22 45 OptionalString s;
23 45 OptionalModelObject temp;
24
25
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 IdfObject idfObject(IddObjectType::Coil_Heating_Fuel);
26
27 ///////////////////////////////////////////////////////////////////////////
28 // Field: Name ////////////////////////////////////////////////////////////
29
1/1
✓ Branch 1 taken 45 times.
45 s = modelObject.name();
30
1/2
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
45 if (s) {
31
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 idfObject.setName(*s);
32 }
33 ///////////////////////////////////////////////////////////////////////////
34
35 // hook up required objects
36 try {
37
1/1
✓ Branch 1 taken 45 times.
45 Schedule sched = modelObject.availableSchedule();
38
1/1
✓ Branch 1 taken 45 times.
45 translateAndMapModelObject(sched);
39
3/3
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
✓ Branch 7 taken 45 times.
45 idfObject.setString(Coil_Heating_FuelFields::AvailabilityScheduleName, sched.name().get());
40
0/2
✗ Branch 2 not taken.
✗ Branch 3 not taken.
45 } catch (std::exception& e) {
41 ✗ LOG(Error, "Could not translate " << modelObject.briefDescription() << ", because " << e.what() << ".");
42 ✗ return boost::none;
43 ✗ }
44
45 ///////////////////////////////////////////////////////////////////////////
46 // Field: Fuel Type
47 ///////////////////////////////////////////////////////////////////////////
48
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 idfObject.setString(openstudio::Coil_Heating_FuelFields::FuelType, modelObject.fuelType());
49
50 ///////////////////////////////////////////////////////////////////////////
51
52 ///////////////////////////////////////////////////////////////////////////
53 // Field: Gas Burner Efficiency ///////////////////////////////////////////
54
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 idfObject.setDouble(openstudio::Coil_Heating_FuelFields::BurnerEfficiency, modelObject.gasBurnerEfficiency());
55 ///////////////////////////////////////////////////////////////////////////
56
57 ///////////////////////////////////////////////////////////////////////////
58 // Field: Nominal Capacity ////////////////////////////////////////////////
59
1/1
✓ Branch 1 taken 45 times.
45 OptionalDouble d = modelObject.nominalCapacity();
60
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 44 times.
45 if (d) {
61
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(openstudio::Coil_Heating_FuelFields::NominalCapacity, *d);
62 } else {
63
2/2
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
88 idfObject.setString(openstudio::Coil_Heating_FuelFields::NominalCapacity, "AutoSize");
64 }
65 ///////////////////////////////////////////////////////////////////////////
66
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 idfObject.setDouble(openstudio::Coil_Heating_FuelFields::OnCycleParasiticElectricLoad, modelObject.onCycleParasiticElectricLoad());
67
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 idfObject.setDouble(openstudio::Coil_Heating_FuelFields::OffCycleParasiticFuelLoad, modelObject.offCycleParasiticGasLoad());
68
69 ///////////////////////////////////////////////////////////////////////////
70 // Field: Air Inlet Node Name /////////////////////////////////////////////
71
1/1
✓ Branch 1 taken 45 times.
45 temp = modelObject.inletModelObject();
72
2/2
✓ Branch 0 taken 37 times.
✓ Branch 1 taken 8 times.
45 if (temp) {
73
2/2
✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
37 s = temp->name();
74
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
37 if (s) {
75
2/2
✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
37 idfObject.setString(openstudio::Coil_Heating_FuelFields::AirInletNodeName, *s);
76 }
77 }
78 ///////////////////////////////////////////////////////////////////////////
79
80 ///////////////////////////////////////////////////////////////////////////
81 // Field: Air Outlet Node Name ////////////////////////////////////////////
82
1/1
✓ Branch 1 taken 45 times.
45 temp = modelObject.outletModelObject();
83
2/2
✓ Branch 0 taken 37 times.
✓ Branch 1 taken 8 times.
45 if (temp) {
84
2/2
✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
37 s = temp->name();
85
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
37 if (s) {
86
2/2
✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
37 idfObject.setString(openstudio::Coil_Heating_FuelFields::AirOutletNodeName, *s);
87
2/2
✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
37 idfObject.setString(openstudio::Coil_Heating_FuelFields::TemperatureSetpointNodeName, *s);
88 }
89 }
90 ///////////////////////////////////////////////////////////////////////////
91
92
1/1
✓ Branch 1 taken 45 times.
45 m_idfObjects.push_back(idfObject);
93
94 // Part Load Fraction Correlation Curve
95
2/3
✓ Branch 1 taken 45 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 45 times.
90 if (boost::optional<model::Curve> curve = modelObject.partLoadFractionCorrelationCurve()) {
96 ✗ if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve.get())) {
97 ✗ idfObject.setString(Coil_Heating_FuelFields::PartLoadFractionCorrelationCurveName, _curve->name().get());
98 ✗ }
99 45 }
100
101
1/1
✓ Branch 1 taken 45 times.
45 return boost::optional<IdfObject>(idfObject);
102 45 }
103
104 } // namespace energyplus
105
106 } // namespace openstudio
107