How to communicate to iC9200 using RSC (PyPLCnextRsc) from a Python application on a PC
| Version Number | Description |
|---|---|
| 1.0 | Initial version |
| 2.0 | Added restriction that only Python version 3.7.6 can be used. |
This application note shows how to write a script in Python on a user's PC and use the PyPLCnextRSC to communicate and exchange data with the iC9200 controller.
1. Supported Components
| Component Name | Version |
|---|---|
| iC9200 series | ≥ 2024.3 |
| iCube Engineer | ≥ 2024.3 |
| Python | = 3.7.6 |
2. Solution details
Create a new Python Script and Install the "PyPlcnextRsc" library using the following pip command. Python version 3.7.6 is required for this solution.

Add the following modules to the Python Script
To establish communication with the iC9200 controller use the 'Device' class from PyPlcnextRsc as shown below. Define the ipAddress, user name and password as required.
Launch iCube engineer and create a template project for iC9200 controller. Create a user-defined datatype as shown below.
Create a POU named 'Main.' Open the POU's variable worksheet add the following port variable with the same datatype created earlier.
In Main POU's code worksheet add a simple logic to move the value of "Trajectory_0" to "Trajectory_1"
Create a new cyclic task of interval 4ms and assign the Main POU to the task. Rebuild and download the program to the controller.
In Python Script, create an object called 'data_access_service' to access data from the iC9200 controller.
Create a new data type instance by copying and pasting the data structure from iCube Engineer into the Python script as shown below. This method offers a convenient way to construct complex user-defined data structures from IEC61131 to Python.
Create a new instance of the PathStruct data and assign some values to the structure. Use the data_access_service object to write these values to the "Arp.Plc.Eclr/Main.Trajectory_0" port variable, as shown below. To receive and print the response, use the "Arp.Plc.Eclr/Main.Trajectory_1" port variable.