GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 96.8% 30 / 0 / 31
Functions: 100.0% 1 / 0 / 1
Branches: 78.3% 36 / 0 / 46

src/energyplus/ForwardTranslator/ForwardTranslateGeneratorFuelCellWaterSupply.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/GeneratorFuelCellWaterSupply.hpp"
10 #include "../../model/GeneratorFuelCellWaterSupply_Impl.hpp"
11
12 #include "../../model/CurveCubic.hpp"
13 #include "../../model/CurveCubic_Impl.hpp"
14 #include "../../model/CurveQuadratic.hpp"
15 #include "../../model/CurveQuadratic_Impl.hpp"
16 #include "../../model/Node.hpp"
17 #include "../../model/Node_Impl.hpp"
18 #include "../../model/Schedule.hpp"
19 #include "../../model/Schedule_Impl.hpp"
20 #include "../../model/ScheduleConstant.hpp"
21 #include "../../model/ScheduleConstant_Impl.hpp"
22 #include "../../model/ScheduleTypeLimits.hpp"
23 #include "../../model/ScheduleTypeRegistry.hpp"
24
25 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
26
27 #include <utilities/idd/Generator_FuelCell_WaterSupply_FieldEnums.hxx>
28 #include "../../utilities/idd/IddEnums.hpp"
29 #include <utilities/idd/IddEnums.hxx>
30 #include <utilities/idd/IddFactory.hxx>
31
32 using namespace openstudio::model;
33
34 using namespace std;
35
36 namespace openstudio {
37
38 namespace energyplus {
39
40 3 boost::optional<IdfObject> ForwardTranslator::translateGeneratorFuelCellWaterSupply(GeneratorFuelCellWaterSupply& modelObject) {
41 3 boost::optional<std::string> s;
42 3 boost::optional<double> d;
43 3 boost::optional<Node> node;
44 3 boost::optional<CurveQuadratic> curvequad;
45 3 boost::optional<CurveCubic> curvecubic;
46 3 boost::optional<Schedule> sch;
47
48
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 IdfObject pcm = createAndRegisterIdfObject(openstudio::IddObjectType::Generator_FuelCell_WaterSupply, modelObject);
49 //Name
50
1/1
✓ Branch 1 taken 3 times.
3 s = modelObject.name();
51
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (s) {
52
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 pcm.setName(*s);
53 }
54
55 //ReformerWaterFlowRateFunctionofFuelRateCurveName
56
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 curvequad = modelObject.reformerWaterFlowRateFunctionofFuelRateCurve();
57
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (curvequad) {
58
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 pcm.setString(Generator_FuelCell_WaterSupplyFields::ReformerWaterFlowRateFunctionofFuelRateCurveName, curvequad.get().nameString());
59 }
60
61 //ReformerWaterPumpPowerFunctionofFuelRateCurveName
62
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 curvecubic = modelObject.reformerWaterPumpPowerFunctionofFuelRateCurve();
63
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (curvecubic) {
64
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 pcm.setString(Generator_FuelCell_WaterSupplyFields::ReformerWaterPumpPowerFunctionofFuelRateCurveName, curvecubic.get().nameString());
65 }
66
67 //PumpHeatLossFactor
68
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 d = modelObject.pumpHeatLossFactor();
69
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (d) {
70
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 pcm.setDouble(Generator_FuelCell_WaterSupplyFields::PumpHeatLossFactor, d.get());
71 }
72
73 //WaterTemperatureModelingMode
74
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 s = modelObject.waterTemperatureModelingMode();
75
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (s) {
76
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 pcm.setString(Generator_FuelCell_WaterSupplyFields::WaterTemperatureModelingMode, s.get());
77 }
78
79 //WaterTemperatureReferenceNodeName
80
1/1
✓ Branch 1 taken 3 times.
3 node = modelObject.waterTemperatureReferenceNode();
81
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (node) {
82 ✗ pcm.setString(Generator_FuelCell_WaterSupplyFields::WaterTemperatureReferenceNodeName, node.get().nameString());
83 }
84
85 //WaterTemperatureScheduleName
86
1/1
✓ Branch 1 taken 3 times.
3 sch = modelObject.waterTemperatureSchedule();
87
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (sch) {
88
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 pcm.setString(Generator_FuelCell_WaterSupplyFields::WaterTemperatureScheduleName, sch.get().nameString());
89 }
90
91
1/1
✓ Branch 1 taken 3 times.
6 return pcm;
92 3 }
93
94 } // namespace energyplus
95
96 } // namespace openstudio
97