From 76883fe6676c5a6b2e757a6e04273ef5a4927bdc Mon Sep 17 00:00:00 2001 From: john525 Date: Tue, 30 Jul 2019 17:15:39 -0400 Subject: [PATCH 1/2] got u_values to run successfully and show a graph --- bpeng/simulation/base.py | 46 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/bpeng/simulation/base.py b/bpeng/simulation/base.py index fd23cbf..6552779 100644 --- a/bpeng/simulation/base.py +++ b/bpeng/simulation/base.py @@ -139,6 +139,10 @@ class BaseSim: Column name in building_shapefile DataFrame corresponding to number of units in building """ # Assert if columns taht will be used exist in building shapefile + print("try to assert") + LOGGER.info("info") + LOGGER.info("LOGGER") + assert buildingid_colname in building_shapefile, "Missing column {} in building shapefile"\ .format(buildingid_colname) assert cnstrct_yr_colname in building_shapefile, "Missing column {} in building shapefile"\ @@ -149,14 +153,18 @@ class BaseSim: .format(build_height_colname) assert num_floors_colname in building_shapefile, "Missing column {} in building shapefile"\ .format(num_floors_colname) + print("passed asserts") if num_units_colname not in building_shapefile: logging.warning("Missing number_of_units column in building shapefile. Required to add DHW object.") col_float = [buildingid_colname, cnstrct_yr_colname, build_height_colname, num_floors_colname] else: col_float = [buildingid_colname, cnstrct_yr_colname, build_height_colname, num_floors_colname, num_units_colname] + print("passed if/else") # Convert columns to float building_shapefile[col_float] = building_shapefile[col_float].astype(float) + + print("asserting again") # Assert data type of geometry geom_type1 = building_shapefile[geometry_colname].apply(type).value_counts().index[0] assert geom_type1 == Polygon, 'Geometry in building shapefile is not ' \ @@ -172,6 +180,7 @@ class BaseSim: num_vert = building_shapefile[geometry_colname].apply(lambda x: len(x.exterior.coords)) assert (num_vert < 120).all(), "One or more building footprint geometry has more than 120 vertices" + print("perform some checks") # Perform same checks on shading building shapefile if building_shading_shapefile is not None: # Check if important columns exist in shading building shapefile @@ -218,6 +227,7 @@ class BaseSim: 'these buildings were deleted') building_shading_shapefile = building_shading_shapefile.drop(num_vert_too_big_index) + print("load starting") # Load starting idf file dir_path = os.path.dirname(os.path.abspath(__file__)) if idf_start_file is None: @@ -225,6 +235,7 @@ class BaseSim: else: idf_source = IDF(idf_start_file) + print("initialize fields") self.idf = idf_source.copy() self.build_type = self.__class__.__name__ self.building_id = list(building_shapefile[buildingid_colname]) @@ -561,7 +572,7 @@ class BaseSim: def idf_creation(self, add_shading_analysis=False, window_to_wall_ratio=0.16, infiltration_value='Automatic', add_people=False, people_value='Automatic', add_equipment=False, equipment_value='Automatic', add_light=False, light_value='Automatic', solar_dist_method="FullExterior", output_table=False, - add_dhw=False): + add_dhw=False, u_values='Automatic'): """ Create EnergyPlus input IDF file from building shapefile. Default output variables (see output_var_default): @@ -617,6 +628,16 @@ class BaseSim: "FullExteriorWithReflections" "FullInteriorAndExteriorWithReflections" See EnergyPlus InputOutputReference documentation for more information + + u_values (dict mapping string -> float) + Specifies insulation level for following building elements: + External wall + Ground floor + Roof + Internal ceiling + Internal floor + Window + See bloclink/apps/envelope/models.py output_table (bool) Default to False: remove "OutputControl:Table:Style" object @@ -978,6 +999,29 @@ class BaseSim: self.idf.add_object("ZoneAirContaminantBalance, No;") self.idf.add_object("ZoneAirHeatBalanceAlgorithm, ThirdOrderBackwardDifference;") + # Added for U-Values + if u_values != 'Automatic': + print('u_values') + convert_to_eplus_name = { + 'u_ext_wall': 'AllExteriorWalls', + 'u_ground_floor': 'AllExteriorFloors', + 'u_roof': 'AllExteriorRoofs', + 'u_in_ceiling': 'AllInteriorCeilings', + 'u_in_floor': 'AllInteriorFloors', + 'u_window': 'AllExteriorWindows', + } + for key in convert_to_eplus_name: + ep_name = convert_to_eplus_name[key] + if key not in u_values: + continue + newIdfObj = '''SurfaceProperty:ConvectionCoefficients:MultipleSurface, + {}, ! - Surface Types + Outside, ! - Convection Coefficient 1 Location + Value, ! - Convection Coefficient 1 Type + {}; ! - Convection Coefficient 1'''.format(ep_name, u_values[key]) + print(newIdfObj) + self.idf.add_object(newIdfObj) + # Design Days add_dday(self.idf) -- GitLab From 031224c95a48ec1e98c3a3120b16a9f816dc6455 Mon Sep 17 00:00:00 2001 From: john525 Date: Wed, 31 Jul 2019 15:46:01 -0400 Subject: [PATCH 2/2] made log messages more descriptive --- bpeng/simulation/base.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bpeng/simulation/base.py b/bpeng/simulation/base.py index 6552779..799b8f9 100644 --- a/bpeng/simulation/base.py +++ b/bpeng/simulation/base.py @@ -139,9 +139,7 @@ class BaseSim: Column name in building_shapefile DataFrame corresponding to number of units in building """ # Assert if columns taht will be used exist in building shapefile - print("try to assert") - LOGGER.info("info") - LOGGER.info("LOGGER") + print("assert building shapefile is formatted correctly") assert buildingid_colname in building_shapefile, "Missing column {} in building shapefile"\ .format(buildingid_colname) @@ -164,7 +162,7 @@ class BaseSim: # Convert columns to float building_shapefile[col_float] = building_shapefile[col_float].astype(float) - print("asserting again") + print("assert geometry data type") # Assert data type of geometry geom_type1 = building_shapefile[geometry_colname].apply(type).value_counts().index[0] assert geom_type1 == Polygon, 'Geometry in building shapefile is not ' \ @@ -180,7 +178,7 @@ class BaseSim: num_vert = building_shapefile[geometry_colname].apply(lambda x: len(x.exterior.coords)) assert (num_vert < 120).all(), "One or more building footprint geometry has more than 120 vertices" - print("perform some checks") + print("second round of shapefile checks") # Perform same checks on shading building shapefile if building_shading_shapefile is not None: # Check if important columns exist in shading building shapefile @@ -227,7 +225,7 @@ class BaseSim: 'these buildings were deleted') building_shading_shapefile = building_shading_shapefile.drop(num_vert_too_big_index) - print("load starting") + print("simulation base: load file starting") # Load starting idf file dir_path = os.path.dirname(os.path.abspath(__file__)) if idf_start_file is None: @@ -235,7 +233,7 @@ class BaseSim: else: idf_source = IDF(idf_start_file) - print("initialize fields") + print("initialize sim base fields") self.idf = idf_source.copy() self.build_type = self.__class__.__name__ self.building_id = list(building_shapefile[buildingid_colname]) -- GitLab