GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 88.2% 30 / 0 / 34
Functions: 100.0% 1 / 0 / 1
Branches: 75.4% 46 / 0 / 61

src/energyplus/ForwardTranslator/ForwardTranslateSolarCollectorIntegralCollectorStorage.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 #include "../../model/PlanarSurface.hpp"
9 #include "../../model/PlanarSurface_Impl.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Node_Impl.hpp"
12 #include "../../model/SolarCollectorIntegralCollectorStorage.hpp"
13 #include "../../model/SolarCollectorIntegralCollectorStorage_Impl.hpp"
14 #include "../../model/SolarCollectorPerformanceIntegralCollectorStorage.hpp"
15 #include "../../utilities/core/Logger.hpp"
16 #include "../../utilities/core/Assert.hpp"
17 #include <utilities/idd/SolarCollector_IntegralCollectorStorage_FieldEnums.hxx>
18 #include "../../utilities/idd/IddEnums.hpp"
19 #include <utilities/idd/IddEnums.hxx>
20 #include <utilities/idd/IddFactory.hxx>
21
22 using namespace openstudio::model;
23
24 using namespace std;
25
26 namespace openstudio {
27
28 namespace energyplus {
29
30 1 boost::optional<IdfObject> ForwardTranslator::translateSolarCollectorIntegralCollectorStorage(SolarCollectorIntegralCollectorStorage& modelObject) {
31 1 boost::optional<std::string> s;
32 1 boost::optional<double> value;
33
34
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject(IddObjectType::SolarCollector_IntegralCollectorStorage);
35
36
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(idfObject);
37
38 // Name
39
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 std::string name = modelObject.name().get();
40
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setName(name);
41
42 // SolarCollectorPerformanceIntegralCollectorStorage
43 {
44
1/1
✓ Branch 1 taken 1 time.
1 auto mo = modelObject.solarCollectorPerformance();
45
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 IdfObject performance = translateAndMapModelObject(mo).get();
46
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(SolarCollector_IntegralCollectorStorageFields::IntegralCollectorStorageParametersName, performance.name().get());
47 1 }
48
49 // SurfaceName
50
1/1
✓ Branch 1 taken 1 time.
1 OptionalPlanarSurface surface = modelObject.surface();
51
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (surface) {
52 ✗ IdfObject surf = translateAndMapModelObject(*surface).get();
53 ✗ idfObject.setString(SolarCollector_IntegralCollectorStorageFields::SurfaceName, surf.name().get());
54 ✗ } else {
55
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
1 LOG(Error, "SolarCollector:IntegralCollectorStorage '" << name << "' does not reference a surface.");
56 }
57
58 // BottomSurfaceBoundaryConditionsType
59
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(SolarCollector_IntegralCollectorStorageFields::BottomSurfaceBoundaryConditionsType,
60
1/1
✓ Branch 1 taken 1 time.
2 modelObject.bottomSurfaceBoundaryConditionsType());
61
62 // BoundaryConditionModelName
63 // DLM: not implemented
64
65 // InletNodeName
66
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<ModelObject> mo = modelObject.inletModelObject()) {
67
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
68
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(SolarCollector_IntegralCollectorStorageFields::InletNodeName, node->name().get());
69 1 }
70 1 }
71
72 // OutletNodeName
73
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<ModelObject> mo = modelObject.outletModelObject()) {
74
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
75
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(SolarCollector_IntegralCollectorStorageFields::OutletNodeName, node->name().get());
76 1 }
77 1 }
78
79 // MaximumFlowRate
80
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<double> maximumFlowRate = modelObject.maximumFlowRate();
81
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (maximumFlowRate) {
82 ✗ idfObject.setDouble(SolarCollector_IntegralCollectorStorageFields::MaximumFlowRate, *maximumFlowRate);
83 }
84
85
1/1
✓ Branch 1 taken 1 time.
2 return boost::optional<IdfObject>(idfObject);
86 1 }
87
88 } // namespace energyplus
89
90 } // namespace openstudio
91