Heat Balance Algorithm input in HB Energy

I want to set the Heat Balance Algorithm to Conduction Finite Difference in Ladybug 1.2.0 HB energy model. The default is Conduction Transfer Function. The only way I thought I could do it was through add_string_. However, since the default is set by the HB Energy component, it gives an error for assigning two HeatBalanceAlgorithm inputs. I can edit the IDF file in either text or the EnergyPlus environment. But I was looking for a way to be able to do it in Ladybug/Grasshopper environment.


Hi @Habib ,

You’re right that this isn’t exposed in Honeybee and trying to specify this with additional strings will result in duplicated objects.

For now, the only way that you can change this is to either manually edit the IDF (and then use the “HB Rerun IDF” to run the IDF through EnergyPlus) or you could write an OpenStudio Measure to change this attribute of the OSM (using the “HB Load Measure” component to load it and apply it to the measure_ input of the simulation). The latter will be much more automated and reusable but it understandably has more of a learning curve given that you’ll have to write a little Ruby.

1 Like

Thanks, Chris, for the quick response. What I do for now is, as you mentioned, editing the IDF and then running it through either HB or EnergyPlus. Although it’s not that convenient, it takes less time than digging into writing a piece of code.

1 Like

Hello chris I think this can be solved by a simple python battery, I replaced the Solar disturition parameter by this battery.

import os

Input variables

idf_file_path = x
old_content = y
new_content = z

Open the IDF file and read its contents

with open(idf_file_path, ‘r’) as f:
file_content = f.read()

Replace the specified content with the replacement content

new_file_content = file_content.replace(old_content, new_content)

Get the file name and directory of the input IDF file

idf_file_dir, idf_file_name = os.path.split(idf_file_path)

Generate the output file path by appending “_updated” to the file name

output_file_path = os.path.join(idf_file_dir, idf_file_name.split(‘.’)[0] + ‘_updated.idf’)

Save the updated file contents

with open(output_file_path, ‘w’) as f:

Output the path to the updated IDF file

a = output_file_path


1 Like

Sorry I forgot to respond and say that you’re solution is also a usable one, @xiaoyuling , albeit a slightly riskier one given that the IDF schema has been known to change between versions of EnergyPlus. But it will definitely get the job done.

In this application of Honeybee, I use IDF editor to modify the IDF file(Such as Heat Balance Algorithm ) automatically created by Honeybee, and then run it again with RUN IDF. If I modify a parameter in Honeybee later(Such as material thickness), and then click Run the “HB Model to OSM” model in Grasshopper, will my original file be overwritten again(If that happens, modifying the algorithm won’t work)?