Placing a TwinCAT3 Machine Under Source Control

Auteur avatarGareth Green | Dernière modification 21/03/2022 par Gareth Green en cours de rédaction

Introduction

...Note - This dokit is now obsolete - the sourcetree system has been replaced by the internal one in TcXAEShell

Click here for the latest procedure


For many years, the source code for the PLCs has resided on the G:\drive and then a copy on each and every one of the PCs used to edit the code, so at least one on each machine. This is a recipe for disaster because maintaining all the copies and version numbers is incredibly difficult and adds a lot of time overhead to fixes and changes. This has worked because there has been only one developer, but this is set to change in future as more programmers will be trained and tracking versions becomes more difficult


From 2020, the PLC code version control has been improved by using an industry standard source control system called "Git" along with "BitBucket" to store the PLC code in the cloud. The program "SourceTree" is used to commit, push and pull the changes


Click here for an introduction to version control using Git


This tutorial is a step by step guide to setting up an existing machine or diagnostic PC to a standard uses on all Stuga machines to enable quick, easy and stress free version control.

Étape 1 - Install Sourcetree on the PC

See this tutorial for installation instructions


Étape 2 - Backup the Old Project

See this tutorial for backing up (archiving) a TwinCAT3 project

Étape 3 - Rename tcMulti and PLC_Reset

Remove the version numbers at the end

Étape 4 - Clone the tcMulti repository

Clone the online repository to a new local directory c:\TwinCAT\stuga\versionControl

Check success by navigating to the folder - there should be 2 folders

PLC_Reset

tc3Multi


Étape 5 - Pull the latest tcMulti Projects

This will get the latest file versions from the cloud of tcMulti and PLC_Reset and copy into PLC_Reset and tc3Multi folders

Étape 6 - Change the PLC Projects to versionControl

  1. Open the machine's standard Visual Studio project file
  2. Right click on tc3Multi_and select Change Project
  3. Navigate to the versionControl folder\tc3Multi
  4. Select Use Original Project Location
  5. Repeat for PLC_Reset
...Following this method will keep the io links in the project


Étape 7 - Check the IO Links still Exist

Étape 8 - Activate Configuration

Étape 9 - Delete the Old PLC Projects

In the Project folder for the machine, delete tc3Multi and PLC_Reset folder

...These folders now reside in the versionControl folder

Commentaires

Draft