I am developing scripts using Ladybug/Honeybee/Dragonfly libraries in Python for automated modeling of buildings.
I am reaching the stage of assigning constructions/loads etc… to the honeybee objects. However I do not understand how to add new materials, constructions etc… to the libraries.
I understood that, like the grasshopper version of Ladybug, all the data are contained in files in the Python library, but I don’t know which one. It seems to load data from other files than the energy_default.json as it loads the construction from samples present in the Grasshopper version, that are not in this default file.
I tried to load a set of construction with the load_construction_set_object function in honeybee_energy.lib._loadconstructionsets. I used one of the construction set already present in the Python library, from the Grasshopper data base (all the constructions and material must be available), I just changed the identifier, but it did not load it and does not show errors.
My questions are the followings :
Where the constructions/loads etc… are stored in the python libraries ?
What are the functions to use to load constructions etc… what is the procedure?
How should the json files containing the data be? one material/construction etc… per file ? or there can be many of them and we can use a for loop to load all of them one by one ?
My question might not be clear, I will rephrase it more simply.
I cannot find how to add new materials/constructions/… to the Honeybee-Energy library when using the Ladybug Tool in Python only (completely disconnected from Grasshopper).
Hi @Elie_MED, are you trying to create materials and construction that you will be using frequently or are you trying to create one-of construction that is used for a specific case? Can you provide a sample code as a reference?
The reusable resources are loaded from honeybee-standards package. You can add your constructions and materials to user library.
For on-off materials and construction you can use honeybee_energy.material and honeybee_energy.construction modules. Here is the docs.
Hi @mostapha ,
Thank you very much for your answer.
Actually I want to be able to load news constructions/sets of constructions etc… automatically form a json file, not having to modify the files in the Honeybee library (the honeybee-standards packages), so that the code can be used instantly in an other computer.
In my code the building are modeled automatically from GIS. They all belong to a typology/archetype that are applied on them. Each typology has its folder, containing all information, especially the json file with the constructions sets of constructions for Honeybee. I want the loads/constructions etc… to be loaded automatically when a new typology is used (I may create a Typology class ?).
After reading your answer I found the honeybee.config.py and .json files, where you can set the path to the folders with the loads/sets of constructions etc… and it worked !
I can add the paths of the folders I want the json files to be in and they are loaded in python.
I just have one last problem: when I try to read my Honeybee models in Grasshopper (to plot the buildings and check) after exporting the model to hbjson the constructions/materials cannot be read properly by Honeybee, even if I use a standard set of construction natively present in ladybug tool (in "2004 data). Only the default constructions works. Surprisingly the non-default loads can be read. I will create a dedicated post if I don’t manage to fix it and will share an example file.
I wouldn’t recommend editing the config except in very special circumstances. Just use the “HB Dump Objects” component to write whatever objects you want to the appropriate subfolder in the following location:
As long as you add the JSON of the object to the correct subfolder for that object type, that object will be loaded into your standards library the next time you open Grasshopper.
Indeed, I understood that the Ladybug tool folder was the default folder for python to search constructions etc…
However the Ladybug tool will not necessary be installed on the computer tan will run the simulations (though that would be handier as it comes with EnergyPlus etc…).
I will do as you say for now, at least I know how to extract libraries from another folder if I really need to.