Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

I recently added a cycling PTAC to the hvac library in OpenStudio, along with several variations of fan coils. This will roll out with version 1.7.0. I thought I would share how I did this, because I think it will be useful to some people on this forum. @aparker's solution is good because it is simple and low overhead. But editing the hvac_library.osm file directly is tricky, and can potentially corrupt the library if there are large changes that add and remove objects. When we work with osm files at NREL we almost always use the API that many of you are using to write Measures as opposed to editing osm directly. Here is the Ruby code that I used to add to the hvac library. If you save this as a Ruby file and run it from the directory where the hvac library osm file is installed C:\Program Files\OpenStudio 1.6.0\share\openstudio-1.6.0\OSApp\hvaclibrary you will have a new PTAC and four new variations of fan coil in your model. If you are already writing OpenStudio Measures you will find this syntax natural and you can probably imagine adding other items to the library that you may want.

require 'openstudio'

# Load current library and bring up to current version
version_translator = OpenStudio::OSVersion::VersionTranslator.new
m = version_translator.loadModel('hvac_library.osm').get 

# Get the model's built in always on schedule
s = m.alwaysOnDiscreteSchedule

# ConstantFanVariableFlow

name = 'Fan Coil with Const Fan Var Fluid Flow'
fan = OpenStudio::Model::FanConstantVolume.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('ConstantFanVariableFlow');

# CyclingFan

name = 'Fan Coil with Cycling Fan'
fan = OpenStudio::Model::FanOnOff.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('CyclingFan');

# VariableFanVariableFlow

name = 'Fan Coil with Var Fan Var Fluid Flow'
fan = OpenStudio::Model::FanVariableVolume.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('VariableFanVariableFlow');

# VariableFanConstantFlow

name = 'Fan Coil with Var Fan Const Fluid Flow'
fan = OpenStudio::Model::FanVariableVolume.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('VariableFanConstantFlow');

# Cycling PTAC

# Make an always-zero schedule for the PTAC fan
twenty_four_hrs = OpenStudio::Time.new(0,24,0,0)
ptac_fan_mode_sch = OpenStudio::Model::ScheduleRuleset.new(m)
ptac_fan_mode_sch.setName("Cycling PTAC Fan Mode Always Zero")
ptac_fan_mode_sch.defaultDaySchedule().setName("Cycling PTAC Fan Mode Sch Default")
ptac_fan_mode_sch.defaultDaySchedule().addValue(twenty_four_hrs,0)

fan = OpenStudio::Model::FanOnOff.new(m)
fan.setName("Cycling PTAC Fan")
fan.setPressureRise(250)

htg_coil = OpenStudio::Model::CoilHeatingWater.new(m)
htg_coil.setName("Cycling PTAC HW Htg Coil")

clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(m)
clg_coil.setName("Cycling PTAC 1 Spd DX Clg Coil")

ptac = OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner.new(m,s,fan,htg_coil,clg_coil)
ptac.setName("Cycling PTAC DX Clg HW Htg")
ptac.setSupplyAirFanOperatingModeSchedule(ptac_fan_mode_sch)

m.save 'hvac_library.osm',true

I recently added a cycling PTAC to the hvac library in OpenStudio, along with several variations of fan coils. This will roll out with version 1.7.0. I thought I would share how I did this, because I think it will be useful to some people on this forum. @aparker's solution is good because it is simple and low overhead. But editing the hvac_library.osm file directly is tricky, and can potentially corrupt the library if there are large changes that add and remove objects. When we work with osm files at NREL we almost always use the API that many of you are using to write Measures as opposed to editing osm directly. Here is the Ruby code that I used to add to the hvac library. If you save this as a Ruby file and run it from the directory where the hvac library osm file is installed C:\Program Files\OpenStudio 1.6.0\share\openstudio-1.6.0\OSApp\hvaclibrary you will have a new PTAC and four new variations of fan coil in your model. If you are already writing OpenStudio Measures you will find this syntax natural and you can probably imagine adding other items to the library that you may want.

require 'openstudio'

# Load current library and bring up to current version
version_translator = OpenStudio::OSVersion::VersionTranslator.new
m = version_translator.loadModel('hvac_library.osm').get 

# Get the model's built in always on schedule
s = m.alwaysOnDiscreteSchedule

