Heat Balance Algorithm input in HB Energy

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:
f.write(new_file_content)

Output the path to the updated IDF file

a = output_file_path


Snipaste_2023-04-13_17-12-52

1 Like