commit 931ce9d522a5ca0f952a8e001bea0f1aa20c70ea
parent 2a784ae50c682fb6e1c81466083b67195cf2279a
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Fri, 17 Jan 2025 15:16:37 +0100
Add a message on glazing surface ratio for mode 1
Just like the message in mode 2.
Rename a few variables too.
Diffstat:
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/cg_construction_mode_1.c b/src/cg_construction_mode_1.c
@@ -244,7 +244,7 @@ build_int_insulation
double e_wall = data->wall_thickness;
double e_roof = data->roof_thickness;
double e_roof_insulation = data->roof_insulation_thickness;
- double attic = data->attic_height;
+ double e_attic = data->attic_height;
double e_ext_insulation = data->external_insulation_thickness;
double e_int_insulation = data->internal_insulation_thickness;
double offset = 0;
@@ -280,7 +280,7 @@ build_int_insulation
ERR(build_footprint(pg_ext, 0, &footprint_ext));
ERR(scad_cut_geometries(NULL, &footprint_ext, 1, &footprint_int, 1, &footprint));
- d[2] = height - e_roof - attic - e_roof_insulation;
+ d[2] = height - e_roof - e_attic - e_roof_insulation;
ERR(scad_geometry_extrude(footprint, NULL, d, &geom));
if(inter_floor) {
@@ -371,7 +371,7 @@ build_roof_insulation
double e_wall = data->wall_thickness;
double e_insulation = data->external_insulation_thickness;
double e_roof = data->roof_thickness;
- double attic = data->attic_height;
+ double e_attic = data->attic_height;
double e_roof_insulation = data->roof_insulation_thickness;
double offset = 0;
double z_insulation = 0;
@@ -395,7 +395,7 @@ build_roof_insulation
offset, &pg_int));
/*footprint*/
- z_insulation = height - e_roof - attic - e_roof_insulation;
+ z_insulation = height - e_roof - e_attic - e_roof_insulation;
ERR(build_footprint(pg_int, z_insulation, &footprint));
d[2] = e_roof_insulation;
@@ -480,7 +480,7 @@ build_inter_floor
size_t floor_n = data->inter_floor_count;
double e_roof = data->roof_thickness;
double e_roof_ins = data->roof_insulation_thickness;
- double attic = data->attic_height;
+ double e_attic = data->attic_height;
double e_floor = data->inter_floor_thickness;
double e_wall = data->wall_thickness;
double e_insulation = data->external_insulation_thickness;
@@ -512,7 +512,7 @@ build_inter_floor
offset, &pg_int));
ERR(scpr_polygon_get_vertices_count(pg_int, 0, &nverts));
- h_cavity = height - e_roof - attic - e_roof_ins - (double)floor_n*e_floor;
+ h_cavity = height - e_roof - e_attic - e_roof_ins - (double)floor_n*e_floor;
z_floor = h_cavity/(double)(1 + floor_n);
d[2] = e_floor;
for(i = 0; i < floor_n; i++) {
@@ -809,11 +809,13 @@ build_windows
struct scad_geometry* benv = NULL;
struct scad_geometry* problem = NULL;
size_t floor_n;
- double e_roof, e_roof_ins, attic, h_wall, e_floor;
+ double e_roof, e_roof_ins, e_attic, h_wall, e_floor;
struct str name;
struct adjoining_data* adj;
struct city* city;
struct mem_allocator* allocator;
+ double effective_ratio, total_wall_surface = 0, total_windows_surface = 0;
+ int meet_effective_ratio;
(void)removed_hor;
ASSERT(data && data_cad && adjoining_data);
@@ -830,9 +832,9 @@ build_windows
floor_n = data->inter_floor_count;
e_roof = data->roof_thickness;
e_roof_ins = data->roof_insulation_thickness;
- attic = data->attic_height;
+ e_attic = data->attic_height;
e_floor = data->inter_floor_thickness;
- h_wall = (data_cad->building->total_height- e_roof - attic - e_roof_ins
+ h_wall = (data_cad->building->total_height- e_roof - e_attic - e_roof_ins
- (double)floor_n*e_floor) / (double)(floor_n + 1);
d3_splat(scale, sqrt(data->glass_ratio));
@@ -855,7 +857,7 @@ build_windows
ERR(darray_geometries_reserve(&hole_array, list_n));
ERR(darray_geometries_reserve(&glass_array, list_n));
for(i = 0; i < list_n; i++) {
- double hsz, mass, center[3];
+ double hsz, wall_surface, center[3];
size_t center_n;
size_t count;
int removed = 0;
@@ -873,8 +875,9 @@ build_windows
continue; /* keep only vertical face */
}
- ERR(scad_geometry_get_mass(list[i], &mass));
- if(mass < CG2_MIN_WINDOWS_WIDTH * h_wall) {
+ ERR(scad_geometry_get_mass(list[i], &wall_surface));
+ total_wall_surface += wall_surface;
+ if(wall_surface < CG2_MIN_WINDOWS_WIDTH * h_wall) {
/* this window would be too small */
ERR(scad_geometry_ref_put(surface));
surface = NULL;
@@ -962,6 +965,7 @@ build_windows
ERR(darray_geometries_push_back(current_cad, &glass));
ERR(scad_geometry_ref_put(glass));
glass = NULL;
+ total_windows_surface += wall_surface * data->glass_ratio;
}
ASSERT(hole == NULL);
ASSERT(detect == NULL);
@@ -1004,6 +1008,12 @@ build_windows
logger_print(city->logger, LOG_OUTPUT,
"Building '%s' has no window removed (out of %zu).\n", prefix, array_n);
}
+ effective_ratio = total_windows_surface / total_wall_surface;
+ meet_effective_ratio = data->glass_ratio == 0
+ || fabs(effective_ratio - data->glass_ratio) / data->glass_ratio < 0.01;
+ logger_print(city->logger, (meet_effective_ratio ? LOG_OUTPUT : LOG_WARNING),
+ "Building '%s' overall glass ratio is %.1f %% (expected is %.1f %%).\n",
+ prefix, 100 * effective_ratio, 100 * data->glass_ratio);
if(array_n > 0) {
hole_list = darray_geometries_data_get(&hole_array);