Nirtec Studio Forum

General Category => Machines Simulator => Topic started by: plcello on January 01, 2023, 06:37:25 PM

Title: OPC UA connection
Post by: plcello on January 01, 2023, 06:37:25 PM
Hello, I'm trying to configure the driver for OPC UA connection with an external server but I'm facing some issues:
As I press the CONNECT button, a pop-up message appears telling "Untrusted Server Certificate" and it's asking whether I want to accept it or not.
I press YES to accept it but then every time the connection fails returning the message "Connect failed. Error: BadSecureChannelClosed".

I thought that manually moving the certificates on both Client and Server sides could be helpful, but while I managed to do it very easily on the Server side moving what is called "EasyPLC OPCUA Driver" from the Quarantined to the Trusted certificates folder, I can't find where are certificates folders on the Client side (my PC where Machines Simulators is running).

The PLC application is made on Codesys. I tested it already on localhost and everything run smoothly, then the problem seems to exist only with an external OPC server

Many thanks!!!  :)
Title: Re: OPC UA connection
Post by: EasyPLC_Master on January 01, 2023, 08:57:39 PM
Hello,
If you have purchased the USB License, please install the OPC Core Components Redistributable package located in the Software Components folder of the USB key.
If you have purchased the Single PC License download it from here:
OPC Core Components Redistributable (x86) 3.00.108.msi -> https://drive.google.com/file/d/1ABWb5C5TORDs-ar2mxNrt12i8IO8rHeN/view?usp=share_link (https://drive.google.com/file/d/1ABWb5C5TORDs-ar2mxNrt12i8IO8rHeN/view?usp=share_link)
OPC Core Components Redistributable (x64) 3.00.108.msi -> https://drive.google.com/file/d/1eNYxgEmzDlKwG0x_V40nMAV28GKipR3N/view?usp=sharing (https://drive.google.com/file/d/1eNYxgEmzDlKwG0x_V40nMAV28GKipR3N/view?usp=sharing)

And Also the OPC UA Local Discovery Server Utility:

https://drive.google.com/file/d/13HfdO8yR3MLbP4IjDIFq6XyBB-AjHmPa/view?usp=share_link (https://drive.google.com/file/d/13HfdO8yR3MLbP4IjDIFq6XyBB-AjHmPa/view?usp=share_link)
Title: Re: OPC UA connection
Post by: Joachim.Boling on April 19, 2023, 09:34:20 AM
I seem to have similar issue when trying to connect Codesys softPC to MachineSim. I do have the OPC UA server running on Codesys softPLC and have tested this by connecting with UA Expert => works fine.
When trying to connect the EasyPLC driver I run into problems.
Pressing Connect asks me if I want to trust the untrusted certificate. I click YES but then Machine Simulator reports "Connect failed. Error: BadSecureChannelClosed".
I tried to install the files from the earlier post here but no success.

I've now run out of ideas.. Any ideas what I should do next?

(Running both Codesys softPLC and MachineSimulator on same PC so trying to connect to opc.tcp://localhost:4840)
Title: Re: OPC UA connection
Post by: EasyPLC_Master on April 19, 2023, 07:27:47 PM
Have you followed the steps indicated here?:



What version of Codesys software are you working on?

Do you have other OPC UA clients/servers software's installed on your system? if yes, can you list them?
Title: Re: OPC UA connection
Post by: Joachim.Boling on April 19, 2023, 09:06:35 PM
Hello,

I have checked the video several times and followed the steps there. The video is made with a rather old version of the Codesys so many things have changed in that environment, I think.
I'm running Codesys 3.5.19.0 (also have 3.5.18.40)
I have UA Expert and Prosys OPC server simulator installed on the same computer. As I mentioned I successfully have connected to the Codesys server with the UA Expert and have no problem to browse the server.
When I press connect in EasyPLC I get this message
ConnectMessage.PNG

And when I press Yes I only get the "Connect failed. Error: BadSecureChannelClosed" message.
Title: Re: OPC UA connection
Post by: Joachim.Boling on April 20, 2023, 08:53:30 AM
Did some more testing this morning and found the following from the Codesys log
LogMessageCodesys.PNG
Title: Re: OPC UA connection
Post by: EasyPLC_Master on April 20, 2023, 10:12:48 AM
It seems that it is a problem with the certificates, I check it and try to update the tutorial to explain better the connection process!
Title: Re: OPC UA connection
Post by: EasyPLC_Master on April 20, 2023, 07:11:39 PM
I have tested with Codesys v.3.5.18 and works well.
But you must to configure the anonymous login in the controller:

https://faq.codesys.com/display/CDSFAQ/OPC+UA+Server%3A+Anonymous+login (https://faq.codesys.com/display/CDSFAQ/OPC+UA+Server%3A+Anonymous+login)Anonymus screenshot.jpg
Title: Re: OPC UA connection
Post by: EasyPLC_Master on April 21, 2023, 03:14:04 PM
Updated instructions:
Title: Re: OPC UA connection
Post by: Joachim.Boling on April 25, 2023, 09:58:40 AM
Thank you very much.
I will have to give it a go from scratch again to see if I get the certificates and user managements under control.