LabView and PLC Momentum

C

Thread Starter

Cristina

I want to establish communication between LabView (National Instruments) and PLC TSX Momentum Modbus Plus (Schneider Electric). I have already downloaded an OPC (MatrikonOPC Server for Modbus and MatrikonOPC Server for DDE), but I have never used OPC before, and I can't establish the communications. Does any one know a step by step process to make this function?
 
F

Fred Loveless

It really depends on which version of Labview you are using. 8.5 includes an NI OPC server and has a very nice OPC connection configuration. Older versions will require you to create and OPC or DDE data socket to connect to the server.

Your best option is to go to the NI forums for Lab view. Ther will be a Labview expert that can provide a VI for either option in the older versions.

You could also use Kepwares OPC server for this connectivity. one server supports both OPc and DDE conenctivity. I made the following notes a long time ago for doing OPC to KepserverEx in Labview 5.0. They may get you headed in the right direction.

Labview Notes

1. Create a new VI2. Save and name the VI. Ours is "Kepware OPC Demo.vi".
3. Using the Vi Front Panel use Control pallete Select Boolean then select the Round LED.
4. Place the LED in the Upper LEft corner of the display.
5. Click on the Edit text Icon in the Tool Pallet.
6. Select the LED lable and make it "Time Out From Server".
7. Repeat the process placing a secon LED below the first. Make its lable "Error Reading Items".
8. Next you are goint go select the rectangular Stop button from the Boolean pallette. Place this button directly below the two LED indicators and remove its lable.
9. Lastly, we are going to place a Waveform Chart in the display. In the Control Pallette select the Graph Icon and then form the Graph pallette selecxt the Waveform Chart. Place the chart in the upper right hand side of the display.
10. We will complete the project working in the VI diagram window. (Somewhere here show the tool pallete and the function window).
11. Now we need to Wire the controls together and create the OPC input.
12. First Lets add the Data socket items that we will be using.
13. In the Functions Pallet click on the Communications Icon.
14. From the Communications pallet select the Data Sockets Icon.
15. Select the Open Data Socket and place it in the VI Diagram.
16. Do the same for the Close Data Socket and the Read Double Data Socket. The latter is to input the correct data type into the Waveform Chart.
17. The last data socket to add is on the Advanced Data socket pallete and can be accessed by selecting the Advanced Data Socket Icon.
18. In the Advanced Data Socket Pallette select the Update Data Socket.
19. To make wiring easier we have re-arranged the objects in the Vi Diagram as seen below.
20. Now we need to add a timer. Click on the Timers Icon on the Functions Pallette
21. In the Timers Pallet select the "Wait untill Next MSEC" timer.Place it top center in the VI Diagram.
22. Click on Clusters on the Functions Pallette and select the Unbundle Cluster. Place it below the Read Double Data socket and to the left of the Error Reaing indicator.
23. Next on the Functions Pallette Select the Boolean Icon and from the Boolean pallette select the Not/Or decision control. Place it centerd below the Unbundle cluster and the Error indicator.
24. Now you need to wire up all of these objects.
25. Making sure you still have the select Cursor right click on the left side of the timer and select Create Constant.
26. Select the Edit Text cursor and change the text to 100. This means that the timer will trigger in multiples of 100 msec.
27. With the Select cusor right click on the upper left corner of the Open Data Socket. Select Create
Constant to create a Sting Constant for the OPC URL.
28. In the Tool Pallet select the Edit Text Cursor and enter the URL for the KepserverEx. The URL string will be "opc://localhost/KEPware.KEPServerEx.V4/Channel_1.Device_1.Float_1"
29. Next right click below that on the side of the Open Data Socket. Select Create a Constant.
30. In the Tool Pallete select the Operate Cursor and click on the right hand side of the ReadAutoUpdate constant and Change it to read
31. Now it is time to start Wiring the objects in the VI diagram together.
32. In the Tool Pallete select the Wire Cursor.
33. First we will wire the Data sockets so that data flows between them. At the upper right and left had corners of the data sockets are terminals for passing in and out data socket references respectively. The lower right and left hand corners are terminals for Error's in and out. We are going to wire these together. Start with the close Data Socket. You will notice that as soon as the Wire cursor is close to the objects their wire terminals become visible.
34. Because the Open Data Socket is set a little higher then the Update one you may find that the wires overlay each other. You should select these, with the select cursor, and separate them.
35. Next we will wire the Time Out indicator and the data out to the Waveform Chart from the Double Read Data Socket.
36. Now we will wire the Bundle to the error wires and then to the Boolean Not(or) switch and connect the error indictor.
37. Now wire the Stop button to the Not(or) switch.
38. Now as you are setup now you will only read once and stop. You need to place everything between the Open and close data sockets in a while loop.
39. In the functions pallet select the Structures Icon and from the structures pallete select the While Loop and draw a square around the items you want in the loop.
40. The last thing you need to do is wire the Not(or) to the Continue function of the While Loop
41. What this last piece does is make sure that as long as there are no errors or the stop button is not on then the loop will keep processing.
42. You will notice that the Run button on theButton bar has become a solid white arrow which means that the VI should run.

http://www.kepware.com

Fred Loveless
Support Manager
Kepware Technologies
 
M

Michael Griffin

If you have Modbus/TCP or Modbus/RTU protocols available (not Modbus/Plus protocol) then you might want to have a look at the following. I haven't used it so I can't make a recommendation. It's free though, so you can download it without any risk.

Modbus LabVIEW Library: "The Modbus library is a free, downloadable set of VI function blocks that provide Modbus communication from any standard Ethernet or serial port. The LabVIEW library implements the Modbus protocol in software and offers both master and slave functionality."

http://sine.ni.com/nips/cds/view/p/lang/en/nid/201711
 
Thank you very much for the information. Do you have the Kepware OPC Demo.vi Block Diagram image?
 
Top