GCC Code Coverage Report


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

src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACHighTemperatureRadiant.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/ZoneHVACHighTemperatureRadiant.hpp"
19 #include "../../model/ZoneHVACHighTemperatureRadiant_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_HighTemperatureRadiant_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> ForwardTranslator::translateZoneHVACHighTemperatureRadiant(ZoneHVACHighTemperatureRadiant& modelObject) {
37 ✗ boost::optional<std::string> s;
38 ✗ boost::optional<double> value;
39 ✗ boost::optional<ModelObject> temp;
40
41 ✗ IdfObject idfObject(IddObjectType::ZoneHVAC_HighTemperatureRadiant);
42 ✗ m_idfObjects.push_back(idfObject);
43
44 //Name
45 ✗ std::string baseName = modelObject.name().get();
46 ✗ idfObject.setName(baseName);
47
48 // AvailabilityScheduleName
49 ✗ if (boost::optional<Schedule> schedule = modelObject.availabilitySchedule()) {
50 ✗ if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get())) {
51 ✗ idfObject.setString(ZoneHVAC_HighTemperatureRadiantFields::AvailabilityScheduleName, _schedule->name().get());
52 ✗ }
53 ✗ }
54
55 //field Zone Name
56 ✗ boost::optional<std::string> thermalZoneName;
57 ✗ if (boost::optional<ThermalZone> zone = modelObject.thermalZone()) {
58 ✗ if ((s = zone->name())) {
59 ✗ thermalZoneName = s;
60 ✗ idfObject.setString(ZoneHVAC_HighTemperatureRadiantFields::ZoneName, thermalZoneName.get());
61 }
62 ✗ }
63
64 // OpenStudio only supports "Heating Design Capacity", which is the default in IDD
65 ✗ idfObject.setString(ZoneHVAC_HighTemperatureRadiantFields::HeatingDesignCapacityMethod, "HeatingDesignCapacity");
66
67 //MaximumPowerInput
68 ✗ if (modelObject.isMaximumPowerInputAutosized()) {
69 ✗ idfObject.setString(ZoneHVAC_HighTemperatureRadiantFields::HeatingDesignCapacity, "AutoSize");
70 ✗ } else if ((value = modelObject.maximumPowerInput())) {
71 ✗ idfObject.setDouble(ZoneHVAC_HighTemperatureRadiantFields::HeatingDesignCapacity, value.get());
72 }
73
74 //FuelType
75 ✗ if ((s = modelObject.fuelType())) {
76 ✗ idfObject.setString(ZoneHVAC_HighTemperatureRadiantFields::FuelType, s.get());
77 }
78
79 //CombustionEfficiency
80 ✗ if ((value = modelObject.combustionEfficiency())) {
81 ✗ idfObject.setDouble(ZoneHVAC_HighTemperatureRadiantFields::CombustionEfficiency, value.get());
82 }
83
84 //FractionofInputConvertedtoRadiantEnergy
85 ✗ if ((value = modelObject.fractionofInputConvertedtoRadiantEnergy())) {
86 ✗ idfObject.setDouble(ZoneHVAC_HighTemperatureRadiantFields::FractionofInputConvertedtoRadiantEnergy, value.get());
87 }
88
89 //FractionofInputConvertedtoLatentEnergy
90 ✗ if ((value = modelObject.fractionofInputConvertedtoLatentEnergy())) {
91 ✗ idfObject.setDouble(ZoneHVAC_HighTemperatureRadiantFields::FractionofInputConvertedtoLatentEnergy, value.get());
92 }
93
94 //FractionofInputthatIsLost
95 ✗ if ((value = modelObject.fractionofInputthatIsLost())) {
96 ✗ idfObject.setDouble(ZoneHVAC_HighTemperatureRadiantFields::FractionofInputthatIsLost, value.get());
97 }
98
99 //TemperatureControlType
100 ✗ if ((s = modelObject.temperatureControlType())) {
101 ✗ idfObject.setString(ZoneHVAC_HighTemperatureRadiantFields::TemperatureControlType, s.get());
102 }
103
104 //HeatingThrottlingRange
105 ✗ if ((value = modelObject.heatingThrottlingRange())) {
106 ✗ idfObject.setDouble(ZoneHVAC_HighTemperatureRadiantFields::HeatingThrottlingRange, value.get());
107 }
108
109 //HeatingSetpointTemperatureScheduleName
110 ✗ if (boost::optional<Schedule> schedule = modelObject.heatingSetpointTemperatureSchedule()) {
111 ✗ if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get())) {
112 ✗ idfObject.setString(ZoneHVAC_HighTemperatureRadiantFields::HeatingSetpointTemperatureScheduleName, _schedule->name().get());
113 ✗ }
114 ✗ }
115
116 //FractionofRadiantEnergyIncidentonPeople
117 ✗ double fractionofRadiantEnergyIncidentonPeople = 0.04;
118 ✗ if ((value = modelObject.fractionofRadiantEnergyIncidentonPeople())) {
119 ✗ idfObject.setDouble(ZoneHVAC_HighTemperatureRadiantFields::FractionofRadiantEnergyIncidentonPeople, value.get());
120 ✗ fractionofRadiantEnergyIncidentonPeople = value.get();
121 }
122
123 //get rid of any existing surface (just to be safe)
124 ✗ idfObject.clearExtensibleGroups();
125
126 //aggregator for total area; will be used to create weighted area
127 ✗ double totalAreaOfNonFloorSurfaces = 0;
128 ✗ double totalAreaOfFloorSurfaces = 0;
129
130 //loop through all surfaces, adding up their area
131 ✗ for (const Surface& surface : modelObject.getImpl<model::detail::ZoneHVACHighTemperatureRadiant_Impl>()->surfaces()) {
132 ✗ if (istringEqual(surface.surfaceType(), "Floor")) {
133 ✗ totalAreaOfFloorSurfaces = totalAreaOfFloorSurfaces + surface.grossArea();
134 } else {
135 ✗ totalAreaOfNonFloorSurfaces = totalAreaOfNonFloorSurfaces + surface.grossArea();
136 }
137 ✗ }
138
139 // Assume that 70% of what is not on people is on the floor
140 ✗ double fractionOnFloor = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.70;
141 // Assume that 30% of what is not on people is on the non floor surfaces
142 ✗ double fractionOnNonFloor = (1.0 - fractionofRadiantEnergyIncidentonPeople) * 0.30;
143 //loop through all the surfaces, adding them and their flow fractions (weighted per-area)
144 ✗ for (const Surface& surface : modelObject.getImpl<model::detail::ZoneHVACHighTemperatureRadiant_Impl>()->surfaces()) {
145 ✗ IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
146 ✗ group.setString(ZoneHVAC_HighTemperatureRadiantExtensibleFields::SurfaceName, surface.name().get());
147 ✗ if (istringEqual(surface.surfaceType(), "Floor")) {
148 ✗ group.setDouble(ZoneHVAC_HighTemperatureRadiantExtensibleFields::FractionofRadiantEnergytoSurface,
149 ✗ (surface.grossArea() / totalAreaOfFloorSurfaces * fractionOnFloor));
150 } else {
151 ✗ group.setDouble(ZoneHVAC_HighTemperatureRadiantExtensibleFields::FractionofRadiantEnergytoSurface,
152 ✗ (surface.grossArea() / totalAreaOfNonFloorSurfaces * fractionOnNonFloor));
153 }
154 ✗ }
155
156 ✗ return idfObject;
157 ✗ }
158
159 } // namespace energyplus
160
161 } // namespace openstudio
162