Skip to content

Weather#

smart_control.simulator.weather_controller #

Controls ambient temperature in simulator.

BaseWeatherController #

Represents the weather on any specific time.

get_current_temp abstractmethod #

get_current_temp(timestamp: Timestamp) -> float

Gets outside temp at specified timestamp.

ReplayWeatherController #

ReplayWeatherController(
    local_weather_path: str, convection_coefficient: float = 12.0
)

Weather controller that interplolates real weather from past observations.

Attributes:

Name Type Description
local_weather_path

Path to local weather file.

convection_coefficient

Air convection coefficient (W/m2/K).

get_current_temp #

get_current_temp(timestamp: Timestamp) -> float

Returns current temperature in K.

Parameters:

Name Type Description Default
timestamp Timestamp

Pandas timestamp to get temperature for interpolation.

required

WeatherController #

WeatherController(
    default_low_temp: float,
    default_high_temp: float,
    special_days: Optional[Mapping[int, TemperatureBounds]] = None,
    convection_coefficient: float = 12.0,
)

Bases: BaseWeatherController

Represents the weather on any given day.

Weather operates as a sinusoid: low at midnight and high at noon.

Attributes:

Name Type Description
default_low_temp

Default low temperature in K at midnight.

default_high_temp

Default high temperature in K at noon.

special_days

Map of day of year (1-365) to 2-tuple (low_temp, high_temp).

convection_coefficient

Air convection coefficient (W/m2/K).

get_air_convection_coefficient #

get_air_convection_coefficient(timestamp: Timestamp) -> float

Returns the convection coefficient (W/m2/K) based on the current wind.

Parameters:

Name Type Description Default
timestamp Timestamp

Pandas timestamp to get convection coefficient for.

required

get_current_temp #

get_current_temp(timestamp: Timestamp) -> float

Returns current temperature in K.

Parameters:

Name Type Description Default
timestamp Timestamp

Pandas timestamp to get temperature for.

required

seconds_to_rads #

seconds_to_rads(seconds_in_day: int) -> float

Returns radians corresponding to number of second in the day.

Parameters:

Name Type Description Default
seconds_in_day int

Seconds that have passed so far in the day.

required

get_replay_temperatures #

get_replay_temperatures(
    observation_responses: Sequence[ObservationResponse],
) -> Mapping[str, float]

Returns temperature replays from past observations.

Parameters:

Name Type Description Default
observation_responses Sequence[ObservationResponse]

array of observations to extract weather from

required

Returns: map from timestamp to temp