Open DavidGoldwasser opened 7 years ago
Here's what I tried:
require 'openstudio'
include OpenStudio::Model
m = Model.new
z = ThermalZone.new(m)
outdoor_unit = AirConditionerVariableRefrigerantFlow.new(m)
vrf = ZoneHVACTerminalUnitVariableRefrigerantFlow.new(m)
outdoor_unit.addTerminal(vrf)
vrf.addToThermalZone(z)
baseboard = ZoneHVACBaseboardConvectiveElectric.new(m)
baseboard.addToThermalZone(z)
b = m.getBuilding
puts "Before clone, Original model has #{m.getAirConditionerVariableRefrigerantFlows.size} Outdoor VRF Units, " +
"#{m.getZoneHVACTerminalUnitVariableRefrigerantFlows.size} VRF terminals, " +
"#{m.getZoneHVACBaseboardConvectiveElectrics.size} baseboards"
m2 = Model.new
b.clone(m2)
puts "After clone, Original model has #{m.getAirConditionerVariableRefrigerantFlows.size} Outdoor VRF Units, " +
"#{m.getZoneHVACTerminalUnitVariableRefrigerantFlows.size} VRF terminals, " +
"#{m.getZoneHVACBaseboardConvectiveElectrics.size} baseboards"
puts "After clone, Target model has #{m2.getAirConditionerVariableRefrigerantFlows.size} Outdoor VRF Units, " +
"#{m2.getZoneHVACTerminalUnitVariableRefrigerantFlows.size} VRF terminals, " +
"#{m2.getZoneHVACBaseboardConvectiveElectrics.size} baseboards"
Result:
Before clone, Original model has 1 Outdoor VRF Units, 1 VRF terminals, 1 baseboards
After clone, Original model has 1 Outdoor VRF Units, 1 VRF terminals, 1 baseboards
After clone, Target model has 0 Outdoor VRF Units, 0 VRF terminals, 0 baseboards
I'm having a hard time figuring out what your problem was: whether the VRFs are removed from the original model, or not included in the target model? Perhaps this is fixed now?
@DavidGoldwasser could you give an minimal example if I missed your problem?
@jmarrec b.clone(m2)
should be cloning the building b' into model
m2`. Model 'm2' should no longer be empty. If you look at zones and spaces size it probably already matches the original model.
Here is code in measure where I replace the building from the model passed into the measure with a building from a user provided model. https://github.com/NREL/OpenStudio-measures/blob/develop/nrel_dev/clone_building_from_external_model/measure.rb#L80-L81
So, should the title of the issue be changed to "building.clone should clone HVAC" ?
@jmarrec it already clones most of the HVAC objects; zone equipment, air loops and plant loops. For some reason doesn't VRF's are not included in that. The primary model objects that should not be included are simulation settings, site related objects, and output requests.
Does it really clone Airloops and plant loops? I'd be surprised if it did, given the implementation of Building::clone here.
A dumb test shows it appears not to:
m = Model.new
z = ThermalZone.new(m)
a = AirLoopHVAC.new(m)
atu = AirTerminalSingleDuctConstantVolumeNoReheat.new(m, m.alwaysOnDiscreteSchedule)
a.addBranchForZone(z, atu)
m2 = Model.new
b = m.getBuilding
b.clone(m2)
puts "m2 has #{m2.getAirLoopHVACs.size} AirLoopHVACs"
m2 has 0 AirLoopHVACs
I may have mis-understood what it clones, you can re-assign to me and I can close it if this is expected behavior. This isn't anything necessary for 2.8.0
I don't think there's any bug right now indeed. "Severity Major Bug" has to go.
Like I said above, I'm fine with changing the title to "building.clone should clone HVAC" and relabeling to "Enhancement Request" if that's what we want.
My two cents:
Hit this on net zero school work. which clones building in first measure to pick primary or secondary custom seed. VRF's in those seeds are removed when this happens. I worked around this by writing a downstream measure to add VRF's vs. relying on them being in the seed model.
This happens to both AirConditionerVariableRefrigerantFlow and ZoneHVACTerminalUnitVariableRefrigerantFlow objects
A related issue to this is #1571 which shows building.clone breaking surface matching.