OPC UA Lesson 3- Understanding OPC UA Server in Siemens S7-1200

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] all right now we will continue with our last lesson so i will overview about what i talked about the node id and address so here as i told you we have a unified object model in which we have variable which is again methods and events so for example we have an object one which has some variables methods and evens now what is a variable variables are basically the data the data which you read write and the data which has a notification when the data changes that comes in the variable the methods are basically opc commands for example the method is it can be if you're reading the data or if you write the data or if you subscribe to the data we will study that when we when we do some programming with opcwa so these are different methods to to have a communication between server and client and some even in which you need some inter notification in case of for example system errors so an object consists of these three elements okay variable methods and evens so there can be more objects with the same these events and they can also have a relation with each other and when we come to a node model we have attributes and we have reference now for example if you see this window of my client now every node like for example this counter has an attribute which defines the property of this node and it also defines the reference which means the connection of this node with another node for example i open this variable one okay and i go to inverse and i refresh so this says that variable one is connected by a test which is this one and if i click this one this is connected to a simulation which is this one and when i click this one it is organized by an object which is this one and this is organized by a root so reference is nothing but a linkage of this node with another nodes and attributes defines the property of this node so this node has these components attribute and reference which defines the nature of this node and it says every node has a node id which is always composed of three elements which we talked about already so we have a namespace index which is signified by this you have identifier which is which can be here it can be string or it can be integer we will see that in the next slide and the identifier itself what is the identifier here so three things which every node has so for example we see ns2 s equivalent to my temperature in this case ns is a namespace index is two s is my string which is a string identifier and identifier is my computer okay now here you if you see just i equivalent to two zero four five it means it has no space no name space index so by default it's zero and here it's a numeric identifier this is defined by a number and i is for integer so for example if we have namespace identifier sg it defines as global unique identifier it's a very unique identifier now why unique sometimes you may have two identifiers which are equivalent in case of integer and in case of string two identifiers can be same but if you have guid this identifier cannot be same it's a unique one i don't have an example to show you where we can use it but i hope if i have one i will post a video about it and now there's another kind of identifier which called opaque byte string identifier unfortunately i've never used it again i've never encountered encounter some applications where i need to use it so mostly we will talk about string and integer identifier and i will show you the example of on both of these now as i told you in the beginning we will talk about opc way related to plc because most of my courses are related to plc and in most of the examples i'm going to talk about plc and plc is the most widely used device in the industry in the factory so we'll talk more about how to fetch the data from plc server so when the value is coming from a blc it has this kind of identifier so ns3 like i told you it's a namespace dynamically generated s is a string identifier type and this is the dag so here if you see opc read write this is a 1db value 1 this is the tag this is a value one this is a variable or you can say this is a tag and the data type which is very important i told you it's boolean so this is one of the examples how a tag is defined if it is coming from a plc okay we will do a lot of examples on this in our upcoming lessons okay so let's see the first example opc ua in the plc so what we're going to see in this example we have an opcus server inside the plc however this is possible this is a siemens plc which i'm using in this example and this is s7 1200. if you have this plc you must note that siemens has a new firmware firmware means the operating system of your plc so you can download a new firmware which i think it's 4.4 and once you do that your plc will have an opc us server inside the same plc which didn't have before as i told you opc is just a set of codes now the new firmware it supports opc ua so download this firmware it is available on the internet on the siemens website just download it now another thing is if you really want to use this firmware it only supports tr portal wait a second i take another pointer it will only happen if you have tia wait i should should not write here i have some some text here it is only possible via tia v16 if you have this version of your software then only you can download it in your plc that's one constraint it cannot support v13 or 14. so let's say we have a plc and i'm going to show you some data coming to this vlc some sensor or actuator simulation and then i will show you how to link this plc to an opc ua client which is installed which is installed in my computer so this is my computer that's my plc and then you have an opc ua client which can be node-red as our course is focused on node-red so we will study how node-red can be working as a client this can also be on a plc on a pc a node can also be on a raspberry pi so client can be on a in a computer or in a raspberry pi and then okay i'll come to that later so let's see this example first opc ui server in the plc so i have this data factory automation data coming from here and my plc is here so plc has some values in this db and let me just bring it back so let's see let's say we have this we have this example in which there are boxes coming on the conveyor and this pick and place arm just pick the boxes and place it on this conveyor let's imagine we have this situation and here i have a tank in which there will be some filling and raining application so now the information from the factory i o is going to the plc we know that you have a lot of you have done this factory io connection connectivity with your plc so plc is talking to the software via s7 connection i'm not talking about opc ui yet so plc s7 connections talking to factory io okay and if you see these values are getting updated here this is the feedback of position of your robotic arm or you can say pick and play scantry so the way it moves it reflects here okay now if i want to read all these values in my opc ua client there are some steps i have to follow but in this video i'm just showing you the overview and then i will show you in detail how this is done so first i will show you the client so that's my client and this is my server which was from simulation i don't need it so i need a server which is on my plc okay so this is my client what i'm going to do is i will add a server now how to add the server to add the server if you remember we need three things we need the endpoint url so in this case if you see your plc and as i told you plc has its own opc us server inside so i will go to my configuration and i'm going to show you how this server can be activated so i will pause this video so when you go to the property of your plc go to the opc ua here okay and if you drag down you will see activate opc ua server so you have to make sure this is ticked and once you tick it you will see an address coming automatically so as i told you before in case of plc in case of simulation it was rv home but in case of plc this is the ip address of my plc and this is the port address of my plc 4840 not of my pc now so i just have to copy this and go to my client click on add server put this value here and click ok and this is already connected multiple times so i will see it here and then i open this one and you i will see siemens that this value is coming from the server and i will open it again and i will use none as a security and now you can see here your server is added and the server has information which is coming here so i will remove this simulated information before and here you can see i have a server interface and the server interface i have an opc and here i have some tags now this opc what is this opc this is my tag this is the name of my blog opc okay this is the blog now how this blog is coming to the client so in blc the first step was to activate the server okay now let's go down and here is the port address which will be by default and let's understand some properties it says maximum session timeout 30 seconds it means it is a it is a time limit if there is a no connection it will keep waiting and try to connect so for 30 seconds if there is no connection it will make an error okay maximum number of opc ui session it's five it means at the same time this plc can only accept five connections so five clients can interact if there are more than five it will reject so this is not a big number and because it's a s7 1200 it has a limited option if you have s7 1500 sometimes you have 32 or 48 connections okay another interesting thing is which is very important minimum sampling interval it says it's 100 milliseconds now what is that sampling interval means every 100 millisecond the opc us server which is inside the plc is going to read the tags okay so plc has some tags in a db and plc have you can see here a scan time of three millisecond at the moment or sorry one millisecond so every one millisecond the values are changing our values are updating but the server will only read these values every 100 millisecond and if i go here i might find wait let me see what is the minimum time i'll go offline so here i can have minimum 100 millisecond or maximum 10 seconds okay so i choose the minimum value so every 100 millisecond the server requests the plc to give me the values okay this is very important if you have application which needs faster response this server may not be the best maybe there are better servers in a better plc so you need to make sure about your application if this delay is enough or not this is very important another is minimum publishing publishing time okay so this hundred millisecond was to read from its own plc and 200 millisecond this is the minimum so minimum is 200 is the time which it needs to publish to the client so in the end a client is getting in 200 milliseconds so if i have to explain you in a presentation about these two times so this opc ua server which is inside the plc full screen so the server is getting the value from here every 100 millisecond so string pointer different color oh i took the same color whoa so this or maybe you can say from here so every 100 millisecond again not exactly from here but this is just to explain you so this opc's u.s server which is already inside a plc so it is reading from the plc every 100 millisecond okay if the value is changing in one millisecond it will lose the value which changed in 99 milliseconds but it will only take from 100 milliseconds this is called sampling so at every 100 millisecond plc takes the samples of the value all right but to publish this value to the client it needs 200 millisecond so in the end client gets update value every 200 millisecond this is the limitation of s7 1200 minimum is 200 milliseconds so this was the setting here in tia portal and let's go down then you have a server certificate so maybe if it's blank for you you can define it from here and double click here so it will automatically generate a plc certificate and this is a certificate which goes to opc ui client so if i show you here like you saw for the simulation plc also sends a certificate and if i show you in managed certificates that's the certificate lying here from the plc from the siemens and it says it's valid up to 28 april 2037 so if the certificate expire you can also renew it okay so for every opc collection connection you have a certificate for example this was for plc this was for simulation server which which we did process and the third one is from wind tech iot device which i'll talk about later so client keeps the certificate in this directory similarly server also do that okay now when you go down you will see the type of security you want so you can have no security or you can mention some security sign and encrypt once you define it you can also define the trusted clients so you can put a list of the clients here for example when the client talks to the plc for the first time you have to make you have to trust the certificate in the plc if you enable all the securities if you don't have security this option will not be valid but most of the time clients and the server has to put the certificate in the trusted list like i trusted the certificate of these two and the client put the list here these are the trusted certificate you can see trusted issue and issuers similarly trusted certificate list is also in the server okay and comes user authentication here you can mention enable guest or enable user id and password i have enabled guest so in this case when i connect from my client to server it didn't ask for id and password if i disable it it will ask for id and password which you can define in the plc as admin and hear its password so every time any client tries to connect to a plc he needs to enter the id and password this makes the connection secure okay all right and these were the different settings you need to put in the server besides that if you go to the runtime license here in opc ua you have to mention here basic if you put no license you can't do the connection you have to make sure this is linked to the basic so these were the settings you need to do in plc s7 1200 to enable opc us server okay and in the client side now i will show you this opc this okay one more thing once you do these settings in a 7 1200 you go to here opc ua communication and if you open server interface you have to click add new server interface and then you have a new server interface like this and here i have added the db which i want to push to the server so it's up to me which information i want to put in the server so i took this db from here and i just dragged it here so this is already here and once i drag it here you can see this db is coming here so this db is now in the opc ua server and then i download this whole logic into my plc so maybe in the next exercise i will show you a small example doing all the steps by myself how to put the db into this opc ui server and one more thing once you are pushing this db you have to make sure the property of this db so this db right click and go to properties and you have to make sure this is having attributes of optimized optimize block access and this should be tick data block accessible from opc way these two options you have to make sure it stick and then you download this logic in your plc so the opc ua server knows which values he needs to read from the plc and these are the values it's reading this just opc ua tags so in this server you only see these three in the client sorry conveyor pick in place and the tank it do not read the ios it doesn't know what's the status of inputs what's the status of outputs because i haven't mentioned that in my in my server if i want that server should also tell to the client about the status of i o so i can go to my plc tags and i can take the tags from my plc tags for example these ios and i can push it to my server then it has more information it's totally up to me which information i want to open up to the clients all right so now i can show you here the same information which is going to plc so i will start my process again so you can see this information is coming in my db go online here you can see some information changing pick in place and i can open my client this is coming in pick and place access pick and place access and i go to i position y position and set position and you can see these values are here which are reflecting from here and this will have a delay of 200 millisecond for sure as i told you this is a limitation of my plc so you can use all this information in your client box detected is false or true for example box detected must be when the box is here you can see this is true or maybe it's something else i'm not sure about the tags wait let me see i'm not sure what is this center but anyways you can see the information of this of this arm movement here and parallely if i okay now i told you also about you can change the process so if i open this conveyor and i have a start and a stop so start stop are false so if i click on stop i have this box here and i click this one if i click on stop my conveyor will not move anymore so let's see that if my programming is correct convert will not start again so from this software i control my plc so this is my client it is controlling the server values and i make this false again and we'll start the conveyor from here so this is started this is a pulse command okay let's see another example so i have this tank here now and here in the tank nothing is happening so let's bring it a little bit smaller here and you can also see the tank here so i will try to organize everything like this and that's my client so tank this is the input flow meter the level draining and filling so let me just delete this one so flow there is no flow there is nothing happening in the tank there is no level of zero no liquid in that draining this is the output so i can put the value let's do the filling first i put four and enter so when i do 4 you can see that the fill valve is open by 40 percent and that's the discharge wall and let's see the tank level as well so tank level is rising you can see here and you can see the tank level here as well so my client is reading the information and my client is also able to write the information so i put eight so this will be like 80 percent filling the tank and if i put drain for 40 percent is draining and this is possible because this opc way client is writing to the opc ui server in the plc and plc is for the link to the factory i o here i'm just showing you the software simulation example i'm just talking about the simulation in the soft factory i o but you understand if the value is going from this client to the plc you can also read and write the value to your real actuator because that's a db you can just move the value to your i o tags so the point of understanding the idea of understanding here is how you're linking your factory i o or the real data to your opc ua client via opcwa server okay now you'll be saying oh i don't have opcs in my plc what should i do how should i learn don't worry about that i have some next videos in which i talk about what to do if your plc has no opc ui server this example was only in the case if your plc has a server inside of it okay and once the values are inside the server you can also display these values i'll come to that in a dashboard in the node-red now the question is how the values are coming to the node-red because so far i just talked about i just talked about client which has no programming inside it's just drag and drop and you see the values you can control the values but you don't want that you need some automatic operations that's the point of this course so we will understand how to make some nodes in which we can read the value in node-red and further displaying this value in the dashboard all right so we can start stop the value not from the ua expert by a click of a button or push button or slider we can do that and then we will see okay this is this is uh this is a siemens plc and this is plcnext forgot to mention here and i have made some web series on plc next an opc us server which you can find in lesson 10 and 12 10 11 and 12 this is on youtube and i will put the link in in the next lectures or subtitles in the description i mean and i've already explained in detail how this obscure server worked with plc next and this is must for you because in this case i'm using real world data i'm using the buttons of my trainer and potentiometer so this is a real world data but the fundamentals are same as i explained you in siemens plc and opca server the same fundamentals we have in pnc next but the difference is just for your information i'm reading a real world data which most of you are interesting to see and in this case also you can i have also i have shown that how to do it with opc a client and i've i've also showed it also shown how to do it with opc ua client and further i have explained how to do a dashboard but in this course we will understand how to bring the values to client and how to make a dashboard this will be a lesson in this course all right so this was about opc server which was inside the plc okay so let's stop this video here and i'll see you in the next video about the next [Music] case you
Info
Channel: Rajvir Singh
Views: 42,380
Rating: undefined out of 5
Keywords: node-red, node-red with PLC, node-red with OPCUA, opcua, opcua course, node-red course, opcua with PLC, opcua with arduino, OPCUA tutorials, opcua lessons, opc ua client, opc ua server, opcua server and client, what is OPCua server, what is opcua client, opcua server vs client, server vs client, opcua client, difference between opcua server and client, code and compile, rajvir singh, OPCua with PLC, opc ua in siemens plc, opcua in s71200, opc ua in plc
Id: zgijGxFLH6E
Channel Id: undefined
Length: 27min 40sec (1660 seconds)
Published: Tue Oct 13 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.