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

Ground temperature in openstudio

asked 2018-01-04 03:10:54 -0500

Manuel's avatar

I wanted to change the ground temperature in openstudio. I saw in other posts that default is set at 18 ° C. I tried to follow some other posts, but with poor results, I'm a freshman of openstudio and I'm not able to use energy plus. I tried to copy this post but, despite not reporting errors, it fails to load into the model. this post I do not even know how to basting it. does anyone have the patience to give me a hand? I would be interested in setting the monthly averages of the outdoor air as monthly temperatures of the ground. if a measure were possible in such a way as to use it also in future works it would not be bad. thank you all

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2018-01-04 04:54:30 -0500

Avi's avatar

After some reading in the Engineering Reference I decided that for my application (Residential) a good solution would be to use the Foundation Kiva, Rather then setting the ground temperature to the average monthly air temperature. The Input Output Reference is stating:

Caution: The “undisturbed” ground temperatures calculated by the weather converter should not be used in building losses but are appropriate to be used in the Site:GroundTemperature:Shallow and Site:GroundTemperature:Deep objects. The reasoning (for building losses) is that these values are too extreme for the soil under a conditioned building. For best results, use the Slab or Basement program described in this document to calculate custom monthly average ground temperatures (see the Ground Heat Transfer section). This is especially important for residential applications and very small buildings. If one of these ground temperature preprocessors is not used, for typical commercial buildings in the USA, a reasonable default value is 2C less than the average indoor space temperature.

You can read about the theory behind Foundation Kiva in the Engineering Reference from page 144 and on. You are welcome to use the E+ Measures I wrote to include Foundation Kiva and for Kiva settings at your own risk.

edit flag offensive delete link more


the problem is created when I calculate the model without hvac systems. I have a supermarket as a model. 3 walls on 4 against ground, so modeled in winter with external temperature 0 ° C and without heating system, the internal temperature does not drop below 17 ° C. doing so when I insert the hvac system, at night with the thermostat off, the temperature would not drop below 18 ° C.

Manuel's avatar Manuel  ( 2018-01-05 02:14:14 -0500 )edit

Have you tried running the model with the Kiva measures?

Avi's avatar Avi  ( 2018-01-05 03:09:34 -0500 )edit

not yet. I have to click on apply measure. create a new one from the template. and make a paste copy of the link code in the .RB file, right?

Manuel's avatar Manuel  ( 2018-01-05 04:33:42 -0500 )edit

Yes that should work

Avi's avatar Avi  ( 2018-01-05 04:37:25 -0500 )edit

I can not make it go. gives me errors: [12: 54: 53.930441 ERROR] Could not set argument 'footWallConstName' to value 'concrete'

Manuel's avatar Manuel  ( 2018-01-05 06:00:32 -0500 )edit

answered 2023-04-18 08:36:07 -0500

cdv23's avatar

Hey, I have the same problem, but I don't know where I have to add the code above? Could someone explain in a more detailed way, what I should do to change the ground temp with this code?

Greetings :)

edit flag offensive delete link more


Refer to OpenStudio's Measure Writer's Reference Guide. The code above would go in the "measure.rb" file of a measure folder. If you create your measure using the "Create Measure Button" on the "Measures" tab of OpenStudio application then it will automatically generate the measure folder and associated files for you. Then you can swap out the code in "measure.rb".

anchapin's avatar anchapin  ( 2023-04-18 09:04:42 -0500 )edit

While @anchapin and others are correctly pointing you towards an OpenStudio Measure (or even a simpler, SDK Ruby script) to safely add monthly ground temperatures in your model, it is usually pretty safe (if you're in a rush) to simply copy/paste the input directly in the .osm file, as suggested here. Make sure its Handle is unique. Not recommended for most classes, but somewhat OK for higher level ones. Try it out on a copy of your model.

Denis Bourgeois's avatar Denis Bourgeois  ( 2023-04-18 12:20:00 -0500 )edit

answered 2021-01-29 04:32:50 -0500

Iswarya M Mohan's avatar

updated 2021-01-29 04:33:33 -0500

You could try using the following code, but I have set only a single input variable that will set the temperature for the entire year. Monthly variation has not been provided for. You could create more input variables as per your convenience.

class AddGroundTemperatures < OpenStudio::Measure::ModelMeasure

  #define the name that a user will see
  def name
    return "Add user defined monthly Ground Temperatures"

  # human readable description
  def description
    return 'Set the ground temperature to user-defined values for all months'

  # human readable description of modeling approach
  def modeler_description
    return 'Adds a specific ground temperature overriding the default energyplus ground temperature of 18 degree celsius.'

  #define the arguments that the user will input
  def arguments(model)

    args =

    # Define input variables
    ground_temp = OpenStudio::Measure::OSArgument::makeDoubleArgument('ground_temp',true)
    ground_temp.setDisplayName('Ground Temperature')
    args << ground_temp

    return args
  end #end the arguments method

  #define what happens when the measure is run
  def run(model, runner, user_arguments)
    super(model, runner, user_arguments)

    #use the built-in error checking
    if not runner.validateUserArguments(arguments(model), user_arguments)
      return false

    #set user defined values to variables
    ground_temp = runner.getDoubleArgumentValue('ground_temp',user_arguments)

    # assign the user inputs to variables
    # create ground temperature object    
    groundtemps =
    # add monthly temperatures

    # check the ground temperature for reasonableness
    if ground_temp <=0
      runner.registerError("Please choose a temperature above 0")
      return false

    # report final condition
    runner.registerFinalCondition("The model's ground temperature was changed to #{ground_temp}.")

    return true

  end #end the run method

end #end the measure

#this allows the measure to be used by the application
edit flag offensive delete link more


You can just do data=[ground_temp]*12 ;-)

shorowit's avatar shorowit  ( 2021-01-29 15:38:20 -0500 )edit

Yes, just wanted to make my point regarding the flexibility of the code. Thanks for the comment :)

Iswarya M Mohan's avatar Iswarya M Mohan  ( 2021-01-31 23:02:54 -0500 )edit

Iswarya M Mohan , How can he change de code do get decimal values, for example 15.5?

J Monteiro's avatar J Monteiro  ( 2021-03-11 07:31:28 -0500 )edit

You need to run the measure using menu item 'Components and Measures' >'Apply Measure Now' in the OpenStudio App. Once you click the measure, enter the required value in the textbox that appears on the right.

Iswarya M Mohan's avatar Iswarya M Mohan  ( 2021-03-11 07:58:22 -0500 )edit

I try with 16,7 C, but when I run the simulation I get the information that the ground temperature is 16 C

J Monteiro's avatar J Monteiro  ( 2021-03-11 08:15:16 -0500 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2018-01-04 03:10:54 -0500

Seen: 1,728 times

Last updated: Apr 18