adccommunitymod (AutomationDirect) asked a question.

Time and Date arithmetic

Created Date: August 10,2004

Created By: Paul Matejcek

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

I recently purchased a DL06 and an EZTouch (6 " mono). I was astounded to see that there are no routines for easily handling date and time arithmetic. (I probably SHOULDN't have been, but I was.) My application will involve doing things on a schedule that is entered through the EZTouch. Events may happen at a certain frequency, or at certain times on certain days of the week. So I need to be able to accept and store days, dates, and times of day, as well as time durations (do 'x ' on Tuesdays at 2 AM for 2 hours, or do 'y ' every four days at noon for 20 minutes) and then compare them to real times and dates. The most obvious vehicle I 've found for entering durations is three two-digit thumbwheels (one for days, one for hours, one for minutes). I haven't sorted out any of the more interesting calendar-oriented operator inputs... Most of my assembler programming was with VAXes and PDP-11s in a long-ago former life. Doing the math involved using ladder logic looks as though it will be... let's say 'interesting. ' But SOMEONE must have faced this sort of challenge before me. Are there libraries of subroutine, examples, that sort of thing, that I can access? I'm certain that re-inventing the wheel will be fun, but perhaps not profitable. Regards, Paul Matejcek Clinton Power Co.


  • adccommunitymod (AutomationDirect)

    Created Date: August 10,2004

    Created by: Paul Matejcek

    I recently purchased a DL06 and an EZTouch (6 " mono). I was astounded to see that there are no routines for easily handling date and time arithmetic. (I probably SHOULDN't have been, but I was.)

    My application will involve doing things on a schedule that is entered through the EZTouch. Events may happen at a certain frequency, or at certain times on certain days of the week. So I need to be able to accept and store days, dates, and times of day, as well as time durations (do 'x ' on Tuesdays at 2 AM for 2 hours, or do 'y ' every four days at noon for 20 minutes) and then compare them to real times and dates.

    The most obvious vehicle I 've found for entering durations is three two-digit thumbwheels (one for days, one for hours, one for minutes). I haven't sorted out any of the more interesting calendar-oriented operator inputs...

    Most of my assembler programming was with VAXes and PDP-11s in a long-ago former life. Doing the math involved using ladder logic looks as though it will be... let's say 'interesting. '

    But SOMEONE must have faced this sort of challenge before me. Are there libraries of subroutine, examples, that sort of thing, that I can access? I'm certain that re-inventing the wheel will be fun, but perhaps not profitable.

    Regards,

    Paul Matejcek

    Clinton Power Co.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 10,2004

    Created by: franji1

    If anyone gets a date/time library together that can do this, please post it here and maybe we can make it a part of a future version of DirectSoft!

    Not that I want to introduce any Y2.1K bugs http://forum1.automationdirect.com/board/wink.gif , but it would be nice to be able to do time deltas or ???.

  • adccommunitymod (AutomationDirect)

    Created Date: August 10,2004

    Created by: marksji

    Most of what you describe can be done with the basic math already in the CPU. Just don't do anything for 2 hours at 22:53...

    When you need to do X every 3 days just run a one-shot off a compare with the "current day " and the PLC's internal day of week register and incremented a counter and stored the new "current day " when they 're different. When the counter gets to 3 then run your sub routine and rest the counter.

    Expand Post