PLC Time-Series Data Collection with a Nonblocking Queue
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Programmable logic controllers (PLCs) face challenges in rapidly updating and storing input/output (I/O) data due to the lower access speed of large-capacity storage compared to main memory, necessitating a mechanism to efficiently enter records into storage.
Innovation Solution
A controller with a time-series database and a nonblocking queue in volatile main memory, where data is temporarily stored in the queue before being written to the database, allowing for independent data collection and storage processes, and enabling resizing of the queue based on data generation speed.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Quantity of substance
If data is directly written from main memory to large-capacity storage, then storage capacity is sufficient, but writing speed is limited by storage access speed
Solution Approach 1:
A nonblocking queue is introduced as an intermediary data structure between main memory and large-capacity storage. The queue acts as a buffer that decouples the fast data generation process from the slow storage process, allowing data to be enqueued rapidly while being dequeued and written to storage at the storage's sustained write speed.
Solution Approach 2:
The data flow is segmented into two independent processes: a data generation process that writes to the nonblocking queue, and a data storage process that reads from the queue and writes to large-capacity storage. This segmentation allows each process to operate at its own optimal speed without blocking the other.
2Reliability
If data is temporarily stored in nonblocking queue before writing to database, then data collection reliability is improved, but memory usage increases
Solution Approach 1:
The nonblocking queue is implemented with dynamic memory allocation, allowing the buffer size to be adjusted based on the data generation rate and storage write speed. This dynamic sizing ensures sufficient buffering for reliability while minimizing unnecessary memory consumption when the data flow balance changes.
3Productivity
If data generator and database manager operate independently, then processing throughput is improved, but coordination complexity increases
Solution Approach 1:
The nonblocking queue serves as a coordination mechanism between the independent data generator and database manager processes. It provides a simple interface (enqueue/dequeue operations) that enables asynchronous communication and synchronization without requiring complex inter-process coordination protocols.
Data Source
AI summary
A controller controls a control target. The controller includes a time-series database that stores a record including data about the control target in chronological order, a data generator that generates data to be included in the record to enter the time-series database in every predetermined cycle, and a nonblocking queue included in a volatile main memory that sequentially stores the data generated by the data generator.


