Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: amezcackle on November 05, 2015, 09:10:29 PM

Title: Timer length limit?
Post by: amezcackle on November 05, 2015, 09:10:29 PM
Is there a limit on how long a timer will run? I have an on delay timer which will run a pump while timing. Will this timer reach a limit if it runs for many days?
MW
Title: Re: Timer length limit?
Post by: BobO on November 05, 2015, 09:37:05 PM
It'll run for about 24 days. If you need more than that, you'll have to use the system time.
Title: Re: Timer length limit?
Post by: Controls Guy on November 05, 2015, 10:09:32 PM
Or go old school and cascade a timer with a counter (like we use to have to do with 9999 count BCD timers with 100ms timebase) ;)

Using system time has the advantage (or disadvantage, depending on what you're trying to do) of not losing time if the PLC is off for part of the time.
Title: Re: Timer length limit?
Post by: franji1 on November 07, 2015, 04:33:40 PM
The answer is dependent upon the needed resolution and/or duration.

The TMR instructions in Do-more have millisecond resolution (this is the finest POSSIBLE).  However, your PLC scan time resolution will ultimately define the granularity, e.g. you can't get millisecond resolution with a scan time of 2ms.  The maximum duration of Do-more TMR instructions is 24 days, 20 hours, 31 minutes, 23.647 seconds (0x7FFFFFFF milliseconds, the largest positive signed 2's complement DWORD integer).

If you need duration but not resolution, use DST22 ($LocalTime) as the "start" time-stamp.  Just save DST22 into a D DWORD register at the "start" event, then every scan, take the difference of DST22 and that D "start" time to get the accumulated time and stick that in another D DWORD register.  Although its resolution is 1 second, it can time up to over 68 years! (0x7FFFFFFF seconds).

If you need both resolution and long duration (beyond the TMR duration of 24 days...), set up a day timer with a preset of 24 hours 0m 0.000s that auto resets, but when it resets, increment a D register to count the number of days.  The D register day counter can count up to 0x7FFFFFFF days (2+ billion days), and the auto-resetting TMR will give you the millisecond resolution within that day.   ;D
Title: Re: Timer length limit?
Post by: Controls Guy on November 07, 2015, 09:05:15 PM
Don't forget that your 24 hour timer will end up being a 24 hour + 1/2 scan timer, statistically speaking, so if that degree of inaccuracy is an issue (as might be implied by needing ms resolution), you'll need to make the error non-accumulating (although you'll still get one single 1/2 scan error when you evaluate at the end)

Does the system clock not do ms? What's the resolution?  If it's only seconds, and if you need ms resolution, could you time how many ms it takes SDT0.Second to change.  Then, knowing how many ms into the starting second you started, you could do ms resolution timing with the system clock (though you may have to time using ms at the end of the period as well. (You'll still have to correct for scan time at both ends if that accuracy is needed)
Title: Re: Timer length limit?
Post by: b_carlton on November 07, 2015, 09:16:50 PM
Quote
The D register day counter can count up to 0x7FFFFFFF days (2+ billion days)

Only 5,800,000 years. Do you think we make equipment that flimsy that it only needs that kind of timer?

And I suppose that near the end of that Host Engineering won't be there to provide support?

I'm disappointed.
Title: Re: Timer length limit?
Post by: Controls Guy on November 07, 2015, 09:37:06 PM
By about 4.0 x 106 years into that epoch, Rockwell will have morphed into the Automation Borg and assimilated Host.  Their uniqueness will have been added to the collective.

So yeah, no tech support unless you catch up all 4.0 x 106 support contract payments.   ;D