Using a version control system is a great way to manage your company’s code and track changes over time; however, many PLC programming platforms do not work nicely with version control, since they tend to use binary files instead of human-readable text files.
To address this problem, Siemens released the Version Control Interface (VCI) in TIA Portal V16. Let’s take a look at how this tool can enable better version control practices.
What is the VCI?
The name “Version Control Interface” is a little misleading on the surface. It does not actually perform any version control operations: rather, it provides a mechanism to synchronize text files between your TIA Portal project and your version control system. Specifically, it imports and exports elements of your project to XML files. These XML files are added to a workspace, which is just a folder on your PC.
If this folder is a version control repository, you can then back those files up, as well as import any changes from the repository back into your project.
A workspace is created with the “Add new workspace” option under the project-level “Version control interface.” Once created, the workspace must be configured by selecting a folder. If you have an add-in for a version control system, that can be configured as well (at the time of this blog, there are no add-ins available yet).
Figure 1. Configuring the workspace.
Exporting Objects
To start using the VCI, you need to export items from your project to the workspace. Currently, the VCI only supports program blocks, PLC tag tables, and PLC data types. Once you have these objects in your project, open the workspace, and drag the desired items from the project view into the workspace view.
You can drag individual items, folders, or the entire PLC to export all objects at once. Note that any item must be compiled to be exported; TIA Portal will give you a prompt that will compile all the objects you have selected. Once the export has finished, your workspace will have folders and files matching the exported items.
Figure 2. The workspace after exporting items. Here, the PLC’s program blocks are shown in the workspace view.
Synchronizing the Project and Workspace
Now that your objects have been exported, you can see that each item in the project view have a green circle. This icon shows the comparison between the project and workspace and uses the same color code as performing a PLC comparison. Since we just exported our items, everything is the same. Let’s go ahead and make some changes to the code in our project.
Figure 3. The workspace after making changes to the TIA Portal project.
I made some changes to fbMain and the IO Tags tag table. These objects now have an icon indicating that there is a difference between the project and the workspace. The small star on the icon shows which side was more recently changed; in this case, it is on the project side.
On the top of the VCI window, there are several buttons that can be used to choose which direction to synchronize the changes. Since I only made changes in the project, I will choose to “Export changes to workspace,” then use the “Synchronize” button to execute this operation. The project changes will then be exported to the workspace and all the objects will show the green icon again.
Comparing Objects
This process works to import changes from the workspace into the project. The XML files produced by the VCI are a bit dense and hard to work with. Typically, you would not be making changes directly to these files, but, instead, using a version control system to load files that another developer had modified and exported.
For this example, I have loaded a change to my IO Tags tag table in the workspace. The icon for the tag table changes to indicate that a more recent change has been made; however, I would prefer to know what changes I am loading before I execute the operation. Since the XML files are very difficult to read and understand, we will use Siemens’ Simatic Automation Compare Tool for this purpose.
The Simatic Automation Compare Tool provides a way to view the XML file as it would appear in TIA Portal, as well as see differences between the workspace and project files. It can be downloaded from Siemens' website. After installing, go to your TIA Portal settings, and set it as a comparison program for the VCI.
Figure 4. Setting the Simatic Automation Compare Tool as an option for VCI.
Now, if you go back to the workspace, you can open a comparison between your project objects and workspace object by right clicking the project object.
Figure 5. Executing comparison between project and workspace.
The compare tool will then be opened, and the comparison displayed. In this case, you can see that I added “Q_Output3” in my file. I can then choose to import this file into my project to get the latest changes.
Figure 6. Comparison of project and workspace files.
Merging Changes
Both of the above examples involved only changing either the project object or the workspace object. What would happen if changes were made to both? For example, if another developer modified the same function block you did, you would need to reconcile those differences.
There’s no way to manage differences between the project and workspace in a more granular way. To do so, you would need to use an external utility to merge both XML files that you want to reference. If you’re using a version control system, this functionality is built in and can be done with a standard text editor (I’m a big fan of Visual Studio Code).
Otherwise, you can use any one of a plethora of programs for comparing and merging text files. Once you have merged your text files, the resulting file can be imported into your project as normal.
Final Thoughts
Overall, the VCI is a step in the right direction. As someone who gets a lot of use out of version control systems, it is nice to see more PLC platforms starting to incorporate them and provide tools for using them effectively.
Right now, only PLC blocks, tag tables, and data types are supported by the VCI. If you are using version control, you will still need to archive and back up your entire TIA Portal project to preserve changes to things like your hardware configuration or any HMIs.
The ability to see a detailed history of changes made to a project can be very beneficial for managing a project over its lifetime. Additionally, being able to easily import and export files enables multiple developers to quickly share parts of their project with each other, without having to export the entire thing.
Since it is a relatively new feature, keep an eye out for future improvements and additional functionality to be added in later releases.
Learn more about DMC's TIA Portal development expertise and contact us for your next project.