Enhancing Energy Efficiency and Real-Time Monitoring in Industrial Environments Through an Integrated Software Solution: NIGHTWATCH

ABSTRACT

Globally, the demand for energy continues to escalate due to factors such as heating, lighting, transportation, and fuel supply for various devices. In this context, achieving energy efficiency has necessitated a comprehensive approach encompassing activities related to energy generation, transmission, and consumption. The presented study, operates within industrial settings and interfaces with energy analyzers, collecting and analyzing data such as energy consumption, instantaneous current, and voltage. This initiative seeks to provide real-time visibility into energy-related operations on factory premises. Additionally, the software's capabilities extend to retrospective data analysis, enabling informed insights for future extrapolations. Furthermore, the integration of energy consumption data from the analyzers into the Manufacturing Execution System , (MES) facilitates energy tracking on a per-job basis. The software's dashboard component empowers users to establish customized threshold values for monitored energy parameters. When these thresholds are exceeded or when values deviate from expected levels, the software triggers alerts and notifications via email and other communication channels, ensuring timely dissemination of pertinent information. Consequently, the software allows businesses to establish a correlation between specific job order and machine level energy consumption data and unit costs. This correlation could foster the augmentation of efficient energy utilization, thereby enhancing competitiveness and overall efficacy.
1. INTRODUCTION
The need for effective monitoring and analysis of energy consumption in industrial environments has become increasingly important. In the past, energy consumption data was often collected manually, leading to delays in accessing and analyzing the information. However, with the development of energy monitoring and analysis software platforms, businesses now can monitor their energy consumption in real-time and make informed decisions based on the collected data. This paper will demonstrate the importance of energy monitoring and analysis software in industrial environments. Real-time monitoring and analysis of energy consumption is crucial in industrial environments. It allows businesses to track and analyze their energy usage patterns, identify areas of inefficiency, and make adjustments to reduce energy consumption and costs.
One of the key features of energy monitoring and analysis software is real-time monitoring of energy consumption. This software platform collects and analyzes values such as energy consumption, instantaneous current, and voltage from energy analyzer devices used in industrial environments. The collected data is then used to monitor the factory in real-time, providing businesses with insights into their energy usage patterns at any given moment. Furthermore, the software platform allows for retrospective data analysis. This means that the collected data can be analyzed over time to make inferences for the future. For instance, businesses can identify trends in energy consumption and make predictions about future energy needs.

Another important aspect of energy monitoring and analysis software is its integration with other systems. For example, the energy consumption data collected from the energy analyzer can be integrated into the work order/production notifications in the MES system. This integration enables businesses to monitor energy consumption on a work order basis, allowing them to measure the unit costs realized for each work order. Moreover, the software platform includes a control panel or dashboard that provides alarms and notifications when user-defined threshold values for energy consumption are exceeded or lower than expected, alerting relevant personnel through channels such as email. This feature ensures that businesses can take immediate action in response to any anomalies or deviations in energy consumption, helping them optimize their energy usage and minimize costs.
One of the benefits of implementing energy monitoring and analysis software in industrial environments is the potential for increased efficiency and competitiveness [1]. By monitoring energy consumption on a work order basis, businesses can identify areas of inefficiency and take corrective actions. For example, by analyzing the relationship between work order-based energy consumption data and machine-based energy consumption, businesses can identify machines or processes that are consuming excessive [2] energy and implement measures to optimize their use. Additionally, the software platform allows for the comparison of energy consumption between different work orders or production lines [3].

