Skip to content

Commit

Permalink
Merge pull request #1374 from NREL/86020008-ThermalZoneClone
Browse files Browse the repository at this point in the history
86020008 thermal zone clone
  • Loading branch information
evanweaver committed Feb 3, 2015
2 parents fee38fa + 13d8fce commit 6394835
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 5 deletions.
19 changes: 14 additions & 5 deletions openstudiocore/src/model/ThermalZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
#include "SetpointManagerSingleZoneReheat.hpp"
#include "SetpointManagerSingleZoneReheat_Impl.hpp"

#include <utilities/idd/IddFactory.hxx>
#include <utilities/idd/IddFactory.hxx>

#include <utilities/idd/OS_ThermalZone_FieldEnums.hxx>
#include <utilities/idd/OS_ThermalZone_FieldEnums.hxx>
#include <utilities/idd/IddEnums.hxx>

#include "../utilities/geometry/Transformation.hpp"
Expand Down Expand Up @@ -1890,12 +1890,21 @@ namespace detail {
PortList exhaustPortList(tz);
tz.setPointer(OS_ThermalZoneFields::ZoneAirExhaustPortList,exhaustPortList.handle());

SizingZone sizingZone(model,tz);

tz.setUseIdealAirLoads(false);
auto sizingZoneClone = sizingZone().clone(model).cast<SizingZone>();
sizingZoneClone.getImpl<detail::SizingZone_Impl>()->setThermalZone(tz);

ZoneHVACEquipmentList equipmentList(tz);

if( auto t_thermostat = thermostat() ) {
auto thermostatClone = t_thermostat->clone(model).cast<Thermostat>();
tz.setThermostat(thermostatClone);
}

if( auto t_humidistat = zoneControlHumidistat() ) {
auto humidistatClone = t_humidistat->clone(model).cast<ZoneControlHumidistat>();
tz.setZoneControlHumidistat(humidistatClone);
}

return tz;
}

Expand Down
47 changes: 47 additions & 0 deletions openstudiocore/src/model/test/ThermalZone_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
#include "../AirLoopHVACZoneSplitter.hpp"
#include "../Node.hpp"
#include "../Node_Impl.hpp"
#include "../ScheduleRuleset.hpp"
#include "../ScheduleRuleset_Impl.hpp"
#include "../ThermostatSetpointDualSetpoint.hpp"
#include "../ThermostatSetpointDualSetpoint_Impl.hpp"

#include "../../utilities/data/Attribute.hpp"
#include "../../utilities/geometry/Point3d.hpp"
Expand Down Expand Up @@ -520,3 +524,46 @@ TEST_F(ModelFixture, ThermalZone_ZoneControlHumidistat)
thermalZone.resetZoneControlHumidistat();
EXPECT_FALSE(thermalZone.zoneControlHumidistat());
}

TEST_F(ModelFixture, ThermalZone_Clone)
{
Model m;
ThermalZone thermalZone(m);

ZoneControlHumidistat humidistat(m);
thermalZone.setZoneControlHumidistat(humidistat);
ScheduleRuleset humidSchedule(m);
humidistat.setHumidifyingRelativeHumiditySetpointSchedule(humidSchedule);
ScheduleRuleset dehumidSchedule(m);
humidistat.setDehumidifyingRelativeHumiditySetpointSchedule(dehumidSchedule);

ThermostatSetpointDualSetpoint thermostat(m);
thermalZone.setThermostat(thermostat);
ScheduleRuleset coolingSchedule(m);
thermostat.setCoolingSchedule(coolingSchedule);
ScheduleRuleset heatingSchedule(m);
thermostat.setHeatingSchedule(heatingSchedule);

auto thermalZoneClone = thermalZone.clone(m).cast<ThermalZone>();

auto humidistatClone = thermalZoneClone.zoneControlHumidistat();
ASSERT_TRUE(humidistatClone);
ASSERT_NE(humidistatClone.get(),humidistat);
auto humidSchedule2 = humidistatClone->humidifyingRelativeHumiditySetpointSchedule();
ASSERT_TRUE(humidSchedule2);
ASSERT_EQ(humidSchedule,humidSchedule2.get());
auto dehumidSchedule2 = humidistatClone->dehumidifyingRelativeHumiditySetpointSchedule();
ASSERT_TRUE(dehumidSchedule2);
ASSERT_EQ(dehumidSchedule,dehumidSchedule2.get());

auto thermostatClone = thermalZoneClone.thermostat();
ASSERT_TRUE(thermostatClone);
ASSERT_NE(thermostatClone.get(),thermostat);
auto coolingSchedule2 = thermostatClone->cast<ThermostatSetpointDualSetpoint>().coolingSetpointTemperatureSchedule();
ASSERT_TRUE(coolingSchedule2);
ASSERT_EQ(coolingSchedule,coolingSchedule2.get());
auto heatingSchedule2 = thermostatClone->cast<ThermostatSetpointDualSetpoint>().heatingSetpointTemperatureSchedule();
ASSERT_TRUE(heatingSchedule2);
ASSERT_EQ(heatingSchedule,heatingSchedule2.get());
}

5 comments on commit 6394835

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (evanweaver) - x86_64-Linux-Ubuntu-14.04-clang-3.5: OK (2071 of 2191 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (evanweaver) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: Build Failed

Build Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (evanweaver) - i386-Windows-7-VisualStudio-12: OK (2180 of 2191 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (evanweaver) - Win64-Windows-7-VisualStudio-12: OK (2178 of 2191 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (evanweaver) - x86_64-MacOS-10.9-clang: OK (2177 of 2191 tests passed)

Build Badge Test Badge

Please sign in to comment.