Skip to content

Commit

Permalink
Merge pull request #3638 from architecture-building-systems/3637-fix-…
Browse files Browse the repository at this point in the history
…radiation-simplified

Fix radiation simplified
  • Loading branch information
reyery authored Aug 6, 2024
2 parents b9ebdf7 + 052eac2 commit 8307c87
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cea/resources/radiation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def main(config):
architecture_wwr_df,
geometry_staging_location)

daysim_staging_location = os.path.join(locator.get_solar_radiation_folder(), 'cea_radiation')
daysim_staging_location = os.path.join(locator.get_temporary_folder(), 'cea_radiation')
cea_daysim = CEADaySim(daysim_staging_location, daysim_bin_path, daysim_lib_path)

# create radiance input files
Expand Down
31 changes: 25 additions & 6 deletions cea/resources/radiation/simplified/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def main(config):
print("verifying geometry files")
zone_path = locator.get_zone_geometry()
surroundings_path = locator.get_surroundings_geometry()
trees_path = locator.get_tree_geometry()

print(f"zone: {zone_path}")
print(f"surroundings: {surroundings_path}")

Expand All @@ -98,6 +100,14 @@ def main(config):
verify_input_geometry_zone(zone_df)
verify_input_geometry_surroundings(surroundings_df)

if os.path.exists(trees_path):
print(f"trees: {trees_path}")
trees_df = gpd.GeoDataFrame.from_file(trees_path)
else:
print("trees: None")
# Create empty area if it does not exist
trees_df = gpd.GeoDataFrame(geometry=[], crs=zone_df.crs)

# import material properties of buildings
print("Getting geometry materials")
building_surface_properties = read_surface_properties(locator)
Expand All @@ -111,12 +121,16 @@ def main(config):
terrain_raster = gdal.Open(locator.get_terrain())
architecture_wwr_df = gpd.GeoDataFrame.from_file(locator.get_building_architecture()).set_index('Name')

geometry_terrain, zone_building_names, surroundings_building_names = geometry_generator.geometry_main(config,
zone_df,
surroundings_df,
terrain_raster,
architecture_wwr_df,
geometry_staging_location)
(geometry_terrain,
zone_building_names,
surroundings_building_names,
tree_surfaces) = geometry_generator.geometry_main(config,
zone_df,
surroundings_df,
trees_df,
terrain_raster,
architecture_wwr_df,
geometry_staging_location)
# Fetch simulation buildings based on proximity to sample buildings
simulation_buildings = fetch_simulation_buildings(sample_buildings, zone_df, buffer_m)

Expand All @@ -130,6 +144,11 @@ def main(config):
cea_daysim.create_radiance_geometry(geometry_terrain, building_surface_properties, simulation_buildings,
surroundings_building_names, geometry_staging_location)

if len(tree_surfaces) > 0:
print("Creating radiance shading file")
tree_lad = trees_df["density_tc"]
cea_daysim.create_radiance_shading(tree_surfaces, tree_lad)

print("Converting files for DAYSIM")
weather_file = locator.get_weather_file()
print('Transforming weather files to daysim format')
Expand Down

0 comments on commit 8307c87

Please sign in to comment.