An IoT based Condition Monitoring System of Biogas Electrical Generator for Performance Evaluation

— Biogas is a promising renewable energy source having great potential, especially in livestock farms. However, as biogas electric generators are usually deployed in rural areas, it would take more time and effort to repair if any fault occurs. Remote monitoring of the system condition is essential to diagnose or even predict the faults in advance and subsequently plan the maintenance schedule in time. This paper presents a monitoring system of biogas-based power generation system us-ing Internet-of-Things (IoT) devices. Information of the generator operation is acquired by field devices and forwarded to a remote server. Data collection and management are facilitated by Lambda architecture and Apache Kafka software platform for their interoperability and strong support of big data management. The system shows that near real-time supervision of the object conditions can be obtained. Historical data analyses of a few operation scenarios are also provided to evaluate the generation system performance as well as to discuss its fault diagnosis


I. INTRODUCTION
NCREMENT in energy demand raises a serious concern worldwide, especially in developing countries.While fossil fuel resources do not provide sustainable means for sustainable development, other conventional energy sources such as hydroelectricity or nuclear power have adverse environmental impacts and constraints.Seeking alternative energy sources, agricultural countries are taking advantage of the energy generated by agricultural wastes such as biogas to replace gasoline and oil in some cases.Biogas extracted from animal manure through anaerobic digestion is a renewable energy source for livestock farms, and it can be used to produce heat or electricity.Moreover, this process also helps to reduce completely methane emissions and stabilizes the manure before its agronomic use [1].The electrical generators using biogas are typically modified from gasoline and diesel engines or based on dual-fuel engine [2,3].Once installed in livestock farms, the energy produced by these generators can power the electrical loads and help to avoid disposing of contaminated substances to the surrounding area.

I
In order to facilitate the reliable operation of such a biogas energy system, users are required to observe and under-stand its performance while it is functioning.Machines Monitoring System (MMS), also known as SCADA (Supervisory control and data acquisition) is a system which performs real-time communication and data collection from field devices.The data is then processed, stored and analysed.The outcome would assist users to understand the operating status of machinery and equipment and take appropriate actions when an incident occurs.Businesses can be then more proactive in managing internal activities and at the same time helping to avoid loss of income due to any machine downtime.
Related studies in condition monitoring of similar systems with data analysis have been reported in the literature.One of the early works is presented in [4].The authors monitored a natural gas-based generator; generator data was collected, calculated, and stored in a floppy disc.Recent advances in information management technologies enable data acquisition systems to handle a big amount of data and carry out sophisticated analysis, specifically in generation systems with rotary machines [5][6][7].Evaluation of system conditions can be performed by processed parameters such as vibration, noise [8] or oil analysis method [9].Variety of the data from a number of machines acquired over a long duration can provide comprehensive understanding of the machines.However, efficient data management with scalability, high security and privacy needs to be taken into account [10,11].
In this work, an IoT based monitoring system for the biogas electrical generators has been proposed and developed to enable remote observation.Various parameters of the generator as well as other parts of the energy system are collected.The data acquisition solution is an integration of a single board computer with open source self-developed software and industrial devices like PLCs.Data acquired are pre-processed at the single board computer and then sent over the Internet to a remote for further analysis.In order to collect, store, and analyse a huge amount of information as well as to be extensible, we use a lambda architecture to build the monitoring system.It highly supports data gathering from multiple sources and processing a large amount of distributed data.The ultimate purpose of this process is to understand the biogas system comprehensively, provide the end-users recommendation of the operation and allow the manufacturers to have in-depth view of the usage patterns.
The structure of this paper is as the following: Section 1 provides the introduction of the work, Section 2 gives a description of the biogas energy system, Section 3 presents technical details of the developed system, Section 4 shows the experimental results, data analysis and discussion, and Section 5 provides the conclusion.

