accuracy of timers CompactLogix ?

realolman

Member
Join Date
Mar 2009
Location
here
Posts
584
How accurate are the timers in a CompactLogix L16ER ?

There are also two Point I/O cards attached: one analog two channel input and one analog 4 channel output... do these affect scan times or timer accuracy?



I would think the timing accuracy would be affected by scan times... is that right?
how can I calculate the scan time? If you were to somehow involve the PLC in a routine that took 10 seconds, would any of the timers with shorter presets fire during that time?


what kinds of things is it dependent upon? Is the WallClock more accurate?

I am measuring the lengths of objects passing on a conveyor in front of a photocell ... same thing with laser measurements taken of the thickness... some times it seems to nail them... other times ... not so much.

these measurements are not that critical... If I could measure within a 1/16" I'd be tickled ... it's not like I need to measure to the thousandth the belt is moving probably 15 -20 inch per second

typing that down here makes me think I need to pick up the calculator ..... see you in a bit

Im back ... would that mean these timers have to be accurate within 3 mSec? to get within 1/16" at 20 inches per second?

what kinds of things could be done to try to get the best accuracy possible? For example, there are routines that don't need to do anything unless the operator interacts... would it be useful to jump these routines if the operator is not interacting?



thank you
 
Last edited:
Hi

The scan time will affect the timers accuracy.
You could set up a task that runs ever 1 ms and use that task to do
Your timing.
You could also attach an encoder to the conveyor and use that to measure for you. With out knowing what else the plc has to operate its hard to give an accurate answer.

Sorry could not help my self

Donnchadh
 
Hi

Well to start with i would make a routine that measures the scantime, just to keep track with what's going on, making 3 tags with the highest, lowest and average scantime.

I try to avoid to deep subroutines, so my scantime will be more even, i find this easier to work with, especially if timing is an issue.

/Holmux
 
thanks for both your replies

I 'm not really asking about my specific program, but timing in general

Holmux, could you give me an idea of how to make a routine that measures scan time?

thank you
 
Hi

Here is a scantime routine that will take the average of 1000 scan, it counts every second scan (count to 500)

Your first scan after downloading the routine is always longer, so you will have to go in manually and reset the high and low tags after startup.

Hope this is usefull.

/Holmux
 
I am measuring the lengths of objects passing on a conveyor in front of a photocell ... same thing with laser measurements taken of the thickness... some times it seems to nail them... other times ... not so much.

if all else fails – and the "timer" idea doesn't solve your problem, then you might want to consider this ...

with COMPACT-Logix (not CONTROL-Logix) weird things can happen with the transfers of Input and Output signals between the modules and the processor ...

suggestion: read the first part of the following thread – and play the first little WAV file ... you can actually HEAR the I/O signals being degraded ...

http://forums.mrplc.com/index.php?showtopic=26162#entry125399

once again – this might have NOTHING to do with your problem – but – if this effect is causing your situation, then nothing else is going to fix it except attacking this issue first ...
 
A TON, RTO, TOF, is a computer instruction that operates on a location in memory. When first executed to start timing it stores a time reference in word 0 of the timer structure. When it is executed again it reads the system time reference, then subtracts the stored time reference to determine how much time has elapsed since the timer instruction was last executed. It then adds that time to the accumulator, then it stores the new time reference in word 0. This way the timer stays accurate. However, because it is a computer instruction, there is a timing delay between when the timer conditions become true and when the timer instruction is executed. The desired time period will almost always expire during the interval between timer executions, leading to some more time accuracy loss. This is how scan time affects the timer accuracy. In short, scan time doesn't affect accuracy while the timer is timing, but rather scan time error is in the interval between when the time period actually expired and when the computer instruction was executed again. Now when you have a timer that is self resetting then the scan time problem becomes compounded, with between two and three full scan periods lost. After a while those missed scans add up. (Did you know that you can execute the same timer multiple times during a scan with no problems? What effect would that have on improving timer accuracy? AB even has a technote recommending this for certain conditions).

