0
Answered

OPCUA values not in PLC Output

PeterFischer 5 years ago in realvirtual.io Starter and Professional updated 5 years ago 5

Hello,

I am running the OPCUA demo with the UaCPPServer and it works fine, except that the values are not shown next to the GameObjects in Unity. I can see the current values from the server on each OPCUA_Node component, however it seems that the corresponding PLCSignals were not created like they should (from the OPCUA documentation page: "If the Game4Automation framework is installed, additionally all
corresponding PLCSignals are created. These signals can be dragged and
dropped with sensors or drives of the Game4Automation framework.")

I then added a PLC Output Float script manually to the respective node (see picture). Now the current value is shown next to the GameObject, but it doesn't update.

I also tested this with the test scene (OPCUADriveReadingWriting.unity) provided here: https://forum.game4automation.com/communities/1/topics/101-write-to-opc-ua-varible-using-the-plcinputfloat-datatype

But the PLC Output value is also not updated there.

Image 153

Answer

Answer


Hi, 

first of all I strongly recommend to use Unity 2018.4 instead of 2019. Specially when compiling to the Build with an IL2CPP compiler there might be issues with Unity 2019.

There is something interfering with the demo use cases (need still to check what exactly). 

Please follow these steps:

- Make sure that the compiler defines are set to GAME4AUTOMATION; GAME4AUTOMATION_PROFESSIONAL 

Import while running the OPCUA server the nodes again. If you have enabled with the Compiler defines the full framework it will also create all PLCInputs and Outputs:


If you try now to run it you will get errors:

These errors are because the demo server is limited in subscriptions.


You need to turn off all subscriptions in the OPCUA nodes or you turn it off in the OPCUA interface and import again:


Please also delete the Use Cases completely (we will get rid of the problem with the use cases in the next release).

Now it should work as expected:

You find also the full working model (based on Unity2018.4) in the Uploadfoalder I have send you via mail.

Under review

Hi, we will release (tomorrow) a new version. Pleae check the current beta (I will send you a downloadlink) if it resolves your issue. If not please send us your project.

Best regards

Thomas

It didn't work with that version either. With this beta version there is a new error appearing in the console when I open and run DemoOPCUA.unity (which wasn't there before): "game4automation: No Game4AutomationController found - Game4AutomationController Script needs to be once inside every Game4Automation Scene: Float (game4automation.PLCOutputFloat)".

It disappears when I add the Game4Automation Component to the scene, but the initial problem is still there.

 

I sent you the project via mail.

Answer


Hi, 

first of all I strongly recommend to use Unity 2018.4 instead of 2019. Specially when compiling to the Build with an IL2CPP compiler there might be issues with Unity 2019.

There is something interfering with the demo use cases (need still to check what exactly). 

Please follow these steps:

- Make sure that the compiler defines are set to GAME4AUTOMATION; GAME4AUTOMATION_PROFESSIONAL 

Import while running the OPCUA server the nodes again. If you have enabled with the Compiler defines the full framework it will also create all PLCInputs and Outputs:


If you try now to run it you will get errors:

These errors are because the demo server is limited in subscriptions.


You need to turn off all subscriptions in the OPCUA nodes or you turn it off in the OPCUA interface and import again:


Please also delete the Use Cases completely (we will get rid of the problem with the use cases in the next release).

Now it should work as expected:

You find also the full working model (based on Unity2018.4) in the Uploadfoalder I have send you via mail.

The compiler defines seem to have fixed the problem (tried this before, but didn't notice they weren't saved). It also seems to work with Unity 2019.2.9f1 just fine. So, thanks a lot for the swift support!