GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 97.6% 41 / 0 / 42
Functions: 100.0% 1 / 0 / 1
Branches: 94.2% 81 / 0 / 86

src/energyplus/ForwardTranslator/ForwardTranslateWaterHeaterSizing.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/WaterHeaterSizing.hpp"
10
11 #include "../../model/WaterToWaterComponent.hpp"
12
13 #include <utilities/idd/WaterHeater_Sizing_FieldEnums.hxx>
14 // #include "../../utilities/idd/IddEnums.hpp"
15 #include <utilities/idd/IddEnums.hxx>
16
17 using namespace openstudio::model;
18
19 namespace openstudio {
20
21 namespace energyplus {
22
23 41 boost::optional<IdfObject> ForwardTranslator::translateWaterHeaterSizing(model::WaterHeaterSizing& modelObject) {
24
25 // It doesn't have a name
26
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
41 IdfObject idfObject(openstudio::IddObjectType::WaterHeater_Sizing);
27 // WaterHeater Name: Required Object
28
1/1
✓ Branch 1 taken 41 times.
41 auto waterHeater = modelObject.waterHeater();
29
2/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 41 times.
✗ Branch 4 not taken.
82 if (boost::optional<IdfObject> _owo = translateAndMapModelObject(waterHeater)) {
30
3/3
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
✓ Branch 7 taken 41 times.
41 idfObject.setString(WaterHeater_SizingFields::WaterHeaterName, _owo->nameString());
31 } else {
32 ✗ return boost::none;
33 41 }
34
1/1
✓ Branch 1 taken 41 times.
41 m_idfObjects.push_back(idfObject);
35
36 // Design Mode: boost::optional<std::string>
37
2/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 41 times.
✗ Branch 4 not taken.
82 if (boost::optional<std::string> _designMode = modelObject.designMode()) {
38
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
41 idfObject.setString(WaterHeater_SizingFields::DesignMode, _designMode.get());
39 41 }
40
41 // Time Storage Can Meet Peak Draw: boost::optional<double>
42
2/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 41 times.
✗ Branch 4 not taken.
82 if (boost::optional<double> _timeStorageCanMeetPeakDraw = modelObject.timeStorageCanMeetPeakDraw()) {
43
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
41 idfObject.setDouble(WaterHeater_SizingFields::TimeStorageCanMeetPeakDraw, _timeStorageCanMeetPeakDraw.get());
44 }
45
46 // Time for Tank Recovery: boost::optional<double>
47
2/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 41 times.
✗ Branch 4 not taken.
82 if (boost::optional<double> _timeforTankRecovery = modelObject.timeforTankRecovery()) {
48
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
41 idfObject.setDouble(WaterHeater_SizingFields::TimeforTankRecovery, _timeforTankRecovery.get());
49 }
50
51 // Nominal Tank Volume for Autosizing Plant Connections: boost::optional<double>
52
2/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 41 times.
✗ Branch 4 not taken.
82 if (boost::optional<double> _nominalTankVolumeforAutosizingPlantConnections = modelObject.nominalTankVolumeforAutosizingPlantConnections()) {
53 41 idfObject.setDouble(WaterHeater_SizingFields::NominalTankVolumeforAutosizingPlantConnections,
54
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
41 _nominalTankVolumeforAutosizingPlantConnections.get());
55 }
56
57 // Number of Bedrooms: boost::optional<int>
58
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<int> _numberofBedrooms = modelObject.numberofBedrooms()) {
59
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setInt(WaterHeater_SizingFields::NumberofBedrooms, _numberofBedrooms.get());
60 }
61
62 // Number of Bathrooms: boost::optional<int>
63
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<int> _numberofBathrooms = modelObject.numberofBathrooms()) {
64
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setInt(WaterHeater_SizingFields::NumberofBathrooms, _numberofBathrooms.get());
65 }
66
67 // Storage Capacity per Person: boost::optional<double>
68
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<double> _storageCapacityperPerson = modelObject.storageCapacityperPerson()) {
69
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WaterHeater_SizingFields::StorageCapacityperPerson, _storageCapacityperPerson.get());
70 }
71
72 // Recovery Capacity per Person: boost::optional<double>
73
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<double> _recoveryCapacityperPerson = modelObject.recoveryCapacityperPerson()) {
74
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WaterHeater_SizingFields::RecoveryCapacityperPerson, _recoveryCapacityperPerson.get());
75 }
76
77 // Storage Capacity per Floor Area: boost::optional<double>
78
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<double> _storageCapacityperFloorArea = modelObject.storageCapacityperFloorArea()) {
79
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WaterHeater_SizingFields::StorageCapacityperFloorArea, _storageCapacityperFloorArea.get());
80 }
81
82 // Recovery Capacity per Floor Area: boost::optional<double>
83
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<double> _recoveryCapacityperFloorArea = modelObject.recoveryCapacityperFloorArea()) {
84
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WaterHeater_SizingFields::RecoveryCapacityperFloorArea, _recoveryCapacityperFloorArea.get());
85 }
86
87 // Number of Units: boost::optional<double>
88
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<double> _numberofUnits = modelObject.numberofUnits()) {
89
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WaterHeater_SizingFields::NumberofUnits, _numberofUnits.get());
90 }
91
92 // Storage Capacity per Unit: boost::optional<double>
93
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<double> _storageCapacityperUnit = modelObject.storageCapacityperUnit()) {
94
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WaterHeater_SizingFields::StorageCapacityperUnit, _storageCapacityperUnit.get());
95 }
96
97 // Recovery Capacity PerUnit: boost::optional<double>
98
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<double> _recoveryCapacityPerUnit = modelObject.recoveryCapacityPerUnit()) {
99
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WaterHeater_SizingFields::RecoveryCapacityPerUnit, _recoveryCapacityPerUnit.get());
100 }
101
102 // Storage Capacity per Collector Area: boost::optional<double>
103
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<double> _storageCapacityperCollectorArea = modelObject.storageCapacityperCollectorArea()) {
104
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WaterHeater_SizingFields::StorageCapacityperCollectorArea, _storageCapacityperCollectorArea.get());
105 }
106
107 // Height Aspect Ratio: boost::optional<double>
108
3/3
✓ Branch 1 taken 41 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 40 times.
82 if (boost::optional<double> _heightAspectRatio = modelObject.heightAspectRatio()) {
109
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WaterHeater_SizingFields::HeightAspectRatio, _heightAspectRatio.get());
110 }
111
112
1/1
✓ Branch 1 taken 41 times.
41 return idfObject;
113 41 } // End of translate function
114
115 } // end namespace energyplus
116 } // end namespace openstudio
117