Contact and Coil | Nearly In Control



Offline Changes to a PLC Program

As a PLC programmer, you’ll often be asked to do a change to an existing system. If there’s a significant amount of functionality to be added, you generally get your changes ready “offline” and then do all the changes during a short window of time to minimize disruption to the production schedule.

If you’re using an Allen-Bradley PLC, the procedure is typically this:

  1. Get a copy of the latest program from the PLC (a.k.a. an “upload”)
  2. Make your changes to the offline copy, and write down every change you had to make
  3. Go online with the PLC and apply your changes as online changes

Step 3 is much safer than just taking your modified program and doing a “download”. That’s mainly because when you download, you’re not just downloading the program, but the memory state of the PLC as well. The PLC typically has to track things in memory (like recipe data, part tracking, data collection, sequence numbers, machine counters, etc.). If you do a download, you’re going to overwrite all those values with previous values, and that can cause a lot of problems. The other thing step 3 saves you from is simultaneous changes that were done online while you were busy making offline changes.

The only other option you have is upload-change-download, but you really have to shut the machine down for the duration to make sure that the internal state doesn’t change.

When I did a lot of Allen-Bradley programming, I didn’t question that. It’s just how it was. I remember visiting a plant one time for a service call, and the local maintenance person was a bit suspicious of what I was going to do (after all, I was a young kid who had never seen this machine before). He decided to quiz me a bit, and one of the things he asked was, “when you go online, do you download or upload?” I said “it depends,” but his answer was, “you never download.” I agreed that someone in a maintenance role should never need to do a download unless they’re replacing a CPU, or recovering from a corrupted PLC program.

Now that I mostly do Beckhoff TwinCAT 3 programming, I realized one of the benefits are that offline changes are a breeze. It’s due to the fact that TwinCAT 3 completely separates the program from the memory data. The program is stored in local files on your hard drive and compiled into a TMC file. The persistent data is stored in a different place on your hard drive.

When I want to do offline changes to a TwinCAT 3 project, here’s the procedure:

  1. Get a copy of the latest program
  2. Make your changes to the offline copy
  3. Copy changes back to the machine (keeping a backup, of course), rebuild, and activate configuration

This makes offline changes go a lot more smoothly, of course. I don’t have to copy and paste my changes in while online, so it takes less time and eliminates the possibility of a copy/paste error.

Since we also use Mercurial for version control, getting a copy of the latest program is a matter of pulling the latest from the source control, and copying it to the machine is a matter of pulling the offline changes to the machine. Any changes that were done in parallel can be merged with Mercurial’s built-in diff and merge utilities. (Note: I/O changes can’t be merged nicely, so if someone changed the I/O while you were doing your offline changes, you have to copy those changes in manually, but that’s rare and at least it tells you that it can’t merge them.)

This got me thinking that Allen-Bradley probably has a better way of doing offline changes that most of us just don’t know about. I know that you can do an upload without uploading the memory. However, it seems like it requires you to download both the program and data at the same time. I wonder if anyone out there knows how to do better offline changes to a ControlLogix. If so, I would be interested to know that.

· · · ·


  • David · November 2, 2015 at 1:42 am

    I appreciate this post and I wish someone explained the difference between upload/download when I was a co-op student and shut down the factory for 2 hours. As a veteran now this is the first thing that I explain to inexperienced engineers. Also, I don’t think there is a better way to do a major change for an AB controller without downloading. UDTs are so useful however they are also not configurable without downloading or by creating new one and cleaning things up on a weekend. There should be a way but I don’t think there is.

  • Author comment by Scott Whitlock · November 2, 2015 at 8:00 am

    @David – great point about UDTs, you’ve always had to download to modify or add them. In fact, I’ve started to avoid using UDTs for general control stuff, and now I only use them for Recipe management and a couple rock-solid pieces of code that never change. I’m more likely to use Sta01_Dr01_Run (for Station 1, Drive 1, Run) than Sta01.Dr01.Run for exactly this reason. I can add and remove the former online, but adding a new bit to the latter is a real pain.

    TwinCAT 3 on the other hand – you can add/modify and remove structures (equivalent of a UDT) all day long and do it with an online change. It will sometimes warn you that it’s moving variables around in memory to do this, but it gives you a warning, and I just make sure to close and re-open the HMI when I apply the change (otherwise it might still be reading from the old address).

  • Mike Thiel · November 2, 2015 at 1:08 pm

    If you have Rockwell’s Data Preservation Download Tool it is possible to download new logic to a Control/CompactLogix processor without loosing any of the data.

    What is does is saves the current datatable into a local xml file. Then it downloads like normal. But before it puts the PLC back into run mode, it will reload the data from the xml file.

    It is far from perfect. If you change a UDT (add or remove a member) it will not reload any of the data for that variable, because it doesn’t match the structure saved in the xml.
    Plus there are some weird nuances to the program. Like you can only have the one instance of 5000 open that you want downloaded. The processor path has to already be established and set in the file.

    But what your are saying about the TwinCAT3 has me interested in checking out Beckhoff.

  • Author comment by Scott Whitlock · November 2, 2015 at 2:33 pm

    @MikeThiel – I didn’t know about that tool, so thanks very much. The problem with UDTs does limit its usefulness. As David said, modifying UDTs is one of the main reasons to do a download. Imagine adding a new field to your Recipe UDT and then having it not preserve the recipe data. Big problem.

    I find it weird that the tool can’t restore data inside an instance of a modified UDT. If you stored every field separately, it wouldn’t matter if you added or removed a member field.

  • Jeremy Choate · January 27, 2016 at 2:53 pm

    Regarding the hazards of misunderstanding upload and download:

    Many years ago, I was doing a project at Tropicana in Bradenton, FL. One of my colleagues made some offline changes to the PLC program, and not understanding that the program retains the tag values that were present during the last save, he chose to download his changes to the PLC on a running line.

    Once the download was complete, and he placed the processor back in Run Mode, the old tag values took effect and he dumped 25,000 gallons of orange juice on the plant floor.

    He was on a plane that afternoon.

  • Trusted Rockwell Automation Training For RSLogix500 · May 3, 2019 at 8:07 am

    […] turn each other on and off. When you are working on it, it is happening online. If you don’t know how to change the code, you need to go to the online bar and click on go […]

  • Bill Hillman · September 12, 2019 at 1:07 pm

    I know this is an old subject, but just be aware that with a GE PLC, you can make changes online or make changes offline, go online and download with the PLC in run. It also is a separate process to download data stored in the project variables. For a technician troubleshooting or programmer making changes, GE is soooo much easier to use. Plus the PLC and HMI devices can all be in one project, one software package that does everything. AB can be very powerful but is way behind in making life easier for the programmer.

  • Author comment by Scott Whitlock · September 12, 2019 at 1:34 pm

    @BillHillman – I’ve never used a GE PLC, so that’s very interesting. I’ve never seen anything like that.

Leave a Reply



Theme Design by