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

Revision history [back]

Here is the link to API documentation for SiteGroundTemperatureBuildingSurface. There are similar pages for SiteGroundTemperatureShallow and SiteGroundTemperatureDeep.

To get the site ground objets in the model use this code.

ground_temps = model.getSiteGroundTemperatureBuildingSurface

You can then set each month's temperature manually using this method

ground_temps.setJanuaryGroundTemperature(10.0) # takes double value for degrees C

If you are going to set all of the months, you can save an array of temperatures and use setTemperatureByMonth method as shown below.

temps_array = [10.0,11.0,12.0,13.0,13.0,13.0,13.0,13.0,13.0,12.0,11.0,10.0]
temps_array.each_with_index do |temp,index|
  ground_temps.setTemperatureByMonth(index+1,temp)
end

You can just drop the code above in the run section of a new measure. You can ignore the existing measure argument and just have hard coded temperatures, or you can create either a series of double arguments for each month, or a single string argument that would take comma separated values. If you have a comma separated string you can convert it to an array with code below. If you use this when you use an array entry may need to add '.to_f' to make sure it functions as a number, but may not be necessary.

temps_array = argument_string.split(',')