OPC write value issue-IBH opc server

Forum Home Forums Communicating with Devices OPC OPC write value issue-IBH opc server

Viewing 15 posts - 46 through 60 (of 98 total)
  • Author
    Posts
  • #4525
    Mikhail
    Moderator

    Thank you.
    We can see that m_subscription has ISubscription type that is an interface.
    We need to find out which class implements ISubscription and what is inside Write method.

    Do you able to attach to this library by a debugger in runtime?

    #4528
    mariodavid
    Participant

    “public interface Isubscription : IDisposable”

    https://imgur.com/a/X1d0qQE

    Go to implementation in write- line:31, goes to two subscription.cs

    https://imgur.com/a/9XlCdxf

    https://imgur.com/a/FpmJN0I

    https://imgur.com/a/8msCvnr

    https://imgur.com/a/RBJUunj

    #4529
    mariodavid
    Participant

    I will try to debug using visual studio code.

    https://imgur.com/a/aPoNcak

    #4530
    Mikhail
    Moderator

    When debug is in progress please you do the following:
    1. Stop on a breakpoint on line 393 shown here

    2. Step into the Write method and watch what particular Write method is executed in line 393?

    #4531
    mariodavid
    Participant

    Hi

    Do you know a software that open and debug dll files? with visual studio does not show the code.

    https://imgur.com/a/f8g3tmJ

    But when i search in write:

    https://imgur.com/a/hefNQHN

    goes to:

    https://imgur.com/a/QmkwexB

    #4533
    Mikhail
    Moderator

    Hi,

    Do you know a software that open and debug dll files? with visual studio does not show the code.

    VS can show the code if a DLL is complied in debug configuration.

    Good screenshots. Thank you.
    The 3rd screenshots shows that WriteVQT is used.
    What about m_group variable? May be it contains other method for writing in addition to WriteVQT?
    I see that m_group uses m_subsription.Write and m_subsription executes m_group.WriteVQT

    • This reply was modified 5 years, 5 months ago by Mikhail.
    #4535
    Mikhail
    Moderator

    I suppose, m_group field is not public. Am I right? Is it protected or private?
    We should use other overloaded m_group.Write

    #4536
    mariodavid
    Participant

    Hi
    “21 protected object m_group;”

    https://imgur.com/a/HRSz8Ke

    • This reply was modified 5 years, 5 months ago by mariodavid.
    #4538
    mariodavid
    Participant

    How do we find another overloaded m_group.Write?

    #4543
    Mikhail
    Moderator

    Hi,

    “21 protected object m_group;”

    So if you create a new class that is derived from Subscription, you can add your own write method of Subscription and use needed m_group.Write.

    How do we find another overloaded m_group.Write?

    Open the Group class and find all Write method in it. Or just scroll down the tree shown in the last screenshot.

    #4545
    mariodavid
    Participant

    Hi,

    Here is all the write method inside Group class

    https://imgur.com/a/etdAgJd

    https://imgur.com/a/N4qiVNu

    https://imgur.com/a/Jb3lVBV

    https://imgur.com/a/DnWeNez

    https://imgur.com/a/oEDblkx

    but I really do not see m_group

    #4546
    mariodavid
    Participant

    can you try to remove the quality and the timestamp in the writeVQT method that kplogic uses? please.

    I think the main difference between the methods is than IOPCSyncIO:write only use Value, instead writeVQT (value, quality, timestamp). Am I right?

    As I understand in the code there are some exceptions where another method is used in case you can not write with the default.

    I am seeing here for example:

    https://imgur.com/a/72IVdZE

    #4547
    mariodavid
    Participant

    Hi, I found this, where OpcRcw.Da.IOPCSyncIO.Write(Int32, Int32[], Object[], IntPtr&) : Void

    is Used By
    OpcCom.Da20.Server.Write(ItemValue[]) : IdentifiedResult[]
    OpcCom.Da20.Subscription.Write(ItemIdentifier[], ItemValue[]) : IdentifiedResult[]

    https://imgur.com/a/N6YQT7Y

    https://imgur.com/a/wPUYicY

    https://imgur.com/a/R0uSwog

    So, to use IOPCSyncIO.Write in KpOpclogic, the goal is to create a class that is derived from server and add IOPCSyncIO.Write to this new class. Am I right?

    #4551
    Mikhail
    Moderator

    So, to use IOPCSyncIO.Write in KpOpclogic, the goal is to create a class that is derived from server and add IOPCSyncIO.Write to this new class. Am I right?

    Probably. There is the link to the source code of the OPC driver in the beginning of this topic. Can you play with it? It’s not hard to compile the driver by yourself. I can help you to understand where to change the driver.

    #4554
    mariodavid
    Participant

    Yes, I can play with it. I learned how to decompiled with dotpeek and how to export to a visual studio proyect. Now, daserver is used a lot in kplogic. So I have a:

    protected override IdentifiedResult[] Write(ItemIdentifier[] itemIDs, ItemValue[] items)

    than uses:
    .
    .
    .
    try
    {
    ((IOPCSyncIO) this.m_group).Write(arrayList1.Count, phServer, pItemValues, out ppErrors);
    }
    catch (Exception ex)

    I still do not understand how da.server could call “protected override IdentifiedResult[] Write(ItemIdentifier[] itemIDs, ItemValue[]”

    Is it possible?

Viewing 15 posts - 46 through 60 (of 98 total)
  • You must be logged in to reply to this topic.