I have managed to run the two sample models in the repo on pollination and was able to see the models on the web-app which is super cool
So my natural next step was to see if instead of using the given .hbjson files in the guide files, i wanted to create my own .hbjson files from a parametric model…directly in vscode. This then led me down the rabit hole to this repo with the sample code here: https://github.com/ladybug-tools/honeybee
Here I managed to run my simulation in a venv and print the Lux results to cmd for each analysis points.
The app might timeout before the simulation is finished! This is because of how we are deploying the apps at this point. They are not production-ready but it should help you get a better idea of the overall workflow.
An here is a sample code for creating the room and saving it as an HBJSON file as you asked for!
This script shows how to:
1. create a room from a box
2. add a single aperture to the south wall
3. add the room to a model
4. create a sensor grid and add it to the room
5. save the room as an HBJSON file
from honeybee.room import Room, Vector3D
from honeybee.model import Model
from honeybee_radiance.sensorgrid import SensorGrid
width = 4
height = 3.6
depth = 6
wwr = 0.6
grid_size = 0.5 # every half a meter
grid_offset = 0.8 # 80 cms from the floor
# initiate a room
room = Room.from_box(identifier='single_room', width=width, depth=depth, height=height)
# get south facing wall using wall face normal angle.
south_vector = Vector3D(0, -1, 0)
south_face = [face for face in room.faces if south_vector.angle(face.normal) <= 0.01]
# create an aperture by ratio
# alternatively one can use other methods like `aperture_by_width_height`
# see here for docs: https://www.ladybug.tools/honeybee-core/docs/honeybee.face.html#honeybee.face.Face.aperture_by_width_height
# create a model and add the room to it
model = Model('sample-model', rooms=[room], units='Meters')
# create a sensor grid - this is only required if you want to run grid-based studies
# use generate_grid method to create a sensor grid from room floor
grid_mesh = room.generate_grid(x_dim=grid_size, y_dim=grid_size, offset=grid_offset)
# create a sensor grid using the generated mesh
sensor_grid = SensorGrid.from_mesh3d(identifier='room', mesh=grid_mesh)
Also, I just realized that you are using the older version of honeybee (AKA Honeybee[+]). The most updated libraries are listed here:
For running the above script you should install honeybee-radiance which you can do by running this command:
python -m pip install honeybee-radiance -U
Another good source for getting yourself up to speed with using the LBT SDK is checking the code inside the Grasshopper component. This is the same as the Python code but inside Grasshopper and you can see I basically used the same line of the code in my script.
This is a great start and answers my questions perfectly, thank you. I managed to use your .py file, and it created the .hbjson as expected, now it’s time for the fun stuff! I’ll let you know on my progress and if I have any further questions. Also, great tip with peaking into the gh components source code.