ContentHub
20251210-OPC-UA#2-Client-EN.mp4
28 views
View transcript
Hello, in this WAGO tutorial we’ll show you how to configure an OPC UA Client in CODESYS 3.5 to establish a connection to a server. In this video, we’ll start with the server from the OPC UA Server tutorial – a PFC200 running firmware version 30. Instead of using the UaExpert client, we’ll configure a client on a second PFC, also with firmware 30, using CODESYS 3.5. First, we’ll add the second controller to the CODESYS project and scan the K-Bus. In the server tutorial, we demonstrated two communication paths: one via the Communication Manager and one via the Symbol Configuration. Here, we’ll focus on the Communication Manager. The OPC UA Client acts as the Data Source Manager and supports both communication paths; however, Information Models are only possible through the Communication Manager. To ensure the client can find the server later, we’ll start the server controller now. Moving on to the client: right-click under Application and add the Data Source Manager. Then, right-click on the Data Source Manager to add a new data source. In the pop-up window, select OPC UA Server. This opens the Initialisation Data Source Wizard. At the top, there are two options for adding the server. If the server is online and reachable, as in our case, it’s recommended to browse for a live server. For offline engineering, you can work with information models. The two standard OPC UA models are already included. If a specific information model had been created during server configuration, it would also appear in this list. For now, we’ll stick with Browse Live Server. If the connection settings were stored in a variable, you could specify that here. But we’ll continue by entering the server URL. It’s important that the URL starts with opc.tcp, followed by the server’s IP address and then the OPC standard port, 4840. Since both controllers are in the same project, the server IP already appears in the drop-down list. If passwords are used, you could also select which endpoint to use for the server connection. For a production system, the security settings at the bottom would be essential. For our test setup, we’ll leave everything disabled. We’ll cover OPC UA security options in a separate tutorial. In the advanced settings, you can define the polling interval using these two values. The default is one second. If you want to increase the interval to reduce network load, simply enter a new value here. Both values must be equal. Since the server controller is already online, we can immediately see the symbol set created on the server, which contains the two variables from the server tutorial: an integer variable that counts up and a boolean variable mapped to digital input 1. That completes the client configuration. To test the application, we’ll quickly create a programme on the client and, in the programme editor, call up the two OPC UA variables using the Input Assistant with F2. Under Application, you’ll find the data source with the symbol set containing the variables in the Data Source Objects folder. Once both variables are added, the programme needs a task call. Then we log in and start the controller. The integer variable counts up, and when we apply 24V to DI1 on the server, the client displays the change. Communication also works in the opposite direction. To demonstrate this, we’ll create two integer variables on the server, call them up in the programme editor, and add them to the symbol set via drag and drop. Then log in, download, and start. On the client, update the variables in the data source and add the two new integer variables to the variable list. In the programme, we’ll add 5 to the start variable and send the result back via the end variable. Log in and start. Now, if we write the value 10 to the start variable on the server, this value is passed to the client, incremented by 5, and passed back to the server. That brings us to the end of this tutorial on configuring an OPC UA Client in CODESYS 3.5. If you found this video helpful, give us a thumbs up, subscribe to the channel, and contact the WAGO Support Centre if you have any further questions.