TIA Portal meets Git - Version Control Interface in V16 using Github, VCI, Add-Ins and ACT

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the ti portal meets kit hey everyone in this video we'll talk about version control in tia using the version control interface and get github and the git connector and i'll also show you automation compare tool so why would you need version control in ti is the first question imagine you have a block a block that maybe controls a motor when you do your first project it's going to be a very simple block that maybe just sets this motor to work it work at different speeds but the more projects you do you will probably start reusing this block and you will be expanding it adding extra functionality maybe some alarms maybe some safety some extra inputs and outputs handling this block will start growing now imagine there is more than one of you maybe you and five of your colleagues are developing different projects using the same blocks you know to reuse to not uh reinvent the wheel you are reusing the blocks that each of you made so this block starts growing and is being developed by multiple people at the same time now suddenly it stops working or stops working as you would expect it to be and how do you find who modified it last at what changes they made why is it not working why is it doing what it's doing well these questions are the actual reasons why you need version control methods and there are three things you can do regarding version control in tia first and the most native thing are the tia libraries so with ti libraries you can version of version control and different objects in ti and it's great for having like copies of maybe even entire hmi or entire hmi screens big objects in tia you can also version control different blocks but the downside of the libraries is they don't really show you the exact changes between different revisions so then we get to point two the second method of version control in tia is what is now called project server it used to be called multi-user server and and this method allows to version control entire project it's really really good it allows multiple users to develop at one project simultaneously so they can be online to a server at the same time modifying the project you see who modified at what and and which blocks they changed but this is for entire projects so it's on the project level rather than on the block level so the third method is what we'll discuss today vci version control interface it's something that you will use if you want to version control individual blocks the great advantage of vci is it will actually export your blocks as xml or dot scl files to allow tools like getting a github git lab to easily compare different revisions of files and to show you exactly what's changed between them it'll also show you who modified it what they modified when they modified you will be able to fork it you'll be able to merge different changes and track exactly what was happening to your blogs with descriptive comments so this is what we're going to do today first thing you'll do we'll set up your environment so we'll install git for windows and set it up then i'll show you how to use vci in ti portal we'll set up ourselves a little repository on github we'll push our blogs from our local repository from our pc to the center repository in github in github using the command line interface then i will show you the um the git connector add-in to show you how to automate this process and how to control your git not from command line but directly from inside tia and the last thing i will also show you a little program called act automation comparator that allows you to visually compare xml files so rather you're reading the files and the contents it looks at the file and actually shows you it nicely in ladder and plugs up any changes between different files and revisions okay let's start by installing git uh we can find git just go to your favorite um web browser and look for git for windows then we go to getforwindows.org webpage and we download the latest version of kit now before you go on and start installing get the important thing is make sure that your um tia isn't turned on if it is and you install gateway ti is running then you will need to restart tia for it to be able to pick up and get in your environment so make sure that that ti is not running when you're installing it in terms of the installation of git itself uh you should be go just going you know through all the default options and the one thing i'm going to change is i'm going to change the text editor that git uses as default i'm going to change it from them to visual studio code but any of them works perfectly fine if you don't know which one you prefer just stick with them if you have any preference you can choose it here go through all the default options which should be good for most of people if some of these options are not good for you you most likely know about it so there is no need to discuss quickly install get shouldn't take okay get is installed for us now there are a few things that will need to set inside get okay let's fire up a command line and what we will need to do we will in need to initialize our repository so we need to create a local folder at which uh gate is going to connect and it will be monitoring this space for us to then be able uh to push it to the central repository also this folder will be used by ti itself so we do get init and we define uh where we want to create our local repository so for me it's c and then i will create a new folder there called ti underscore ws for workspace yeah so we create we initialize an empty git repository there if we now go to this place to this pc c ti as you can see it's empty but if you do hidden files you can see that there are some files used by git itself inside okay so we've done this if we've never used git before what we'll also need to do we'll need to um define our username and our email this is so that git knows when it pushes the changes to a center repository and it will know who made these changes so the command we need to run here is going to do git config global user dot name this is your username might be first name last name i just use my first name and then we do git config global dot user dot email and here put your email address yeah no dot here so global space user dot email and this should be fine our environment is more or less set up for using it now we can go to tia let's close this down let's fire up ti v16 we have ti running now what we're going to do we're going to open a previous project that we created when going through the scaling and processing of analog inputs if you want to check out the video on this if you're interested you should now have the link above okay just to recap you know project we have an analog input scaling block that takes the analog input value normalizes and then scales it between our for our sensor range and gives us an output of scaled value but the thing that we'll focus on today is the version control interface so now imagine that you have this block and you start with something very basic like this but throughout your projects you will be probably adding an extra functionality maybe some extra thresholds to give you warnings to give you alarms etc now you'd like to track the changes to this block so if something goes wrong you can always go back you can see what was changed maybe if there is a team of you your colleague makes a change you make a change with like an easy way to merge these changes together and again track what was happening with the project throughout the project for the development of your blog and keep comments about all the changes this is exactly what version control means and and is used for so we now with version 16 have this version control interface and where we can add the new workspace and what it's going to do for us is when we defined a local workspace and if you remember you know five minutes ago maybe maybe even less we create the workspace for git so here this is the place where we should actually show it exactly same workspace so uh both gate and tia will share the same same workspace for for a project so we go c t i workspace okay and here we can select a version control added this is something that we'll um do just in a moment but first i'd like to show you how you would work with version control interface without having the add-in okay so that you know how it works behind the scene so we defined our workspace and then what the vcr actual allows us to do it allows us to automatically export the program blocks to one common format and this is a text format so that they can be um easily cross reference so if we have different versions we can see exactly what was changed there is no way to do something like this normally especially if you're talking about ladder blocks seo quite easy you can export the sources ladder function block diagrams not so much so with with the vci which uses openness in the background we can actually do it the way you do it you define the blocks that you actually want um to version control by dragging and dropping them so we drag and drop our analog input scaling block it will export it for us into xml format for for ladder for function block diagrams it will always be xml for seo you have the choice so it can either be exported as dot seo and then it just looks like your scl or it could be exported again as xml okay so you can see it exported for us as xml now if i go here i have this xml file i can open it and see how it looks like so as you can see it has information about ti version that we used it then has um information about our our interface okay so all the inputs outputs with the comments then it will show you how the um the networks are being blocked you can actually find more information about this xml format in the ti openness documentation because this is what is being used here to export it as xml but what it means is that we now have a format that we can use to export and import files and with a text format like this it's very very easy to just see the differences so for example and if i changed the input name i would be able to see it clearly in a visual manner what i can actually do here let's call it maybe not draw value but raw value underscore mod okay and i save it let's see what happens in ti if i make the change to this um exported block that sits in my workspace if i go back here i can see oh there's a difference okay so there is a difference between these two blocks now how can i see what the difference is i actually have a little program called act automation comparator that allows me to visually see the differences between them and at the end of this video i'll show you where to get it and how to install it in ti for now i just right click compare to the workspace file and use act for it so it will fire up act for me and it will show me that yeah this is the the file that you have in your project this is the modified file and in red i can see okay the the change here is that raw value was changed to be raw value underscore mod the rest is exactly the same so a very very nice tool that shows you graphically the differences between the files that were exported as xml files okay let's close it for now we know what the differences are and then you can decide okay so which one is the correct one do you want to import from the workspace so like take the one with the mod or do you want to export the workspace so override the mod with what you have in the project i actually want to have what i have in my project so i'm going to select the arrow pointing towards the workspace and then i will hit the synchronize button which again will overwrite the file and if i go back to it reload it again it's just called raw value so this is how you can see the differences but all this is being done locally okay it's good okay i exported the files i can see the differences but how do i then send it to a central repository so that i can work with my colleagues on the same files i have a central place for tracking it this is where gate actually comes into play okay and we have um different services for get we can use things like github or gitlab would be the most popular ones gitlab is great if you have a big organization maybe and want to set your own server because you can you can just grab gitlab install it on the server and use it for your organization or if you want you can use something like github where you right just register on the website and create yourself some repos so this is what we are actually going to do so we go to chrome we go to github okay and here if you don't have a github account you can just sign up for it uh there are different variants but generally speaking you can have a github account for free with some limitations i already have a github account so i'm just going to login and here you can actually create a new repository so you just go create new give it a name let's just call it vci okay uh you can give it a description okay this is going to be public yeah that's all good let's create a gate repository now so it created us a repository and here you actually have links uh that we will need to use to commit to this repository uh gateway github will also tell you what commands you need to use so we already did get in it we won't bother with uh adding the readme but we need to commit the the files that we have to our repository so what we'll do we'll fire up ourselves command line will then move we'll then go they will change the directory to go where our repository actually is so we'll do cd c uh where was it ti workspace yeah now we'll add all the files that we have here so we'll do git add oh okay so we added all the files that are in this repository now we're going to commit them so git commit and we'll call it initial commit analog input scaling yeah now we need to [Music] we need to add the origin so this way you need to go https or ssh if you have set it up copy it and we do get remote add origin so this is how we just map um our local repository to the central repository that says on github and we do get push set up stream origin master normally uh if you were not logged in you would get a pop-up here asking to log in then you can choose login with browser and we verify that you actually have access to this repository before it allows you to push your changes okay let's now go to our repository and see if anything changed here as you can see we have our initial comment uh with the comment and with the entire xml file so everything worked fine we're able to push our block to the central repository which now means that any future changes that we push here will be version control which means that we can give access to other people and to maybe push their changes to this block that we can then merge and version uh control everything that happens in this central repository so next time if i have a project which needs some analog input scaling i can just create a workspace and pull down the latest version of this block that might have been modified by by my colleagues and just use it in my future projects now all this we did using the command line interface how would we do it um using the the add-in that i mentioned before if we go to the siemens support website and look for yeah look for mti add-ins and if you want to learn more about adidas please check our other videos specifically on add-ins also showing you a very very cool add-in for fcfb conversion so we go for the download of ti portal add-ins we scroll down and we download the vci git connector add-in and description not necessarily the source code i already downloaded it so i should have it in my downloads just extract it and then you will find an install instruction that will tell you yeah take the add-in and paste it there so we copy the add-in with ctrl c we go to the c drive program files siemens automation portal 16 add-ins and copy and paste it here i already have the add-in installed but the way you will have it is it will appear here as deactivated you can then right click activate the add-in and give it all the permissions okay so again follow the instruction copy and paste the ad into what the instruction tells you then in tia go to add-ins on the right-hand side you need v16 for it right click activate give it permissions the add-in is installed and activated now if you remember initially when we set up our workspace in tia we said yeah no add-in but now we can actually go and select version control add-in what is going to happen now is if you right-click something in workspace you have this extra menu for git so rather than you having to control get from the command line you can do everything with a gui from tia now in this ui there are two really interesting options if you go to settings you have commit on vci synchronize and push on the vco synchronized i use this add-in in the past so that's why they're attacked i think by default they are either both unticked or at least pushes unticked so let's untick them which should match what you have but just double check your settings because i honestly don't remember the default so i'll untick these they are now unticked yeah so i have full manual control at at this stage so now let's imagine i have another block which is for analog output scaling i synchronize this with my local repository the git adding shouldn't be doing anything but it will ask me for a commit message and this is because every time i synchronize this means yeah it's it's a different version so if you want a commit message so initial upload maybe let's call it commit of analog output scaling block yeah okay and now you can uh for example do a push okay so if you don't have a manual push you can do a push from here sorry if you don't have an automatic push you can do a push from here if uh by clicking right click push button speaking i would probably recommend doing comment on vci synchronized it steps it just saves you this one step because uh every time you synchronize your changes in the project with the changes in the local repository it's already going it's also going to create a comment for you maybe necessarily push maybe you don't want to push every time you synchronize to a local repository but i leave this choice to you so now i'm going to do right click and just push this thing yeah it should have pushed this now so if you go back to our vci we now have this analog output scaling block that we just pushed okay so this is how easy it is to work with uh with git with the vci and with the vci git connector now it's not something i would normally recommend but let's try to modify this file here just to show you uh how you would grab the changes okay so we edit this file in the browser and we change raw value to be raw value modified yeah we give it a um modified interface we commit this directly to the master branch okay so now this changed and what i can do i can right click i can just get myself at the latest version so rather than pushing uh we want to pull it okay so i'll pull the latest changes from the repository this is something that you will do every time you probably start a project and you want to get the latest versions of your blogs so we pull it now it tells us okay wait there are differences between what is on the central repository and what you have in your project do you want to do something about it again i could use a ct to see what the changes are i see okay yeah the change of this was modified it is the correct way to go about it so i want to import this from the workspace i synchronize and then if i go back to my analog output scaling block it should now have the new name in its interface so this is how you work with it one last thing i promised i promised to show you where to get act so automation comparator on the siemens website you just find it here i include this video at this link in the video you download this and then you actually need to go to missions settings version control interface okay scroll down here and you need to add um add your program so basically you go here and you point it to your program you click modify and it then should appear whenever you have changes you right click and and show the changes with act so again if i make a change here go back to my workspace i can now right click compare use act yeah do you want to compile yes and again it shows me where the changes are if you have any questions around the version control interface please do let me know in the comments below thanks and bye
Info
Channel: AutomationStation
Views: 16,415
Rating: undefined out of 5
Keywords:
Id: Jm-KNwNnrgQ
Channel Id: undefined
Length: 24min 55sec (1495 seconds)
Published: Wed Apr 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.