Home / Software

2 comments

  1. hello;
    I’m doing research on kepware OPC server’s.
    I can read the snapshot data from tag onkepware opc client using c#.
    See the following address.
    I looked at your web page “OPC Client c# .Net Sample (RSLinx OPC server) ” the subject.
    Can we connect with KEPWARE OPC SERVER instead of RSLinx OPC server with your sample opcclient.rar
    Because dont connect to Kepware opc server.I dont know what not connect.Please help me.
    Is it possible to connect to? or how
    thanks help me

    • Hi Zeki, the code that you found works with every Opc Server.
      The example is made on RsLinx because i had only RsLinx to test it out, but after some time i tested it also on Matrikon Opc Server.
      Before you write the code, you should check what is the URL of kepware OPC server and write it here:
      url = new Opc.URL(“opcda://localhost/RSLinx OPC Server“);
      Then you should know how to access the PLC with Kepware OPC Server.
      For example RSLinx identifies every address in plc with [PLC_NAME] + tag
      So if you are reading from a SLC that you named PLC_1 the address n7:0 will be:
      items[0].ItemName = “[PLC_1]N7:0“;
      In the code that you downloaded it’s written with L2 at the end. That means that i’m reading both N7:0 and N7:1 in an array.
      If you are reading a tag (int) named Counter from a CompactLogix named PLC_2 the address will be this:
      items[0].ItemName = “[PLC_2]Counter“;
      Notice that under DataChanged Event there is an important cast:
      here: short[] receivedData = (short[])values[i].Value;
      This is working only with the sample that i provided, and not with floats.
      so if you are receiving a float, or a 32bit int, you should use the correctly cast.
      Suppose i want to read the item:
      [PLC_1]F8:0 -> value is 37.1
      I should write float[] receivedData = (float[])values[i].Value;
      Unfortunately that code is not complete and ready to be sold, but it still need works.
      Last advice. To discover paths every OPC Server provides a testing OPC-client (RsLinx provides OPC Client Tools) where you can browse your PLC.
      You should check if kepware provides that test-client and check what are the correct paths for every plc address.

Leave a Reply