svshow (Customer) asked a question.

Daylight Saving Time (DST) in DoMore

Before the NETTIME instruction appeared I used 6 variables (year,month,...) and once a day set the time remotely thru Modbus. I did not care about $SummerTime flag.

Now NETTIME updates UTC time in PLC and it just applies $TimeZone and $SummerTime to local time calculation. TimeZone I can setup 1 time and forget about it. But $Summertime flag I have to adjust twice a year in this case.

The idea is to have automatically updated flag ST768 ($SummerTime).

mathI hope someone already thought about it. I created some tests to this logic and seems like only 1 of 4 will work right.

Summertime_testFor example:

 // DST starts 2nd Sunday of March; 2am

// DST ends 1st Sunday of November; 2am


  • svshow (Customer)

    Done.

    Long story short - I have some ideas for DoMore developers regarding SummerTime register.

     

    Developers from Cisco systems made it possible manually set up summertime in their configuration like this:

     

    clock summer-time name recurring 2 Sun Mar 02:00 1 Sun Nov 02:00 60

    Where "2 Sun Mar 02:00" means "Second Sunday in March in 2AM"

    Where "1 Sun Nov 02:00" means 1st November Sunday in 2am

    60 means amount of minutes to play with

     

    For DoMore (for now) idea is simple:

    Rise $Summertime On second Sunday of March at 2am and reset it on first Sunday in November at 2am.

    Now logic:

    1. If current month more than 3 and less than 11 then set $Summertime
    2. If current month =3 and day > than day(second Sunday) then set $Summertime
    3. If current month =11 and day < than day(first Sunday) then set $Summertime
    4. Else reset $Summertime

    DST_testNow collect everything together:

     

    DST_workingPotentially you can add "Success" bit from NETTIME instruction to this logic - should work.

     

    If anyone have time to test this and let me know about the results - that will be helpful for all.

     

    Expand Post
    Selected as Best
    • svshow (Customer)

      Thanks. That works for systems working 24/7.

      But, maybe I want too much, I want to have this flag ready any time any day after power cycle PLC.

      • Garry (Customer)

        How about using the first scan bit of the PLC or NETTIME success bit and then do the comparisons to see if the $SummerTime bit should be set.

        Regards,

        Garry

      • svshow (Customer)

        Yeah. The problem is not in a primitive logic like to use first scan bit - its obvious. I want to create universal formula (function) what returns this flag any time any day of a year according to $Now.

      • svshow (Customer)

        :) Tooooooooo many contacts. I like smaller programs.

  • svshow (Customer)

    Done.

    Long story short - I have some ideas for DoMore developers regarding SummerTime register.

     

    Developers from Cisco systems made it possible manually set up summertime in their configuration like this:

     

    clock summer-time name recurring 2 Sun Mar 02:00 1 Sun Nov 02:00 60

    Where "2 Sun Mar 02:00" means "Second Sunday in March in 2AM"

    Where "1 Sun Nov 02:00" means 1st November Sunday in 2am

    60 means amount of minutes to play with

     

    For DoMore (for now) idea is simple:

    Rise $Summertime On second Sunday of March at 2am and reset it on first Sunday in November at 2am.

    Now logic:

    1. If current month more than 3 and less than 11 then set $Summertime
    2. If current month =3 and day > than day(second Sunday) then set $Summertime
    3. If current month =11 and day < than day(first Sunday) then set $Summertime
    4. Else reset $Summertime

    DST_testNow collect everything together:

     

    DST_workingPotentially you can add "Success" bit from NETTIME instruction to this logic - should work.

     

    If anyone have time to test this and let me know about the results - that will be helpful for all.

     

    Expand Post
    Selected as Best
    • Garry (Customer)

      Have you tested this in the simulator?

      Can you zip and send the file?

      Thanks,

      Garry

      • svshow (Customer)

        I tested this in real DoMore. Worked great for me.

        Some test cases in the beginning of The program. Just replace $Now.Day with V1 and $NowDayOfWeek with V2

      • Garry (Customer)

        It works well in the simulator.

        I like it.

        Thanks,

        Garry

10 of 11