Introduction to OPC with Examples

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi in this video we will give our introduction to Appa see and we will show how you can use OPC with some examples so the contents of this video is first a short introduction to OPC and the different specifications especially the difference between the classic OPC specifications and the next-generation OPC in this video we will use the metric on opposite simulation server as an example of an opposite server and we will create some opposite clients and see how they can work in different programming language like LabVIEW with the studio and MATLAB we will also show some examples using the next generation op z the so called of OPC ua specification so then we will see that you can use LabVIEW to create of OPC ua server and op c ua clients so what is opposite OPC is a standard that defines the communication of data between devices from different manufacturers you typically require an OPC server that communicates with one or more opposite clients we have different standards you know OPC direct access see historical data access OPC alarm heavens et cetera and so here you see the typical scenario where you have an OPC server and you have one or more opposite lines that communicates with the server and share data so here is your typical example here we have our PLC a distributed control system or a SCADA system that control a process and measure some data within the process and those data are sent to an OPC server and then we could have moved to the clients that and read data from the OPC server that we could also see clients that right to the OPC server that is and all these clients can be could be distributed in a network so here we see some opposite specifications we have what we call classic OPC so this is the first specifications and that came in OPC then we have this OPC direct access which is used for real-time data and we have the OPC historical pay taxes which which is used for historical data and then we have the OPC alarm on events that is used for alarm animals and a few years ago the next generation of OPC was released and this specification is called OPC UA UA reunified architecture yeah so we hear we see these specifications and those three are the most common in classic OPC and then we have this new OPC unified architecture and with this classic see we have these this problem with the comm and decom communication if we have multiple clients on servers in a network there is a problem sending data between them because OPC in the classic op C is based on comm and e-comm another thing in opposite classic you typically may need more than one opposite server or at least one opposite server that supports different standards like this while in the OPC UA all these standards are defined within the same standard like this and here we also see the typical problem in the classic opposite if you use classic opposite in a network we will have problem sending the data between the server and the clients and because of settings in the firewall etc because modern network don't don't really support the decom standard because you need to a lots of configuration in order to make this work so typically in this case you need to use a standard software that makes this communication easier but in a more modern approach and OPC unified architecture and the configuration you need to set up is much easier because this protocol uses the more modern web standards like HTTP etc yeah here we see some examples also in classic ops II and the clients and the server needed to be a Windows computer but with OPC UA you could use different kind of operating system like embedded system Linux Windows or even a Macintosh or OSX so the different clients would be a computer it could be an embedded system etc like this since you are going to use the magic on opposite simulation sir in this video we are going to give a short introduction to that OPC server so the matric on opposite server and you can download the matric on opposite simulation server you can download for free on internet on the home page of Madrigal in addition to the opposite server the package also include an OPC client called matric on opposite Explorer and this opposite is T a client is handy to use and you want to check your communication between the server and the client you're great and so in this Explorer you just choose the server you want to connect to in the list to the left and then you click connect and then next you can add tags you want to monitor so then when you click attacks you will get access to the folders on the OPC server if you click one of the folders you will get the tags in that specific folder so select default do you want to use typically and with this server you have lots of tags you can use you have some random tags that just can read from random data if you want to test right on read communication between client and server you could typically use the bucket brigade tags so you click packet pre-dates you can get lots of different tags you can use so I just select the tag you want to use double click and then next click on the Add button here and tags you want to monitor will be listed in this list and here you see the value quality etc of that specific tag you can also right-click on the tag in order to write data directly from the Explorer like this now we will show some practical examples where we create OPC clients in different programming language and so you can create opposite lines and opposite servers in most programming languages today you can create these totally from scratch using the opposite specifications or typically you create these clients or servers and using existing libraries with or a piece within the different programming language so you'll use these libraries on a piece both in LabVIEW which is to do on that lab in order to show some examples where we can create primary and OPC clients but also an OPC UA server we start with LabVIEW so in LabVIEW we have the data socket palette which we can use to communicate with OPC servers so using this functionality you can create an opposite line that communicates with an existing opposite server so the arm function step you can use both for right to the opposite server and also read to the opposite server next MATLAB and the MATLAB has us basic opposite to box you can use in order to communicate with an opposite server and with this opposite server you can read write and log opposite data from devices such as distributed control systems supervisory control and data acquisition systems SCADA systems and PLC systems in MATLAB opposite to box supports both the OPC direct access specification and the OPC ua specification in vicious do you do I guess you can use lots of different libraries and in this video we will show how we can use the measurement studio add-on package a national studio is an add-on package created by National Instruments which is the same in doris LabVIEW and with this package you can communicate with OPC and da servers from Visual Studio programming so in this package you use the data socket library which is the same as you use inside LabVIEW we start with some simple OPC examples we are going to read the values from an opposite server in this video we will use the magic on opposite server but of course you can use any kind of OPC server so in the first example we will use LabVIEW in order to read from the opposite server in this example we have used the data socket library with in LabVIEW I will just open our connection read from the server and then I read until we click the stop button let's show this example in lab Europe so here I open the example in lab you here we see the front panel the graphical user interface we just have a numeric indicator and a stop button so when you start this program this should get the latest value from the OPC server until we click the stop button let's see the code order block diagram it looks like this first we need to specify which tag we are going to read and then inside the loop we read the value every second in this case so let's run this example so it started like this now in the beginning is 0 but slept open the metric on OPC server to see the value scale so here we have the metric on obviously Explorer a metric on opposite server is animatic on opposite Explorer which is an OPC client that comes with the package which you can download for free so let's connect to our server let's connect and it's add the tag we are using in this case it is a bucket brigade unreal 4 so just double click and click plus here in order to get it in the lists of tags we are monitoring so here we can right click and write a value directly to the OPC server so let's task file enter file and then the value that specific tag is 5 so let's go to our lab you code and you see the value has been updated like this so just change it to 2-8 like this come back to lab group onion see and the value has been updated next we will see an example created with the visual studio and c-sharp in this example this is our graphical user interface we have a text box on every time a click and read opposite button the text box will be updated with the latest value from the opposite server so let's try this example so now I have opened wishes to do and then we can run our example here so this is the user interface so let's start example clicking the start button and here so every time I click read obviously I will get the latest value from the server so let's just take a short look at the code so it just close it right click here view code and here is the code so I just connect to the server using this URL so here we connect and then every time I click the button I get the latest value from the OPC server now we will show some simple examples very right values to the opposite server so we start with LabVIEW record is almost identical so you connect to the opposite server in the specific tag and then you use the right function and here we see the wishes to do example and the user interface is almost identical so every time we click this right opposite button we write this value to the opposite server let's see these examples running with in LabVIEW and wishes to do so now I open the example in LabVIEW and you see you see interest is almost identical as read example so we have a numeric control here where you enter a value and then this value will be updated and rewritten to the opposite server so take a short look at the cold so here it's the same you connect to the server and then we write the value within the while loop like this so let's run example so you start running it so no the value is 222 and let's go to the metric on opposite server and you see the value is 72 you change it to 33 and then go back to the admin server and you see the value has been updated like this so let's test the Visual Studio example so here is our graphical using base let's just run program like this only come enter a value 5 and click click write op C and then we go to the metric on an you see the value has been updated like this so just take a short look at the code stop the application we right-click and select new code on here you see the code it's almost identical you connect to the server and then in reading and you click the button you update the server with the with the value like this and since we used OPC da specification in these examples of course here we see we here we have the right example created in LabVIEW and here we have the read example created in issue studio and then of course they should work together let's run these examples so here we write 10 - 2 - the opposite server on here individual stood exactly King out read obviously we can get the same value like this you change it 24 read up see and then so this example writes to the opposite server on this example and reads from the same server and the same tag like this or in this example where you have an opposite client that writes to the opposite server made with LabVIEW we have a opposite client that right - the opposite server using wishes to do we in this application we read from the opposite server and this application is written in which the studio here we have an application written in LabVIEW when we read the value from the OPC server so now we are running for clients - you are writing until you're reading to the OPC server using the same tag so let's try this and see here here we write 10th if 24 and then this application reads 24 you come here update 245 and you see the values updating 245 but it's almost at the same time change back to 24 because this application runs inside a loop and it updates the value continuously on this one just update the server only when you click this button like this next I will show an example and we rewrite values to an OPC server and then as a second op C client which is used for training the data from the OPC server like this so here's example we trend or plot the value from the OPC server like this so let's run this example also so here you see the example this is the previous lab application very right to the opposite server and this is the new application created in which studio where we read from the server and trend the value within this short so let's just update the value here you see it's plotting the value like this so this this example and could be an OPC client that read the values from from a duct device and temperature sensor or something and then you could have this second client that reads the value and also change the value like this now I will show an example in LabVIEW so in this example you have created a program with in sorry I cannot love you but MATLAB where we read lots of value from the opposite server and then finally plot up here so here we use the plot command so let's run this example also so let's open matlab so now i have opened the matlab and here you see the code for this example so here i connect to over a matter conserver and in this case i use on all the tag in this case i'll use the random tag which could be very useful in demonstrations so in this case and this tag just random link can write some random data and in this example a log from the server in 60 seconds either rate 0.2 seconds like this and finally i plot the values like this so let's run the example i'm just wait some seconds and then we will get the results so after 60 seconds we get this spot so see it's just getting some random data from the random tag within the metric on obviously the simulation server like this next we will show an opposite UVA example you a is the next generation of OPC so UA is a short for unified architecture so you are you a and the next generation of OPC is based on more modern software and network architecture and you don't need to hustle with these decom problems that you have with the classic and OPC we will show an example in LabVIEW where we use the opposite you've a palette in LabVIEW this palette or this library can be installed with either using the LabVIEW DSC module or the lab you'll real time module with this palette or this library you can create both OPC UA servers and you can create opposite ua clients so in this example we will create an opposite way server and we will create an OPC UA client that write data to the server and then third we will create an oopsie you a client that reads the same value from the server like this so here you see an example of the code and how it looks inside LabVIEW so in the opera here we see the code for creating the OP CUA server so just create the server you add some holders items and then you start the server and then the server runs until you stop click this stop button here you see one of the clients that read the value to the opposite server so here you connect to the server you just created here and then within the loop you write values to the opposite array a server like this so let's run this example with in LabVIEW so now I opened these examples inside lab you on here on top we have the OPC da server and here you see the code for the server here is the OP see you a client that writes to the server and here you see the code for that program and finally here you have the client that reads from the same server like this so let's start by running the server like this and then we can start the client and start the right client and then start to read client like this then let's start writing some values to this server so let's write 22° to the server and then you see on the client it reads a value from the server like this that's updated and updated to 23 and this other client also read the same value like this so using the OPC UA library we didn't lab you you can easily create both ops euh servers and obviously you read clients like this so this video has given you a short overview of OPC and what you see but it is and what you can use it for and also has shown some examples where we use the metric on opposite simulation server and will create opposite clients and also a server using LabVIEW which is to do on MATLAB and if you are interested I will go through these examples in more detail in another set of videos when I create these examples from scratch step-by-step that's all for today thank you
Info
Channel: Industrial IT and Automation
Views: 56,061
Rating: undefined out of 5
Keywords: OPC, LabVIEW, C#, OPC DA, OPC UA
Id: E6ELXwzJFgE
Channel Id: undefined
Length: 27min 30sec (1650 seconds)
Published: Thu Mar 30 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.