In a Logix5000 PLC you don't need to make a routine that measures scan time. Last scan time for a program can be obtained with a GSV. However if you are doing this in the continuous task then don't expect any consistency. The continuous task is the bottom dweller and it gets interrupted by everything. If you have something where timing is important then put it in a periodic task. A fast periodic task can actually execute more scans than the continuous task. AB has a demo they do at various training classes where they convert a continuous task to a periodic task and increase its period so that it is executing three scans in the time it was running just one when it was a continuous task. At the same time it lowers the burden on the processor. Some programmers just routinely deleted the continuous task. If you have the chance play around with the task monitor tool - nothing convinces more than seeing it yourself.
 
Last edited:
Thank you all. Very helpful. Thanks for the detailed explanation
The entire program is not terribly large but it is all in one continuous
scan. I have one routine for JSR s

Are you talking about putting the timing in a scheduled task? In which case i suppose i couls remove the JSR ??
 
Last edited:
Here is how you get the scan time for the last scan and the maximum scan time for a program using the GSV instruction.

The second rung shows how to get the task rate for a periodic task.

tc10131402.jpg
 
Last edited:
I wonder if one of you would be so kid as to tell me how to set up a periodic task... I've never done that

can I use a subroutine I already have? move it or set properties?

thank you
 
The timer instructions are accurate to 1ms at BEST. They compare the start time and the current system time at the instant their rung is executed, so two identical timers in a big program could finish in different scans.

WallClock's CurrentValue is the most accurate and reads down to 1 microsecond (but is not actually accurate to 1 microsecond). Depending on the IO you are using, you could set it up to trigger an event task when the beam is broken and record a start time or position. Then call a second event task to record a stop time or position. This is the most accurate you can get with ControlLogix. Event tasks have the second highest priority under motion control, and so will interrupt the rest of your program to record the time or position as close to the actual instant as possible. Unfortunately, there isn't really any way to determine exactly how accurate this will be except by empirical testing since it would be completely non-deterministic.

If you want to be more deterministic, you could run a very small cyclic task at 0.5ms that must monitors the IO and records the start/stop. This will at least verify the calculation time, but IO access in ControlLogix is still rather non-deterministic. You may want to look into a control system that is better at determinism, Rockwell is more of a cross your fingers and try it kind of platform. They cant calculate latencies or jitter ahead of time since even their back-plane protocol is non-deterministic, let alone Ethernet/IP.
 
To set up a periodic task right click "Tasks" in the project explorer window on the left hand side in RSLoigx5000. Select New. In the popup form enter a name the new task and select periodic as the type from the drop down. Enter a time period for how often you want the task to execute and enter priority. When you click OK you should see your new task appear under tasks. Now your new task needs a program, so on your new task right click and select New Program. Make sure it is scheduled in your new task. When you click OK, you should see the new program appear below the new task. You new program needs a new routine, so right click again and select new routine. Name the routine and pick its type. The new program must have one routine that is scheduled as the main routine. You can specify it when the first routine is created or later by right clicking on the program and selecting properties and clicking the configuration tab. Once you have a new task created with at least one program under it and that program has a main routine you can now program code that will execute at a deterministic rate.
 
Compactlogix does not have a register that stores number of seconds since power up?
That would be nice...
GE plcs have that function, called a service request (svc_req 9) and it is nice to use for timing.
There is also a service request to pull last sweep time in microseconds or nanoseconds....you can even set sweep time.
I have equipment that has up to 20 hour plus soak times at different temperatures, and I need about 10 sec accuracy on that soak time, the "service request 9" function gives me resolution to 100 microseconds with an overall accuracy to 0.01%.
 
Last edited:

Similar Topics

Good Morning , I am working on a small project for a food safety audit . We ran some tests in our ovens concerning speed and temperature to...
Replies
10
Views
2,765
I am working on an installation that will require sensor cabling interconnecting sensors to PLC subject to outdoor temperatures. Will the ambient...
Replies
3
Views
2,063
So I have a plc program where most of the outputs are based on a counter that goes from 0 to 1000. The counter speed is adjustable and is...
Replies
23
Views
5,935
I have been working for a small turn key machine builder. We mostly do table top machine which do a few automated steps in assembling a product...
Replies
20
Views
5,336
Using a 1769-IT6 module with a Type K thermocouple, we're seeing a +7 degree C offset. We used a calibrated fluke tester and simulated both 0C...
Replies
12
Views
2,732
Back
Top Bottom