all test passed

This commit is contained in:
Pilar Monsalvete 2023-08-08 11:20:44 -04:00
parent ab81edc33d
commit bdf0deb3b3
8 changed files with 27 additions and 27 deletions

View File

@ -114,8 +114,7 @@ class Building(CityObject):
:return: [InternalZone]
"""
if self._internal_zones is None:
_number_of_storeys = self.eave_height * self.volume / self.floor_area
self._internal_zones = [InternalZone(self.surfaces, self.floor_area, self.volume, _number_of_storeys)]
self._internal_zones = [InternalZone(self.surfaces, self.floor_area, self.volume)]
return self._internal_zones
@property
@ -447,8 +446,7 @@ class Building(CityObject):
monthly_values = PeakLoads(self).heating_peak_loads_from_methodology
if monthly_values is None:
return None
# todo: @Pilar!!!!
results[cte.MONTH] = monthly_values * cte.WATTS_HOUR_TO_JULES
results[cte.MONTH] = [x * cte.WATTS_HOUR_TO_JULES for x in monthly_values]
results[cte.YEAR] = [max(monthly_values)]
return results
@ -465,8 +463,7 @@ class Building(CityObject):
monthly_values = PeakLoads(self).cooling_peak_loads_from_methodology
if monthly_values is None:
return None
# todo: @Pilar!!!!
results[cte.MONTH] = monthly_values * cte.WATTS_HOUR_TO_JULES
results[cte.MONTH] = [x * cte.WATTS_HOUR_TO_JULES for x in monthly_values]
results[cte.YEAR] = [max(monthly_values)]
return results
@ -772,8 +769,6 @@ class Building(CityObject):
Get total electricity produced onsite in J
return: dict
"""
# Add other systems whenever new ones appear
orientation_losses_factor = {cte.MONTH: {'north': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
'east': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
'south': [2.137931, 1.645503, 1.320946, 1.107817, 0.993213, 0.945175,
@ -784,6 +779,8 @@ class Building(CityObject):
'south': [1.212544],
'west': [0]}
}
# Add other systems whenever new ones appear
if self.energy_systems is None:
return self._onsite_electrical_production
for energy_system in self.energy_systems:

View File

@ -18,13 +18,12 @@ class InternalZone:
"""
InternalZone class
"""
def __init__(self, surfaces, area, volume, number_of_storeys=None):
def __init__(self, surfaces, area, volume):
self._surfaces = surfaces
self._id = None
self._geometry = None
self._volume = volume
self._area = area
self._number_of_storeys = number_of_storeys
self._thermal_zones_from_internal_zones = None
self._usages = None
self._thermal_archetype = None
@ -132,7 +131,8 @@ class InternalZone:
windows_areas.append(hole.area)
_thermal_boundary = ThermalBoundary(surface, surface.solid_polygon.area, windows_areas)
_thermal_boundaries.append(_thermal_boundary)
_thermal_zone = ThermalZone(_thermal_boundaries, self, self.volume, self.area, self._number_of_storeys)
_number_of_storeys = int(self.volume / self.area / self.thermal_archetype.average_storey_height)
_thermal_zone = ThermalZone(_thermal_boundaries, self, self.volume, self.area, _number_of_storeys)
for thermal_boundary in _thermal_zone.thermal_boundaries:
thermal_boundary.thermal_zones = [_thermal_zone]
self._thermal_zones_from_internal_zones = [_thermal_zone]

View File

@ -90,7 +90,9 @@ class Storey:
:return: ThermalZone
"""
if self._thermal_zone is None:
self._thermal_zone = ThermalZone(self.thermal_boundaries, self._internal_zone, self.volume, self.floor_area)
_number_of_storeys = 1
self._thermal_zone = ThermalZone(self.thermal_boundaries, self._internal_zone,
self.volume, self.floor_area, _number_of_storeys)
return self._thermal_zone
@property

View File

@ -225,7 +225,7 @@ class InselMonthlyEnergyBalance:
parameters.append(thermal_opening.overall_u_value)
parameters.append(thermal_opening.g_value)
if thermal_boundary.type is not cte.GROUND:
parameters.append(thermal_boundary.parent_surface.short_wave_reflectance)
parameters.append(thermal_boundary.external_surface.short_wave_reflectance)
else:
parameters.append(0.0)
file = InselMonthlyEnergyBalance._add_block(file, i_block, custom_insel_block, inputs=inputs, parameters=parameters)
@ -259,10 +259,10 @@ class InselMonthlyEnergyBalance:
if cte.MONTH not in surface.global_irradiance:
raise ValueError(f'surface: {surface.name} from building {building.name} has no global irradiance!')
global_irradiance = surface.global_irradiance[cte.MONTH] * cte.WATTS_HOUR_TO_JULES
global_irradiance = surface.global_irradiance[cte.MONTH]
for j in range(0, len(global_irradiance)):
parameters.append(f'{j + 1} '
f'{global_irradiance[j] / 24 / _NUMBER_DAYS_PER_MONTH[j]}')
f'{global_irradiance[j] * cte.WATTS_HOUR_TO_JULES / 24 / _NUMBER_DAYS_PER_MONTH[j]}')
else:
for j in range(0, 12):
parameters.append(f'{j + 1} 0.0')

View File

@ -34,8 +34,7 @@ class SimplifiedRadiosityAlgorithm:
for key in self._results:
_irradiance = {}
header_name = key.split(':')
# todo: @Pilar!!!!!!!!!!!!!!!!!!!!!!!!
result = self._results[key] / cte.WATTS_HOUR_TO_JULES
result = [x / cte.WATTS_HOUR_TO_JULES for x in self._results[key]]
city_object_name = header_name[1]
building = self._city.city_object(city_object_name)
surface_id = header_name[2]

View File

@ -110,17 +110,21 @@ class EpwWeatherParameters:
# new_value = pd.DataFrame(self._weather_values[['dry_bulb_temperature_c']].to_numpy(), columns=['epw'])
# number_invalid_records = new_value[new_value.epw == 99.9].count().epw
building.external_temperature[cte.HOUR] = self._weather_values['dry_bulb_temperature_c']
building.global_horizontal[cte.HOUR] = self._weather_values[
'global_horizontal_radiation_wh_m2'] / cte.WATTS_HOUR_TO_JULES
building.diffuse[cte.HOUR] = self._weather_values['diffuse_horizontal_radiation_wh_m2'] / cte.WATTS_HOUR_TO_JULES
building.beam[cte.HOUR] = self._weather_values['direct_normal_radiation_wh_m2'] / cte.WATTS_HOUR_TO_JULES
building.global_horizontal[cte.HOUR] = [x / cte.WATTS_HOUR_TO_JULES
for x in self._weather_values['global_horizontal_radiation_wh_m2']]
building.diffuse[cte.HOUR] = [x / cte.WATTS_HOUR_TO_JULES
for x in self._weather_values['diffuse_horizontal_radiation_wh_m2']]
building.beam[cte.HOUR] = [x / cte.WATTS_HOUR_TO_JULES
for x in self._weather_values['direct_normal_radiation_wh_m2']]
building.cold_water_temperature[cte.HOUR] = wh().cold_water_temperature(building.external_temperature[cte.HOUR])
# create the monthly and yearly values out of the hourly
for building in self._city.buildings:
building.external_temperature[cte.MONTH] = MonthlyValues().get_mean_values(building.external_temperature[cte.HOUR])
building.external_temperature[cte.MONTH] = \
MonthlyValues().get_mean_values(building.external_temperature[cte.HOUR])
building.external_temperature[cte.YEAR] = [sum(building.external_temperature[cte.HOUR]) / 9870]
building.cold_water_temperature[cte.MONTH] = MonthlyValues().get_mean_values(building.cold_water_temperature[cte.HOUR])
building.cold_water_temperature[cte.MONTH] = \
MonthlyValues().get_mean_values(building.cold_water_temperature[cte.HOUR])
building.cold_water_temperature[cte.YEAR] = [sum(building.cold_water_temperature[cte.HOUR]) / 9870]
# If the usage has already being imported, the domestic hot water missing values must be calculated here that

View File

@ -51,8 +51,7 @@ class TestExports(TestCase):
_irradiance = {}
for key in self._results:
header_name = key.split(':')
# todo: @Pilar!!!!!!!!!!!!!!!!!!!!!!!!
result = self._results[key] / cte.WATTS_HOUR_TO_JULES
result = [x / cte.WATTS_HOUR_TO_JULES for x in self._results[key]]
city_object_name = header_name[1]
building = self._city.city_object(city_object_name)
surface_id = header_name[2]

View File

@ -51,8 +51,7 @@ class TestExports(TestCase):
_irradiance = {}
for key in self._results:
header_name = key.split(':')
# todo: @Pilar!!!!!!!!!!!!!!!!!!!!!!!!
result = self._results[key] / cte.WATTS_HOUR_TO_JULES
result = [x / cte.WATTS_HOUR_TO_JULES for x in self._results[key]]
city_object_name = header_name[1]
building = self._city.city_object(city_object_name)
surface_id = header_name[2]