06-02-2010 04:56 PM
Hi.
I've got some shared variables binded to my OPC server, but sometimes some variables need to "ignore" the OPC updates and and be simulated, and in some cases, all of the variables.
So, I've got an application to dynamically change the shared variables properties: Network.UseBinding and Network.URL to "connect to" or "disconnect from" the OPC server, but is there a way to "unbind" the whole library from the OPC quickly and restore it back when need it?
I tried creating and deleting the IO server programatically but the variables go "bad"...
Is this is a good practice or should I change the method?
06-10-2010 06:36 PM
Hi Kepat, an option you can do here is Create the I/O server programmatically but instead of creating the Shared variables and Binding them, you can use data socket directly to the server.
Here is an example of how to read, multiple Variables using Data socket:
http://decibel.ni.com/content/docs/DOC-3743
Best regards
06-11-2010 02:04 PM
Hi, Benjamín.
Thank you for answering.
As long as the shared variables are binded to the I/O server (OPC client) they cannot be modified by other applications but the OPC Server (read-only variables, of course), that's why I unbind them.
My variables are linked to PLCs via OPC, but sometimes I need to work in a "simulation mode", that means forcing values and sending no changes to the actual PLCs. Most of the times, just a few variables need to work this way, but sometimes all the variables need to be simulated.
So I was wondering if there's a way to quickly enable/disable the I/O server?
06-11-2010 03:33 PM
Or, are you saying that I can write to the OPC without binding variables?
I mean, insted of "\\host\Library\Variable" use "\\host\Library\IOserver\Variable" ?
I get error 1812: "Error parsing URL"
06-15-2010 07:08 PM
Hi Keptat, you can bind them directly to the OPC sever but you need to add psp: at the begining.
For example
psp:\\localhost\IOServer\ModbusSlave1.000001
psp:\\aebenjamin\IOServer\OPC1.Channel_0_User_Defined.Ramp.
psp:\\ host \ library\IOservername.register
An easy way to find the complete address y bind a Variable with psp binding to the OPC server and you will get the path.
In the example code it gets the psp address from a Library, but won't get you the directions of the registers inside the IOserver, so you need this list manually.
Another option is create 2 libraries one with the variables binded to the IO Server and the other binded to the simulated info, in this case you just have to point to the library, and get the address of all variables.
Also you have to make sure the OPC server is deploy and you can see it in the Distributed System Manager
Best Regards
06-25-2010 03:50 PM
Thanks a lot, Benjamín.
Now I can decide when to write to the actual OPC/PLCs by PSP.
But, for the read-only variables I use value change notifications, since it's more efficient than polling, so I guess I'll stick to the binding/unbinding process, or rather, duplicate the library.