Forum

TON preset for a 30...
 
Notifications
Clear all

[Solved] TON preset for a 30 day filter timer overflows, what do people use instead

9 Posts
4 Users
0 Reactions
49 Views
(@wandak)
Trusted Member
Joined: 2 years ago
Posts: 39
Topic starter   [#230]

Remote lift station, 1769-L30ER, no operator there most weeks. The filter on the seal water line wants changing every 30 days and I said I'd put a reminder on the panel view rather than have someone drive out to look at a sticker.

Typed 2592000000 into the preset of a TON and Studio won't take it. Tried it as a constant in a MOV to the .PRE instead, which it accepted without complaining, and the timer now finishes somewhere around day 25 and the reminder comes up five days early every time.

Checked the tag and .PRE is holding a negative number, so I've clearly wrapped something. What do people actually use for an interval this long, and is there a reason the MOV let me do it?


Advertisement

   
Quote
(@jcasey)
Trusted Member
Joined: 1 year ago
Posts: 59
 

> .PRE is holding a negative number

DINT. Signed 32 bit, tops out at 2147483647, and your preset is in milliseconds, so the ceiling on any TON is 2147483647 ms which is 24 days 20 hours and change. You asked for 30 days and it wrapped past the top into negative.

Studio refused the literal because it checked. The MOV didn't because a MOV is just moving a number, it has no idea what you meant by it.


Advertisement

   
ReplyQuote
(@wandak)
Trusted Member
Joined: 2 years ago
Posts: 39
Topic starter  

24.8 days. That explains the five days exactly.

So I think that's it for a long TON anywhere, it's a ceiling on the instruction rather than something I've configured badly.



   
ReplyQuote
(@kiran_s)
Trusted Member
Joined: 2 years ago
Posts: 48
 

Same ceiling on the Siemens side, in case anyone reads this later. The IEC TIME type is a 32 bit signed value in milliseconds, so TON tops out at T#24d20h31m23s647ms and not a millisecond further.

On a 1500 there is LTIME, 64 bit, and TON_LTIME with it, which gets you into years. A 1200 does not have it. So the answer depends on which CPU, which is usually the thing nobody says.



   
ReplyQuote
 louk
(@louk)
Eminent Member
Joined: 2 years ago
Posts: 27
 

Cascade it and stop fighting the instruction. One TON with a 60000 ms preset that resets itself on DN, feeding a CTU with a preset of 43200. Counter DN is your 30 days, the accumulator tells you how many minutes in you are, and both numbers stay small.

We had these on filter and belt reminders on a dozen sites and none of them ever needed better than a minute of accuracy.



   
ReplyQuote
(@wandak)
Trusted Member
Joined: 2 years ago
Posts: 39
Topic starter  

That's the shape I was after. One thing though, this station drops power more often than I'd like, maybe a couple of hours at a time when the co-op has a line down.

A minute counter that loses its place every outage is going to drift and the reminder ends up meaningless by the third month.



   
ReplyQuote
 louk
(@louk)
Eminent Member
Joined: 2 years ago
Posts: 27
 

Then don't count, compare. GSV WALLCLOCKTIME into a DINT array at the point somebody presses the filter changed button, store the date, and every hour compare today against stored plus 30. The controller's clock keeps running on the battery through an outage and the comparison doesn't care how long you were off.

Counting suits a machine that only matters while it's running. A calendar job wants the calendar.



   
ReplyQuote
(@wandak)
Trusted Member
Joined: 2 years ago
Posts: 39
Topic starter  

Put the clock version in on Thursday. GSV WALLCLOCKTIME into a 7 element DINT array, the date written to a retentive tag when the operator presses Filter Changed, and a compare on an hourly basis against that plus 30 days.

The original problem was me assuming a TON preset was just a big number. It's a signed DINT in ms, so 24 days 20 hours is the ceiling and the MOV let me sail straight past it into negative without a word.

Still not sure what happens if someone sets the controller clock forward while the timer is pending, I expect the reminder just fires. Thanks jcasey, kiran_s and louk.



   
ReplyQuote
(@kiran_s)
Trusted Member
Joined: 2 years ago
Posts: 48
 

It will fire. Nothing wrong with that on a filter.



   
ReplyQuote
Share: