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

OpenStudio SDK Connect Coil to PlantLoop

asked 2022-05-06 14:00:38 -0600

updated 2022-05-09 09:12:23 -0600

I have 100 plus Coil:Heating:Water components that I would like to connect to the Heating Hot Water Plant Loop. Is there a method in the OpenStudio SDK for connecting a coil object to the plant loop object?

I think there is a way to do this in the SDK but I'm having trouble figuring out the method. I have returned a list of the coils and plant loops but can't figure out how to connect them. Examples in python would be my preference but others are welcome.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2022-05-09 03:53:23 -0600

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....

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-re... 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-re...

edit flag offensive delete link more

Comments

Does the addToNode(Node&) method required the creation of the splitters and mixers and other node components or are those created automatically? I'm guessing it requires more manual creation of all the connectors?

Thank you for the tip on adding a ThermalZone and AirTerminal, I will absolutely be using those in the future!

These example files you shared are excellent! They show a lot of the methods I was looking for. Thank you for sharing them!

Are the add_geometry, add_windows, and add_hvac methods available in the OpenStudio SDK or are they part of the simulationtest?

JustinShultz's avatar JustinShultz  ( 2022-05-09 08:17:37 -0600 )edit
1

add_xx are helpers from https://github.com/NREL/OpenStudio-re...

addToNode does require more manual work. If you really want to know, PlantLoop's ctor creates some loop topology for you. For eg supply side: a supply inlet node, a splitter, a connection node, a mixer, a supply outlet node. See this: m = Model.new; p = PlantLoop.new(m); p.supplyComponents.map{|c| c.nameString} => ["Node 1", "Connector Splitter 1", "Node 3", "Connector Mixer 1", "Node 2"]

Julien Marrec's avatar Julien Marrec  ( 2022-05-12 01:48:30 -0600 )edit
1

Thanks for sharing the baseline_model.rb files in lib. That seems incredibly powerful for quick setups.

Thank you for sharing the OpenStudio src. It's good to see what the SDK is doing in the background! It's a good way to search all the methods quickly too.

JustinShultz's avatar JustinShultz  ( 2022-05-13 07:53:31 -0600 )edit
3

answered 2022-05-06 15:26:45 -0600

updated 2022-05-06 15:27:30 -0600

I was able to figure out the answer to this question. Though if others come up with a more creative solution, let me know.

My flaw was that I was looking in the Coil:Heating:Water component for a method to connect to a plant loop. Instead, I needed to look at the plant loop and use the addDemandBranchForComponet(coil) method to connect the coil on the demand side of the loop.

Here is a python juyter notebook with the method applied: PythonConnectReheatCoilsToHotWaterPlantLoop.ipynb

edit flag offensive delete link more

Comments

1

You could also use plant_loop_object.sizingPlant.loopType == 'Heating' to make your script more generic rather than relying on the plant_loop_object.name == 'Hot Water Loop' check. However, additional filtering would be necessary for service hot water loops.

MatthewSteen's avatar MatthewSteen  ( 2022-05-09 16:30:07 -0600 )edit

Thank you for the suggestion. I was also looking for a Type method for the coils. Is there a similar method?

JustinShultz's avatar JustinShultz  ( 2022-05-10 08:22:48 -0600 )edit
1

In Ruby, there's the object.class method, which will return the entire class i.e. OpenStudio::Model::CoilHeatingWater. In Python, the type(object) probably returns similar.

For the spreadsheet tool I helped develop, we extended OpenStudio::Model::ModelObject with a get_class_name method.

class OpenStudio::Model::ModelObject

  # returns a string of a model object's class name
  def get_class_name
    return self.class.to_s.gsub('OpenStudio::Model::', '')
  end

end
MatthewSteen's avatar MatthewSteen  ( 2022-05-10 08:54:53 -0600 )edit
1

Julien's to_actual_objectmethod is also helpful to avoid all the casting that is required without it. https://unmethours.com/question/17616...

MatthewSteen's avatar MatthewSteen  ( 2022-05-10 08:56:54 -0600 )edit

These are very helpful examples. Thank you for sharing them! I'll see if I can convert them to python for my applications.

JustinShultz's avatar JustinShultz  ( 2022-05-13 07:47:36 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2022-05-06 14:00:38 -0600

Seen: 261 times

Last updated: May 09 '22