Event-Driven PLC Programming for Fast Response
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing programmable logic controllers (PLCs) based on scan cycles suffer from slow response to events, complex and poorly structured user applications due to the need for integrated event detection and handling within a single program, leading to difficulties in maintenance and performance.
Innovation Solution
An event-driven programming method and controller architecture that registers and prioritizes events, stores event handler programs, and uses an event queue to manage and execute event handlers in a modular and efficient manner, allowing for user-defined and customized event handling.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If scan cycle programming method is used, then the controller can execute user application programs, but the response speed to events is slow
Solution Approach 1:
The patent segments the monolithic user application program into multiple independent event handler program sections, each dedicated to handling specific event types. This segmentation allows the controller to jump directly to relevant event handlers when events occur, rather than executing through the entire scan cycle program sequentially, thereby significantly improving response speed and reducing event handling delay.
2Ease of operation
If scan cycle programming method is used, then the controller can handle various events, but the user application structure is complicated and poorly structured
Solution Approach 1:
The patent divides the user application into distinct event handler program sections (e.g., input event handlers, output event handlers, communication event handlers, diagnostic event handlers) that can be independently written, tested, and maintained. Each section handles a specific type of event, eliminating the need to integrate all event processing logic in a single monolithic program, thus simplifying the overall application structure and improving readability.
Solution Approach 2:
The patent introduces an event queue as an intermediary data structure between event detection and event handling. Events are detected by the event detector, stored in the event queue with their respective event identifiers, and then processed by the corresponding event handlers. This intermediary mechanism decouples event detection from event handling, allowing for more modular and maintainable program structure.
3Ease of repair
If scan cycle programming method is used, then the controller can process events, but the maintenance difficulty increases
Solution Approach 1:
By organizing the program into separate event handler sections for different event types (input, output, communication, diagnostic, system events), the patent enables developers to locate, modify, and debug specific event handling logic without affecting other parts of the system. This modular structure significantly reduces maintenance difficulty compared to integrated scan cycle programs where changes require careful consideration of global program flow.
4Speed
If event-driven programming is implemented, then the response speed improves, but the controller architecture becomes more complex
Solution Approach 1:
The patent implements event-driven programming by segmenting the controller into distinct functional modules: event detector module for detecting events, event queue module for storing events with identifiers, and event handler module for executing corresponding program sections. While this modular architecture is more complex than traditional scan cycle design, it provides significant advantages in response speed and program maintainability, with each module having a clear, single responsibility.
Data Source
AI summary
The present invention provides an event-driven programming method of programmable logic controller (PLC), including: registering at least one event to be detected; storing at least one event handler segment corresponding to the at least one event to be detected respectively; detecting the occurrence of the at least one event to be detected; adding the detected event into an event queue; extracting events from the event queue; and executing the event handler segment corresponding to the extracted event.