This allows businesses to identify best practices and replicate them across the organization, leading to more efficient energy usage and ultimately, increased competitiveness in the market. The integration of energy monitoring and analysis software with other systems, such as the MES system, enables businesses to have a comprehensive view of their energy consumption and make informed decisions based on real-time data [4]. The energy management systems offers many benefits, such as optimizing energy consumption, reducing costs, improving the corporate image of the enterprise, and reducing the negative impact on the environment [5]. Therefore, by implementing an effective energy monitoring and analysis software platform within industrial environments, businesses can not only reduce their overall energy consumption and costs but also improve their environmental sustainability and corporate reputation. Moreover, the integration of energy consumption data into work order and production notifications allows for a more accurate measurement of unit costs. This allows companies to have a more transparent understanding of their energy expenses, enabling them to make data-driven decisions for cost optimization. In this context, monitoring and analyzing energy consumption in industrial environments can play a vital role in achieving energy savings and promoting sustainability. Alerts and notifications provided by the developed control panel further enhance the efficiency of energy management. These notifications ensure that relevant stakeholders are immediately informed when energy values exceed or fall below predefined thresholds [6]. As a result, prompt actions can be taken to address any anomalies or deviations, preventing potential energy waste or inefficiencies.

In today's rapidly changing world, the significance of accurate monitoring and analysis of energy consumption in industrial environments cannot be overstated. Energy efficiency is a crucial factor for the industrial sector, and businesses are increasingly recognizing the importance of implementing effective energy management systems [5]. These systems not only enable businesses to optimize their energy consumption and reduce costs but also improve their corporate image and minimize their negative impact on the environment. 


According to the feature comparison presented in Table 1, the Nightwatch software encompasses numerous supplementary functionalities and features in comparison to its counterparts. Thanks to its support for multiple communication protocols and alarm channels, it can be easily adapted to a large number of devices and can work in harmony with different communication channels. Noteworthy, among its attributes is the capacity to perform unit conversion cost calculations on collected data tailored to user specifications. This capability ensures the prevention of any compromise in system speed and performance without incurring additional processing overhead. Moreover, the system exhibits robust support for heightened system integrations and a facile adaptability to diverse application domains and user profiles. A distinctive advantage of the Nightwatch lies in its obviation of the necessity for supplementary gateway hardware during the data transfer phase, a requirement found in equivalent systems [7] [8]. Consequently, the system precludes incurring additional investment costs.

2. MATERIAL AND METHODS
This section outlines the methodology and components employed in this study for enabling real-time data collection from machines, analyzers, and sensors situated within production fields, along with the standardization of data transmission to upper-level modules and systems. The key concepts within the overarching architecture are as follows:
• Data Collection: Data retrieval is based on configurations and involves the extraction of data from data sources, notably Modbus TCP gateways. Device identification, encompassing device IP/port and unit ID/slave ID, as well as addresses and data types, plays a crucial role in data collection.
• Device: Refers to a physical device or gateway utilized for data retrieval. Presently, the system is configured to interface with Modbus TCP gateways, with plans to accommodate other protocols and standards in the future.
• Unit: A logical component residing within a device, presently identified via a Slave ID/Unit ID.
• Reading Definition: Signifies a data point characterized by a unique address and data type. Readings for units are defined, and numeric formulas are attached to these readings to facilitate value calculations.
• Numeric Formulas: These formulas offer the means to compute actual values from raw reading data. Numeric formulas support basic calculations by employing predefined and optional multipliers and divisors.
• Alerts: A mechanism for sending notifications to users predicated on predefined threshold values and trigger conditions. Alerts are defined in relation to a device reading, identified by its name, and the numeric formula attached to the reading definition.
• Channels: Channels are used to disseminate alerts. Presently, SMTP Mail and Telegram channels are supported.
• Sinks: Sinks are employed to disseminate reading data to message brokers, databases, third-party systems with REST endpoints, and our proprietary trexDCAS. Some sink implementations support the distribution of alerts. Sinks can be configured for integration purposes to transmit device data or alerts.
• Actor Model: Data collection and alert chart generation background services are implemented as Actor Models using the Akka.NET framework. All logic is encapsulated within actors, with services utilized by these actors. Communication between actors is achieved through messages and events.
• Plots: Device data is visualized using OxyPlot charts within our Windows Desktop application. Additionally, support is provided for embedding PNG charts within alert messages.

