GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 60.0% 3 / 0 / 5
Functions: 100.0% 1 / 0 / 1
Branches: 40.0% 4 / 0 / 10

src/energyplus/ReverseTranslator/ReverseTranslateZoneVentilationDesignFlowRate.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 "../ReverseTranslator.hpp"
7
8 #include "../../model/Space.hpp"
9 #include "../../model/Space_Impl.hpp"
10 #include "../../model/SpaceType.hpp"
11 #include "../../model/SpaceType_Impl.hpp"
12 #include "../../model/Schedule.hpp"
13 #include "../../model/Schedule_Impl.hpp"
14
15 #include <utilities/idd/ZoneVentilation_DesignFlowRate_FieldEnums.hxx>
16 #include "../../utilities/idd/IddEnums.hpp"
17 #include <utilities/idd/IddEnums.hxx>
18
19 using namespace openstudio::model;
20
21 namespace openstudio {
22
23 namespace energyplus {
24
25 6 OptionalModelObject ReverseTranslator::translateZoneVentilationDesignFlowRate(const WorkspaceObject& workspaceObject) {
26
4/5
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 6 times.
6 if (workspaceObject.iddObject().type() != IddObjectType::ZoneVentilation_DesignFlowRate) {
27 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: ZoneVentilation:DesignFlowRate");
28 ✗ return boost::none;
29 }
30
31 6 return boost::none;
32
33 /*
34 openstudio::model::SpaceVentilationDesignFlowRate ventilation(m_model);
35
36 OptionalString s = workspaceObject.name();
37 if(s){
38 ventilation.setName(*s);
39 }
40
41 OptionalWorkspaceObject target = workspaceObject.getTarget(openstudio::ZoneVentilation_DesignFlowRateFields::ZoneorZoneListName);
42 if (target){
43 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
44 if (modelObject){
45 if (modelObject->optionalCast<Space>()){
46 ventilation.setSpace(modelObject->cast<Space>());
47 }else if (modelObject->optionalCast<SpaceType>()){
48 ventilation.setSpaceType(modelObject->cast<SpaceType>());
49 }
50 }
51 }
52
53 target = workspaceObject.getTarget(openstudio::ZoneVentilation_DesignFlowRateFields::ScheduleName);
54 if (target){
55 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
56 if (modelObject){
57 if (modelObject->optionalCast<Schedule>()){
58 ventilation.setSchedule(modelObject->cast<Schedule>());
59 }
60 }
61 }
62
63 s = workspaceObject.getString(openstudio::ZoneVentilation_DesignFlowRateFields::DesignFlowRateCalculationMethod, true);
64 OS_ASSERT(s);
65
66 OptionalDouble d;
67 if (istringEqual("Flow/Zone", *s)){
68 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::DesignFlowRate);
69 if (d){
70 ventilation.setDesignFlowRate(*d);
71 }else{
72 LOG(Error, "Flow/Zone value not found for workspace object " << workspaceObject);
73 }
74 }else if(istringEqual("Flow/Area", *s)){
75 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::FlowRateperFloorArea);
76 if (d){
77 ventilation.setFlowRateperSpaceFloorArea(*d);
78 }else{
79 LOG(Error, "Flow/Area value not found for workspace object " << workspaceObject);
80 }
81 }else if(istringEqual("Flow/Person", *s)){
82 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::FlowRateperPerson);
83 if (d){
84 ventilation.setFlowRateperPerson(*d);
85 }else{
86 LOG(Error, "Flow/Person value not found for workspace object " << workspaceObject);
87 }
88 }else if(istringEqual("AirChanges/Hour", *s)){
89 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::AirChangesperHour);
90 if (d){
91 ventilation.setAirChangesperHour(*d);
92 }else{
93 LOG(Error, "AirChanges/Hour value not found for workspace object " << workspaceObject);
94 }
95 }else{
96 LOG(Error, "Unknown DesignLevelCalculationMethod value for workspace object" << workspaceObject);
97 }
98
99 s = workspaceObject.getString(openstudio::ZoneVentilation_DesignFlowRateFields::VentilationType);
100 if (s){
101 ventilation.setVentilationType(*s);
102 }
103
104 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::FanPressureRise);
105 if (d){
106 ventilation.setFanPressureRise(*d);
107 }
108
109 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::FanTotalEfficiency);
110 if (d){
111 ventilation.setFanTotalEfficiency(*d);
112 }
113
114 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::ConstantTermCoefficient);
115 if (d){
116 ventilation.setConstantTermCoefficient(*d);
117 }
118
119 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::TemperatureTermCoefficient);
120 if (d){
121 ventilation.setTemperatureTermCoefficient(*d);
122 }
123
124 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::VelocityTermCoefficient);
125 if (d){
126 ventilation.setVelocityTermCoefficient(*d);
127 }
128
129 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::VelocitySquaredTermCoefficient);
130 if (d){
131 ventilation.setVelocitySquaredTermCoefficient(*d);
132 }
133
134 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::MinimumIndoorTemperature);
135 if (d){
136 ventilation.setMinimumIndoorTemperature(*d);
137 }
138
139 target = workspaceObject.getTarget(openstudio::ZoneVentilation_DesignFlowRateFields::MinimumIndoorTemperatureScheduleName);
140 if (target){
141 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
142 if (modelObject){
143 if (modelObject->optionalCast<Schedule>()){
144 ventilation.setMinimumIndoorTemperatureSchedule(modelObject->cast<Schedule>());
145 }
146 }
147 }
148
149 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::MaximumIndoorTemperature);
150 if (d){
151 ventilation.setMaximumIndoorTemperature(*d);
152 }
153
154 target = workspaceObject.getTarget(openstudio::ZoneVentilation_DesignFlowRateFields::MaximumIndoorTemperatureScheduleName);
155 if (target){
156 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
157 if (modelObject){
158 if (modelObject->optionalCast<Schedule>()){
159 ventilation.setMaximumIndoorTemperatureSchedule(modelObject->cast<Schedule>());
160 }
161 }
162 }
163
164 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::DeltaTemperature);
165 if (d){
166 ventilation.setDeltaTemperature(*d);
167 }
168
169 target = workspaceObject.getTarget(openstudio::ZoneVentilation_DesignFlowRateFields::DeltaTemperatureScheduleName);
170 if (target){
171 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
172 if (modelObject){
173 if (modelObject->optionalCast<Schedule>()){
174 ventilation.setDeltaTemperatureSchedule(modelObject->cast<Schedule>());
175 }
176 }
177 }
178
179 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::MinimumOutdoorTemperature);
180 if (d){
181 ventilation.setMinimumOutdoorTemperature(*d);
182 }
183
184 target = workspaceObject.getTarget(openstudio::ZoneVentilation_DesignFlowRateFields::MinimumOutdoorTemperatureScheduleName);
185 if (target){
186 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
187 if (modelObject){
188 if (modelObject->optionalCast<Schedule>()){
189 ventilation.setMinimumOutdoorTemperatureSchedule(modelObject->cast<Schedule>());
190 }
191 }
192 }
193
194 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::MaximumOutdoorTemperature);
195 if (d){
196 ventilation.setMaximumOutdoorTemperature(*d);
197 }
198
199 target = workspaceObject.getTarget(openstudio::ZoneVentilation_DesignFlowRateFields::MaximumOutdoorTemperatureScheduleName);
200 if (target){
201 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
202 if (modelObject){
203 if (modelObject->optionalCast<Schedule>()){
204 ventilation.setMaximumOutdoorTemperatureSchedule(modelObject->cast<Schedule>());
205 }
206 }
207 }
208
209 d = workspaceObject.getDouble(openstudio::ZoneVentilation_DesignFlowRateFields::MaximumWindSpeed);
210 if (d){
211 ventilation.setMaximumWindSpeed(*d);
212 }
213
214 return ventilation;
215 */
216 }
217
218 } // namespace energyplus
219
220 } // namespace openstudio
221