Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloning building doesn't bring over thermostatSetpointDualSetpoint #978

Closed
DavidGoldwasser opened this issue Apr 13, 2014 · 4 comments
Closed

Comments

@DavidGoldwasser
Copy link
Collaborator

Cloning building from one model to another doesn't bring over thermostats. Directly cloning thermal zones has the same results. @kbenne is this the desired behavior? It makes it tricky for me to bring in ref buildings because I need to bring in and re-wire zones to thermostats manually, (FYI my workflow is to translate ref IDF to model2, and then clone that building into the original model.

Water use equipment doesn't come in either, but that is how I expect that worked, but still isn't ideal.

cc: @asparke2

@DavidGoldwasser
Copy link
Collaborator Author

This is made particularly tricky because both the thermal zones and the thermostats each get new UUID's when cloned in vs. preserving the original ones. Issue #870 is directly related to this.

It also isn't ideal that thermostats and setpoint schedules use UUID's for names, both for readability in app, and in E+ errors/warnings. Plus it also makes diffing files with each other because every time I generate it the names are different. Thermostat and setpoint schedules should be named after thermal zone they serve (when used as non-shared thermostat as they are in reverse translation)

OS:ThermostatSetpoint:DualSetpoint,
{014c041c-0268-4249-9dc8-b73a3e919d23}, !- Handle
{e312ef53-5871-49d7-8c2d-f83a157a39bf}, !- Name
{d3c20ff1-2d06-44d8-894c-700c532c29b3}, !- Heating Setpoint Temperature Schedule Name
{e3095225-7df7-4f08-bd66-a15004cbe5e9}; !- Cooling Setpoint Temperature Schedule Name

@DavidGoldwasser
Copy link
Collaborator Author

Not pretty, but this works for now to address both issues.

# translate IDF file to OSM
workspace = OpenStudio::Workspace::load(OpenStudio::Path.new(source_idf_path))
rt = OpenStudio::EnergyPlus::ReverseTranslator.new
model2 = rt.translateWorkspace(workspace.get)

# remove original building
building = model.getBuilding
building.remove

# clone in building from IDF
building2 = model2.getBuilding
building2.clone(model)

# hash of old and new thermostats
thermostatOldNewHash = {}

# cloning thermostats
thermostats = model2.getThermostatSetpointDualSetpoints
thermostats.each do |thermostat|
  newThermostat = thermostat.clone(model)
  # populate hash
  thermostatOldNewHash[thermostat] = newThermostat
end

# loop through thermal zone to match old to new and assign thermostat
thermalZonesOld = model2.getThermalZones
thermalZonesNew = model.getThermalZones
thermalZonesOld.each do |thermalZoneOld|
  thermalZonesNew.each do |thermalZoneNew|
    if thermalZoneOld.name.to_s == thermalZoneNew.name.to_s
      # wire thermal zone to thermostat
      if not thermalZoneOld.thermostatSetpointDualSetpoint.empty?
        thermostatOld = thermalZoneOld.thermostatSetpointDualSetpoint.get
        thermalZoneNew.setThermostatSetpointDualSetpoint(thermostatOldNewHash[thermostatOld].to_ThermostatSetpointDualSetpoint.get)
      end
      next
    end
  end
end # end of thermalZonesOld.each do

I'll have to do something similar for SHW, but that doesn't even make it trough reverse translation, so I'll have to extract it directly out of the IDF file and then make OSM objects with the same water use demand.

@macumber
Copy link
Contributor

macumber commented Mar 3, 2015

@kbenne is this fixed? Can you close it?

@macumber
Copy link
Contributor

macumber commented Mar 3, 2015

@kbenne nevermind, I accepted the pivotal ticket I will close

@macumber macumber closed this as completed Mar 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants