MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / clone

Method clone

src/model/CentralHeatPumpSystem.cpp:91–116  ·  view source on GitHub ↗

This will clone the CentralHeatPumpSystem as well as the CentralHeatPumpSystemModules if there are some and will return a reference to the new CentralHeatPumpSystem

Source from the content-addressed store, hash-verified

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 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 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 auto newChillerHeaterModuleList = ModelObjectList(model);
99 newChillerHeaterModuleList.setName(newCentralHP.name().get() + " Chiller Heater Module List");
100 bool ok = true;
101 ok = newCentralHP.getImpl<detail::CentralHeatPumpSystem_Impl>()->setChillerHeaterModuleList(newChillerHeaterModuleList);
102 OS_ASSERT(ok);
103
104 // Now, the matter is to repopulate it.
105 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 auto centralHPModClone = centralHPMod.clone(model).cast<CentralHeatPumpSystemModule>();
110
111 // Add that to the new object
112 newCentralHP.addModule(centralHPModClone);
113 }
114
115 return std::move(newCentralHP);
116 }
117
118 // CoolingLoop
119 unsigned CentralHeatPumpSystem_Impl::supplyInletPort() const {

Callers

nothing calls this directly

Calls 8

modulesMethod · 0.95
addModuleMethod · 0.80
ModelObjectListClass · 0.70
cloneFunction · 0.50
setNameMethod · 0.45
getMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected