modified hourly/monthly values in building.py to reduce number of properties using dictionaries
This commit is contained in:
parent
3a22e7afff
commit
584640ab6e
|
@ -41,12 +41,8 @@ class Building(CityObject):
|
|||
self._usage_zones = []
|
||||
self._building_units = []
|
||||
self._type = 'building'
|
||||
self._m_heating = pd.DataFrame()
|
||||
self._h_heating = pd.DataFrame()
|
||||
self._heating = pd.DataFrame()
|
||||
self._m_cooling = pd.DataFrame()
|
||||
self._h_cooling = pd.DataFrame()
|
||||
self._cooling = pd.DataFrame()
|
||||
self._heating = dict()
|
||||
self._cooling = dict()
|
||||
self._external_temperature = dict()
|
||||
self._global_horizontal = dict()
|
||||
self._diffuse = dict()
|
||||
|
@ -283,109 +279,37 @@ class Building(CityObject):
|
|||
self._building_units = value
|
||||
|
||||
@property
|
||||
def _monthly_heating(self) -> pd.DataFrame:
|
||||
def heating(self) -> dict:
|
||||
"""
|
||||
building monthly heating values in Watts-hour
|
||||
:return: DataFrame with 12 values and a header with the source of those
|
||||
heating demand in Wh
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._m_heating
|
||||
|
||||
@_monthly_heating.setter
|
||||
def _monthly_heating(self, value):
|
||||
"""
|
||||
building monthly heating values in Watts-hour and a header with the source
|
||||
:param value: DataFrame(heating demand)
|
||||
"""
|
||||
if self._m_heating.empty:
|
||||
self._m_heating = value
|
||||
else:
|
||||
self._m_heating = pd.concat([self._m_heating, value], axis=1)
|
||||
|
||||
@property
|
||||
def _hourly_heating(self) -> pd.DataFrame:
|
||||
"""
|
||||
building hourly heating values in Watts-hour
|
||||
:return: DataFrame with 8760 values and a header with the source of those
|
||||
"""
|
||||
return self._h_heating
|
||||
|
||||
@_hourly_heating.setter
|
||||
def _hourly_heating(self, value):
|
||||
"""
|
||||
building hourly heating values in Watts-hour and a header with the source
|
||||
:param value: DataFrame(heating demand)
|
||||
"""
|
||||
if self._h_heating.empty:
|
||||
self._h_heating = value
|
||||
else:
|
||||
self._h_heating = pd.concat([self._h_heating, value], axis=1)
|
||||
|
||||
def heating(self, time_scale):
|
||||
"""
|
||||
Get heating demand in Wh in a defined time_scale
|
||||
:param time_scale: string.
|
||||
:return: DataFrame(float)
|
||||
"""
|
||||
if time_scale == cte.time_scale['hour']:
|
||||
self._heating = self._hourly_heating
|
||||
elif time_scale == cte.time_scale['month']:
|
||||
self._heating = self._monthly_heating
|
||||
else:
|
||||
raise NotImplementedError
|
||||
return self._heating
|
||||
|
||||
@property
|
||||
def _monthly_cooling(self) -> pd.DataFrame:
|
||||
@heating.setter
|
||||
def heating(self, value):
|
||||
"""
|
||||
building monthly cooling values in Watts-hour
|
||||
:return: DataFrame with 12 values and a header with the source of those
|
||||
heating demand in Wh
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._m_cooling
|
||||
|
||||
@_monthly_cooling.setter
|
||||
def _monthly_cooling(self, value):
|
||||
"""
|
||||
building monthly cooling values in Watts-hour and a header with the source
|
||||
:param value: DataFrame(cooling demand)
|
||||
"""
|
||||
if self._m_cooling.empty:
|
||||
self._m_cooling = value
|
||||
else:
|
||||
self._m_cooling = pd.concat([self._m_cooling, value], axis=1)
|
||||
self._heating = value
|
||||
|
||||
@property
|
||||
def _hourly_cooling(self) -> pd.DataFrame:
|
||||
def cooling(self) -> dict:
|
||||
"""
|
||||
building hourly cooling values in Watts-hour
|
||||
:return: DataFrame with 8760 values and a header with the source of those
|
||||
cooling demand in Wh
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._h_cooling
|
||||
|
||||
@_hourly_cooling.setter
|
||||
def _hourly_cooling(self, value):
|
||||
"""
|
||||
building hourly cooling values in Watts-hour and a header with the source
|
||||
:param value: DataFrame(cooling demand)
|
||||
"""
|
||||
if self._h_cooling.empty:
|
||||
self._h_cooling = value
|
||||
else:
|
||||
self._h_cooling = pd.concat([self._h_cooling, value], axis=1)
|
||||
|
||||
def cooling(self, time_scale):
|
||||
"""
|
||||
Get cooling demand in Wh in a defined time_scale
|
||||
:param time_scale: string.
|
||||
:return: DataFrame(float)
|
||||
"""
|
||||
if time_scale == cte.time_scale['hour']:
|
||||
self._cooling = self._hourly_cooling
|
||||
elif time_scale == cte.time_scale['month']:
|
||||
self._cooling = self._monthly_cooling
|
||||
else:
|
||||
raise NotImplementedError
|
||||
return self._cooling
|
||||
|
||||
@cooling.setter
|
||||
def cooling(self, value):
|
||||
"""
|
||||
cooling demand in Wh
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
self._cooling = value
|
||||
|
||||
@property
|
||||
def external_temperature(self) -> dict:
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user