mariodavid

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 54 total)
  • Author
    Posts
  • in reply to: OPC write value issue-IBH opc server #4685
    mariodavid
    Participant

    I tried this Opc.URL url = new Opc.URL(“”); Compile without error but appers: error sending command: remote server is not currently connected. There is no exception in the contructor with this meaning. Where do you think is the exception?. I probe it with “localhost” etc. Still the same error

    in reply to: OPC write value issue-IBH opc server #4678
    mariodavid
    Participant

    I have passed all kinds of values to url: int, boolean, string. The compiler said that: can not be changed to an OPC.URL type.

    URL url = 12;
    URL url = “nashghda”;
    URL url = true;

    Only allows URL url = null;

    Do you know which is the valid URL to new OpcCom.Da20.Server(url, server)?

    in reply to: OPC write value issue-IBH opc server #4677
    mariodavid
    Participant

    Why you don’t pass valid URL to new OpcCom.Da20.Server(url, server)?

    Becase I do not KNOW what is a valid URL. Could be “http://localhost/Scada/”? I really do not know.

    Excuse my mistakes when writing

    in reply to: OPC write value issue-IBH opc server #4676
    mariodavid
    Participant

    Why you don’t pass valid URL to new OpcCom.Da20.Server(url, server)?

    Becase I do not what is a valid URL. Could be “http://localhost/Scada/”? I really do not know.

    Interface is just a declaration. The runtime executes the method of an object that was actually created.

    I am trying to create a class derived from IOPCSyncIO interface. Implementing Something like this:

    “private IOPCSyncIO campo;
    public IdentifiedResult[] Write(ItemValue[] items)
    {
    if (this.campo == null)
    throw new NotConnectedException();
    ((IOPCSyncIO) this.campo).Write(items);
    }”
    without return, because IOPCSyncIO.write is void method

    but give me a NullReferenceException

    I am trying to create a instance of a interface, but that is not possible.

    in reply to: OPC write value issue-IBH opc server #4671
    mariodavid
    Participant

    In the original KpOpcLogic, you use:
    daServer.write(new Opc.Da.ItemValue[] { itemVal });

    Going to write method declaration:

    public class Server : Opc.Server, IServer, Opc.IServer, IDisposable

    .
    .
    .
    public IdentifiedResult[] Write(ItemValue[] items)
    {
    if (this.m_server == null)
    throw new NotConnectedException();
    return ((IServer) this.m_server).Write(items);
    }

    So, “m_server.write” calls write method of IServer. but IServer is a interface. Why does not call a implementation of IServer instead?

    in reply to: OPC write value issue-IBH opc server #4670
    mariodavid
    Participant

    Hi

    I am tryng to call override method using this.

    URL url = null;
    object server = null;
    OpcCom.Da20.Server campo = new OpcCom.Da20.Server(url, server);
    campo.Write(new Opc.Da.ItemValue[] { itemVal });

    Compiled witout error. When I run communicator, appers this error: error sending command: url can not be null.

    I can not change url to another value. So, Can not I use this method definitly?
    Where else can I do with url?

    in reply to: OPC write value issue-IBH opc server #4603
    mariodavid
    Participant

    I am trying this:

    private OpcCom.Da20.Server campo = new OpcCom.Da20.Server();

    but give me this error: CS7036 C# There is no argument given that corresponds to the required formal parameter ‘url’ of ‘Server.Server(URL, object)´

    in reply to: OPC write value issue-IBH opc server #4602
    mariodavid
    Participant

    Yes, I open projects with dotpeek but whe i compiled, give some errors.

    I also tried to call override method using a field like this

    private OpcCom.Da20.Server campo;

    compiled without errors. I run the communicator, trying to send a command give this error:

    “Error sending command: Object reference not set to an instance of an object”.

    Can you give some template o examples to create a instance in KpOpclogic class?

    in reply to: OPC write value issue-IBH opc server #4597
    mariodavid
    Participant

    Hi,

    I have another idea, but i need to know how to open a project of OpcNetApi and OpcNetApi.Com.dll in VS 2017. Can you tell me how do you use those dll to debug in VS? Please. Do you have the folder like KpOpcSource that i can use?

    in reply to: OPC write value issue-IBH opc server #4592
    mariodavid
    Participant

    I also tried to create a project with OpcNetApi but when i compiled shows 2 errors.

    With OpcNetApi.com, compiled wiht no error, attach to the process but can not set break points because the symbols can not be charged.

    in reply to: OPC write value issue-IBH opc server #4591
    mariodavid
    Participant

    Hi,

    I tried to create a class, declaring a field to call override method. Also changing KpOpclogic. Compiled without error.

    View post on imgur.com

    But, when I run communicator, shows a error. “An object of type Op.Da.Server can not be converted to the type Scada.Comm.KP.Class2”

    View post on imgur.com

    in reply to: OPC write value issue-IBH opc server #4585
    mariodavid
    Participant

    View post on imgur.com

    public override IdentifiedResult[] Write(ItemValue[] items) in OpcCom.Da20.Server

    public virtual IdentifiedResult[] Write(ItemValue[] items) in OpcCom.Da.Server

    I really do not understand how to call override write method.

    in reply to: OPC write value issue-IBH opc server #4584
    mariodavid
    Participant

    Hi,
    thank you, I managed to debug but I wanna see the method inside. Said that the simbols are not charged.

    View post on imgur.com

    I just realize than “public override IdentifiedResult[] Write(ItemValue[] items)” belong to a class,
    which is derived from another class That contain “public virtual IdentifiedResult[] Write(ItemValue[] items)”.
    So, the next method

    public IdentifiedResult[] Write(ItemValue[] items)
    {
    if (this.m_server == null)
    throw new NotConnectedException();
    return ((IServer) this.m_server).Write(items);
    }

    calls “public virtual IdentifiedResult[] Write(ItemValue[] items)” but why does not call override method too?
    Is necesary to create a new class like you said?
    I have another doubt. “((IOPCSyncIO) this.m_group).Write” only happens if (arrayList1.Count > 0)?

    public override IdentifiedResult[] Write(ItemValue[] items)
    {
    if (items == null)
    throw new ArgumentNullException(nameof (items));
    if (items.Length == 0)
    return new IdentifiedResult[0];
    lock (this)
    {
    if (this.m_server == null)
    throw new NotConnectedException();
    Item[] items1 = new Item[items.Length];
    for (int index = 0; index < items.Length; ++index)
    items1[index] = new Item((ItemIdentifier) items[index]);
    IdentifiedResult[] items2 = this.AddItems(items1);
    try
    {
    ArrayList arrayList1 = new ArrayList(items.Length);
    ArrayList arrayList2 = new ArrayList(items.Length);
    for (int index = 0; index < items.Length; ++index)
    {
    if (!items2[index].ResultID.Failed())
    {
    if (items[index].QualitySpecified || items[index].TimestampSpecified)
    {
    items2[index].ResultID = ResultID.Da.E_NO_WRITEQT;
    items2[index].DiagnosticInfo = (string) null;
    }
    else
    {
    arrayList1.Add((object) items2[index]);
    arrayList2.Add((object) items[index]);
    }
    }
    }
    if (arrayList1.Count > 0)
    {
    int[] phServer = new int[arrayList1.Count];
    object[] pItemValues = new object[arrayList1.Count];
    for (int index = 0; index < phServer.Length; ++index)
    {
    phServer[index] = (int) ((ItemIdentifier) arrayList1[index]).ServerHandle;
    pItemValues[index] = OpcCom.Interop.GetVARIANT(((ItemValue) arrayList2[index]).Value);
    }
    IntPtr ppErrors = IntPtr.Zero;
    try
    {
    ((IOPCSyncIO) this.m_group).Write(arrayList1.Count, phServer, pItemValues, out ppErrors);
    }
    catch (Exception ex)
    {
    throw OpcCom.Interop.CreateException(“IOPCSyncIO.Write”, ex);
    }
    int[] int32s = OpcCom.Interop.GetInt32s(ref ppErrors, arrayList1.Count, true);
    for (int index = 0; index < arrayList1.Count; ++index)
    {
    IdentifiedResult identifiedResult = (IdentifiedResult) arrayList1[index];
    identifiedResult.ResultID = OpcCom.Interop.GetResultID(int32s[index]);
    identifiedResult.DiagnosticInfo = (string) null;
    if (int32s[index] == -1073479674)
    items2[index].ResultID = new ResultID(ResultID.Da.E_READONLY, -1073479674L);
    }
    }
    }
    finally
    {
    this.RemoveItems(items2);
    }
    return items2;
    }
    }

    in reply to: OPC write value issue-IBH opc server #4580
    mariodavid
    Participant

    Hi, because i do not how to use it. I do not how to open a proyecto with that file. I justo use jetbrains dotpeek, open a DLL and export to visual studio proyecto. Can you tell me how can i use the source kpopc that you shared?

    in reply to: OPC write value issue-IBH opc server #4573
    mariodavid
    Participant

    Hi,
    How do I stop opening a KpOpc project with VS? I only open the dll with DOTPEEK and export to VS. I open the project, compile, without errors. Copy the KpOpc.dll generated in bin / debug and paste it into SCADAcomm / KP. break point in:

    this.daServer.Write(new ItemValue[1]
    {
    itemValue
    });

    Attach to Process and choose ScadaCommSvc.exe. But whe I use SCADA.Communicator to write matrikon tags, does not stop in

    this.daServer.Write(new ItemValue[1]
    {
    itemValue
    });

    What am i doing wrong?

    View post on imgur.com

    • This reply was modified 3 years, 2 months ago by mariodavid.
Viewing 15 posts - 1 through 15 (of 54 total)