# ConstantFanVariableFlow

name = 'Fan Coil with Const Fan Var Fluid Flow'
fan = OpenStudio::Model::FanConstantVolume.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('ConstantFanVariableFlow');

# CyclingFan

name = 'Fan Coil with Cycling Fan'
fan = OpenStudio::Model::FanOnOff.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('CyclingFan');

# VariableFanVariableFlow

name = 'Fan Coil with Var Fan Var Fluid Flow'
fan = OpenStudio::Model::FanVariableVolume.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('VariableFanVariableFlow');

# VariableFanConstantFlow

name = 'Fan Coil with Var Fan Const Fluid Flow'
fan = OpenStudio::Model::FanVariableVolume.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('VariableFanConstantFlow');

# Cycling PTAC
PTAC - Hot Water Heating

# Make an always-zero schedule for the PTAC fan
twenty_four_hrs = OpenStudio::Time.new(0,24,0,0)
ptac_fan_mode_sch = OpenStudio::Model::ScheduleRuleset.new(m)
ptac_fan_mode_sch.setName("Cycling PTAC Fan Mode Always Zero")
ptac_fan_mode_sch.defaultDaySchedule().setName("Cycling PTAC Fan Mode Sch Default")
ptac_fan_mode_sch.defaultDaySchedule().addValue(twenty_four_hrs,0)

fan = OpenStudio::Model::FanOnOff.new(m)
fan.setName("Cycling PTAC Fan")
fan.setPressureRise(250)

htg_coil = OpenStudio::Model::CoilHeatingWater.new(m)
htg_coil.setName("Cycling PTAC HW Htg Coil")

clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(m)
clg_coil.setName("Cycling PTAC 1 Spd DX Clg Coil")

ptac = OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner.new(m,s,fan,htg_coil,clg_coil)
ptac.setName("Cycling PTAC DX Clg HW Htg")
ptac.setSupplyAirFanOperatingModeSchedule(ptac_fan_mode_sch)

# Cycling PTAC - Gas Heating

fan = OpenStudio::Model::FanOnOff.new(m)
fan.setName("Cycling Gas PTAC Fan ")
fan.setPressureRise(250)

htg_coil = OpenStudio::Model::CoilHeatingGas.new(m)
htg_coil.setName("Cycling PTAC Gas Htg Coil")

clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(m)
clg_coil.setName("Cycling Gas PTAC 1 Spd DX Clg Coil")

ptac = OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner.new(m,s,fan,htg_coil,clg_coil)
ptac.setName("Cycling PTAC DX Clg Gas Htg")
ptac.setSupplyAirFanOperatingModeSchedule(ptac_fan_mode_sch)

# Cycling PTAC - Electric Heating

fan = OpenStudio::Model::FanOnOff.new(m)
fan.setName("Cycling Elec PTAC Fan ")
fan.setPressureRise(250)

htg_coil = OpenStudio::Model::CoilHeatingGas.new(m)
htg_coil.setName("Cycling PTAC Elec Htg Coil")

clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(m)
clg_coil.setName("Cycling Elec PTAC 1 Spd DX Clg Coil")

ptac = OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner.new(m,s,fan,htg_coil,clg_coil)
ptac.setName("Cycling PTAC DX Clg Elec Htg")
ptac.setSupplyAirFanOperatingModeSchedule(ptac_fan_mode_sch)

m.save 'hvac_library.osm',true

I recently added a cycling PTAC to the hvac library in OpenStudio, along with several variations of fan coils. This will roll out with version 1.7.0. I thought I would share how I did this, because I think it will be useful to some people on this forum. @aparker's solution is good because it is simple and low overhead. But editing the hvac_library.osm file directly is tricky, and can potentially corrupt the library if there are large changes that add and remove objects. When we work with osm files at NREL we almost always use the API that many of you are using to write Measures as opposed to editing osm directly. Here is the Ruby code that I used to add to the hvac library. If you save this as a Ruby file and run it from the directory where the hvac library osm file is installed C:\Program Files\OpenStudio 1.6.0\share\openstudio-1.6.0\OSApp\hvaclibrary you will have a new PTAC and four new variations of fan coil in your model. If you are already writing OpenStudio Measures you will find this syntax natural and you can probably imagine adding other items to the library that you may want.

