Professional OPC
Development Tools

logos

Connection problems between opc server and unity3d

More
16 Apr 2019 21:17 #7330 by game4automation
Hi, we don't have a solution for exaclty your problem, but we have an OPC Client for Unity available in the Unity Asset Store. You can get it here: assetstore.unity.com/packages/slug/143980

Please Log in or Create an account to join the conversation.

More
27 Feb 2016 15:51 #3890 by support
I have shortly look at this.
Short answer: It is a Mono incompatibility, and you appear to be out of luck.

Elaborate answer: We use some internal parameterization and for that, we load config sections as classes where some members are annotated with attributes such as [IntegerValidator] - see msdn.microsoft.com/en-us/library/system.configuration.intege...idatorattribute(v=vs.110).aspx . When used without arguments in .NET, it allows any integer number: the minimum is equal to Int32.MinValue, and the maximum to Int32.MaxValue. See the source code of .NET: www.dotnetframework.org/default.aspx/Net/Net/3@5@50727@3053/...1/IntegerValidatorAttribute@cs . Unfortunately, Mono has it wrong, and defaults both the minimum and the maximum to zeros: See Mono source code: searchcode.com/codesearch/view/26563218/ (probably not the right place for Mono source, but in line with the observation where your error message says "ArgumentException: The value must be in the range 0 - 0"). Unfortunately I see no work around with the QuickOPC code that has already been built.

Best regards

Please Log in or Create an account to join the conversation.

More
25 Feb 2016 09:32 #3887 by RandomGuy
Thanks a lot for your kick reponse, it is great that you are efficient when answering customers doubts :cheer: .
Even if it is seems not to be feasible, I am going to try.

An error shows up when compiling my code and maybe you could have an idea about it. It comes up when doing: OpcLabs.EasyOpc.DataAccess.EasyDAClient easyDAClient1 = new OpcLabs.EasyOpc.DataAccess.EasyDAClient()

The error is the following one:

ArgumentException: The value must be in the range 0 - 0
System.Configuration.IntegerValidator.Validate (System.Object value)
System.Configuration.ConfigurationProperty.Validate (System.Object value)
System.Configuration.ConfigurationElement.SetPropertyValue (System.Configuration.ConfigurationProperty prop, System.Object value, Boolean ignoreLocks)
Rethrow as ConfigurationErrorsException: The value for the property 'fileLockTimeout' is not valid. The error is: The value must be in the range 0 - 0
System.Configuration.ConfigurationElement.SetPropertyValue (System.Configuration.ConfigurationProperty prop, System.Object value, Boolean ignoreLocks)
System.Configuration.ConfigurationElement.set_Item (System.String property_name, System.Object value)
OpcLabs.BaseLib.Reflection.AssemblyLoaderSection.set_FileLockTimeout (Int32 value)
OpcLabs.BaseLib.Reflection.AssemblyLoaderSection..ctor ()
OpcLabs.BaseLib.Reflection.AssemblyLoader..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for OpcLabs.BaseLib.Reflection.AssemblyLoader
OpcLabs.EasyOpc.Assemblies..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for OpcLabs.EasyOpc.Assemblies
OpcLabs.EasyOpc.DataAccess.EasyDAClient..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for OpcLabs.EasyOpc.DataAccess.EasyDAClient
ConsoleApplication1.Reader.Paivita () (at Assets/Scripts/Reader.cs:30)

In my script I added "using OpcLabs.EasyOpc.DataAccess; and the needed reference for the following libraries: OpcLabs.Base:lib.dll, OpcLabs.BaseLibExtensions.dll, OpcLabs.EasyOpcClassic.dll and
OpcLabs.EasyOpcClassicInternal.dll

Thanks!

Please Log in or Create an account to join the conversation.

More
24 Feb 2016 20:34 #3886 by support
From our (OPC Labs) side: Good luck with using QuickOPC (5.23). I would expect it to either not work at all (I thought it is using Mono?, and we never tested with that and I have doubts about the feasibility), or work without substantial problems - but nothing in between.

The forums are used mainly for communication between our customers and us. You may get an answer from somebody else, but just rarely.
The following user(s) said Thank You: RandomGuy

Please Log in or Create an account to join the conversation.

More
24 Feb 2016 13:38 #3885 by RandomGuy
Good afternoon to everybody!

I'm going to explain my problem to see if anybody had the same issue or may have some ideas about it.
I want to retrieve data (value of variables) from a PLC using an OPC server to do so. The idea is to be able to read the value of the variables and to overwrite it as well. I want to do it in Unity3d (using Unity3D as an OPC Client).

What I've done so far is using the OPC server "KEPServerEX 5", retrieve information from the PLC. I checked it with an OPC Client (OPC Quick Client) and it works. The problem is the connection between the OPC server and Unity3D. To do so, I'm using a socket server programmed in C# within Unity3D.

I had problems with OpcLabs and .NET compatibility so I asked for an earlier version of OpcLabs (5.23) and now it seems that causes no problems but I'm not 100% sure.

Did anybody have to deal with such a problem? Would you know how to do it? Many thanks in advance, kind regards,

Alberto

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.207 seconds

      

 Recommend this on Google