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

Revision history [back]

PlantLoop::addDemandBranchForComponent is indeed the canonical way to connect a coil to the demand side of a PlantLoop, it'll create a branch for you.

HVACComponent have a addToNode(Node&) method if you want to connect them to a specific location on a PlantLoop/AirLoopHVAC. https://openstudio-sdk-documentation.s3.amazonaws.com/cpp/OpenStudio-3.4.0-doc/model/html/classopenstudio_1_1model_1_1_h_v_a_c_component.html#a3457f7e190a0d3fce5511e7f4da4001c

PlantLoop::addSupplyBranchForComponent can be used to the same stuff on the supply side (eg: PlantLoop::addSupplyBranchForComponent(boiler) would create a new branch for that boiler).

The canonical way to connect a ThermalZone via an AirTerminal to an AirLoopHVAC is AirLoopHVAC.addBranchForZone(openstudio::model::ThermalZone &thermalZone, openstudio::model::HVACComponent &airTerminal)

The OpenStudio-resources is a nice place to find examples in Ruby. Those are our regression tests, but they double as a demonstration of the API. Look into the folder https://github.com/NREL/OpenStudio-resources/tree/develop/model/simulationtests and you'll find many .rb files.

Here is an example that showcases some of what I just said for eg: https://github.com/NREL/OpenStudio-resources/blob/d46885bb09f5a6791a85a38ea9e75c9198cce262/model/simulationtests/airterminal_inletsidemixer.rb#L56-L65