Nightwatch comprises three primary components, namely, data collection, data distribution and traceability, and the last one is the alert mechanism.
Nightwatch has the capability to gather data from devices supporting OPC DA, OPC UA, and Modbus communication protocols. The acquired data undergoes enrichment through various calculations and functions, transforming it into meaningful information. The system is versatile in its support for different databases, allowing for integration customization based on user preferences. Visualization of the collected data is achieved by aligning it with the corresponding machine and work order. Notifications regarding anomaly values exceeding user-defined threshold levels can be disseminated to relevant individuals through diverse communication channels.

2.1. Data Collection
Developing industrial IoT solutions presents a primary challenge arising from the diversity of machines and sensors used in the field, resulting in difficulties in maintaining a consistent and healthy data flow.The key issues encountered in data collection and the broader challenges they pose can be summarized as follows:
• Disruption of digitization in production fields due to the presence of older machines incapable of generating data.
• Escalation of system complexity and data collection expenses owing to the diversity in machine and sensor brands, models, protocols, and data formats.
• Diminished data quality at the corporate level due to the inability to centrally perform data integration, cleansing, and enrichment processes.
• High costs and prolonged installation and project durations resulting from repetitive efforts at the organizational level. These efforts arise from the need for various systems (MES, ERP, Quality Applications, etc.) to access machine data using distinct frequencies and methods.

The developed system provides support for widely used industrial protocols, including OPC UA, OPC DA, and MODBUS TCP. Furthermore, it offers direct data retrieval capabilities from PLCs such as Siemens, Mitsubishi, Omron, Rockwell, and Allan-Bradley. In addition to these aforementioned protocols and PLCs, the system is also compatible with Mert Software & Electronics' proprietary hardware, known as the trexDCAS IoT Box.
In the Nightwatch platform, raw data collected from machines and sensors can be amalgamated, filtered, and enriched using advanced scripts that can be defined during the configuration phase. This enrichment encompasses a broad spectrum of functions, encompassing not only fundamental mathematical operations but also advanced numerical processes, signal processing, geographical location calculations, conditional expressions, and more.

2.2. Data Distribution and Traceability

The component responsible for transmitting raw or enriched data collected from various machines and sensors to upper-level modules or systems is referred to as the "data distribution" component. The system's data distribution capabilities encompass the following features:

• Definition of Target Systems: The system allows for the definition of target systems for data transmission using generalized and standardized configurations.
• Data Transmission Formats: It enables the transmission of collected and computed data to target systems in four different standard formats, regardless of the source machines and protocols, based on the intended use.
• Simultaneous Data Transmission: The system facilitates simultaneous data transmission to multiple target systems, whether they are of the same type or different types.

The fundamental concept underpinning the data distribution capabilities of the designed system is referred to as a "Sink." Sinks encompass the types of target systems to which data will be sent and the associated settings for these target systems, including addresses, usernames, passwords, and more. In essence, Sinks are the components responsible for enabling data transmission to external systems within the system.
The system utilizes integration sinks for distributing collected or generated data and alarm sinks for distributing alarm data when predefined alarm conditions are met. The platforms to which the system can distribute data using integration sinks include:

• Relational databases (PostgreSQL, Microsoft SQL Server, Oracle, MySQL, MariaDb, and SQLite)
• Message brokers supporting the MQTT protocol (e.g., Mosquitto)
• Message brokers supporting the AMQP protocol (e.g., RabbitMQ)
• Redis
• Systems supporting the OPC UA protocol (e.g., KepWare)
• Custom systems tailored to individuals or customers using the Web Hook mechanism, based on REST
• trexDCAS Energy module
• trexDCAS Operator Panel
Time-series data gathered from the sensors are stored in PostgreSQL, an open-source database management system, for further analysis. This data is subsequently transformed into real-time and historical analysis plots using Grafana [9], allowing for in-depth analysis (Figure 2).


