So, it's my first time posting here, so be patient please.(not native English speaker) I'm working in a project where I have to connect a OPC DA client to a OPC UA server (a siemens PLC). Three months ago I had never heard of OPC, PLC, etc. All new to me, and a bit confusing. So far i'm using a Wrapper(OPC Expert) in the OPC DA client that displays it to me as an OPC UA server. So I have two servers in both sides and a client(C# stack) in the middle (that I'm working on) that makes the communication. The clients opens two sessions one for each server and subscribe to the items (tags) of interest on both sides. So I get the changes in one side and write it to the other. At the momment I'm using two threads that read each of the subscriptions and write the changes. I'm using a file that maps the nodes from one server to the nodes in the other server. Between quotes is one line of the file, the (+) is the separator. "ns=3;s=UMUARAMA->OA.OpcOAenterprise.1->Test.Equipment.Motor.CV_E101.EquipmentControlCommand+ns=3;s="MotorControl_CV_E101"."EquipmentCommand"." Currently I'm reading the monitoredItems in the subscription one by one, and if there is any value atached I write the value to the other server. I'm pretty sure there are many less dumb ways to do this. So, I'm asking for some advice. Thanks in advance.
1
votes
hmm - well i'm not really sure what you're asking here. If this works - it works. Why do you want a different solution? are you running into performance problems? does this require a lot of maintenance? what is your angel/problem?
- sommmen
You can think of the two servers as databases. Normally is c# to copy between databases you use a BulkCopy. I do not know what type of connection you have between client and servers so not sure if the interface supports BulkCopy. Maybe the following will help : cogentdatahub.com/products/datahub-opc-gateway/?https://…
- jdweng
@jdweng - Thanks, it supports some kind of bulk copy. The software in the link seems to be a wrapper, like the one I am already using, but I will take a look.
- douglas schroeder
@sommmen - Well, perhaps someone has ran into a similar task and has some advice to give. For what I have read I call a Publish request to the server so it knows I received the data properly. but I'm just reading the monitored items from the subscription. Can it cause any problems?
- douglas schroeder
1 Answers
0
votes
I dont know which api your wrapper has, but in OPC UA you can register an event to the MonitoredItem that was fired when the node value was changed.
You can find an example of the registration and handler in the Github Repository from the OPCFoundation
(line 606)