GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 54
Functions: 0.0% 0 / 0 / 1
Branches: 0.0% 0 / 0 / 92

src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACBaseboardRadiantConvectiveElectric.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/Schedule.hpp"
9 #include "../../model/Schedule_Impl.hpp"
10 #include "../../model/ModelObject.hpp"
11 #include "../../model/ModelObject_Impl.hpp"
12 #include "../../model/ThermalZone.hpp"
13 #include "../../model/ThermalZone_Impl.hpp"
14 #include "../../model/Surface.hpp"
15 #include "../../model/Surface_Impl.hpp"
16 #include "../../model/Space.hpp"
17 #include "../../model/Space_Impl.hpp"
18 #include "../../model/ZoneHVACBaseboardRadiantConvectiveElectric.hpp"
19 #include "../../model/ZoneHVACBaseboardRadiantConvectiveElectric_Impl.hpp"
20 #include "../../model/ZoneHVACEquipmentList.hpp"
21 #include "../../model/ZoneHVACEquipmentList_Impl.hpp"
22 #include "../../model/ZoneHVACComponent.hpp"
23 #include "../../model/ZoneHVACComponent_Impl.hpp"
24 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
25 #include <utilities/idd/ZoneHVAC_Baseboard_RadiantConvective_Electric_FieldEnums.hxx>
26 #include <utilities/idd/IddEnums.hxx>
27 #include "../../utilities/idd/IddEnums.hpp"
28 #include <utilities/idd/IddFactory.hxx>
29
30 using namespace openstudio::model;
31
32 namespace openstudio {
33
34 namespace energyplus {
35
36 boost::optional<IdfObject>
37 ✗ ForwardTranslator::translateZoneHVACBaseboardRadiantConvectiveElectric(ZoneHVACBaseboardRadiantConvectiveElectric& modelObject) {
38 ✗ boost::optional<std::string> s;
39 ✗ boost::optional<double> value;
40 ✗ boost::optional<ModelObject> temp;
41
42 // Name
43 ✗ IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneHVAC_Baseboard_RadiantConvective_Electric, modelObject);
44
45 // AvailabilityScheduleName
46 {
47 ✗ auto schedule = modelObject.availabilitySchedule();
48 ✗ if (auto _schedule = translateAndMapModelObject(schedule)) {
49 ✗ idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::AvailabilityScheduleName, _schedule->name().get());
50 ✗ }
51 ✗ }
52
53 // HeatingDesignCapacityMethod
54 ✗ if ((s = modelObject.heatingDesignCapacityMethod())) {
55 ✗ idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::HeatingDesignCapacityMethod, s.get());
56 }
57
58 // HeatingDesignCapacity
59 ✗ if (modelObject.isHeatingDesignCapacityAutosized()) {
60 ✗ idfObject.setString(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::HeatingDesignCapacity, "AutoSize");
61 ✗ } else if ((value = modelObject.heatingDesignCapacity())) {
62 ✗ idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::HeatingDesignCapacity, value.get());
63 }
64
65 // HeatingDesignCapacityPerFloorArea
66 ✗ if ((value = modelObject.heatingDesignCapacityPerFloorArea())) {
67 ✗ idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::HeatingDesignCapacityPerFloorArea, value.get());
68 }
69
70 // FractionofAutosizedHeatingDesignCapacity
71 ✗ if ((value = modelObject.fractionofAutosizedHeatingDesignCapacity())) {
72 ✗ idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::FractionofAutosizedHeatingDesignCapacity, value.get());
73 }
74
75 // Efficiency
76 ✗ if ((value = modelObject.efficiency())) {
77 ✗ idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::Efficiency, value.get());
78 }
79
80 // FractionRadiant
81 ✗ if ((value = modelObject.fractionRadiant())) {
82 ✗ idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::FractionRadiant, value.get());
83 }
84
85 // FractionofRadiantEnergyIncidentonPeople
86 ✗ double fractionofRadiantEnergyIncidentonPeople = modelObject.fractionofRadiantEnergyIncidentonPeople();
87 {
88 ✗ idfObject.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricFields::FractionofRadiantEnergyIncidentonPeople,
89 fractionofRadiantEnergyIncidentonPeople);
90 }
91
92 //get rid of any existing surface (just to be safe)
93 ✗ idfObject.clearExtensibleGroups();
94
95 //aggregator for total area; will be used to create weighted area
96 ✗ double totalAreaOfWallSurfaces = 0;
97 ✗ double totalAreaOfCeilingSurfaces = 0;
98 ✗ double totalAreaOfFloorSurfaces = 0;
99
100 //loop through all surfaces, adding up their area
101 ✗ auto const& surfaces = modelObject.getImpl<model::detail::ZoneHVACBaseboardRadiantConvectiveElectric_Impl>()->surfaces();
102
103 ✗ for (auto const& surface : surfaces) {
104 ✗ if (istringEqual(surface.surfaceType(), "Floor")) {
105 ✗ totalAreaOfFloorSurfaces += surface.grossArea();
106 ✗ } else if (istringEqual(surface.surfaceType(), "RoofCeiling")) {
107 ✗ totalAreaOfCeilingSurfaces += surface.grossArea();
108 } else {
109 ✗ totalAreaOfWallSurfaces += surface.grossArea();
110 }
111 }
112
113 // Assume that 5% of what is not on people is on the floor
114 ✗ double fractionOnFloor = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.05;
115 // Assume that 55% of what is not on people is on the walls
116 ✗ double fractionOnWall = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.55;
117 // Assume that 40% of what is not on people is on the ceiling
118 ✗ double fractionOnCeiling = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.40;
119 //loop through all the surfaces, adding them and their flow fractions (weighted per-area)
120 ✗ for (auto const& surface : surfaces) {
121 ✗ IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
122 ✗ group.setString(ZoneHVAC_Baseboard_RadiantConvective_ElectricExtensibleFields::SurfaceName, surface.name().get());
123 ✗ if (istringEqual(surface.surfaceType(), "Floor")) {
124 ✗ group.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricExtensibleFields::FractionofRadiantEnergytoSurface,
125 ✗ (surface.grossArea() / totalAreaOfFloorSurfaces * fractionOnFloor));
126 ✗ } else if (istringEqual(surface.surfaceType(), "RoofCeiling")) {
127 ✗ group.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricExtensibleFields::FractionofRadiantEnergytoSurface,
128 ✗ (surface.grossArea() / totalAreaOfCeilingSurfaces * fractionOnCeiling));
129 } else {
130 ✗ group.setDouble(ZoneHVAC_Baseboard_RadiantConvective_ElectricExtensibleFields::FractionofRadiantEnergytoSurface,
131 ✗ (surface.grossArea() / totalAreaOfWallSurfaces * fractionOnWall));
132 }
133 ✗ }
134
135 ✗ return idfObject;
136 ✗ }
137
138 } // namespace energyplus
139
140 } // namespace openstudio
141