require 'openstudio'

# Load current library and bring up to current version
version_translator = OpenStudio::OSVersion::VersionTranslator.new
m = version_translator.loadModel('hvac_library.osm').get 

# Get the model's built in always on schedule
s = m.alwaysOnDiscreteSchedule

# ConstantFanVariableFlow

name = 'Fan Coil with Const Fan Var Fluid Flow'
fan = OpenStudio::Model::FanConstantVolume.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('ConstantFanVariableFlow');

# CyclingFan

name = 'Fan Coil with Cycling Fan'
fan = OpenStudio::Model::FanOnOff.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('CyclingFan');

# VariableFanVariableFlow

name = 'Fan Coil with Var Fan Var Fluid Flow'
fan = OpenStudio::Model::FanVariableVolume.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('VariableFanVariableFlow');

# VariableFanConstantFlow

name = 'Fan Coil with Var Fan Const Fluid Flow'
fan = OpenStudio::Model::FanVariableVolume.new m
fan.setName name + ' - Fan'
heating_coil = OpenStudio::Model::CoilHeatingWater.new m
heating_coil.setName name + ' - Heating Coil'
cooling_coil = OpenStudio::Model::CoilCoolingWater.new m
cooling_coil.setName name + ' - Cooling Coil'

fan_coil = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new m,s,fan,cooling_coil,heating_coil
fan_coil.setName name
fan_coil.setCapacityControlMethod('VariableFanConstantFlow');

# Cycling PTAC - Hot Water Heating

# Make an always-zero schedule for the PTAC fan
twenty_four_hrs = OpenStudio::Time.new(0,24,0,0)
ptac_fan_mode_sch = OpenStudio::Model::ScheduleRuleset.new(m)
ptac_fan_mode_sch.setName("Cycling PTAC Fan Mode Always Zero")
ptac_fan_mode_sch.defaultDaySchedule().setName("Cycling PTAC Fan Mode Sch Default")
ptac_fan_mode_sch.defaultDaySchedule().addValue(twenty_four_hrs,0)

fan = OpenStudio::Model::FanOnOff.new(m)
fan.setName("Cycling PTAC Fan")
fan.setPressureRise(250)

htg_coil = OpenStudio::Model::CoilHeatingWater.new(m)
htg_coil.setName("Cycling PTAC HW Htg Coil")

clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(m)
clg_coil.setName("Cycling PTAC 1 Spd DX Clg Coil")

ptac = OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner.new(m,s,fan,htg_coil,clg_coil)
ptac.setName("Cycling PTAC DX Clg HW Htg")
ptac.setSupplyAirFanOperatingModeSchedule(ptac_fan_mode_sch)

# Cycling PTAC - Gas Heating

fan = OpenStudio::Model::FanOnOff.new(m)
fan.setName("Cycling Gas PTAC Fan ")
fan.setPressureRise(250)

htg_coil = OpenStudio::Model::CoilHeatingGas.new(m)
htg_coil.setName("Cycling PTAC Gas Htg Coil")

clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(m)
clg_coil.setName("Cycling Gas PTAC 1 Spd DX Clg Coil")

ptac = OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner.new(m,s,fan,htg_coil,clg_coil)
ptac.setName("Cycling PTAC DX Clg Gas Htg")
ptac.setSupplyAirFanOperatingModeSchedule(ptac_fan_mode_sch)

# Cycling PTAC - Electric Heating

fan = OpenStudio::Model::FanOnOff.new(m)
fan.setName("Cycling Elec PTAC Fan ")
fan.setPressureRise(250)

htg_coil = OpenStudio::Model::CoilHeatingGas.new(m)
OpenStudio::Model::CoilHeatingElectric.new(m)
htg_coil.setName("Cycling PTAC Elec Htg Coil")

clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(m)
clg_coil.setName("Cycling Elec PTAC 1 Spd DX Clg Coil")

ptac = OpenStudio::Model::ZoneHVACPackagedTerminalAirConditioner.new(m,s,fan,htg_coil,clg_coil)
ptac.setName("Cycling PTAC DX Clg Elec Htg")
ptac.setSupplyAirFanOperatingModeSchedule(ptac_fan_mode_sch)

m.save 'hvac_library.osm',true