# Greenhouse Geometry Generator

With this code, you can generate an OSM file for Open Studio with different roof structures for greenhouses, which can be used in EnergyPlus to simulate the greenhouse's energy consumption and indoor climate changes, such as temperature and humidity.

## 1. Import Required Modules

```
from greenhouse_geometry import (
GreenhouseGeometry,
calculate_roof_height_relative_to_wall,
calculate_surface_area_slope,
)
```

## 2. Setting Parameters

### 2.1. Choose Roof Type

The following are the available roof types:

- Half circle (
`half_circle`

) - Triangle (
`triangle`

) - Flat arch (
`flat_arch`

) - Gothic arch (
`gothic_arch`

) - Sawtooth (
`sawtooth`

) - Sawtooth arch (
`sawtooth_arch`

)

For example, to select a triangular roof:

`roof_type = "triangle"`

### 2.2. Set Geometric Parameters

`wall_height`

: Height of the vertical wall, for example, 6.5 meters.`wall_width`

: The width of each greenhouse roof triangle, for example, 4 meters.`wall_length`

: The length of the greenhouse, for example, 1.67 meters (total length is 1.67m * 3).`num_segments`

: The number of segments of the roof.`slope`

: The slope of the roof.

```
wall_height = 6.5
wall_width = 4
wall_length = 1.67
num_segments = 6
slope = 22
```

### 2.3. Additional Parameters

`wall_thickness`

: The thickness of the wall.`window_thickness`

: The thickness of the window.`frame_width`

: The width of the window frame.`shade_distance_to_roof`

: The distance from the shade to the roof.

```
wall_thickness = 0.2
window_thickness = 0.3
frame_width = 0.05
shade_distance_to_roof = 0
```

### 2.4. Number and Dimensions of Greenhouses

`number_length`

: The number of greenhouses in length.`number_width`

: The number of greenhouses in width.

```
number_length = 3 * 4
number_width = 1 * 5
```

## 3. Calculate and Print

```
floor_area = wall_length * number_length * wall_width * number_width
print(f"floor area: {floor_area} m^2")
```

## 4. Complete Code for Generating the Greenhouse Model

```
from greenhouse_geometry import (
GreenhouseGeometry,
calculate_roof_height_relative_to_wall,
calculate_surface_area_slope,
)
if __name__ == "__main__":
# roof_type："half_circle", "triangle", "flat_arch", "gothic_arch", "sawtooth", "sawtooth_arch"
roof_type = "triangle"
wall_height = 6.5 # The ridge height is 6.5m
wall_width = 4 # Each triangle in the greenhouse roof has width 4m
wall_length = 1.67 # The length of the greenhouse is 1.67m * 3
num_segments = 6 # The number of segments for the roof
slope = 22 # The slope of the roof
roof_height_relative_to_wall = calculate_roof_height_relative_to_wall(
wall_width, slope
) # height of the roof relative to the wall
wall_thickness = 0.2
window_thickness = 0.3
frame_width = 0.05 # width of the frame around the window
shade_distance_to_roof = 0 # distance from the shade to the roof
# create m x n houses, with each house having an offset in y and x axes
number_length = 3 * 4
number_width = 1 * 5
floor_area = wall_length * number_length * wall_width * number_width
time_step = 5 # window schedule opening in 30 minutes interval
print(f"floor area: {floor_area} m^2")
print(f"roof height relative to wall: {roof_height_relative_to_wall} m")
# print(calculate_surface_area_slope(wall_length, wall_width, roof_height_relative_to_wall))
# instantiate the Greenhouse object
greenhouse_model = GreenhouseGeometry(
wall_thickness=wall_thickness,
window_thickness=window_thickness,
roof_type=roof_type,
wall_height=wall_height,
wall_width=wall_width,
wall_length=wall_length,
num_segments=num_segments,
roof_height_relative_to_wall=roof_height_relative_to_wall,
frame_width=frame_width,
shade_distance_to_roof=shade_distance_to_roof,
time_step=time_step,
)
greenhouse_model.create_houses(number_length, number_width)
```