modified working hours to give hours a month, not only total
This commit is contained in:
parent
8099037225
commit
a43c971bbb
@ -681,12 +681,17 @@ class Building(CityObject):
|
|||||||
for i, value in enumerate(item):
|
for i, value in enumerate(item):
|
||||||
_working_hours[key][i] = max(_working_hours[key][i], saved_values[i])
|
_working_hours[key][i] = max(_working_hours[key][i], saved_values[i])
|
||||||
|
|
||||||
print(_working_hours)
|
working_hours = {}
|
||||||
_total_hours = 0
|
values_months = []
|
||||||
|
for month in cte.WEEK_DAYS_A_MONTH.keys():
|
||||||
|
_total_hours_month = 0
|
||||||
for key in _working_hours:
|
for key in _working_hours:
|
||||||
hours = sum(_working_hours[key])
|
hours = sum(_working_hours[key])
|
||||||
_total_hours += hours * cte.WEEK_DAYS_A_YEAR[key]
|
_total_hours_month += hours * cte.WEEK_DAYS_A_MONTH[month][key]
|
||||||
return _total_hours
|
values_months.append(_total_hours_month)
|
||||||
|
working_hours[cte.MONTH] = values_months
|
||||||
|
working_hours[cte.YEAR] = sum(working_hours[cte.MONTH])
|
||||||
|
return working_hours
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def distribution_systems_electrical_consumption(self):
|
def distribution_systems_electrical_consumption(self):
|
||||||
|
@ -49,36 +49,140 @@ WEEK_DAYS = 'Weekdays'
|
|||||||
WEEK_ENDS = 'Weekends'
|
WEEK_ENDS = 'Weekends'
|
||||||
ALL_DAYS = 'Alldays'
|
ALL_DAYS = 'Alldays'
|
||||||
|
|
||||||
WEEK_DAYS_A_MONTH = {'monday': [5, 4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 5],
|
JANUARY = 'January'
|
||||||
'tuesday': [5, 4, 4, 4, 5, 4, 5, 4, 4, 5, 4, 4],
|
FEBRUARY = 'February'
|
||||||
'wednesday': [5, 4, 4, 4, 5, 4, 4, 5, 4, 5, 4, 4],
|
MARCH = 'March'
|
||||||
'thursday': [4, 4, 5, 4, 5, 4, 4, 5, 4, 4, 5, 4],
|
APRIL = 'April'
|
||||||
'friday': [4, 4, 5, 4, 4, 5, 4, 5, 4, 4, 5, 4],
|
MAY = 'May'
|
||||||
'saturday': [4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 4, 5],
|
JUNE = 'June'
|
||||||
'sunday': [4, 4, 4, 5, 4, 4, 5, 4, 5, 4, 4, 5],
|
JULY = 'July'
|
||||||
'holiday': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}
|
AUGUST = 'August'
|
||||||
|
SEPTEMBER = 'September'
|
||||||
|
OCTOBER = 'October'
|
||||||
|
NOVEMBER = 'November'
|
||||||
|
DECEMBER = 'December'
|
||||||
|
|
||||||
WEEK_DAYS_A_YEAR = {'monday': 51,
|
MONTHS = [JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER]
|
||||||
'tuesday': 50,
|
|
||||||
'wednesday': 50,
|
|
||||||
'thursday': 50,
|
|
||||||
'friday': 50,
|
|
||||||
'saturday': 52,
|
|
||||||
'sunday': 52,
|
|
||||||
'holiday': 10}
|
|
||||||
|
|
||||||
DAYS_A_MONTH = {'January': 31,
|
WEEK_DAYS_A_MONTH = {JANUARY: {MONDAY: 5,
|
||||||
'February': 28,
|
TUESDAY: 5,
|
||||||
'March': 31,
|
WEDNESDAY: 5,
|
||||||
'April': 30,
|
THURSDAY: 4,
|
||||||
'May': 31,
|
FRIDAY: 4,
|
||||||
'June': 30,
|
SATURDAY: 4,
|
||||||
'July': 31,
|
SUNDAY: 4,
|
||||||
'August': 31,
|
HOLIDAY: 0},
|
||||||
'September': 30,
|
FEBRUARY: {MONDAY: 4,
|
||||||
'October': 31,
|
TUESDAY: 4,
|
||||||
'November': 30,
|
WEDNESDAY: 4,
|
||||||
'December': 31}
|
THURSDAY: 4,
|
||||||
|
FRIDAY: 4,
|
||||||
|
SATURDAY: 4,
|
||||||
|
SUNDAY: 4,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
MARCH: {MONDAY: 4,
|
||||||
|
TUESDAY: 4,
|
||||||
|
WEDNESDAY: 4,
|
||||||
|
THURSDAY: 5,
|
||||||
|
FRIDAY: 5,
|
||||||
|
SATURDAY: 5,
|
||||||
|
SUNDAY: 4,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
APRIL: {MONDAY: 5,
|
||||||
|
TUESDAY: 4,
|
||||||
|
WEDNESDAY: 4,
|
||||||
|
THURSDAY: 4,
|
||||||
|
FRIDAY: 4,
|
||||||
|
SATURDAY: 4,
|
||||||
|
SUNDAY: 5,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
MAY: {MONDAY: 4,
|
||||||
|
TUESDAY: 5,
|
||||||
|
WEDNESDAY: 5,
|
||||||
|
THURSDAY: 5,
|
||||||
|
FRIDAY: 4,
|
||||||
|
SATURDAY: 4,
|
||||||
|
SUNDAY: 4,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
JUNE: {MONDAY: 4,
|
||||||
|
TUESDAY: 4,
|
||||||
|
WEDNESDAY: 4,
|
||||||
|
THURSDAY: 4,
|
||||||
|
FRIDAY: 5,
|
||||||
|
SATURDAY: 5,
|
||||||
|
SUNDAY: 4,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
JULY: {MONDAY: 5,
|
||||||
|
TUESDAY: 5,
|
||||||
|
WEDNESDAY: 4,
|
||||||
|
THURSDAY: 4,
|
||||||
|
FRIDAY: 4,
|
||||||
|
SATURDAY: 4,
|
||||||
|
SUNDAY: 5,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
AUGUST: {MONDAY: 4,
|
||||||
|
TUESDAY: 4,
|
||||||
|
WEDNESDAY: 5,
|
||||||
|
THURSDAY: 5,
|
||||||
|
FRIDAY: 5,
|
||||||
|
SATURDAY: 4,
|
||||||
|
SUNDAY: 4,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
SEPTEMBER: {MONDAY: 4,
|
||||||
|
TUESDAY: 4,
|
||||||
|
WEDNESDAY: 4,
|
||||||
|
THURSDAY: 4,
|
||||||
|
FRIDAY: 4,
|
||||||
|
SATURDAY: 5,
|
||||||
|
SUNDAY: 5,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
OCTOBER: {MONDAY: 5,
|
||||||
|
TUESDAY: 5,
|
||||||
|
WEDNESDAY: 5,
|
||||||
|
THURSDAY: 4,
|
||||||
|
FRIDAY: 4,
|
||||||
|
SATURDAY: 4,
|
||||||
|
SUNDAY: 4,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
NOVEMBER: {MONDAY: 4,
|
||||||
|
TUESDAY: 4,
|
||||||
|
WEDNESDAY: 4,
|
||||||
|
THURSDAY: 5,
|
||||||
|
FRIDAY: 5,
|
||||||
|
SATURDAY: 4,
|
||||||
|
SUNDAY: 4,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
DECEMBER: {MONDAY: 5,
|
||||||
|
TUESDAY: 4,
|
||||||
|
WEDNESDAY: 4,
|
||||||
|
THURSDAY: 4,
|
||||||
|
FRIDAY: 4,
|
||||||
|
SATURDAY: 5,
|
||||||
|
SUNDAY: 5,
|
||||||
|
HOLIDAY: 0},
|
||||||
|
}
|
||||||
|
|
||||||
|
WEEK_DAYS_A_YEAR = {MONDAY: 51,
|
||||||
|
TUESDAY: 50,
|
||||||
|
WEDNESDAY: 50,
|
||||||
|
THURSDAY: 50,
|
||||||
|
FRIDAY: 50,
|
||||||
|
SATURDAY: 52,
|
||||||
|
SUNDAY: 52,
|
||||||
|
HOLIDAY: 10}
|
||||||
|
|
||||||
|
DAYS_A_MONTH = {JANUARY: 31,
|
||||||
|
FEBRUARY: 28,
|
||||||
|
MARCH: 31,
|
||||||
|
APRIL: 30,
|
||||||
|
MAY: 31,
|
||||||
|
JUNE: 30,
|
||||||
|
JULY: 31,
|
||||||
|
AUGUST: 31,
|
||||||
|
SEPTEMBER: 30,
|
||||||
|
OCTOBER: 31,
|
||||||
|
NOVEMBER: 30,
|
||||||
|
DECEMBER: 31}
|
||||||
|
|
||||||
# data types
|
# data types
|
||||||
ANY_NUMBER = 'any_number'
|
ANY_NUMBER = 'any_number'
|
||||||
|
@ -59,7 +59,7 @@ class InselMonthlyEnergyBalance:
|
|||||||
lighting_density = thermal_zone.lighting.density
|
lighting_density = thermal_zone.lighting.density
|
||||||
appliances_density = thermal_zone.appliances.density
|
appliances_density = thermal_zone.appliances.density
|
||||||
|
|
||||||
for month in range(0, 12):
|
for i_month, month in enumerate(cte.MONTHS):
|
||||||
total_dhw_demand = 0
|
total_dhw_demand = 0
|
||||||
total_lighting = 0
|
total_lighting = 0
|
||||||
total_appliances = 0
|
total_appliances = 0
|
||||||
@ -69,7 +69,7 @@ class InselMonthlyEnergyBalance:
|
|||||||
for value in schedule.values:
|
for value in schedule.values:
|
||||||
total_day += value
|
total_day += value
|
||||||
for day_type in schedule.day_types:
|
for day_type in schedule.day_types:
|
||||||
total_lighting += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] \
|
total_lighting += total_day * cte.WEEK_DAYS_A_MONTH[month][day_type] \
|
||||||
* lighting_density / cte.WATTS_HOUR_TO_JULES
|
* lighting_density / cte.WATTS_HOUR_TO_JULES
|
||||||
lighting_demand.append(total_lighting * area)
|
lighting_demand.append(total_lighting * area)
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class InselMonthlyEnergyBalance:
|
|||||||
for value in schedule.values:
|
for value in schedule.values:
|
||||||
total_day += value
|
total_day += value
|
||||||
for day_type in schedule.day_types:
|
for day_type in schedule.day_types:
|
||||||
total_appliances += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] \
|
total_appliances += total_day * cte.WEEK_DAYS_A_MONTH[month][day_type] \
|
||||||
* appliances_density / cte.WATTS_HOUR_TO_JULES
|
* appliances_density / cte.WATTS_HOUR_TO_JULES
|
||||||
appliances_demand.append(total_appliances * area)
|
appliances_demand.append(total_appliances * area)
|
||||||
|
|
||||||
@ -89,9 +89,9 @@ class InselMonthlyEnergyBalance:
|
|||||||
for day_type in schedule.day_types:
|
for day_type in schedule.day_types:
|
||||||
demand = (
|
demand = (
|
||||||
peak_flow * cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY
|
peak_flow * cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY
|
||||||
* (service_temperature - cold_water[month]) / cte.WATTS_HOUR_TO_JULES
|
* (service_temperature - cold_water[i_month]) / cte.WATTS_HOUR_TO_JULES
|
||||||
)
|
)
|
||||||
total_dhw_demand += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] * demand
|
total_dhw_demand += total_day * cte.WEEK_DAYS_A_MONTH[month][day_type] * demand
|
||||||
domestic_hot_water_demand.append(total_dhw_demand * area)
|
domestic_hot_water_demand.append(total_dhw_demand * area)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
domestic_hot_water_demand = [0] * 12
|
domestic_hot_water_demand = [0] * 12
|
||||||
|
@ -64,7 +64,6 @@ class TestResultsImport(TestCase):
|
|||||||
ResultFactory('insel_monthly_energy_balance', self._city, self._output_path).enrich()
|
ResultFactory('insel_monthly_energy_balance', self._city, self._output_path).enrich()
|
||||||
# Check that all the buildings have heating and cooling values
|
# Check that all the buildings have heating and cooling values
|
||||||
for building in self._city.buildings:
|
for building in self._city.buildings:
|
||||||
a = building.distribution_systems_electrical_consumption
|
|
||||||
self.assertIsNotNone(building.heating_demand[cte.MONTH])
|
self.assertIsNotNone(building.heating_demand[cte.MONTH])
|
||||||
self.assertIsNotNone(building.cooling_demand[cte.MONTH])
|
self.assertIsNotNone(building.cooling_demand[cte.MONTH])
|
||||||
self.assertIsNotNone(building.heating_demand[cte.YEAR])
|
self.assertIsNotNone(building.heating_demand[cte.YEAR])
|
||||||
|
Loading…
Reference in New Issue
Block a user