Forum Home › Forums › Communicating with Devices › OPC › OPC write value issue-IBH opc server
Tagged: OPC write data
- This topic has 97 replies, 3 voices, and was last updated 4 years, 8 months ago by Mikhail.
-
AuthorPosts
-
October 30, 2018 at 5:32 pm #4525MikhailModerator
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?
October 31, 2018 at 12:39 pm #4528mariodavidParticipant“public interface Isubscription : IDisposable”
Go to implementation in write- line:31, goes to two subscription.cs
October 31, 2018 at 12:46 pm #4529mariodavidParticipantI will try to debug using visual studio code.
October 31, 2018 at 4:14 pm #4530MikhailModeratorWhen debug is in progress please you do the following:
1. Stop on a breakpoint on line 393 shown here2. Step into the Write method and watch what particular Write method is executed in line 393?
November 1, 2018 at 2:53 pm #4531mariodavidParticipantHi
Do you know a software that open and debug dll files? with visual studio does not show the code.
But when i search in write:
goes to:
November 2, 2018 at 6:19 pm #4533MikhailModeratorHi,
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.
November 2, 2018 at 6:45 pm #4535MikhailModeratorI suppose, m_group field is not public. Am I right? Is it protected or private?
We should use other overloaded m_group.WriteNovember 2, 2018 at 11:44 pm #4536mariodavidParticipantHi
“21 protected object m_group;”- This reply was modified 5 years, 5 months ago by mariodavid.
November 2, 2018 at 11:59 pm #4538mariodavidParticipantHow do we find another overloaded m_group.Write?
November 4, 2018 at 7:26 am #4543MikhailModeratorHi,
“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.
November 4, 2018 at 3:13 pm #4545mariodavidParticipantHi,
Here is all the write method inside Group class
but I really do not see m_group
November 4, 2018 at 3:35 pm #4546mariodavidParticipantcan 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:
November 5, 2018 at 2:13 am #4547mariodavidParticipantHi, 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[]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?
November 5, 2018 at 2:43 pm #4551MikhailModeratorSo, 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.
November 5, 2018 at 10:32 pm #4554mariodavidParticipantYes, 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?
-
AuthorPosts
- You must be logged in to reply to this topic.