II. BIOGAS ENERGY SYSTEM DESCRIPTION
The overall system of this study is illustrated in Fig. 1.It is considered the biogas generator of which the engine has been modified from a diesel type to use biogas as its fuel.
The fuel.Biogas as fuel is contained in the "Biogas tank".As reported by Osorio and Torres in [12], biogas composed of various gases such as methane (60-70%), CO2 (30-40%), nitrogen (<1%), and H2S (10-2000 ppm).This various composition makes it difficult for the user in setting the engine to work stably.As shown in Fig. 1, the biogas from the main treatment tank is pushed into the biogas tank via valve V1.It then flows through the carburetor which mixes the biogas and ambient air with rich oxygen.The ratio of the mixture is pre-fixed with manual valve K2.The flow of this mixture supplied to the engine is controlled with valve V2.
The engine performance highly depends on the quality of fuel supply.The system controller has been designed in such a way that it can control the main input valve V1 and the gas supply valve V2 to obtain the proper fuel for the engine.However, changing working conditions and disturbances from an ambient environment may create some issues with the engine operation.Three parameters including the position of valves V1 and V2 as well as the main tank pressure P are acquired by the monitoring cabinet.Although these values are used by the controller to provide appropriate control signals to the valves, they are also collected for further assessing the system performance.
The generator.The generator includes a combustion engine, a three-phase synchronous generator, and accessories such as a start-up motor, speed encoder, etc.The parameters to be monitored of this component include two groups.First, the electrical parameters such as output line voltage Vab, phase currents Iabc, and frequency calculated from the generator rotary speed SP1.Second, the environmental parameters which are the temperature of the cooling water for the engine T1, oil pressure Oil1 and O2 concentration in the exhaust.engine's operating parameters can thereby give an assessment of its performance as well as predictions of its failure to some extent.In addition, it is expected that analysed data can be employed to suggest that the operator should use and adjust the controller of the machine optimally.

A. Local data acquisition scheme
The biogas generation system is equipped with a PLC Siemens S7-1200 as the main controller and perceive sensing measurements.The PLC module continuously acquires and stores sensing data in its data block.Besides the parameters mentioned in Section 2, the starting time and the stopping time of the machine are also recorded.The module allows third-party devices to connect via Ethernet port and to communicate via an open-source library called Snap7 Interface.The library supports multiple programming languages include Python.As mentioned in Section 2, a single-board computer Raspberry Pi is used as an edge computing unit for its versatility and strong support in opensource software.It is equipped with a 4G modem to communicate with the server remotely.
A python application is written and executed on Raspberry Pi to communicate with the PLC unit.It periodically accesses the PLC data block to get the data, preprocesses and stores it locally, then sends it towards the remote server.SQLite is adopted as the local database for onsite analysis and backup solution in case the Internet connection is lost.MQTT and Kafka are the communication scheme used to transfer the data over the Internet to the server.

B. Remote data collection and storage solution
The entire data collection system including the remote database server is illustrated in Fig. 2. Data Collection is built with two main components which are Message Queuing Telemetry Transport (MQTT) and Kafka.MQTT is a publishing subscription-based messaging protocol (ISO / IEC PRF 20922) widely used for IoT devices as it is light-weight and flexible.However, MQTT is not built for highly scalable, longer archival, or easily integrated into legacy systems.Apache Kafka on the other hand is a highly scalable, decentralized streaming platform.It is capable of managing and storing a massive amount of data on disks.Therefore, MQTT and Apache Kafka are the perfect combination of end-to-end IoT integration from edge to data center.MQTT and Kafka are in charge of gathering data sent by the field devices, i.e. the Raspberry Pi inside the monitoring cabinet, in JSON format packets and circulating them at server side.
Apache Kafka is part of the Lambda Architecture which also facilitates data query for providing information to users subsequently.In lambda Architecture, the data is saved into two databases: Cassandra and MongoDB which is a NoSQL database.Conventional SQL databases impose some constraints with limitations.NoSQL solves big data problems of information systems or distributed data and interact and extend easily with high performance.Fig. 3 illustrates data saved as document-oriented manner in MongoDB.

C. Condition monitoring with a web-based user interface
A webpage graphical user interface (GUI) is developed for end-user to monitor the system in near real-time.It displays the instantaneous values of the important parameters such as phase currents, line voltages, the generator rotary speed, frequency, etc. Besides, it also provides a brief overview of all the generators as well as the historical trend of the monitored parameters.The web application is written mainly in HTML and JavaScript with responsive design.Web-socket MQTT is used as the communication between the front-end web GUI and the server instead of having conventional backend web services.This approach enables the front-end application to be deployed in any web server as well as loaded on a browser as an independent application.

