src/model/CentralHeatPumpSystem.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 "CentralHeatPumpSystem.hpp" | ||
| 7 | #include "CentralHeatPumpSystem_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Schedule.hpp" | ||
| 10 | #include "Schedule_Impl.hpp" | ||
| 11 | #include "ModelObjectList.hpp" | ||
| 12 | #include "ModelObjectList_Impl.hpp" | ||
| 13 | #include "CentralHeatPumpSystemModule.hpp" | ||
| 14 | #include "CentralHeatPumpSystemModule_Impl.hpp" | ||
| 15 | #include "ScheduleTypeLimits.hpp" | ||
| 16 | #include "ScheduleTypeRegistry.hpp" | ||
| 17 | |||
| 18 | #include "PlantLoop.hpp" | ||
| 19 | #include "PlantLoop_Impl.hpp" | ||
| 20 | #include "Node.hpp" | ||
| 21 | |||
| 22 | // Need for clone override | ||
| 23 | #include "Model.hpp" | ||
| 24 | #include "Model_Impl.hpp" | ||
| 25 | |||
| 26 | #include "../utilities/core/Assert.hpp" | ||
| 27 | #include "../utilities/core/DeprecatedHelpers.hpp" | ||
| 28 | #include "../utilities/data/DataEnums.hpp" | ||
| 29 | |||
| 30 | #include <utilities/idd/IddEnums.hxx> | ||
| 31 | #include <utilities/idd/OS_CentralHeatPumpSystem_FieldEnums.hxx> | ||
| 32 | |||
| 33 | namespace openstudio { | ||
| 34 | namespace model { | ||
| 35 | |||
| 36 | namespace detail { | ||
| 37 | |||
| 38 | 16 | CentralHeatPumpSystem_Impl::CentralHeatPumpSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 39 | 16 | : WaterToWaterComponent_Impl(idfObject, model, keepHandle) { | |
| 40 |
4/6✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 16 times.
✗ Branch 13 not taken.
|
16 | OS_ASSERT(idfObject.iddObject().type() == CentralHeatPumpSystem::iddObjectType()); |
| 41 | 16 | } | |
| 42 | |||
| 43 | 1 | CentralHeatPumpSystem_Impl::CentralHeatPumpSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 44 | 1 | : WaterToWaterComponent_Impl(other, model, keepHandle) { | |
| 45 |
4/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 time.
✗ Branch 13 not taken.
|
1 | OS_ASSERT(other.iddObject().type() == CentralHeatPumpSystem::iddObjectType()); |
| 46 | 1 | } | |
| 47 | |||
| 48 | 13 | CentralHeatPumpSystem_Impl::CentralHeatPumpSystem_Impl(const CentralHeatPumpSystem_Impl& other, Model_Impl* model, bool keepHandle) | |
| 49 | 13 | : WaterToWaterComponent_Impl(other, model, keepHandle) {} | |
| 50 | |||
| 51 | ✗ | const std::vector<std::string>& CentralHeatPumpSystem_Impl::outputVariableNames() const { | |
| 52 | static const std::vector<std::string> result{"Chiller Heater System Cooling Electricity Rate", | ||
| 53 | "Chiller Heater System Cooling Electricity Energy", | ||
| 54 | "Chiller Heater System Heating Electricity Rate", | ||
| 55 | "Chiller Heater System Heating Electricity Energy", | ||
| 56 | "Chiller Heater System Cooling Rate", | ||
| 57 | "Chiller Heater System Cooling Energy", | ||
| 58 | "Chiller Heater System Heating Rate", | ||
| 59 | "Chiller Heater System Heating Energy", | ||
| 60 | "Chiller Heater System Source Heat Transfer Rate", | ||
| 61 | "Chiller Heater System Source Heat Transfer Energy", | ||
| 62 | "Chiller Heater System Cooling Inlet Temperature", | ||
| 63 | "Chiller Heater System Cooling Outlet Temperature", | ||
| 64 | "Chiller Heater System Cooling Mass Flow Rate", | ||
| 65 | "Chiller Heater System Heating Inlet Temperature", | ||
| 66 | "Chiller Heater System Heating Outlet Temperature", | ||
| 67 | "Chiller Heater System Heating Mass Flow Rate", | ||
| 68 | "Chiller Heater System Source Inlet Temperature", | ||
| 69 | "Chiller Heater System Source Outlet Temperature", | ||
| 70 | ✗ | "Chiller Heater System Source Mass Flow Rate"}; | |
| 71 | ✗ | return result; | |
| 72 | ✗ | } | |
| 73 | |||
| 74 | ✗ | IddObjectType CentralHeatPumpSystem_Impl::iddObjectType() const { | |
| 75 | ✗ | return CentralHeatPumpSystem::iddObjectType(); | |
| 76 | } | ||
| 77 | |||
| 78 | ✗ | std::vector<ScheduleTypeKey> CentralHeatPumpSystem_Impl::getScheduleTypeKeys(const Schedule& schedule) const { | |
| 79 | ✗ | std::vector<ScheduleTypeKey> result; | |
| 80 | ✗ | UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); | |
| 81 | ✗ | UnsignedVector::const_iterator b(fieldIndices.begin()); | |
| 82 | ✗ | UnsignedVector::const_iterator e(fieldIndices.end()); | |
| 83 | ✗ | if (std::find(b, e, OS_CentralHeatPumpSystemFields::AncillaryOperationScheduleName) != e) { | |
| 84 | ✗ | result.push_back(ScheduleTypeKey("CentralHeatPumpSystem", "Ancillary Operation")); | |
| 85 | } | ||
| 86 | ✗ | return result; | |
| 87 | ✗ | } | |
| 88 | |||
| 89 | // This will clone the CentralHeatPumpSystem as well as the CentralHeatPumpSystemModules if there are some | ||
| 90 | // and will return a reference to the new CentralHeatPumpSystem | ||
| 91 | 5 | ModelObject CentralHeatPumpSystem_Impl::clone(Model model) const { | |
| 92 | |||
| 93 | // Call the WaterToWater clone method, for a clean one, and that will reset the connections to loops | ||
| 94 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | auto newCentralHP = WaterToWaterComponent_Impl::clone(model).cast<CentralHeatPumpSystem>(); |
| 95 | |||
| 96 | // In the CentralHeatPumpSystem Implementation, the actual important object is the chillerHeaterModuleList | ||
| 97 | // Create a new (blank) ModelObjectList, and set it | ||
| 98 |
1/1✓ Branch 1 taken 5 times.
|
5 | auto newChillerHeaterModuleList = ModelObjectList(model); |
| 99 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | newChillerHeaterModuleList.setName(newCentralHP.name().get() + " Chiller Heater Module List"); |
| 100 | 5 | bool ok = true; | |
| 101 |
2/2✓ Branch 3 taken 5 times.
✓ Branch 6 taken 5 times.
|
5 | ok = newCentralHP.getImpl<detail::CentralHeatPumpSystem_Impl>()->setChillerHeaterModuleList(newChillerHeaterModuleList); |
| 102 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(ok); |
| 103 | |||
| 104 | // Now, the matter is to repopulate it. | ||
| 105 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 5 times.
|
7 | for (const CentralHeatPumpSystemModule& centralHPMod : this->modules()) { |
| 106 | |||
| 107 | // The CentralHeatPumpSystemModule_Impl::clone method will set the reference to the same | ||
| 108 | // ChillerHeaterPerformanceElectricEIR as the original one | ||
| 109 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | auto centralHPModClone = centralHPMod.clone(model).cast<CentralHeatPumpSystemModule>(); |
| 110 | |||
| 111 | // Add that to the new object | ||
| 112 |
1/1✓ Branch 1 taken 2 times.
|
2 | newCentralHP.addModule(centralHPModClone); |
| 113 | 7 | } | |
| 114 | |||
| 115 | 10 | return std::move(newCentralHP); | |
| 116 | 5 | } | |
| 117 | |||
| 118 | // CoolingLoop | ||
| 119 | 148 | unsigned CentralHeatPumpSystem_Impl::supplyInletPort() const { | |
| 120 | 148 | return OS_CentralHeatPumpSystemFields::CoolingLoopInletNodeName; | |
| 121 | } | ||
| 122 | |||
| 123 | 75 | unsigned CentralHeatPumpSystem_Impl::supplyOutletPort() const { | |
| 124 | 75 | return OS_CentralHeatPumpSystemFields::CoolingLoopOutletNodeName; | |
| 125 | } | ||
| 126 | |||
| 127 | // SourceLoop | ||
| 128 | 97 | unsigned CentralHeatPumpSystem_Impl::demandInletPort() const { | |
| 129 | 97 | return OS_CentralHeatPumpSystemFields::SourceLoopInletNodeName; | |
| 130 | } | ||
| 131 | |||
| 132 | 56 | unsigned CentralHeatPumpSystem_Impl::demandOutletPort() const { | |
| 133 | 56 | return OS_CentralHeatPumpSystemFields::SourceLoopOutletNodeName; | |
| 134 | } | ||
| 135 | |||
| 136 | // HeatingLoop | ||
| 137 | 68 | unsigned CentralHeatPumpSystem_Impl::tertiaryInletPort() const { | |
| 138 | 68 | return OS_CentralHeatPumpSystemFields::HeatingLoopInletNodeName; | |
| 139 | } | ||
| 140 | |||
| 141 | 126 | unsigned CentralHeatPumpSystem_Impl::tertiaryOutletPort() const { | |
| 142 | 126 | return OS_CentralHeatPumpSystemFields::HeatingLoopOutletNodeName; | |
| 143 | } | ||
| 144 | |||
| 145 | 15 | bool CentralHeatPumpSystem_Impl::addToNode(Node& node) { | |
| 146 |
1/1✓ Branch 1 taken 15 times.
|
15 | boost::optional<PlantLoop> t_plantLoop = node.plantLoop(); |
| 147 | |||
| 148 | // If trying to add to a node that is on the supply side of a plant loop | ||
| 149 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | if (t_plantLoop) { |
| 150 |
5/5✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
✓ Branch 10 taken 9 times.
✓ Branch 11 taken 6 times.
|
30 | if (t_plantLoop->supplyComponent(node.handle())) { |
| 151 | // If there is already a cooling Plant Loop | ||
| 152 |
1/1✓ Branch 1 taken 9 times.
|
9 | boost::optional<PlantLoop> coolingPlant = this->coolingPlantLoop(); |
| 153 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6 times.
|
9 | if (coolingPlant) { |
| 154 | // And it's not the same as the node's loop | ||
| 155 |
4/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 9 taken 3 times.
✗ Branch 10 not taken.
|
3 | if (t_plantLoop.get() != coolingPlant.get()) { |
| 156 | // And if there is no heatingPlantLoop (tertiary) | ||
| 157 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<PlantLoop> heatingPlant = this->heatingPlantLoop(); |
| 158 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 time.
|
3 | if (!heatingPlant) { |
| 159 | // Then try to add it to the tertiary one | ||
| 160 |
7/7✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 2 times.
✓ Branch 17 taken 2 times.
✓ Branch 20 taken 2 times.
|
2 | LOG(Warn, "Calling addToTertiaryNode to connect it to the tertiary (=heating) loop for " << briefDescription()); |
| 161 |
1/1✓ Branch 1 taken 2 times.
|
2 | return this->addToTertiaryNode(node); |
| 162 | } | ||
| 163 | 3 | } | |
| 164 | } | ||
| 165 | 9 | } | |
| 166 | } | ||
| 167 | |||
| 168 | // All other cases, call the base class implementation | ||
| 169 |
1/1✓ Branch 1 taken 13 times.
|
13 | return WaterToWaterComponent_Impl::addToNode(node); |
| 170 | 15 | } | |
| 171 | |||
| 172 | 8 | bool CentralHeatPumpSystem_Impl::addToTertiaryNode(Node& node) { | |
| 173 |
1/1✓ Branch 1 taken 8 times.
|
8 | auto _model = node.model(); |
| 174 |
1/1✓ Branch 1 taken 8 times.
|
8 | auto t_plantLoop = node.plantLoop(); |
| 175 | |||
| 176 | // Only accept adding to a node that is on a supply side of a plant loop | ||
| 177 | // Since tertiary here = heating loop | ||
| 178 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (t_plantLoop) { |
| 179 |
5/5✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 7 times.
✓ Branch 11 taken 1 time.
|
16 | if (t_plantLoop->supplyComponent(node.handle())) { |
| 180 | // Call base class method which accepts both supply and demand | ||
| 181 |
1/1✓ Branch 1 taken 7 times.
|
7 | return WaterToWaterComponent_Impl::addToTertiaryNode(node); |
| 182 | } else { | ||
| 183 |
7/7✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
|
1 | LOG(Info, "Cannot connect the tertiary (=heating) loop to the demand side for " << briefDescription()); |
| 184 | } | ||
| 185 | } | ||
| 186 | 1 | return false; | |
| 187 | 8 | } | |
| 188 | |||
| 189 | 54 | boost::optional<ModelObjectList> CentralHeatPumpSystem_Impl::chillerHeaterModuleList() const { | |
| 190 |
2/2✓ Branch 1 taken 54 times.
✓ Branch 4 taken 54 times.
|
54 | return getObject<ModelObject>().getModelObjectTarget<ModelObjectList>(OS_CentralHeatPumpSystemFields::ChillerHeaterModuleListName); |
| 191 | } | ||
| 192 | |||
| 193 | 14 | bool CentralHeatPumpSystem_Impl::addModule(const CentralHeatPumpSystemModule& centralHeatPumpSystemModule) { | |
| 194 | 14 | bool result = false; | |
| 195 |
1/1✓ Branch 1 taken 14 times.
|
14 | auto modelObjectList = chillerHeaterModuleList(); |
| 196 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if (modelObjectList) { |
| 197 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | result = modelObjectList->addModelObject(centralHeatPumpSystemModule); |
| 198 | } | ||
| 199 | 14 | return result; | |
| 200 | 14 | } | |
| 201 | |||
| 202 | 1 | void CentralHeatPumpSystem_Impl::removeModule(const CentralHeatPumpSystemModule& centralHeatPumpSystemModule) { | |
| 203 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto modelObjectList = chillerHeaterModuleList(); |
| 204 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (modelObjectList) { |
| 205 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObjectList->removeModelObject(centralHeatPumpSystemModule); |
| 206 | } | ||
| 207 | 1 | } | |
| 208 | |||
| 209 | 2 | void CentralHeatPumpSystem_Impl::removeAllModules() { | |
| 210 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto modelObjectList = chillerHeaterModuleList(); |
| 211 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (modelObjectList) { |
| 212 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | auto const modelObjects = modelObjectList->modelObjects(); |
| 213 | |||
| 214 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 2 times.
|
3 | for (const auto& elem : modelObjects) { |
| 215 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto const modelObject = elem.optionalCast<CentralHeatPumpSystemModule>(); |
| 216 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (modelObject) { |
| 217 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObjectList->removeModelObject(elem); |
| 218 | } | ||
| 219 | 1 | } | |
| 220 | 2 | } | |
| 221 | 2 | } | |
| 222 | |||
| 223 | 37 | std::vector<CentralHeatPumpSystemModule> CentralHeatPumpSystem_Impl::modules() const { | |
| 224 | 37 | std::vector<CentralHeatPumpSystemModule> result; | |
| 225 |
1/1✓ Branch 1 taken 37 times.
|
37 | auto const modelObjectList = chillerHeaterModuleList(); |
| 226 |
1/2✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
|
37 | if (modelObjectList) { |
| 227 |
2/2✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
|
37 | auto const modelObjects = modelObjectList->modelObjects(); |
| 228 | |||
| 229 |
2/2✓ Branch 5 taken 28 times.
✓ Branch 6 taken 37 times.
|
65 | for (const auto& elem : modelObjects) { |
| 230 |
1/1✓ Branch 1 taken 28 times.
|
28 | auto const modelObject = elem.optionalCast<CentralHeatPumpSystemModule>(); |
| 231 |
1/2✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
|
28 | if (modelObject) { |
| 232 |
2/2✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
|
28 | result.push_back(modelObject.get()); |
| 233 | } | ||
| 234 | 28 | } | |
| 235 | 37 | } | |
| 236 | 74 | return result; | |
| 237 | 37 | } | |
| 238 | |||
| 239 | /** Convenience Function to return the Cooling Loop **/ | ||
| 240 | 44 | boost::optional<PlantLoop> CentralHeatPumpSystem_Impl::coolingPlantLoop() const { | |
| 241 | 44 | return WaterToWaterComponent_Impl::plantLoop(); | |
| 242 | } | ||
| 243 | |||
| 244 | /** Convenience Function to return the Source Loop **/ | ||
| 245 | 22 | boost::optional<PlantLoop> CentralHeatPumpSystem_Impl::sourcePlantLoop() const { | |
| 246 | 22 | return WaterToWaterComponent_Impl::secondaryPlantLoop(); | |
| 247 | } | ||
| 248 | |||
| 249 | /** Convenience Function to return the Heating Loop **/ | ||
| 250 | 37 | boost::optional<PlantLoop> CentralHeatPumpSystem_Impl::heatingPlantLoop() const { | |
| 251 | 37 | return WaterToWaterComponent_Impl::tertiaryPlantLoop(); | |
| 252 | } | ||
| 253 | |||
| 254 | 20 | bool CentralHeatPumpSystem_Impl::setChillerHeaterModuleList(const boost::optional<ModelObjectList>& modelObjectList) { | |
| 255 | 20 | bool result(false); | |
| 256 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | if (modelObjectList) { |
| 257 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | result = setPointer(OS_CentralHeatPumpSystemFields::ChillerHeaterModuleListName, modelObjectList.get().handle()); |
| 258 | } else { | ||
| 259 | ✗ | resetChillerHeaterModuleList(); | |
| 260 | ✗ | result = true; | |
| 261 | } | ||
| 262 | 20 | return result; | |
| 263 | } | ||
| 264 | |||
| 265 | ✗ | void CentralHeatPumpSystem_Impl::resetChillerHeaterModuleList() { | |
| 266 | ✗ | bool result = setString(OS_CentralHeatPumpSystemFields::ChillerHeaterModuleListName, ""); | |
| 267 | ✗ | OS_ASSERT(result); | |
| 268 | ✗ | } | |
| 269 | |||
| 270 | 4 | double CentralHeatPumpSystem_Impl::ancillaryPower() const { | |
| 271 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> value = getDouble(OS_CentralHeatPumpSystemFields::AncillaryPower, true); |
| 272 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
|
4 | OS_ASSERT(value); |
| 273 |
1/1✓ Branch 1 taken 4 times.
|
8 | return value.get(); |
| 274 | } | ||
| 275 | |||
| 276 | 8 | boost::optional<Schedule> CentralHeatPumpSystem_Impl::ancillaryOperationSchedule() const { | |
| 277 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_CentralHeatPumpSystemFields::AncillaryOperationScheduleName); |
| 278 | } | ||
| 279 | |||
| 280 | 17 | bool CentralHeatPumpSystem_Impl::setAncillaryPower(double ancillaryPower) { | |
| 281 | 17 | bool result = setDouble(OS_CentralHeatPumpSystemFields::AncillaryPower, ancillaryPower); | |
| 282 | 17 | return result; | |
| 283 | } | ||
| 284 | |||
| 285 | 2 | bool CentralHeatPumpSystem_Impl::setAncillaryOperationSchedule(Schedule& schedule) { | |
| 286 | bool result = | ||
| 287 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
8 | setSchedule(OS_CentralHeatPumpSystemFields::AncillaryOperationScheduleName, "CentralHeatPumpSystem", "Ancillary Operation", schedule); |
| 288 | 2 | return result; | |
| 289 | } | ||
| 290 | |||
| 291 | 1 | void CentralHeatPumpSystem_Impl::resetAncillaryOperationSchedule() { | |
| 292 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_CentralHeatPumpSystemFields::AncillaryOperationScheduleName, ""); |
| 293 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 294 | 1 | } | |
| 295 | |||
| 296 | 7 | ComponentType CentralHeatPumpSystem_Impl::componentType() const { | |
| 297 | // Note (JM): This really depends on which loop is calling this... | ||
| 298 | |||
| 299 | // This component has a tertiary loop, and is placed on the supply side of TWO loops: Heating and Cooling | ||
| 300 | // If it's the supplyLoop (= cooling), we should probably have a PlantEquipmentOperation::CoolingLoad | ||
| 301 | // If it's the tertiaryLoop (= heating), PlantEquipmentOperation::HeatingLoad | ||
| 302 | // Returning BOTH will place it on a PlantEquipmentOperation::Uncontrolled | ||
| 303 | |||
| 304 | // As a result, this is handled in coolingComponents() and heatingComponents() directly | ||
| 305 |
1/1✓ Branch 1 taken 7 times.
|
7 | return ComponentType::None; |
| 306 | } | ||
| 307 | |||
| 308 | ✗ | std::vector<FuelType> CentralHeatPumpSystem_Impl::coolingFuelTypes() const { | |
| 309 | ✗ | std::set<FuelType> result; | |
| 310 | ✗ | result.insert(FuelType::Electricity); | |
| 311 | ✗ | if (auto p_ = sourcePlantLoop()) { | |
| 312 | ✗ | for (auto ft : p_->coolingFuelTypes()) { | |
| 313 | ✗ | result.insert(ft); | |
| 314 | ✗ | } | |
| 315 | ✗ | } | |
| 316 | ✗ | return {result.begin(), result.end()}; | |
| 317 | ✗ | } | |
| 318 | |||
| 319 | ✗ | std::vector<FuelType> CentralHeatPumpSystem_Impl::heatingFuelTypes() const { | |
| 320 | ✗ | std::set<FuelType> result; | |
| 321 | ✗ | result.insert(FuelType::Electricity); | |
| 322 | ✗ | if (auto p_ = sourcePlantLoop()) { | |
| 323 | ✗ | for (auto ft : p_->heatingFuelTypes()) { | |
| 324 | ✗ | result.insert(ft); | |
| 325 | ✗ | } | |
| 326 | ✗ | } | |
| 327 | ✗ | return {result.begin(), result.end()}; | |
| 328 | ✗ | } | |
| 329 | |||
| 330 | ✗ | std::vector<AppGFuelType> CentralHeatPumpSystem_Impl::appGHeatingFuelTypes() const { | |
| 331 | ✗ | std::set<AppGFuelType> result; | |
| 332 | ✗ | result.insert(AppGFuelType::HeatPump); | |
| 333 | ✗ | if (auto p_ = sourcePlantLoop()) { | |
| 334 | ✗ | for (auto ft : p_->appGHeatingFuelTypes()) { | |
| 335 | ✗ | result.insert(ft); | |
| 336 | ✗ | } | |
| 337 | ✗ | } | |
| 338 | ✗ | return {result.begin(), result.end()}; | |
| 339 | ✗ | } | |
| 340 | |||
| 341 | } // namespace detail | ||
| 342 | |||
| 343 | 15 | CentralHeatPumpSystem::CentralHeatPumpSystem(const Model& model) : WaterToWaterComponent(CentralHeatPumpSystem::iddObjectType(), model) { | |
| 344 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
✗ Branch 5 not taken.
|
15 | OS_ASSERT(getImpl<detail::CentralHeatPumpSystem_Impl>()); |
| 345 | |||
| 346 | 15 | bool ok = true; | |
| 347 |
1/1✓ Branch 1 taken 15 times.
|
15 | ok = setAncillaryPower(0.0); |
| 348 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
✗ Branch 3 not taken.
|
15 | OS_ASSERT(ok); |
| 349 | |||
| 350 |
1/1✓ Branch 1 taken 15 times.
|
15 | auto chillerHeaterModuleList = ModelObjectList(model); |
| 351 |
4/4✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
✓ Branch 10 taken 15 times.
|
15 | chillerHeaterModuleList.setName(this->name().get() + " Chiller Heater Module List"); |
| 352 |
2/2✓ Branch 3 taken 15 times.
✓ Branch 6 taken 15 times.
|
15 | ok = getImpl<detail::CentralHeatPumpSystem_Impl>()->setChillerHeaterModuleList(chillerHeaterModuleList); |
| 353 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
✗ Branch 3 not taken.
|
15 | OS_ASSERT(ok); |
| 354 | |||
| 355 | // Perhaps we should by default add one CentralHeatPumpSystemModule | ||
| 356 | // But this is at least caught by the ForwardTranslator right now... | ||
| 357 | 15 | } | |
| 358 | |||
| 359 | 7645 | IddObjectType CentralHeatPumpSystem::iddObjectType() { | |
| 360 |
1/1✓ Branch 1 taken 7645 times.
|
7645 | return {IddObjectType::OS_CentralHeatPumpSystem}; |
| 361 | } | ||
| 362 | |||
| 363 | 4 | double CentralHeatPumpSystem::ancillaryPower() const { | |
| 364 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::CentralHeatPumpSystem_Impl>()->ancillaryPower(); |
| 365 | } | ||
| 366 | |||
| 367 | 8 | boost::optional<Schedule> CentralHeatPumpSystem::ancillaryOperationSchedule() const { | |
| 368 |
1/1✓ Branch 3 taken 8 times.
|
8 | return getImpl<detail::CentralHeatPumpSystem_Impl>()->ancillaryOperationSchedule(); |
| 369 | } | ||
| 370 | |||
| 371 | 17 | bool CentralHeatPumpSystem::setAncillaryPower(double ancillaryPower) { | |
| 372 |
1/1✓ Branch 3 taken 17 times.
|
17 | return getImpl<detail::CentralHeatPumpSystem_Impl>()->setAncillaryPower(ancillaryPower); |
| 373 | } | ||
| 374 | |||
| 375 | 2 | bool CentralHeatPumpSystem::setAncillaryOperationSchedule(Schedule& schedule) { | |
| 376 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::CentralHeatPumpSystem_Impl>()->setAncillaryOperationSchedule(schedule); |
| 377 | } | ||
| 378 | |||
| 379 | 1 | void CentralHeatPumpSystem::resetAncillaryOperationSchedule() { | |
| 380 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::CentralHeatPumpSystem_Impl>()->resetAncillaryOperationSchedule(); |
| 381 | 1 | } | |
| 382 | |||
| 383 | 14 | bool CentralHeatPumpSystem::addModule(const CentralHeatPumpSystemModule& centralHeatPumpSystemModule) { | |
| 384 |
1/1✓ Branch 3 taken 14 times.
|
14 | return getImpl<detail::CentralHeatPumpSystem_Impl>()->addModule(centralHeatPumpSystemModule); |
| 385 | } | ||
| 386 | |||
| 387 | 1 | void CentralHeatPumpSystem::removeModule(const CentralHeatPumpSystemModule& centralHeatPumpSystemModule) { | |
| 388 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::CentralHeatPumpSystem_Impl>()->removeModule(centralHeatPumpSystemModule); |
| 389 | 1 | } | |
| 390 | |||
| 391 | 2 | void CentralHeatPumpSystem::removeAllModules() { | |
| 392 |
1/1✓ Branch 3 taken 2 times.
|
2 | getImpl<detail::CentralHeatPumpSystem_Impl>()->removeAllModules(); |
| 393 | 2 | } | |
| 394 | |||
| 395 | 25 | std::vector<CentralHeatPumpSystemModule> CentralHeatPumpSystem::modules() const { | |
| 396 |
1/1✓ Branch 3 taken 25 times.
|
25 | return getImpl<detail::CentralHeatPumpSystem_Impl>()->modules(); |
| 397 | } | ||
| 398 | |||
| 399 | // Convenience functions | ||
| 400 | 35 | boost::optional<PlantLoop> CentralHeatPumpSystem::coolingPlantLoop() const { | |
| 401 |
1/1✓ Branch 3 taken 35 times.
|
35 | return getImpl<detail::CentralHeatPumpSystem_Impl>()->coolingPlantLoop(); |
| 402 | } | ||
| 403 | |||
| 404 | 22 | boost::optional<PlantLoop> CentralHeatPumpSystem::sourcePlantLoop() const { | |
| 405 |
1/1✓ Branch 3 taken 22 times.
|
22 | return getImpl<detail::CentralHeatPumpSystem_Impl>()->sourcePlantLoop(); |
| 406 | } | ||
| 407 | |||
| 408 | 34 | boost::optional<PlantLoop> CentralHeatPumpSystem::heatingPlantLoop() const { | |
| 409 |
1/1✓ Branch 3 taken 34 times.
|
34 | return getImpl<detail::CentralHeatPumpSystem_Impl>()->heatingPlantLoop(); |
| 410 | } | ||
| 411 | |||
| 412 | /// @cond | ||
| 413 |
1/1✓ Branch 3 taken 55 times.
|
55 | CentralHeatPumpSystem::CentralHeatPumpSystem(std::shared_ptr<detail::CentralHeatPumpSystem_Impl> impl) : WaterToWaterComponent(std::move(impl)) {} |
| 414 | |||
| 415 | // DEPRECATED | ||
| 416 | ✗ | std::vector<std::string> CentralHeatPumpSystem::controlMethodValues() { | |
| 417 | ✗ | DEPRECATED_AT_MSG(3, 12, 0, | |
| 418 | "The Control Method field was removed from the CentralHeatPumpSystem object in EnergyPlus. " | ||
| 419 | "\"SmartMixing\" was the only valid value."); | ||
| 420 | ✗ | return {"SmartMixing"}; | |
| 421 | } | ||
| 422 | |||
| 423 | ✗ | std::string CentralHeatPumpSystem::controlMethod() const { | |
| 424 | ✗ | DEPRECATED_AT_MSG(3, 12, 0, | |
| 425 | "The Control Method field was removed from the CentralHeatPumpSystem object in EnergyPlus. " | ||
| 426 | "This now always returns \"SmartMixing\"."); | ||
| 427 | ✗ | return "SmartMixing"; | |
| 428 | } | ||
| 429 | |||
| 430 | ✗ | bool CentralHeatPumpSystem::setControlMethod(const std::string& controlMethod) { | |
| 431 | ✗ | DEPRECATED_AT_MSG(3, 12, 0, | |
| 432 | "The Control Method field was removed from the CentralHeatPumpSystem object in EnergyPlus. " | ||
| 433 | "This is now a no-op that only accepts \"SmartMixing\"."); | ||
| 434 | ✗ | return istringEqual(controlMethod, "SmartMixing"); | |
| 435 | } | ||
| 436 | |||
| 437 | /// @endcond | ||
| 438 | |||
| 439 | } // namespace model | ||
| 440 | } // namespace openstudio | ||
| 441 |