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