IV. DATA ANALYSIS AND DISCUSSION
Four biogas based generation systems have been built and deployed in four different hog farms distributed in the north of Vietnam.Each generator is able to supply power up to 90 kW which is sufficient for all loads on the farm.Data have been collected for a few months and analyzed to comprehend the operation of those machines.The data acquisition device read sensing measurements every 10 seconds.
Real-time monitoring.Fig. 4a illustrates the web-based GUI with the four machine locations in the main dashboard page marked by 4 circles.The metadata of the machines including their locations are recorded in the database once the machines are installed.The web application also displays the measurements of machine parameters which are being sent remotely from the Raspberry Pi on site.Values shown in the parameter page in Fig. 4b are of a particular machine selected to display. the fig shows the current values of few parameters at steady state such as three-phase currents, line voltage between phase A and B, the generator speed, frequency, etc. when the machine operates normally.    .Generator speed at steady state is kept at 1500 revolutions per minute (rpm) which is maintained by the speed controller in order to achieve 50Hz output frequency.The phase current is decided by the farm load requirement, average value of the current is around 60A which is usually consumed by the ventilation and lighting system and pumps.It can also be seen in this figure that at some moments the speed may increase above the desired value of 1500 rpm.No matter how the load current varies within the generator capacity, the speed should be kept constant, any fluctuation if occurs should be stabilized as soon as possible.As mentioned in Section 2, this speed is regulated by adjusting the opening position of the valve V2 to control the flow of gas mixture into the combustion engine.
The valve V2 position in terms of percentage is plotted together with the engine speed and phase A current in Fig. 8a.Normally, the position is around 20% when the current is around 70A.If the current increased or decreased the valve is also open wider or less respectively to maintain the same engine speed.However, it sometimes misbehaves as highlighted with the dashed line box in Fig. 8a.Fig. 8b shows a zoom in view of that period.At around 16.45, the load does not change but the valve open position is increased to a maximum of 100% and the speed is still the same.After 15 minutes, the speed is decreased which results V. CONCLUSIONS In this paper, we have presented an IoT based system for monitoring performance of a biogas generator.The system architecture implemented is resilient due to edge computing and storage facilitated by IoT devices that are local to the biogas generator, thereby capable of overcoming the intermittent connectivity challenges faced in rural farms.The system is scalable for multiple edge devices and can serve many simultaneous users, owing to its adoption of lambda architecture.Through the deployment of this robust monitoring system, outages of the machines have been recognized and studied with the collected data.The common faults recorded are due to the inconsistent quality of input biogas as well as the error of the fuel feeding valve.Future work would investigate predictive techniques based on sensitivity analysis and correlation of system parameters with various fault types.Forecasting of energy generation is also worth exploring since that can improve the logistics of biogas generation planning.

Fig. 2 .
Fig. 2. The data acquisition system.The monitoring cabinet.The cabinet consists of local data acquisition system hardware.Some of the sensors are built-in inside the system such as engine water temperature and oil pressure, valve positions, tank pressure.All of them are connected to the cabinet terminals.The others including voltage and current sensors are installed inside the cabinet.The key component in charge of data collection is a single board computer, Raspberry Pi, equipped with 3G modem.Data are stored locally in Raspberry Pi and also sent to a remote server over the Internet.The monitoring of the

Fig. 4 .
Fig. 4. (a) Main page and (b) real-time measurement page in the web-based GUI.Data analysis.Measurements from generators are acquired every 10 seconds at the server-side with the support of Lambda architecture.Fig 5.shows the daily operating hours of a biogas generator which we deployed on a farm in Thai Nguyen province for one month.The duration varies from around 5 hours to 20 hours per day depending on the availability of the gas as well as the load demand.The generator is usually run into two sessions.Daily energy consumption of the farm when using the generator during the same period is shown in Fig.6.The average energy consumption is around 397 kWh per day and the total energy of this month is 13126 kWh.

Fig. 6 .
Fig. 6.Daily energy produced by the biogas generator to supply the farm.

Fig. 7 .
Fig. 7. Historical data of phase A current, generator speed and engine oil temperature Fig. 7 shows the historical measurements over 7 days of one phase current, speed and temperature of the cooling water for the engine.The zero values represent that the machine is at rest.The temperature of cooling water varies around.Generator speed at steady state is kept at 1500 revolutions per minute (rpm) which is maintained by the speed controller in order to achieve 50Hz output frequency.The phase current is decided by the farm load requirement, average value of the current is around 60A which is usually consumed by the ventilation and lighting system and pumps.It can also be seen in this figure that at some moments the speed may increase above the desired value of 1500 rpm.No matter how the load current varies within the generator capacity, the speed should be kept constant, any fluctuation if occurs should be stabilized as soon as possible.As mentioned in Section 2, this speed is regulated by adjusting the opening position of the valve V2 to control the flow of gas mixture into the combustion engine.

Fig. 8 .
Fig. 8. Speed valve position vs. engine speed vs. phase A current over time.