from honeybee.model import Model
from honeybee.room import Room
import honeybee_energy
import honeybee

# Path were are the hbjon files
path_folder ="C://Users//eliem//Documents//PhD_Technion//Programming//Building_modeling//Discourse_pb_material_21_06_30//"

# Name of the hbjson files
json_construction_generic_file_name           = "generic.hbjson"
json_construction_generic_to_modify_file_name = "generic_to_modify.hbjson"
json_construction_standard_file_name          = "standard.hbjson"

# Load the HB models in python from hbjson files
construction_generic_model           = Model.from_hbjson(path_folder+json_construction_generic_file_name)
construction_generic_model_to_modify = Model.from_hbjson(path_folder+json_construction_generic_to_modify_file_name)
construction_standard_model          = Model.from_hbjson(path_folder+json_construction_standard_file_name)

# Print the construction set of one of the room (which is the same for all the rooms
print("construction set of the generic model:          " , construction_generic_model.rooms[0].properties.energy.construction_set)
print("construction set of the generic model to modify:" , construction_generic_model_to_modify.rooms[0].properties.energy.construction_set)
print("construction set of the generic model:          " , construction_standard_model.rooms[0].properties.energy.construction_set)

# load a standard construction
standard_construction_set = '2004::ClimateZone1::SteelFramed'
standard_construction_set = honeybee_energy.lib.constructionsets.construction_set_by_identifier(standard_construction_set)

# Apply the standard construction on one of the room of the "generic_to_modify" model
construction_generic_model_to_modify.rooms[0].properties.energy.construction_set = standard_construction_set
print("new construction set of the generic model to modify:" , construction_generic_model_to_modify.rooms[0].properties.energy.construction_set)
construction_generic_model_to_modify.to_hbjson(json_construction_generic_to_modify_file_name,path_folder)