Stream-Based Data Management Strategy in Environmental Monitoring Systems (EMS): A New Approach to Programmable Logic Controller (PLC) Programming
EMS: Role of PLCs
Today, it is difficult to imagine a modern pharmaceutical manufacturing facility operating without an EMS. Despite its critical role; however, very few people truly understand what it is. Information on this topic is also extremely limited.
An EMS is designed to continuously monitor, control and document conditions within the manufacturing environment. It is well known that pharmaceutical manufacturing requires strict adherence to tighty controlled environmental conditions in production areas. These include familiar parameters such as pressure, temperature, and humidity, as well as more specific ones, such as the concentration of aerosol particles per cubic meter of air, laminar airflow velocity and others. All these parameters require visualization, monitoring, data recording, and reporting capabilities. EMS systems are specifically designed to perform these functions.
The main element of the system is the PLC. It performs acquisition and processing of primary sensor data, alarm handling, control of visual and audible signaling devices, data transmission to SCADA systems, other PLCs or human-machine interface (HMI) panels. The PLC is the “brain” of the system, executing its primary functions, and the overall system quality and good manufacturing practices (GMP) compliance largely depend on the efficiency of PLC software implementation.
Improving PLC software efficiency requires the application of modern programming strategies and approaches. Under these conditions, it is no longer sufficient to rely solely on procedural or object-oriented programming techniques and structured code organization. It becomes necessary to develop new programming strategies within these paradigms to ensure efficient data flow management inside PLC applications.
PLC: Unified Data Access Point for Process Data
Experience in operating and maintaining EMS PLC systems demonstrates that process data is often fragmented, while scalability, maintainability, and system integration remain challenging despite the use of procedural or object-oriented programming approaches.
An important element capable of solving these problems is the implementation of a unified data access point for process data within the PLC program. Such a data access point allows engineers to quickly monitor the status of an object, identify abnormal situations, and make operational decisions. It also provides fast access to executable code sections associated with the monitored process.
Stream-Based Process Data Management Architecture
The stream-based data management architecture in EMS is based on the creation of such a data access point within the PLC application. This concept forms the foundation of the strategy.
The data access point is a single global database containing all necessary information about the monitored object or process. Inside the data access point, streams and channels are defined.
A stream is a software entity associated with a production object or process. In EMS applications, such an object may represent a production room where pressure, temperature, and humidity are monitored.
A channel is nested within a stream and corresponds to a specific monitored parameter. For example, a room may contain three channels: pressure channel (P-channel), temperature channel (T-channel), and humidity channel (rH-channel). Data within the channel is stored in channel properties, such as measured values and alarm limits. Properties may be structured and grouped according to their functional purpose: sensor-related information, SCADA communication data, subordinate PLC communication data, HMI panel communication data, visualization data used directly inside the PLC.
The architecture concept is illustrated in Figure 1.
Figure 1: Stream-Based Process Data Management Architecture
A practical implementation example of the stream-based strategy for the OWEN SPK110 PLC in the CoDeSys 3.5 programming environment is shown in Figure 2.
Figure 2: Stream-Based Strategy in CoDeSys 3.5
In this example, the project global variable list acts as the unified data access point. A single stream representing room MBL33 has been created. Three monitored parameters (channels) are implemented in this room: Pressure channel (P), Temperature channel (T), Humidity channel (rH). Each channel contains properties. Property sets may either be standardized across all channels within the stream or customized depending on functional requirements. Some properties are grouped together; such as data intended for SCADA systems and data required for PLC visualization.
The data structure uses intuitive and self-descriptive naming conventions.
To implement this strategy in CoDeSys 3.5, Defined User Types (DUTs) are used. DUTs allow the definition of variables of various types, including nested DUT structures. In this architecture, streams, channels, and groups are implemented as nested DUTs. Figure 3 illustrates the definition of the DUT typ_Room used for stream MBL33.
Figure 3. Definition of DUT typ_Room
The structure contains three channels: Channel_P, Channel_T, Channel_rH. All channels are implemented using the typ_RSChannel data type (Fig. 4), corresponding to pressure, temperature, and humidity respectively.
Figure 4: Definition of DUT typ_RSChannel
Within each channel, some properties are grouped together: dfsData of type typ_Data_For_SCADA (Fig. 5), containing data transmitted from the PLC to the SCADA system, acData of type typ_AlarmColors (Fig. 6), containing PLC visualization-related data.
Figure 5: Definition of DUT typ_Data_For_SCADA.
Figure 6. Definition of DUT typ_AlarmColors.
In online mode, CoDeSys 3.5 allows engineers to browse data values and statuses in a hierarchical tree structure at every architecture level and quickly navigate to the exact code sections responsible for data storage and processing. Property processing mechanisms within channels (including programs, function blocks and functions) are standardized and easily scalable.
Conclusions and Future Development
The proposed architecture demonstrated several advantages during the practical implementation of the EMS project for the innovation and quality center laboratory complex.
The stream-channel approach provided a highly structured and scalable software architecture, simplifying both development and long-term system maintenance. One of the key advantages was the standardization of monitoring channel logic, which substantially reduced development time, minimized probability of programming errors, and improved overall system transparency.
Practical operation confirmed the effectiveness of this methodology by ensuring stable real-time monitoring, simplified troubleshooting, and high data integrity in compliance with GMP requirements. In addition, architecture has strong scalability potential and allows the integration of additional sensors, new monitoring zones, and advanced analytical functions without major modifications to the software structure.
At the same time, this approach requires careful preliminary architectural design and a high level of engineering discipline throughout the entire project lifecycle. Future system development may include integration with industrial internet of things platforms, implementation of advanced analytics, predictive alarming mechanisms, and enhanced cybersecurity features for critical pharmaceutical infrastructure.
About the Author
For more than nine years, Yevgeniy Davydik has been involved in PLC programming and SCADA system design for pharmaceutical manufacturing facilities. During this time, he has successfully implemented five large-scale EMS projects at Polpharma Santo and gained extensive experience in the operation and maintenance of such systems.