Protocols And Practical Learning Of Industrial Automation With CODESYS

Patrick

August 23, 2023

General
Protocols And Practical Learning Of Industrial Automation With CODESYS

I was onsite delivering CODESYS training the other day. A nice setup with an Industrial PC, Raspberry PI, a range of remote I/O from ODOT, and a number of sample CODESYS targets including Berghof PLC, CMZ Motion PLC, Linux IPC, Wago controller, Siemens IoT edgegate, etc!

The demo includes an Industrial PC running CODESYS talking to FOUR Industrial protocols: Modbus TCP, Profinet, Ethernet/IP, and my favourite… EtherCAT!

Today’s blog goes over my training material, which talks about:

1. Building foundation with CODESYS

2. Hardware and software configuration

3. Integration and Interaction

4. Four Main Industrial Protocols

5. CODESYS Development Environment

6. Exploring sample CODESYS targets

7. Advanced Features with HMI and Raspberry Pi

8. Troubleshooting & Debugging

If you’re interested to learn more about this or request a training session, please contact us HERE.

Building foundation with CODESYS

Building a foundation with CODESYS involves getting to know the CODESYS development environment, its user interface, and the basic concepts of PLC programming. Here’s what I covered in this phase:

1. Getting Familiar with CODESYS Development Environment: Getting comfortable with the CODESYS IDE (Integrated Development Environment) is key. This means understanding the layout, toolbars, project navigation, and panels like the device tree and program editor.

2. Creating First Project: The participants created their very first project in CODESYS. This includes choosing a project name, target device, and setting up any required configurations.

3. Adding Devices to Project: I show participants how to add different devices to their project. This could be PLCs, remote I/O modules, communication adapters, or any other devices needed for their automation tasks.

4. Understanding Program Structure: I explain how programs are organised in CODESYS. This involves understanding tasks, programs, and program organisation units (POUs) like program blocks, function blocks, and functions.

5. Exploring Different Programming Languages: I introduce participants to the various programming languages supported by CODESYS according to the IEC 61131-3 standard. This includes languages like ladder logic, structured text, function block diagrams, and sequential function charts.

6. Grasping Basic Logic Concepts: I help participants understand basic logic concepts such as digital inputs, outputs, timers, counters, and relay logic. I show how to use these concepts to create simple control logic.

7. Switching Between Online and Offline Modes: I guide participants on the difference between online and offline modes in CODESYS. This includes demonstrating how to test code in simulation (offline) and how to connect to a real device (online).

8. Downloading Code and Debugging: I walk participants through the process of downloading their program to the target device and how to monitor and debug the running program. This involves using tools like online/offline visualisation, watch lists, and breakpoints.

9. Adding Documentation and Comments: I emphasise the importance of adding comments to code for clarity and documentation purposes. I show participants how to add comments to their code and create meaningful variable and symbol names.

10. Highlighting Safety Considerations: I introduce participants to safety considerations in industrial automation programming. This involves discussing best practices for designing fail-safe systems and avoiding potential hazards.

11. Engaging in Hands-On Exercises: I incorporate hands-on exercises and small projects to give participants the opportunity to apply what they’ve learned. Practical experience is key to building confidence in using CODESYS effectively.

This phase is all about setting a strong foundation that participants can build upon as they dive deeper into industrial automation and CODESYS programming. By providing clear explanations, demonstrations, and hands-on practice, I ensure participants feel confident in their ability to harness CODESYS for their automation needs.

Hardware Components

  • Industrial PCs: These high-performance computing devices serve as the brains of the operation. They execute the control logic, monitor processes, and facilitate communication between various devices.
  • Controllers (PLCs): Controllers act as the heart of automation systems. They process inputs, execute control algorithms, and generate outputs, ensuring seamless operation of industrial processes.
  • Raspberry Pi: This versatile miniature computer brings a blend of flexibility and functionality. It can be integrated into automation setups to perform tasks like data logging, interfacing with sensors, and even running HMI (Human-Machine Interface) applications.
  • Remote I/O Modules: These (ODOT) modules extend the reach of your control system by interfacing with sensors and actuators in remote locations, enabling control over a wide range of processes.
  • Communication Adapters: Equipped with protocols like Modbus TCP, Profinet, Ethernet/IP, and EtherCAT, bridge the gap between different components.

