GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 19 / 0 / 19
Functions: 100.0% 1 / 0 / 1
Branches: 84.6% 22 / 0 / 26

src/energyplus/ForwardTranslator/ForwardTranslateGeneratorFuelCellInverter.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/GeneratorFuelCellInverter.hpp"
10 #include "../../model/GeneratorFuelCellInverter_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
17 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
18
19 #include <utilities/idd/Generator_FuelCell_Inverter_FieldEnums.hxx>
20 #include "../../utilities/idd/IddEnums.hpp"
21 #include <utilities/idd/IddEnums.hxx>
22 #include <utilities/idd/IddFactory.hxx>
23
24 using namespace openstudio::model;
25
26 using namespace std;
27
28 namespace openstudio {
29
30 namespace energyplus {
31
32 3 boost::optional<IdfObject> ForwardTranslator::translateGeneratorFuelCellInverter(GeneratorFuelCellInverter& modelObject) {
33 3 boost::optional<std::string> s;
34 3 boost::optional<double> d;
35 3 boost::optional<CurveQuadratic> curvequad;
36
37
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 IdfObject pcm = createAndRegisterIdfObject(openstudio::IddObjectType::Generator_FuelCell_Inverter, modelObject);
38 //Name
39
1/1
✓ Branch 1 taken 3 times.
3 s = modelObject.name();
40
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (s) {
41
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 pcm.setName(*s);
42 }
43
44 //InverterEfficiencyCalculationMode
45
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 s = modelObject.inverterEfficiencyCalculationMode();
46
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (s) {
47
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 pcm.setString(Generator_FuelCell_InverterFields::InverterEfficiencyCalculationMode, s.get());
48 }
49
50 //InverterEfficiency
51
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 d = modelObject.inverterEfficiency();
52
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (d) {
53
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 pcm.setDouble(Generator_FuelCell_InverterFields::InverterEfficiency, d.get());
54 }
55
56 //EfficiencyFunctionofDCPowerCurveName
57
1/1
✓ Branch 1 taken 3 times.
3 curvequad = modelObject.efficiencyFunctionofDCPowerCurve();
58
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (curvequad) {
59
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 pcm.setString(Generator_FuelCell_InverterFields::EfficiencyFunctionofDCPowerCurveName, curvequad.get().nameString());
60 }
61
62
1/1
✓ Branch 1 taken 3 times.
6 return pcm;
63 3 }
64
65 } // namespace energyplus
66
67 } // namespace openstudio
68