Now that we've seen how timers are created and used, let's learn a little about their precision. When we are creating a timer that lasts a few seconds, or more, we can typically not be very concerned about their precision because it's usually insignificant. However, when we're creating timers that have a duration in the millisecond (1ms= 1/1000 second) range we MUST be concerned about their precision.

  • There are general two types of errors when using a timer. The first is called an input error. The other is called an output error. The total error is the sum of both the input and output errors.
  • Input error- An error occurs depending upon when the timer input turns on during the scan cycle. When the input turns on immediately after the plc looks at the status of the inputs during the scan cycle, the input error will be at its largest. (i.e. more than 1 full scan time!). This is because, as you will recall, (see scan time chapter) the inputs are looked at once during a scan. If it wasn't on when the plc looked and turns on later in the scan we obviously have an error. Further we have to wait until the timer instruction is executed during the program execution part of the scan. If the timer instruction is the last instruction on the rung it could be quite a big error!
  • Output error- An another error occurs depending upon when in the ladder the timer actually "times out" (expires) and when the plc finishes executing the program to get to the part of the scan when it updates the outputs. (again, see scan time chapter) This is because the timer finishes during the program execution but the plc must first finish executing the remainder of the program before it can turn on the appropriate output.
Below is a diagram illustrating the worst possible input error. You will note from it that the worst possible input error would be 1 complete scan time + 1 program execution time. Remember that a program execution time varies from program to program. (depends how many instructions are in the program!)

Shown below is a diagram illustrating the worst possible output error. You can see from it that the worst possible output error would be 1 complete scan time.

                               Total output error diagram

Based upon the above information we can now see that the total worst possible timer error would be equal to:
1 scan time + 1 program execution time + 1 scan time
= 2 scan times + 1 program execution time.

What does this really mean? It means that even though most manufacturers currently have timers with 1ms increments they really shouldn't be used for durations less than a few milliseconds. This assumes that your scan time is 1ms. If your scan time is 5ms you had better not use a timer with a duration less than about 15ms. The point is however, just so that we will know what errors we can expect. If we know what error to expect, we can then think about whether this amount of error is acceptable for our application. In most applications this error is insignificant but in some high speed or very precise applications this error can be VERY significant.

We should also note that the above errors are only the "software errors". There is also a hardware input error as well as a hardware output error.

The hardware input error is caused by the time it takes for the plc to actually realize that the input is on when it scans its inputs. Typically this duration is about 10ms. This is because many PLCs require that an input should be physically on for a few scans before it determines its physically on. (to eliminate noise or "bouncing" inputs)

The hardware output error is caused by the time it takes from when the plc tells its output to physically turn on until the moment it actually does. Typically a transistor takes about 0.5ms whereas a mechanical relay takes about 10ms.

The error keeps on growing doesn't it! If it becomes too big for the application, consider using an external "hardware" timer.

Blog, Updated at: 19:16


Post a comment