ControlLogix Clock Calibration


Introduction to ControlLogix Clock Calibration

Today, I wanted to discuss the ControlLogix Clock Calibration. Actually, that is a little bit misleading though, because we can’t really calibrate the clock itself. We can adjust it each day though. One way to do this is through the clock update tool. Another method might be through the 1756-TIME module, which is now obsolete.

There are other more advanced methods that are more absolute, but if those options are not for you, then you can try the method below. Do not depend on this method for general production that depends on the clock. It works well if we just need to display the clock to the operator, or to time-stamp data when I just need a general idea of when an event took place.

First, you will need to determine how much deviation your processor’s clock has from actual time. You can do this by setting the clock in the controller properties. After that, allow 30 days or so to pass, then compare the processor’s clock to actual time.

For example, if you find your clock is about 30 seconds slow per month, you can simply add one second each day. On the other hand, if you are only 15 seconds slow per month, then you can just add 1 second every other day. Just be aware that we are setting the clock, blindly assuming that the clock is consistently slow. Basically, the idea is that we would have to adjust the clock manually less often.

In this post, I will assume that you are already using the GSV Command to get the LocalDateTime attribute of the WallClockTime object.

Create a Counter

First, we will create a counter. This will count the number of days that pass. Another option is just to use the “day” value that we get from the GSV command for the wallclock time object. I like to use the counter though, because I can reset it, and know how many days have passed since the last time I’ve set the clock manually. That way I can compare the number of days to the clock deviation and make more adjustments at that point. We don’t care about the preset, because we are not using the DN bit. The counter will run 2147483647 days before it overflows, but even then, it shouldn’t miss a beat. Even if it did, that would be for someone else to worry about!

When it’s midnight, each day, I’m just latching the TimeAdjust bit. The reason for the latch is because if we need to subtract time, we don’t want to trigger the counter twice. Later on, we’ll unlatch this bit.

Just be sure to create new tags with names that are unique to any other tag in your logic. You don’t want to interfere with your equipment’s operation.

Add Logic for ControlLogix Clock Calibration

At this point, we are ready to add logic to adjust the clock. Keep in mind that the processor is just a computer. Computers “think” in binary. This means the accumulated value is really a binary number. Bit 0 of the accumulated value is true on odd numbers, and 0 on even numbers. In other words, it will be true every other day. In this case, the address of bit 0 is TimeCalibrationCounter.ACC.0.

Likewise, bit 1 will be true every 4 days… Bit 2 is true every 8 days, and so on. If you need an adjust every single day, then you can just use the CU bit (TimeCalibrationCounter.CU). You can also use binary conditions. For example, if you need an adjustment every 3 days, you would simply require bits 0 AND 1 to be true before the adjustment happens.

In the example below, I’m adding 1 second every 2 days. I’m using the OneShot (ONS), so I only add a second for one processor scan.

Here, I’m using a UDT for the tag that stores the time. If you use a standard array, then your seconds will likely a tag such as Time[5].

Unlatch your Adjustment Bit

Since we are using the OneShot instruction (ONS), we can simply clear this ONS by unlatching TimeAdjust at any time later in the day. We need to execute the unlatch though, at a time that is out of reach of any adjustment we might make. In other words, we don’t want our clock to skip over the time at which we unlatch the bit.

Additionally, we don’t want to unlatch the bit immediately before it latches if we need to subtract time. For example, if we unlatch the bit one second before midnight, and we subtract 1 second every day at midnight, we could cause a runaway condition.

In this example, we’ll just unlatch the bit at noon.

Summary of ControlLogix Clock Calibration

In short, this is a crude method. We simply add or subtract time blindly without knowing the exact time. It should work out fairly well though if your clock is consistently fast or slow. Don’t use this method on equipment that is sensitive to the clock. Mainly this is a thought experiment, but I’m going to let it run for a few months to see how it works out for me. Keep in mind there are other methods that will be more reliable. In this case, I didn’t want to set up any extra server, though. I just wanted to adjust the clock with logic.

If you have any thoughts or ideas, please post them below.

For more information, please visit the ControlLogix Category Page!

— Ricky Bryce

Leave a comment

Your email address will not be published. Required fields are marked *