LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MatrikonOPC to Labview

Hi,

 

I'm trying to send data from MatrikonOPC explorer to Labview.

Currently I'm using datasocket to do the job but it doesn't seem to work. 

Anyone able to help? I'm trying to send numbers and display as a waveform on the labview.

 

Regards,

Minghui

0 Kudos
Message 1 of 5
(2,825 Views)

Hi Minghui,

 

I won't be able to open your vi for a couple hours (in the middle of upgrading Labview), but I just recently used datasocket to communicate with an OPC server so I might be able to help.

 

Is MatrikonOPC explorer on the same machine that the vi is running on or a different one? If it's on a different machine, then your DCOM configuration could be the problem. This link from Matrikon should guide you through the configuration process if you need it.

 

What version(s) of the OPC spec does Matrikon use? I ask because datasocket doesn't work with version 3. If you have to use version 3 (and you don't want to buy the DSC module) you can also try using the shared variable engine. Labview's shared variable engine is built on a fully compliant OPC server, so it's pretty well suited for the job. This NI whitepaper can walk you through how it works.

0 Kudos
Message 2 of 5
(2,796 Views)

Hi Gary,

 

My data in MatrikonOPC explorer is running on the same PC as my Labview. So I don't think is due to the DCOM setting issue.

Currently I'm using MatrikonOPC explorer version 4 if I'm not wrong, and I have the dataloggin module in my labview program. When I run my Labview program using the diaram I have attached previously, the value of in my MAtirkonOPC explorer tag was able to be seen in the Distribution management system under tools in labview but it just doesn't seem to be able to be plot onto the chart.

 

Regards,

Minghui

0 Kudos
Message 3 of 5
(2,774 Views)

That's good news about the DCOM (it can be a nightmare to get it configured)

 

I got a chance to test your code. Is the data in the opc tag an array of double or a single value that changes over time? Your code treats it as an array, but I've never seen an OPC tag that holds an array. If the tag does contain a double, then try the code I have attached to see if treating it as one value helps.

 

I also noticed that there's no wait function in your loop. Right now it runs as often as your hardware will allow which could be overwhelming whatever it's talking to. I put a 100ms wait function in there so the loop will run 10 times per second. You can always increase or decrease it to match the update rate that you're looking for, but it's a good idea to have it there.

 

While I was at it, I added shift registers to 'remember' the error information from loop to loop. Otherwise you might be encountering an error but not realising it because it gets overwritten by the next itteration of the loop.

 

Give it a try and let me know if it helped.

 

 

0 Kudos
Message 4 of 5
(2,756 Views)

I also noticed that the node you're trying to connect to is 'dstp://mon adresse IP/monpc'. That needs to be overwritten with the actual adress of the tag. If you're not sure what that is, try the code I've attached to this post. It will launch a dialog that will let you navigate to the tag. Once you select the tag, it will then monitor its value and display it on the chart.

0 Kudos
Message 5 of 5
(2,751 Views)