At that moment, I realized: to become a truly comprehensive automation systems engineer, I need to master PLC programming. From the entire IEC 61131-3 standard, I chose Structured Text and the CODESYS development environment. As always, mastering something "new" requires a massive challenge. In this case β studying Object-Oriented Programming (OOP), modular development, architecture, data structuring, code execution optimization, building abstractions, and complex visualization.
I chose a real-world object β the largest intersection in my city (View on Google Maps). Having absolutely no official documentation, I performed a complete reverse engineering of the intersection's operational logic solely through visual observation.
For ease of review, the repository contains:
- AdaptiveTrafficLightControl_DK22-DK25_CODESYS.projectarchive β for a quick download and seamless launch of the project in CODESYS.
- src folder β fully replicates the structure of the project's codebase. This allows you to easily view and analyze the code (POU, GVL, DUT) directly in your browser on GitHub, without needing to open the IDE.
βοΈ Technical Architecture & Features
The project was created in CODESYS V3.5 SP21 Patch 1+ (64 bit). Since everything was written entirely from scratch (including the math, simulator, and adaptive logic) and designed to run in a standard free CODESYS environment, the project does not require the installation of any third-party libraries.
Everything is accompanied by detailed technical documentation:
- A full description of the intersection's structure and a comprehensive specification of the operational logic for all its components (written before coding even began).
- A Unified Naming Standard (developed at the initial stage and strictly adhered to throughout the development process).
The system is built on the principle of deep, multi-level modularity. Here are the key modules (top abstraction level):
1) Intersection Control Core
A logic controller that synchronizes the operation of all actuators and displays the current state. The operation of all physical inputs and outputs is visualized on the main screen (the intersection model). The visualization implements connections specifically to hardware variables, not just logical ones.
2) Settings Manager
An isolated security module acting as a protective gateway between the user interface (HMI) and the main controller.
- Operational settings screen: For quick parameter changes.
- Critical settings dialog: Operates on a transactional validation principle ("all or nothing") to guarantee configuration integrity.
3) Adaptive Traffic Control Logic
Analyzes intersection data in real-time (generated by the MOCK simulator). Adaptive logic decisions include:
- Phase Skipping: Determining the next traffic phase with the possibility of skipping it if there is no traffic waiting, and no requests from dependent pedestrian phases.
- Phase Prolonging: Extending the current traffic phase in case of local overload (relative to its own norm) or global overload (relative to the overall intersection state).
- Gap-Out (Early Termination): Terminating the currently active traffic phase upon cascaded fulfillment of conditions: completion of the minimum threshold time, absence of traffic on the current lanes for a specified time, presence of confirmed demand elsewhere, and absence of active parallel pedestrian phases. (All logic operations are visualized on a separate HMI screen to monitor the system's decisions).
4) MOCK Simulator
An independent multi-parameter module that generates a dynamic traffic simulation (imitating the operation of a CCTV system and inductive loops).
- Schematic dynamic visualization of traffic movement.
- Hierarchical dialog HMI screens for configuring traffic generation parameters.
π Multilingual & Scalable
The visualization supports 4 languages (English, German, Polish, Ukrainian) via Text Lists and native CODESYS localization. The software core is highly flexible and capable of scaling from a simple T-junction to a complex X-junction with 12 entry lanes without rewriting the code.
π Future Aspirations
Initially, this project was created as a testing ground for learning Structured Text, but a deep dive made this field truly fascinating. However, my focus is not limited solely to traffic control.
In the future, I am interested in solving complex architectural challenges in the following areas:
1. Robot Kinematics (SoftMotion): Developing control systems for N-axis open kinematic chains based on the mathematical apparatus from K. Lynch and F. Park's "Modern Robotics" (2019).
2. Renewable Energy: Automatic control systems for wind turbines.
3. Bioengineering: Industrial automation of bioreactors for biowaste processing.
4. Agro-industry: Automation systems for poultry farming complexes.
π€ Currently, I am open to new career opportunities in the field of industrial automation, robotics, and PLC programming.
If you are looking for an engineer who isn't afraid of unconventional challenges β let's talk!
[-download button: missing =-]
A Built-From-Scratch Digital Twin of a Traffic Intersection and Adaptive Traffic Control System (CODESYS / Structured Text)
A year ago, I completed my first project β automating a welding production process via offline robot programming in RoboDK.
- Published on the RoboDK website: https://robodk.com/example/Material-Handling-and-Welding-with-Fanuc-and-KUKA
- YouTube Video: https://youtu.be/yB0ctZ6emPE
- LinkedIn Post: https://www.linkedin.com/posts/yevhenii-kutei-08651b351_robodk-offlineprogramming-industrialautomation-activity-7316474707438981120-HpHb
At that moment, I realized: to become a truly comprehensive automation systems engineer, I need to master PLC programming. From the entire IEC 61131-3 standard, I chose Structured Text and the CODESYS development environment. As always, mastering something "new" requires a massive challenge. In this case β studying Object-Oriented Programming (OOP), modular development, architecture, data structuring, code execution optimization, building abstractions, and complex visualization.
I chose a real-world object β the largest intersection in my city (View on Google Maps). Having absolutely no official documentation, I performed a complete reverse engineering of the intersection's operational logic solely through visual observation.
π₯ Demonstration & Source Code
The extended 4K video review below demonstrates the results of my work: https://youtu.be/HEWyx1gOcKs
The CODESYS file, source code, and accompanying technical documentation are available here:
- GitHub Repository: https://github.com/e13740e/CODESYS-Adaptive-Traffic-Control
- Google Drive: https://drive.google.com/drive/folders/1P619CBIfJyTh8SYTZRu7tSgysg4Qu9o8
For ease of review, the repository contains:
-
AdaptiveTrafficLightControl_DK22-DK25_CODESYS.projectarchiveβ for a quick download and seamless launch of the project in CODESYS.-
srcfolder β fully replicates the structure of the project's codebase. This allows you to easily view and analyze the code (POU, GVL, DUT) directly in your browser on GitHub, without needing to open the IDE.βοΈ Technical Architecture & Features
The project was created in CODESYS V3.5 SP21 Patch 1+ (64 bit). Since everything was written entirely from scratch (including the math, simulator, and adaptive logic) and designed to run in a standard free CODESYS environment, the project does not require the installation of any third-party libraries.
Everything is accompanied by detailed technical documentation:
- A full description of the intersection's structure and a comprehensive specification of the operational logic for all its components (written before coding even began).
- A Unified Naming Standard (developed at the initial stage and strictly adhered to throughout the development process).
The system is built on the principle of deep, multi-level modularity. Here are the key modules (top abstraction level):
1) Intersection Control Core
A logic controller that synchronizes the operation of all actuators and displays the current state. The operation of all physical inputs and outputs is visualized on the main screen (the intersection model). The visualization implements connections specifically to hardware variables, not just logical ones.
2) Settings Manager
An isolated security module acting as a protective gateway between the user interface (HMI) and the main controller.
- Operational settings screen: For quick parameter changes.
- Critical settings dialog: Operates on a transactional validation principle ("all or nothing") to guarantee configuration integrity.
3) Adaptive Traffic Control Logic
Analyzes intersection data in real-time (generated by the MOCK simulator). Adaptive logic decisions include:
- Phase Skipping: Determining the next traffic phase with the possibility of skipping it if there is no traffic waiting, and no requests from dependent pedestrian phases.
- Phase Prolonging: Extending the current traffic phase in case of local overload (relative to its own norm) or global overload (relative to the overall intersection state).
- Gap-Out (Early Termination): Terminating the currently active traffic phase upon cascaded fulfillment of conditions: completion of the minimum threshold time, absence of traffic on the current lanes for a specified time, presence of confirmed demand elsewhere, and absence of active parallel pedestrian phases.
(All logic operations are visualized on a separate HMI screen to monitor the system's decisions).
4) MOCK Simulator
An independent multi-parameter module that generates a dynamic traffic simulation (imitating the operation of a CCTV system and inductive loops).
- Schematic dynamic visualization of traffic movement.
- Hierarchical dialog HMI screens for configuring traffic generation parameters.
π Multilingual & Scalable
The visualization supports 4 languages (English, German, Polish, Ukrainian) via Text Lists and native CODESYS localization. The software core is highly flexible and capable of scaling from a simple T-junction to a complex X-junction with 12 entry lanes without rewriting the code.
π Future Aspirations
Initially, this project was created as a testing ground for learning Structured Text, but a deep dive made this field truly fascinating. However, my focus is not limited solely to traffic control.
In the future, I am interested in solving complex architectural challenges in the following areas:
1. Robot Kinematics (SoftMotion): Developing control systems for N-axis open kinematic chains based on the mathematical apparatus from K. Lynch and F. Park's "Modern Robotics" (2019).
2. Renewable Energy: Automatic control systems for wind turbines.
3. Bioengineering: Industrial automation of bioreactors for biowaste processing.
4. Agro-industry: Automation systems for poultry farming complexes.
π€ Currently, I am open to new career opportunities in the field of industrial automation, robotics, and PLC programming.
If you are looking for an engineer who isn't afraid of unconventional challenges β let's talk!
I would appreciate a repost or a comment!
PLC #CODESYS #StructuredText #Automation #TrafficControl #Engineering #HMI #Robotics
Last edit: e13740e 2 hours ago