Software Configuration

  • CODESYS Development Environment: As your creative studio, the CODESYS IDE is where you’ll write, test, and deploy your automation code. It’s your gateway to creating logic that controls the hardware components.
  • Device Configuration: Each hardware component must be configured within CODESYS. This involves defining the type of device, specifying communication settings, and mapping I/O points.
  • Network Setup: Configuring the network parameters ensures a robust communication infrastructure. Setting up IP addresses, subnet masks, and gateways facilitates seamless data exchange.
  • Programming Language: CODESYS supports various programming languages, including ladder logic, structured text, function block diagrams, and more. Select the language that best suits your application’s requirements.

Integration and Interaction

Ensuring that communication adapters are configured to use the appropriate industrial protocols enables data exchange between devices and facilitates coordinated action. Leverage CODESYS’s programming languages to craft the logic that drives your automation system. Whether it’s controlling a conveyor belt or regulating temperature, your code brings processes to life. Lastly, rigorous testing and validation are paramount. Simulate scenarios in offline mode to catch errors before going live. Debugging tools in CODESYS are your allies in this process.

Four Main Industrial Protocols

Industrial communication protocols are the bridges that allow devices to communicate effectively in an automation network. Let’s explore the four key protocols:

1. Modbus TCP open protocol facilitates communication between various devices over Ethernet. It’s simple and widely used in industrial settings.

2. Profinet is renowned for its high-speed communication capabilities, Profinet ensures real-time data exchange between controllers, sensors, and actuators.

3. Ethernet/IP enables seamless communication and interoperability among devices from different manufacturers.

4. EtherCAT is a high-performance protocol that boasts ultra-fast communication speeds, making it ideal for time-critical applications such as motion control.

CODESYS Development Environment

The CODESYS development environment transcends mere software; it serves as a dynamic creative space for sculpting intricate automation solutions. Within this environment, you embark on your automation journey through seamless project creation, meticulous target device selection, and precise configuration definition. This ecosystem boasts a versatile array of programming languages – encompassing ladder logic, structured text, and function block diagrams – each meticulously designed to cater to distinct control logic requisites. Moreover, the environment’s visualisation tools illuminate your logic’s essence, providing a tangible interface to comprehend and finely tune the intricacies shaping your control system’s behavior.

Read more about Multilingual Programming: Debunking Language Hierarchy In CODESYS.

Exploring sample CODESYS targets

CODESYS isn’t limited to a single type of device. The followings are CODESYS-compatible targets:

1. Berghof PLC

2. CMZ Motion PLC (Ideal for motion control applications)

3. Linux IPC

4. Wago Controller (combines automation and control in a single unit, simplifying system architecture.)

5. Siemens IoT Edgegate

Advanced Features with HMI and Raspberry Pi

Seamlessly integrating an HMI interface amplifies control and monitoring. A well-designed HMI offers real-time insights into processes, allowing operators to interact intuitively with automation systems. Through CODESYS, the marriage of control logic and user-friendly interfaces enhances operational precision and situational awareness. On the other hand, Raspberry Pi enriches automation horizons. From data acquisition and analysis to acting as a bridge between legacy and modern systems, Raspberry Pi’s flexibility shines. Leveraging CODESYS, you can harness the Pi’s prowess for diverse tasks, making it a dynamic component within your automation arsenal.

Troubleshooting & Debugging

Navigating CODESYS’s diagnostic tools, pinpointing issues such as erroneous logic, communication hiccups, and variable conflicts becomes second nature. A vigilant eye on system behavior lays the foundation for swift detection. Delving into CODESYS’s debugging toolkit will uncover an array of resources – from breakpoints and watch lists to online/offline visualisation – aiding in isolating and rectifying issues. Mastering debugging techniques ensures optimal performance and minimises downtime.

Contact us HERE to learn more about CODESYS or hands-on training and how it can help your automation projects to unlock its benefits and drive innovation in your industry.

Or to learn more about what we can do to help your automation requirements, please click projects, products & services.

Ti2 is currently very focused on working with its global partners to secure stock and avoid long delay times in delivering products to their customers. Together with our trusted partners, we are here to provide solutions for your needs.

Please click here to email us your inquiry, we would like to hear from you.