2.3. Alert Mechanism

The alert mechanism in this system involves real-time processing of data obtained from machines and sensors based on user-defined conditions. It also includes the capability to send alarm notifications through user-defined channels to external systems, email, or instant messaging services when specific alarm conditions are met.
The design principles for the alarm system in this developed system encompass the following aspects:

• Ease of Alarm Definition: Alarm conditions should be easily defined.
• Real-time Processing: Alarm conditions should operate in real-time on the raw data collected from machines and sensors.
• Utilization of Calculations: Alarm conditions should also be capable of operating on real-time calculations performed on data generated from the raw data.
• Notification Channels: Notifications should be sent through defined channels when alarm conditions occur.
• Integration with External Systems: Alarm information should be distributed to external systems via alarm sinks when alarm conditions are met.
• Historical Data Distribution: Historical values of the sensor data that triggered the alarm can be distributed as information and, if desired, in graphical form through channels or sinks.
The alarm detection mechanism of the system is founded on four fundamental concepts:
• Raw Data: Real-time data collected from machines or sensors, with unit conversions applied.
• Generated Data: Real-time data derived from raw data using either complex or simple calculations supported by scripts integrated into the system.
• Data Monitoring Windows: These are created by users and configured concerning time intervals.
• Alarm Condition Occurrence: Alarm conditions are defined through configuration and are used to trigger alarms.


Figure 3 illustrates the structure and content of an alarm message sent to the Telegram channel. For channels not directly supported by the system, such as delivering notifications through messaging platforms like Slack or Microsoft Teams, the system offers the option to utilize pre-existing sinks (e.g., MQTT, RabbitMQ, Redis, etc.). These sinks allow the system to interpret alarm messages in JSON format and forward them to the preferred sink for further transmission to the desired messaging services (see Figure 4).

3. RESULTS AND DISCUSSION
In this article, the proposed system facilitates the recording of data related to processes that enterprises aim to monitor. Consequently, it enables businesses to measure unit costs on a work order basis and monitor the relationship between work order-based energy consumption data and machine-based energy consumption.
Upon adapting and implementing the developed system in an enterprise focused on monitoring energy losses, notable results have been obtained. When comparing sample machine data for the same number of work orders over a 5-month period, using a 5-minute data collection interval, it becomes evident that energy consumption for the selected machine improved by 36% from the initial reading (71.1 Amperes) to the final reading (45.4 Amperes) due to the actions taken.

4. CONCLUSION
In today's world, where energy and natural resources are limited, monitoring critical issues such as energy, water, and pollution, and swiftly implementing potential improvements, are of paramount importance in leaving a more habitable world for future generations.
Building on this understanding, the system under discussion in the article enables the following processes:

• Energy consumption data collection and monitoring,
• Energy consumption Key Performance Indicator (KPI) calculation and monitoring,
• Process machine data collection and manual data measurement, trexDCAS production line energy consumption and anomaly detection machine data collection,
• Machine Overall Equipment Efficiency (OEE)/performance data collection.
As a result, Nightwatch software is a significant endeavor in terms of enabling businesses to monitor overlooked aspects through the system, take necessary actions, and make improvements. Our proposed energy management software architecture will make a positive contribution to an organization's energy management and savings policies.
In future studies, the goal is to develop self-learning and predictive systems through the utilization of data analytics and machine learning models derived from the collected data. This initiative is poised to significantly enhance maintenance and quality processes within production sites.

CONFLICT OF INTEREST STATEMENT
There is no conflict of interest among the authors.

ACKNOWLEDGEMENT
This study was developed in the R&D centre of Mert Yazılım Bilgisayar Elektronik Makine Sanayi Ticaret A.Ş. and supported by the Ministry of Industry and Technology with the project code KTPMY29.

CONTRIBUTIONS OF AUTHORS
F.A.: Contributed to investigations, resources, writing-original drafting.
S.A.: Contributed to investigation, resources, writing—review and editing.