Skip to content

Commit

Permalink
AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed: restrict addToNode + fi…
Browse files Browse the repository at this point in the history
…xup clone method
  • Loading branch information
jmarrec committed Dec 18, 2024
1 parent 33fd849 commit 93c150f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
18 changes: 15 additions & 3 deletions src/model/AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
#include "Model_Impl.hpp"
#include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.hpp"
#include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl.hpp"
#include "AirLoopHVAC.hpp"
#include "Node.hpp"
#include "Schedule.hpp"
#include "Schedule_Impl.hpp"
#include "ThermalZone.hpp"
#include "ThermalZone_Impl.hpp"
#include "ScheduleTypeLimits.hpp"
#include "ScheduleTypeRegistry.hpp"
#include "ThermalZone.hpp"
#include "ThermalZone_Impl.hpp"

#include "../utilities/core/Assert.hpp"
#include "../utilities/data/DataEnums.hpp"
Expand Down Expand Up @@ -595,8 +597,18 @@ namespace model {
return OS_AirLoopHVAC_UnitaryHeatPump_AirToAir_MultiSpeedFields::AirOutletNode;
}

bool AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl::addToNode(Node& node) {
if (boost::optional<AirLoopHVAC> airLoop = node.airLoopHVAC()) {
if (airLoop->supplyComponent(node.handle())) {
return StraightComponent_Impl::addToNode(node);
}
}

return false;
}

ModelObject AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl::clone(Model model) const {
auto modelObjectClone = ModelObject_Impl::clone(model).cast<AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed>();
auto modelObjectClone = StraightComponent_Impl::clone(model).cast<AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed>();

if (boost::optional<HVACComponent> supplyFan = this->supplyAirFan()) {
modelObjectClone.setSupplyAirFan(supplyFan->clone(model).cast<HVACComponent>());
Expand Down
13 changes: 8 additions & 5 deletions src/model/AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ namespace model {

virtual std::vector<ScheduleTypeKey> getScheduleTypeKeys(const Schedule& schedule) const override;

virtual std::vector<ModelObject> children() const override;

virtual unsigned inletPort() const override;
virtual unsigned outletPort() const override;
virtual bool addToNode(Node& node) override;

virtual ModelObject clone(Model model) const override;

virtual ComponentType componentType() const override;
virtual std::vector<FuelType> coolingFuelTypes() const override;
virtual std::vector<FuelType> heatingFuelTypes() const override;
Expand Down Expand Up @@ -236,11 +244,6 @@ namespace model {
/** @name Other */
//@{

virtual unsigned inletPort() const override;
virtual unsigned outletPort() const override;
std::vector<ModelObject> children() const override;
ModelObject clone(Model model) const override;

//@}
protected:
private:
Expand Down

0 comments on commit 93c150f

Please sign in to comment.