Skip to content

Baseline SchedulePolicy day/night switches early vs SB1 local comfort window (UTC hod + utcoffset) #201

Open

Description

@Sidharth1743

Summary

On SB1, the baseline HVAC schedule in SchedulePolicy does not stay aligned with the building-local comfort window (SetpointSchedule, 06:00–19:00 US/Pacific).

Observation hod_* features are built from the simulator timestamp in UTC, while schedule lookup does:
Timedelta(hod) + local_start_time.utcoffset()

Under PDT (UTC−7) that makes day setpoints active only for local 06:00–16:59. From local 17:00–18:59 the schedule has already switched to night setpoints, but comfort mode is still on.

This does not appear intentional: gin uses the same 6 / 19 hours for comfort and for schedule events, and get_radian_time documents the timestamp as local.

Intended behavior (config)

smart_control/configs/resources/sb1/sim_config.gin:

  • morning_start_hour = 6
  • evening_start_hour = 19
  • time_zone = "US/Pacific"
  • start_timestamp = '2023-07-06 07:00:00+00:00' (UTC midnight Pacific)

Comfort path correctly uses Pacific:

  • smart_control/simulator/setpoint_schedule.py → is_comfort_mode / _localize_or_convert_timezone

Schedule events are labeled with the same hours:

  • smart_control/reinforcement_learning/policies/schedule_policy.py → create_baseline_schedule_policy (Timedelta(6, hour), Timedelta(19, hour))

Actual behavior (code)

  1. Env overwrites hod_* / dow_* from the building timestamp without converting to time_zone:
    hod_rad = conversion_utils.get_radian_time(
        self.current_simulation_timestamp,
        conversion_utils.TimeIntervalEnum.HOUR_OF_DAY,
    ) 

In simple

Concrete day (Pacific)

Local time Comfort (correct) Schedule (buggy)
6 AM – 5 PM day day
5 PM – 7 PM still day already night
7 PM – 6 AM night night

So for two hours every evening (5–7 PM Pacific), the zone still wants comfort warmth, but the baseline schedule has already switched to night setpoints.

Activity

  1. Sidharth1743 commented on Oct 10, 2026

    @Sidharth1743
    Author

    @s2t2 look into this. i think this bug seems to be serious

  2. burgulvedant commented on Oct 26, 2026

    @burgulvedant

    I can reproduce this by reading the code. get_active_setpoint receives hod plus the UTC offset, which is negative at UTC-7 for UTC hours 0 to 6. No event matches, so it wraps to the last event, which is the 19:00 night setpoint. I have a one line fix that wraps the local time into 0 to 24 hours, with tests. I will open a PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions