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

Revision history [back]

This is straightforward with the OpenStudio SDK.

Create a ZoneHVACFourPipeFanCoil object for each zone. Each FCU requires a schedule, fan, cooling coil, and a heating coil to create the object. The heating coil can be an electric resistance coil.

Example script:

require 'openstudio' # load the OpenStudio SDK

# logic to load the model in the current version of the SDK
osm_path = OpenStudio::Path.new("C:/Users/yourname/Desktop/model.osm")
translator = OpenStudio::OSVersion::VersionTranslator.new
model = translator.loadModel(osm_path)
model = model.get

# create an array of zones served by FCUs
zones = model.getThermalZones # this returns all zones in the model
# there are many other ways you can create an array of zones, e.g. by space names, zone names, from a .csv file, etc.
# for example, choose only zones with "served by FCU" in name
zones = zones.select {|zone| zone.name.to_s.include? "served by FCU"}

# reference a chilled water loop in your model
chilled_water_loop = model.getPlantLoopByName("Chilled Water Loop").get

# loop through each zone and add an FCU
zones.each do |zone|

  # create a coil cooling water
  clg_coil = OpenStudio::Model::CoilCoolingWater.new(model)
  clg_coil.setName("#{zone.name.to_s} FCU Cooling Coil")
  chilled_water_loop.addDemandBranchForComponent(clg_coil) # add to chilled water loop
  clg_coil.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  clg_coil.setHeatExchangerConfiguration('CrossFlow')
  # set cooling coil design temperatures if desired
  # clg_coil.setDesignInletWaterTemperature()
  # clg_coil.setDesignInletAirTemperature()
  # clg_coil.setDesignOutletAirTemperature()
  # coil controller properties
  clg_coil_controller = clg_coil.controllerWaterCoil.get
  clg_coil_controller.setName("#{clg_coil.name.to_s} Controller")
  clg_coil_controller.setMinimumActuatedFlow(0.0)

  # create an electric heating coil
  htg_coil = OpenStudio::Model::CoilHeatingElectric.new(model)
  htg_coil.setName("#{zone.name.to_s} FCU Electric Heating Coil")
  htg_coil.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  htg_coil.setEfficiency(1.0)

  # create a fan onoff
  fan = OpenStudio::Model::FanOnOff.new(model)
  fan.setName("#{zone.name.to_s} FCU Fan")
  fan.setPressureRise(300.0) # pa
  fan.setFanEfficiency(0.60)
  fan.setMotorEfficiency(0.80)
  fan.setMotorInAirstreamFraction(1.0)
  fan.setEndUseSubcategory("FCU Fans")
  fan.setAvailabilitySchedule(model.alwaysOnDiscreteSchedule)
  fan.autosizeMaximumFlowRate

  # create a fan coil unit with these objects
  fcu = OpenStudio::Model::ZoneHVACFourPipeFanCoil.new(model,
                                                       model.alwaysOnDiscreteSchedule,
                                                       fan,
                                                       clg_coil,
                                                       htg_coil)
  fcu.setName("#{zone.name} FCU")
  fcu.setCapacityControlMethod('CyclingFan')
  fcu.autosizeMaximumSupplyAirFlowRate
  fcu.setMaximumOutdoorAirFlowRate(0.0) # no outdoor ventilation from FCUs
  fcu.addToThermalZone(zone)
end

path = "C:/Users/yourname/Desktop/model_new.osm"
model.save(path,true)

The Prototype.hvac_system has plenty of examples for building all different kinds of HVAC systems. Use can use the methods directly with require 'openstudio-standards', or copy them into your own scripts.

See the OpenStudio measure writing guide if you'd like to expand this into an OpenStudio measure.