Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Version control for ladder logic (LL) programs for programmable logic controllers (PLCs) seems to be virtually non-existent. It may be because LL is a visual language and tends to be stored in binary files, or it may be because source code control hasn't "caught on" in process control engineering circles - or perhaps my Google-Fu is weak tonight.

Do you know of any realistic and useful solutions for version control for such systems?

Definitions:

  • realistic = changes to the programs are tracked by user and subject to reversion and merges
  • useful = the system integrates with visual LL designers, is not limited to LL from a single PLC manufacturer, and does not cost a ridiculous amount of money?

Note: I have heard of people using SVN or Mercurial et al to track the binary files, but I don't think the diff/merge capabilities would display readable differences.

ADDENDUM:

At first we only had to support Allen-Bradley PLCs. Now we also have Siemens and MicroLogix PLCs. Still searching for a viable solution...

share|improve this question
    
This question may be relevant to you: stackoverflow.com/questions/4216619/plc-version-control –  blueberryfields Aug 20 '11 at 21:22
    
Hi @Stevenalowe, has there been any developments on this subject? –  Enmos Proje Nov 7 at 8:24
    
@EnmosProje: not that I'm aware of, sorry! –  Steven A. Lowe Nov 10 at 21:54

2 Answers 2

up vote 11 down vote accepted

Unfortunately the answer is going to depend on the PLC vendor you're using. Most of them store their code in proprietary file formats, so it makes it difficult to use regular source control.

Rockwell offers FactoryTalk AssetCenter if you're using Allen-Bradley. I haven't priced it, but it's likely expensive. It does more than source control though.

I have used regular (Mercurial) source control with Beckhoff TwinCAT PLC files. That seems to work OK, but I never had to merge with anyone. Their new version of TwinCAT (3) coming out later this year is supposed to be built on Visual Studio 2010, and I'm assuming will have much better out-of-the-box offerings for version control integration. Fingers crossed.

Start Edit

I just wanted to add that I've now used the new TwinCAT 3 product, and I am using Mercurial (TortoiseHg and the VisualHg add-in for Visual Studio). It is working pretty well. First of all VisualHg makes it feel very integrated into the Visual Studio 2010 IDE that TwinCAT 3 uses. However, the source code for TwinCAT 3 programs are generally stored in XML files. This is a vast improvement over other vendor's proprietary binary formats that I've used, but it still doesn't merge well. Some of the files don't have any line breaks in the XML (I've written to Beckhoff about this) which means a line-by-line source control system doesn't do much. Also, since it's XML, the ordering of the nodes in the XML file seems to change randomly, even when you don't make any changes. Also, I think it sometimes generates new IDs for some nodes when it doesn't have to, which makes for superfluous changes that Hg picks up on. This effectively makes it impossible to make changes to a TwinCAT 3 program by 2 programmers at the same time, and then merge the changes. It's an unfortunate oversight by the TwinCAT 3 developers, who undoubtedly use source control regularly in their own work, and didn't see the advantage for us lowly automation programmers to have access to similarly powerful tools. :(

End Edit

Start Edit #2

I would like to point out that TwinCAT 3.1 now has file formats that are better suited to source control, particularly the structured text language files. In fact, the product is now built to support integration to Team Foundation Server, I believe.

End Edit #2

The other alternative is that most PLC programs can be exported to text files. RSLogix 5000, for instance, exports its projects to an L5K file, which is just text. I've run scripts against those files before - they're fairly easy to parse. They would work well with source control. Of course that means exporting every time, which sucks.

If you do go with any standard version control, I highly suggest a distributed VCS, like Git or Mercurial, because with PLCs, half the time you're onsite and can't connect to your home server, so the ability to do local commits is a real bonus.

The other thing you have to realize is that some PLC programming environments, like RSLogix, already include a diff tool, so you can run diffs against two versions of your projects. This, combined with saving a new file with today's date every day, is what most automation shops seem to get by with.

share|improve this answer
    
Have you ever used Autosave? wingtipllc.com/products/autosave-plc-version-control/… –  blueberryfields Aug 20 '11 at 21:29
    
@blueberryfields: yes I've used the autosave feature on most software that supports it, and yes, it's saved my butt a few times. However, using it as version control isn't a good idea. Version control should have more than just a timestamp, it should have author and a description of the changes. It should also be possible to do a 3-way merge between a parent version and two forks. –  Scott Whitlock Aug 22 '11 at 1:42
    
Beckhoff's TwinCAT projects can be exported and imported to/from text files as well. That's how we put them under version control. Works alright for projects written in ST. Haven't tried with graphical languages like LL though. –  stmax Jun 2 '12 at 16:31
    
@stmax - I just edited the answer to provide my latest experience with it. As I said, it works, just not as well as it could. –  Scott Whitlock Jun 2 '12 at 17:28
    
I accepted this as 'the answer' because it appears that exporting to text files and using SCC is the only viable solution for multiple PLC vendors. –  Steven A. Lowe Sep 9 '12 at 4:44

If you can, look at B&R Automation.

Full Disclosure... I work for a sales partner of B&R Automation.

Modern B&R Automation projects work very well with versioning software. I currently use GIT (which is not integrated), though there is supposed to be integration with SVN in the software. All of the HMI source is saved as XML, and all of their PLC language sources (including ladder) is saved text based instead of binary (mostly XML as well). If you have to do manual merges then you do have to "figure out" the XML to some extent, but I did not find it that difficult. And the automatic merge usually makes that unnecessary anyways.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.