Closed tejasklodha closed 7 years ago
Hi. If you mean "classic" is an OPC DA Server of version 1.0, 2.05A, 3.0, so the library supports that. You can simply try it.
Dear Sir,
My PLC is OPC DA Server but I did work for OPC UA but not detail in OPC DA.
I started with console app but I am confuse in first step that what is "Matrikon.OPC.Simulation."
Uri url = UrlBuilder.Build("Matrikon.OPC.Simulation.1");
Is it Server CLSID or ProgID?
and when I run my console app and throw exception.
throw new OpcClientException(
"Unable to initialize OPC DA client. It should run under MTA apartment state due to CoInitializeSecurity call. " +
"See http://www.pinvoke.net/default.aspx/ole32/CoInitializeSecurity.html for details.", ex);
Kindly find my code in attachment? If its possible then can you give simple example that fetch live variable from OPC DA server ?
Thanks, Program.txt
You can see an example here (https://github.com/titanium-as/TitaniumAS.Opc.Client/issues/4#issuecomment-242775557).
In order to make the example working, you have to install MatrikonOPC Explorer (https://www.matrikonopc.com/downloads/176/index.aspx) firstly. It provides OPC server for simulation.
Also check that you start an application with MTA (https://github.com/titanium-as/TitaniumAS.Opc.Client#bootstrapping-the-library).
Dear Sir,
Download and install MatrikonOPC Explorer also use example https://github.com/titanium-as/TitaniumAS.Opc.Client/issues/4#issuecomment-242775557
but getting error as below in code - class Com
throw new ExternalException("CoCreateInstanceEx: " + GetSystemMessage(error), error);
An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in TitaniumAS.Opc.Client.dll
Additional information: CoCreateInstanceEx: Class not registered
Dear Sir,
private const string ServerUri = "Graybox.Simulator.1"; //ProgId for matrikon simulation server
private const string SubscribeItemId = "time.random"; //itemId for subscribed opc item
After I chnage OPC Server and subscription ID as above then I got below error.
On code (Class - OpcServer.cs):
DoComCall(ComObject,
"IOpcServer::AdGroup", () => ComObject.AddGroup(name, active, (int) requestedUpdateRate.TotalMilliseconds, clientHandle,
pTimeBias, pPercentDeadband, lcid, out _serverHandle, out pRevisedUpdateRate, ref interfaceGuid,
out opcDaGroup), name, active, requestedUpdateRate.TotalMilliseconds, clientHandle,
pTimeBias, pPercentDeadband, lcid);
Exception :
An unhandled exception of type 'System.ArgumentException' occurred in TitaniumAS.Opc.Client.dll
Additional information: Value does not fall within the expected range.
Hm. Check please that Opc Core Components (https://opcfoundation.org/developer-tools/developer-kits-classic/core-components) installed on your system first. It is possible you have not installed OPCEnum service.
I suggest you to make https://github.com/titanium-as/TitaniumAS.Opc.Client/issues/4#issuecomment-242775557 working before you try to use another OPC DA server.
Dear Sir,
Already installed https://opcfoundation.org/developer-tools/developer-kits-classic/core-components
But now again I Create new project and make one console application Install nugets - TitaniumAS.Opc.Client
then copy code form https://github.com/titanium-as/TitaniumAS.Opc.Client/issues/4#issuecomment-242775557 and past to my consol app
Change 3 lines of code as below
Before
private const string ServerUri = "Matrikon.OPC.Simulation.1"; //ProgId for matrikon simulation server
private const string SubscribeItemId = "Random.Int4"; //itemId for subscribed opc item
private const string GroupName = "TestGroup"; //group name for make subscription
after
private const string ServerUri = "Graybox.Simulator.1"; //ProgId for matrikon simulation server
private const string SubscribeItemId = "numeric.sin.int8"; //itemId for subscribed opc item
private const string GroupName = "Group002"; //group name for make subscription
OpcDaGroup @group = server.AddGroup(GroupName, groupState);
Exception:
An unhandled exception of type 'System.ArgumentException' occurred in TitaniumAS.Opc.Client.dll
Additional information: Value does not fall within the expected range.
5 find code Program.txt
Kindly help
Thanks,
Does the library work with Matrikon.OPC.Simulation.1 (not with Graybox) at the moment?
Dear Sir,
I am unable find Matrikon.OPC.Simulation.1 on MatrikonOPC Explorer so I used Graybox and also test Kepware.KEPServerEX.V6 but still getting same error.
Thanks
Matrikon.OPC.Simulation.1 exists by default along with MatrikonOPC Explorer when you have installed the last one. Just try to use the string "Matrikon.OPC.Simulation.1".
Dear Sir,
When I replace below code and run application then below exception generated
private const string ServerUri = "Matrikon.OPC.Simulation.1"; //ProgId for matrikon simulation server
private const string SubscribeItemId = "Random.Int4"; //itemId for subscribed opc item
private const string GroupName = "TestGroup"; //group name for make subscription
exception generated on code : server.Connect();
An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in TitaniumAS.Opc.Client.dll
Additional information: CoCreateInstanceEx: Class not registered
Thanks,
Could you send us the program? I'm unable to try it at the moment because of absence near PC. Maybe someone try to reproduce your problem.
Dear Sir,
Find attached code fro your reference. OpcTest 19_05.zip
Dear Sir,
Done by using https://github.com/titanium-as/TitaniumAS.Opc.Client/blob/master/README.md Its really nice and Easy to use....
Thanks,
Thanks :)
Dear Sir,
I want to fetch data from classic OPC Server. Can it possible by TitaniumAS.Opc.Client?
Thanks,