Industry Articles

Why Choose Copia for Version Control?

June 10, 2022 by Copia

Let's suppose you’re convinced that version control will improve your productivity, mitigate risk, reduce downtime, and improve collaboration. You probably have the following question: What tools should I use for version control?

‍Before you commit to using a tool, it's essential to look forward to the future and ask yourself if you will regret this decision years down the road. Some reasons I've regretted selecting a tool in the past were:

  • It was trendy at the time, but nobody uses it anymore
  • After switching projects or jobs, my time learning the tool was wasted
  • The tool was very non-standard, and nobody but the vendor understood it
  • I could not easily extract my data from the tool to move to a more cost-effective tool (vendor lock-in)

Why Git? 

There are many version control tools, but the behemoth in the room is Git. Nearly 20 years old and written by the creator of Linux, Git is open source and freely available. Numerous surveys show that most software engineers use Git frequently and prefer to use it compared to other version control systems. There are countless books and online resources about Git; it's about as standard of a technology as you can ask for. At this point, you would need a pretty compelling reason to use a version control system that isn't based on Git.

While you can self-host a Git server in your living room or factory floor, most Git users rely on a third-party provider that hosts Git repositories in the cloud. This is convenient for security purposes (functions as an off-site backup) and makes it easy to access and share your code from anywhere with internet access. Git providers usually deliver features like:

  • Access Control (who is allowed to read and modify my code)
  • Code Review (host code review comments and keep track of who approved it)
  • Code browsing (view the code in the web browser)

Because most software is written in text-based languages, it is easy for Git providers to deliver these capabilities without regard to the specific language of the code. Git providers can support code rendering and “diffing” for all text files.

Control and Automation engineers working with PLCs often have very different needs than traditional software development teams. Instead of large numbers of small text files, PLC IDEs frequently save a small number of large binary files in a proprietary format. This means that many of the benefits of version control (diffing, merging, traceability, and code review) are much more challenging to realize. Couple this with Git commands often being challenging to learn, it may be easy for an automation professional to convince themselves that their industry’s domain is too different. While they desire a robust version control system, they may conclude that Git will not work for them.

Unlocking Git for PLCs

This is where Copia Automation comes in. Copia provides tools (including cloud-based Git hosting) that make Git easy to work with PLC files. Copia provides a desktop application that executes Git commands for you so that you don't need to learn how to run Git commands from the terminal. The Copia desktop application and web application have viewing and diffing support for the most popular PLC file types, letting you see the historical changes to your files (without the vendor tools installed), and can even help you share files via web links.

Copia includes commenting for code reviews both for text-based and graphical languages like ladder logic so you can comment on and discuss specific elements that have been modified. This empowers you to spot more coding mistakes before they reach production.

Copia also includes tooling to help with merging changes that were made during concurrent development. Copying and pasting changes between file versions is a tedious process and the Copia merge tool automates this process by extracting modified project items from one project and importing them into another, resulting in a file that has the changes from both versions.

Advantages over Git alone

We at Copia aren't the only ones in the automation space to realize the benefits of Git-based version control for PLC files. Siemens TIA Portal, CODESYS, and Beckhoff TwinCAT3 all have first-party Git integration tools. These integrations are handy, but you still need somewhere to store your Git repositories. If you were to use a general-purpose Git provider like Github, Gitlab, Bitbucket, or Azure DevOps, you'd find that you are still missing some key benefits of version control.

For example, if you used the CODESYS Git integration to store your CODESYS project in Github, and you wanted to send it to a teammate for code review, that teammate wouldn't be able to see your changes without having CODESYS IDE installed and cloning the repo. With Copia, you can see the code changes in the web browser.

To see the difference, this is what a CODESYS project file looks like in Github:

This is what the same file looks like in Copia:

Another example can be seen analyzing Beckhoff TwinCAT3 files. TwinCAT3 stores its files as small text files that are much easier for version control to handle. It also has built-in Git integration so that you can commit and push to a repo without leaving the IDE. But if you were to use a general-purpose Git provider like Github with it, you would still have a difficult time understanding the files that TwinCAT3 produces.

For example, here's a screenshot of an excerpt of a TwinCAT3 TcPOU file that uses ladder logic:

Even though it is text, it is still challenging to see what is happening here. It would be completely impossible to find a bug in this code.

Compare that to how this same file looks in Copia:

The ladder logic is rendered like the IDE so that you can read the code and spot issues.

Increasing efficiency and quality

From the above examples, you can see how Copia unlocks incredible value for PLC programmers. The rendering of ladder logic, with change-highlighting, accelerates the review of code and makes it easy for all team members to understand the changes that have been made. Time is saved, and quality is improved.

One final point worth noting: it's important to consider the risk of being held hostage by your version control system. You don’t want to limit your options down the road because of the inability to cleanly access your files and history. Since Copia is built on Git, it is effortless to migrate, mirror, and back up any managed files. No matter what happens, you will always have access to your data.

Git is the standard version control system throughout the world. With Copia, it is easy for automation professionals that work with PLCs to leverage the power of Git to improve their productivity, mitigate risk, reduce downtime, and improve collaboration. Copia makes it easy to use Git alongside PLC development environments and unlocks greater value by visualizing code created with ladder logic, functional block diagrams, or structured text.