system_assignation/factories/weather_feeders/helpers/weather.py

30 lines
853 B
Python
Raw Normal View History

2020-11-26 09:26:55 -05:00
"""
weather helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
2020-10-28 13:42:58 -04:00
import math
import helpers.constants as cte
class Weather(object):
2020-11-26 09:26:55 -05:00
"""
Weather class
"""
2020-10-28 13:42:58 -04:00
@staticmethod
def sky_temperature(ambient_temperature):
2020-11-26 09:26:55 -05:00
"""
sky temperature from ambient temperature in degree Celsius
:return: float
"""
# Swinbank - Source sky model approximation(1963) based on cloudiness statistics(32 %) in United States
2020-10-28 13:42:58 -04:00
# ambient temperatures( in °C)
# sky temperatures( in °C)
values = []
for temperature in ambient_temperature:
2020-10-28 13:42:58 -04:00
value = 0.037536 * math.pow((temperature + cte.celsius_to_kelvin), 1.5) \
+ 0.32 * (temperature + cte.celsius_to_kelvin) - cte.celsius_to_kelvin
values.append(value)
return values