Abstract

This study develops a new integrated measurement and control system for intermixed biogas and photovoltaic systems to achieve safe and optimal energy usage. Literature and field studies show that existing control methods on small- to medium-scale systems fall short of comprehensive system optimization and fault diagnosis, hence the need to revisit these control methods. The control strategy developed in this study is intelligent as it is wholly based on fuzzy logic algorithms. Fuzzy logic controllers due to their superior nonlinear problem solving capabilities to classical controllers considerably simplify controller design. The mathematical models that define classical controllers are difficult or impossible to realize in biogas and photovoltaic generation process. A microcontroller centered fuzzy logic measurement and control embedded system is designed and developed on the existing hybrid biogas and photovoltaic installations. The designed system is able to accurately predict digester stability, quantify biogas output, and carry out biogas fault detection and control. Optimized battery charging and photovoltaic fault detection and control are also successfully implemented. The system is able to optimize the operation and performance of biogas and photovoltaic energy generation.

1. Introduction

In low income (US28 to US60 per month) Zimbabwean rural households, cooking, heating, and lighting are achieved through the use of either wood, agricultural residues, or cow dung biofuels [1, 2]. The prevailing biofuel for these rural households is wood, followed by the seasonal agricultural residues mainly composed of maize combs and finally by the use of cow dung [1]. Cow dung, although comparable to wood in energy content, is the least used due to its unpleasant odor and the eye irritation it causes from its smoke [1] (p. 59). As early as 1982, more than half of all the energy used in Zimbabwe was attributed to rural households and high density urban households [3], where most of this energy was from wood gathered at no cost from the surrounding bush area. A study conducted by the Beijer Institute and the Scandinavian Institute for African Studies [3] had projected that by the year 2002 the supply of wood biofuel available to rural households would have drastically reduced.

In Table 1, which is an extract from TABLE IX-2 [3] (p. 202) we see further elaboration of the dependency of wood as fuel for rural households. The figures are based on the Long-range Energy Alternatives Planning (LEAP) modeling tool used to follow energy process from production to subsequent use, as applied in the Zimbabwe Energy Accounting Project (ZEAP) [3] (p. 1–8).

From Table 1 it is shown that for the rural households the main end-use for fuel wood is cooking and heating, whilst paraffin/kerosene is used for lighting. However, in some cases kerosene is used for cooking [1] (p. 63). In the households depicted in Table 1, there is lack or very insignificant use of electricity. This observation would naturally imply that these households are not connected to the national electrical power transmission grid. Generally, it is noted that there is a progression of energy use from biomass through kerosene, liquid petroleum gas (LPG), to electricity with rising income for both rural and poor urban dwellers [4, 5]; this is commonly termed the “energy ladder” [5]. The use of charcoal in Zimbabwe is not as widespread as in other Southern African countries [6]. That which is produced finds its way to urban households on the high income side [6, 7].

The negative effects of reliance on wood fuel include deforestation and environmental degradation [8] (p. 2). As a general observation, energy use for rural households is affected by scarcity of biofuels, relative high cost of kerosene and LPG, and high cost of charcoal and unavailability of grid supply [1, 47]. It is prudent at this point in time, to consider alternative sources of energy in the form of renewable energy as a mitigating factor against the aspects just mentioned in the preceding sentence. The attractive attributes of having a renewable energy system have seen the steady growth of photovoltaic (PV) solar, biogas, wind, and small hydropower use in rural areas [9]. Although renewable energy systems are long term sustainable energy systems, their initial startup costs can be high [10]. Fortunately, support in the acquisition, construction, and installation of these energy supply systems is often provided by rural entrepreneurs, government programs, and assistance from donors [9]. This study is limited to biogas and photovoltaic (PV) renewable energies.

In Zimbabwe, the Rural Electrification Fund (REF) is the main organization that oversees the construction and installation of biogas and photovoltaic systems in rural areas [11]. Biogas is used for heating, cooking, and lighting, whilst the photovoltaic system is used to power a host of electrical gadgets that includes mobile phones, laptop computers, refrigerators, water pumps, and lighting systems [9, 10]. The main challenge faced by these rural establishments is that of limited appreciation on their part of the possibility of obtaining all their energy requirements from a hybrid biogas and photovoltaic system. However, this can only be possible provided the biogas and photovoltaic generation efficiencies are kept high [12, 13].

A self-contained energy system providing all the requirements of the rural establishments is obtained when the biogas and photovoltaic (PV) systems exist at a single site and are monitored and controlled through a single controller unit. The overall system is then said to be an intermixed or hybrid system [14].

In Zimbabwe, current rural biogas and photovoltaic installations lack or have limited process monitoring, control, and fault detection capabilities for optimum energy generation [15]. Hence, an intermixed measurement and control system to maximize on these biogas and photovoltaic systems needs to be developed. This aims to provide a scenario were an energy surplus is achieved from the biogas and photovoltaic systems. The development of an intelligent, low cost, reliable, nonexpert user intermixed biogas and photovoltaics measurement and control system is the main contribution of this study.

The intermixed installations considered in this study are made up of medium scale, fifty to eighty cubic metres (50–80 m3) of dome type digesters and one kilowatt (1 kW) of solar mini power grid systems. These installations represent the typical sizes installed in Zimbabwean rural areas [1416]. The fixed dome digesters considered are naturally stirred and heated. With regard to biogas systems, this study dispenses with expensive online monitoring instruments/analyzers, automatic stirring, automatic loading of feedstock, and acid neutralizing agents. In photovoltaic systems, motorized and maximum power point (MPP) [17] tracking aspects are not studied and consequently not included in the measurement and control system design.

Biogas generation is a complex and sensitive nonlinear process [18] (pp. 93–128). The parameters that affect or are a characteristic of biogas generation process include temperature, pH, electrical conductivity (EC), redox, buffer capacity (alkalinity), and volatile fatty acids (VFAs) [12, 19].

Electrical conductivity (EC) gives a measure of the effective decomposition of the active feed in a biodigester. With regard to pH it has been established that a pH value of between 5 and 6.5 will facilitate the hydrolysis stage in the anaerobic digester, whilst in methanogenesis the pH is required to be neutral and in the ranges of 6.8 to 8 [19]. Furthermore, with regard to temperature, the requirements are such that existing industrial anaerobic digesters operate at 43 to 55°C (thermophilic) to give a minimum time for biogas production of fifteen to twenty days. Domestic anaerobic digesters would normally operate at 30 to 42°C (mesophilic) with retention times between thirty to forty days [20].

The concentration of volatile fatty acids should not exceed 1,500–2,000 mg/L as acetic acid since this would imply a definite stoppage of the process in the anaerobic digester process and hence it is paramount to monitor this parameter [21]. The other parameters that can be used to monitor the stability of the anaerobic digester process are total ammonia nitrogen and alkalinity or buffer capacity. Total ammonia nitrogen levels greater than 1,500 mg/L of ammonia at pH values greater than neutral will destroy the anaerobic process [21]. However, biodigesters can operate at moderate ammonium nitrogen concentrations without completely destroying anaerobic digestion process [21].

Buffer capacity is a measure of the tendency of the substrate to avoid change in pH which is a requirement in digesters. Typical alkalinity values in biodigesters range from 2000 to 5500 mgL−1 bicarbonate and normally values above 4000 mgL−1 bicarbonate mean a good buffering capacity [21, 22]. Last but not least, a negative redox potential for the raw material solution/slurry (less than −300 mV) is a much required and necessary condition for any anaerobic digestion to occur [22] (p. 20). Hence, monitoring and controlling all of the above parameters will improve the generation process, in terms of biogas generator stability to assure uninterruptable biogas output. Stability is not a measure of biogas yield, but rather the potential of the digester to produce biogas.

An example of a 50 m3 digester under construction is shown in Figure 1(a). On the other hand the solar mini grid system shown in Figure 1(b) is comprised of twelve solar arrays, a twenty-four volt twelve battery set, an inverter, and a simple charge controller. The battery charging method is simple and the equipment protection strategy used is based on a simple fuse [11].

In addition to monitoring the stability of a biogas digester, there is also need of quantifying the amount of biogas generated in relation to the expected digester designed output capacity and the time period that the feedstock remains in the digester, to assess the efficiency of the digester. This time period that the feedstock remains in the digester is commonly known as the hydraulic retention time (HRT) [20]. The actual amount of litres of methane per day (L-CH4/day) output from the digester is obtained from this study. Carbon dioxide level monitoring is also very important as it complements methane level monitoring [12], since a rise in carbon dioxide level implies less methane is being produced, and therefore there must be a problem in the digester process. The biogas output amount consists of 55 to 70% methane by volume and 30 to 45% carbon dioxide by volume and very small amounts of ammonia (NH3) and hydrogen sulfide (H2S) [23] (p. 8). Hence, a measurement of the ratio of methane/carbon dioxide from the sensors in this study should be 1.22 to 1.56.

In a continuous high load photovoltaic system the battery/bank is a very important component which needs to be kept always at good charge. However, the charging rate, upper limit of charging current, battery internal resistance, terminal voltage, temperature, and moisture vary continuously during the charging and discharging process resulting in a nonlinear [24], battery charging control mechanism. Poor battery charging strategy can result in an impartially or overcharged battery, situations that are both detrimental to the battery. The battery needs to be kept at an acceptable output voltage level under load and the state of charge (SOC) which is the usable capacity of a battery as a function of time monitored [25]. The SOC is an important parameter since at manufacture a battery is capable of providing ideally one hundred percent of its capacity but over time the maximum capacity it can give decreases.

This study also develops a biogas and photovoltaic fault detection and control system with the view of establishing safe system operating conditions. With regard to biogas it is necessary to monitor and control composite gas pressure, slurry level, oxygen gas concentration in the digester, and methane gas leaks at the digester end and user premises [14].

When biogas is mixed with air in certain proportions an explosive mixture is formed [26]. Hence it is imperative that biogas is not unnecessarily exposed to air (oxygen). Dome type gas pressures are usually less than or equal to 120 cm of water (11.77 KPa) [27]. The REF 50 m3 digesters considered in this study operate at biogas pressures of around 15 KPa [11, 15]. The biogas digester should always be operated at a gas pressure greater than the external gas pressures above atmospheric value, since a lower pressure in the gas storage compartment would imply suction of air into it [27]. If this were to happen the oxygen in the air would combine with the biogas to form either a combustible mixture or would incapacitate the anaerobic process, completely shutting down the gas production process. Hence gas usage should not be greater than that required to maintain a higher pressure in the gas storage compartment. Conversely too high a gas pressure will cause bubbles to appear at the outlet liberating methane to the ambient which can result in an explosive mixture [14].

An emergency close valve is incorporated into the main gas outlet line to serve the dual purpose of mitigating against the possibility of air suction into the biogas digester (valve shuts off when pressure goes below a certain point and opens above this point) and also shuts off when there is a gas leak at user end [14]. Feedstock level in the digester is monitored, both as compliment to safe pressure operation and availability of adequate feedstock in the digester. Biogas feedstock control will normally take the form of organic loading rate and pH adjustments [28].

The photovoltaic system addresses the issues of solar array shading, user load, charge controller, battery and inverter fault detection, and control. Identification of prolonged solar panel shading caused by, for example, leaves, cloth, or tree shadows effectively is important as this reduces the efficiency of the solar panel’s ability to collect photovoltaic energy. The designed system also governs the current drawn by the user to levels that will not overload the entire photovoltaic system.

All the nonlinear processes described above can be effectively addressed by using fuzzy logic [29] algorithms with pulse-width modulation (PWM) for the battery charging. Fuzzy logic is a linguistic based computing system that possess nonlinear dynamics problem solving capabilities. Here, PWM is used to control the output of the dc-dc buck-type charge controller. The complexity and cost of measurement and control equipment used are reduced by the use of fuzzy logic algorithms.

The rest of this paper is structured as follows. Section 2 describes the proposed system architecture, Section 3 gives a review of fuzzy logic principle and details the design of the fuzzy logic algorithms for this study, the identification of a faulty PV panel, charge controller, battery, or inverter is also described, Section 4 gives an explanation of the results, and Section 5 gives the conclusion.

2. The Proposed System Architecture

The proposed system is made up of an embedded system centered on the PIC18F4550 microcontroller [14, 30] as shown in Figure 2. This microcontroller meets the minimum memory, speed, input, and output requirements for the embedded system.

The parameters that are input to the microcontroller are redox or oxygen reduction potential (ORP), electrical conductivity (EC), composite gas pressure, feedstock level, oxygen (O2), carbon dioxide (CO2), methane gas concentration (CH4), temperature (Temp), and pH for the biogas system. The photovoltaic system is monitored by two current sensors (one for battery charging and the other for load overload protection), a voltage divider sensing circuit, and two light-dependent-resistors (LDRs), attached to diagonal ends of the solar panels [14].

For the biogas system the expected outputs include digester stability status, emergency main gas pipe close valve, methane gas output amount, oxygen leak detection, feedstock low level detection, abnormal gas pressure detection, operating temperature status, feedstock loading rate, and the addition of a pH changing agent. For the photovoltaic system the expected outputs include battery/bank charging, detection of a break in the electrical power flow and identification of faulty component, abnormal overload detection, and prolonged partial or full shading of the solar panels achieved by incorporating LDRs during normal daylight. All analogue inputs are connected to the microcontroller through preamplification and 0 to 5 V signal scaling circuits [14]. However these are not shown in Figure 2, save for the solenoid drive and LDR circuits.

The gas pressure sensor specified here is of the type that is used on flammable gases. Since the normal accepted methane gas pressures in the digester are limited to 15 KPa (0.15 bar or 2.17557 psi), the pressure sensor used measures at least 30 KPa (0.3 bar or 4.35113 psi). In this study, use is made of the model RC 300 Liyuan Electronic 1 MPa 4–20 mA 24 V gas pressure sensor. The pressure sensor 24 V Dc voltage supply is obtained from the 24 V photovoltaic system. The trace oxygen sensor module is made up of a “galvanic fuel cell” (electrochemical in nature) and an electronics circuit board housing a resistive network that includes resistors and a negative temperature coefficient (NTC) thermistor for current to voltage conversion and temperature compensation, respectively [31]. Methane and carbon dioxide detection is achieved through the use of the MQ2 and MG811 gas sensors, respectively [32, 33].

Level is monitored by the use of two stainless steel sealed vertical float switches. One switch (SW1) is positioned to be at the highest slurry level point whilst the other switch (SW2) is positioned at the lowest slurry level point. An additional float switch (SW12) to those mentioned above is placed between SW1 and SW2 to improve on the accuracy of the level measurement system. pH was measured using the Lutron PE-21 industrial in line pH electrode. The two-electrode 208DH conductivity electrode with a measuring range of 0~199.9 mS was used to detect electrical conductivity of the solution. By definition anaerobic bacteria operate when there is no oxygen, implying a low ORP. An ORP of less than −300 mV has been found to be ideal for anaerobic microbes to function optimally. The output voltage specification of the 201DH ORP probe used in this project is 0~±1999 mV.

A flashing light emitting diode will come on as the load current approaches the set limit value of 5.43 A; otherwise an alarm is activated if this load current value is breached. The normal load current being drawn by the user is displayed on a liquid crystal display as percentage of the maximum allowable value. The user load ac current is detected by a TA17-05 30 A/10 ma 1 : 1000 printed circuit board (PCB) mount current transformer (CT) with turns ratio () = 1 : 3000 connected to pin 33 of PIC18F4550 [14].

In coming up with the voltage divider measurement circuit for converting the 24 V photovoltaic battery value to 0–5 V it was required to take into consideration the maximum allowable source impedance of the microchip microcontrollers. For the 8/10-bit microcontrollers of microchip, the recommended maximum source impedance is 10 KΩ, but the recommended maximum source impedance is 2.5 KΩ for the 12-bit microcontrollers of microchip [30].

3. Fuzzy Logic Algorithms Design

3.1. Fuzzy Logic Principle

The first step [34] in developing a fuzzy logic based monitoring system is to specify the required input and output values (crisp data) and their ranges. Secondly to convert the crisp data to membership values (fuzzification), thirdly to synthesize output membership values based on developed fuzzy rules (fuzzy inference), and finally to convert the output membership values to crisp output values (defuzzification) [34]. The block diagram of the fuzzy logic implementation process is shown in Figure 3.

As opposed to classical set theory where an entity either belongs or does not belong to a set, fuzzy set theory accommodates partial membership of the entity in the set. The fuzzy set is described as a “class with a continuum of grades of membership” [29]. This is interpreted to mean that an entities’ degree of belonging in a set can be on a sliding scale from zero (0) to unity (1). Furthermore the rules that govern operation on classical set theory are extended and adapted to fuzzy set theory. A fuzzy set is related to a membership function by where is a classical set such that when ,   gives degree of membership of in and the case where or for all is known as a crisp set [35]. The most basic fuzzy set is commonly termed the type 1 fuzzy set, as there exist higher fuzzy sets such as the interval type 2 and general type 2 fuzzy sets that address the uncertainty of membership functions [36, 37]. However, this study is premised on the basic type 1 fuzzy set.

The most extensively used membership functions are the monotonically increasing linear, monotonically decreasing linear, and triangular functions [14, 38]. These membership functions are derived from the basic trapezoidal membership function shown in Figure 4. Equations (1), (2), and (3) give the derived mathematical expressions [39, 40] of these three membership functions to be used in the software development process.

For monotonically decreasing linear-function membership function,for triangular membership function,for monotonically increasing linear-function,

These membership functions incorporate a variable (word based term) to describe the respective membership function. For example, the pH in the digester can either be quite acidic (Q. acid), moderate acidic (M. acid), neutral (Neutral), moderate alkaline (M. alkaline), or high alkaline (H. alkaline). The buffering capacity (alkalinity) value can be low (L), medium (M), or high (H). Whilst the digester operation status (stability) could either have failed (F), be failing (FL), or be operating at optimum (O). The total range of influence of a parameter over the horizontal scale of any membership function is called the Universe of Discourse (UoD) [29, 38, 39].

The rules that can include the AND, OR, NOT, and fuzzy operators are structured as follows:

IF condition (premise or antecedent) THEN conclusion (consequent).

The inference that is based in this study on the max-min method is the part that performs fuzzy reasoning or decision making and is made up of the Mamdani inference [38] method to evaluate(i)each rule’s firing level based on the input,(ii)output of each rule,(iii)summation of the results of each rule to realize the fuzzy output.

In this study the output membership functions are assumed symmetrical and the commonly used continuous centre of gravity (COG) also known as the centre of area (COA) or centroid method [38] is applied to the defuzzification.

3.2. Digester System Imbalance (Stability) Early Warning
3.2.1. Stability Membership Functions

The fuzzy logic controller for this routine has two inputs (pH and buffering capacity) and one output (stability status of the digester). A high percentage value of stability implies a greater confidence level in the digesters’ capability to continually produce biogas. Sensors measure pH, redox, and electrical conductivity parameters that form the soft sensor inputs for the buffering capacity prediction equation.

The pH can either be quite acidic (Q. acid), moderate acidic (M. acid), neutral (Neutral), moderate alkaline (M. alkaline), or high alkaline (H. alkaline). The alkalinity value can be low (L), medium (M), or high (H). The digester operation status (Stability) is either failed (F), is failing (FL), or is operating at optimum (O).

From the preceding paragraph it is noted that the numbers of pH (input 1) input linguistic variables (corresponding to independent membership functions) is five (5) and those for alkalinity (input 2) input are three (3). Hence, the number of possible rules is the product of the input 1 membership functions and input 2 membership functions. This is given by fifteen (15) rules in this case. Eleven of the possible fifteen rules obtained from these membership functions are given below as follows:(i)Rule : IF pH is Q. acid AND alkalinity is H THEN digester operation is failed.(ii)Rule : IF pH is Q. acid AND alkalinity is M THEN digester operation is failed.(iii)Rule : IF pH is Q. acid AND alkalinity is L THEN digester operation is failed.(iv)Rule : IF pH is M. acid AND alkalinity is H THEN digester operation is optimum.(v)Rule : IF pH is M. acid AND alkalinity is M THEN digester operation is optimum.(vi)Rule : IF pH is M. acid AND alkalinity is L THEN digester operation is failing.(vii)Rule : IF pH is Neutral AND alkalinity is H THEN digester operation is optimum.(viii)Rule : IF pH is Neutral AND alkalinity is M THEN digester operation is optimum.(ix)Rule : IF pH is Neutral AND alkalinity is L THEN digester operation is failing.(x)Rule : IF pH is M. alkaline AND alkalinity is H THEN digester operation is optimum.(xi)Rule : IF pH is M. alkaline AND alkalinity is M THEN digester operation is optimum.

The membership functions for the stability routine fuzzy logic controller are shown in Figure 5.

The rule base or rule matrix for the fuzzy control showing all the possible combinations of inputs and outputs for the stability routine is given in Table 2.

3.2.2. Evaluation of Alkalinity from Soft Sensors

The buffering capacity (alkalinity) value that forms one of the inputs to the fuzzy logic routine is obtained by prediction from a soft sensor algorithm using multiple linear regression analysis (MLRA) of a number of independent biodigester parameters, namely, pH, electrical conductivity, and redox [14, 19]. This value of alkalinity could have been measured directly by using very expensive instruments which are however beyond the scope of this study. The alternative cheaper online method to measure alkalinity based on soft sensor method is thus considered.

A general (MLRA) model given as (4) was first developed using data which closely relates to the ranges for redox, conductivity, and alkalinity in a typical digester as stated in the references [21, 22, 41]. This was done to set the initial reference point for the prediction equation which was then validated by making actual field measurements.

In the field measurements, the alkalinity is obtained from titration [42] by multiplying the millimoles per litre (mmol/l) value by the molar mass of calcium carbonate (162.1146 g/mol.) in grammes per (g/mol) to give the units of alkalinity in mg/l. Static field measurements were also made of pH, electrical conductivity (EC) and oxygen reduction potential (ORP) or redox, after construction of the measuring instruments [14]. The soft sensor equation from measurement shows the accuracy of the initially formulated equation (4).

3.3. Biogas Output Amount

In the Rural Electrification Fund (REF) 50 m3 biogas digesters under consideration the gas storage capacity are 7 m3 (7000 litres) and the exhausted slurry is 6 m3 per day. Biogas output for these digesters ranges from 15 to 20 m3 (15000 to 20000 litres), in the ratio 1.5 of methane to carbon dioxide. These digesters will normally operate at 30 to 42°C (Mesophilic) with minimum HRT of 21 days. The ground temperature will not go below 0°C nor will digester temperature go above 60°C. The PT100 platinum temperature detector (RTD) is used to sense digester slurry temperature. The amount of biogas produced depends on the type of feedstock (piggery plus sewer waste), the organic loading rate (OLR), and digester temperature. The organic loading rate for the 50 m3 digesters is 2.975 kgVS/m3 day.

The linguistic variables are OLR = low organic loading rate (OLRL), good organic loading rate (OLRG), high organic loading rate (ORLH), temperature = low temperature (TL), optimum temperature (TO) , and biogas output = gas low (GL), gas average (GA), gas high (GH) . Figure 6 shows the membership functions for the biogas amount algorithm.

Table 3 gives the rule matrix for the biogas output amount routine.

The six rules for the biogas amount controller are given below as follows:(i)IF organic loading is OLRL AND temperature is TL THEN biogas output is gas low.(ii)IF organic loading is OLRL AND temperature is TO THEN biogas output is gas low.(iii)IF organic loading is OLRG AND temperature is TL THEN biogas output is gas average.(iv)IF organic loading is OLRG AND temperature is TO THEN biogas output is gas high.(v)IF organic loading is OLRH AND temperature is TL THEN biogas output is gas low.(vi)IF organic loading is OLRH AND temperature is TO THEN biogas output is average.

3.4. Biogas System Fault Detection and Status

Unnecessary exposure of methane to air due to methane leaks at users’ end and at digester can cause serious explosion. Methane leaks will trigger an audible alarm, switch on a light emitting diode (green), and close the emergency gas line valve that is situated close to the digester.

This digester should always be operated at a gas pressure (15 KPa) greater than the external gas pressures above atmospheric value, to prevent suction of air (oxygen) into it which could cause an explosion or incapacitate the anaerobic process, completely shutting down the gas production process. Oxygen ingress into digester leaks will trigger an audible alarm, switch on a light emitting diode (yellow) and close the emergency gas line valve to prevent dangerous gas mixture being transferred to the end user.

The fuzzy logic controller for internal digester danger output status is a two-input controller of pressure and feedstock level (slurry displacement). The linguistic variables are in this case defined as biogas pressure = low pressure (LP), good pressure (GP), high pressure (HP), slurry displacement = high level zero-line (LDIS), between p-line and zero-line level (MDIS), low level p-line (HDIS) , and digester danger status output = no danger (ND), low danger (LD), high danger (HD) .

Six of the nine possible rules are given as follows:(i)IF gas pressure is LP AND feedstock level is LDIS THEN output is no danger.(ii)IF gas pressure is LP AND feedstock level is MDIS THEN output is low danger.(iii)IF gas pressure is LP AND feedstock level is HDIS THEN output is high danger.(iv)IF gas pressure is GP AND feedstock level is LDIS THEN output is low danger.(v)IF gas pressure is GP AND feedstock level is MDIS THEN output is no danger.(vi)IF gas pressure is GP AND feedstock level is HDIS THEN output is low danger.

The membership functions of biogas system fault detection and status are shown in Figure 7.

Table 4 gives the rule base for of biogas system fault detection and status routine.

3.5. Solar Battery Charging/Discharging

The fuzzy logic controller for solar battery constant current-constant voltage charging is a three-input controller of the state of charge (SOC), charging voltage, and charging current. The SOC which can be obtained by a SOC online based algorithm is in this study obtained by taking the value based on open circuit voltage test for a 24 V battery system with the use of a look-up table as shown in Table 5.

The charging current in amperes is not allowed to exceed one-tenth of the battery’s rated capacity in ampere-hours (Ah). The 50 Ah battery used here should be charged at maximum of 5.0 amperes. The output is a PWM signal to a buck charge controller. The linguistic variables are defined as SOC = low SOC (LSOC), medium SOC (MSOC), high SOC (HSOC), charging voltage = low voltage (LV), average voltage (AV), high voltage (HV) , charging current = low current (LC), average current (AC), high current (HC) , and charge controller PWM output = low duty cycle (LD), medium duty cycle (MD), high duty cycle (HD) . The possible number of rules given by these inputs is twenty-seven (27).

The membership functions for solar battery charging/discharging are shown in Figure 8.

Table 6 gives the rule matrix for the solar battery charging/discharging routine.

3.6. Solar Panel Shading Control

The fuzzy logic controller for panel shading is a single input controller of LDR voltage, giving a single output of panel shading level. The linguistic variables are defined as potential difference across pull down resistor = low voltage (LVadc), lower medium voltage (LMVadc), upper medium voltage (UMVadc), high voltage (HVadc) and panel shading level output = total shading (TS), heavy shading (HS), partial shading (PS), no shading (NS) . Total shading (TS) in photovoltaic systems is not to be confused with total solids (TS) in biogas systems. Shading levels less than fifty percent are usually transitory. In cases of high percent shading levels the user should physically check for any panel obstructions.

One of the 27 rules from Table 6 is given as follows:(i)Rule : IF SOC is LSOC AND charging voltage is LV AND charging current is LC THEN duty cycle is low.The membership functions for solar panel shading control are given in Figure 9.All the four rules from the membership functions in Figure 9 are given as follows:(ii) IF potential across pull down resistor is LVadc THEN total shading of panels is TS.(iii) IF potential across pull down resistor is LMVadc THEN total shading of panels is HS.(iv) IF potential across pull down resistor is UMVadc THEN total shading of panels is PS.(v) IF potential across pull down resistor is HVadc THEN total shading of panels is NS.

3.7. User Load Control

The fuzzy logic controller for user load control is a single input controller of load current, giving a single output of overload warning level. The linguistic variables are defined as load current = acceptable (AC), reaching limit (RL), too high (TH), and overload warning level output = no warning (NW), approaching limit flashing LED (FLED), alarm (A) . This study develops an algorithm to monitor the overall load current where its ceiling is limited to 5,43 A for the 1250 W, 230 V, and 50 Hz inverter. The control output is in the form of alarms and status indicator to alert on increasing load condition.

The membership functions for user load control are given in Figure 10. The three fuzzy logic rules from Figure 10 are given as follows:(i)IF load current is acceptable (AC) THEN all overload indicators off (NW).(ii)IF load current is reaching limit (RL) THEN activate flashing LED (FLED).(iii)IF load current is too high (TH) THEN activate load overload alarm (A).

3.8. PV Panel, Charge Controller, Battery, and Inverter Fault Detection

The designed system detects the current from the photovoltaic (PV) array that goes into the charge controller, the output current of the charge controller which is the input to the battery, the output current from the battery which forms the input to the inverter, and finally the inverter output current which is the load current. The battery and charge controller input currents will identify the component that is faulty between the charge controller and solar panels, respectively. Secondly the current into and out of the inverter will identify the faulty component between the battery and inverter, respectively.

4. Results

4.1. Biogas Digester System

Table 7 shows the readings displayed on the LCD, of digester status taken from 30 September 2016 to 18 November 2016. The pH, redox, and electrical conductivity probes were submerged into the digester slurry. The three probes were each secured by waterproof tape to the ends of long polyvinyl chloride (PVC) and 20 mm conduits and the probe cabling ran through the conduits to the outside control unit. The measurements were performed at the same time at 14:00 hrs in the afternoons where digester temperatures ranged from 30°C to 40°C, and OLR is constant at approximately 2.975 kgVS/m3 day.

Figure 11 shows that the stability of the biogas generation process is fairly constant over the period studied. However, a dip on the sixth measurement was due to a massive increase in the amount of feedstock added prior to this measurement. The sudden increase in the feedstock upset the balance in the pH, redox, and electrical conductivity parameters. The stability started to rebound as seen after the seventh measurement.

Methane detection is achieved by using the MQ2 gas sensor. Figure 12 shows the methane output distribution over the three month period under study. The graph shows that biogas methane use peaked sometime towards the end of October 2016 with a dip on the sixth measurement. A dip in the methane level can be attributed to the instability issue at this point mentioned in the preceding paragraph or increased user use.

Figure 13 gives the variation of methane concentration in the digester with time, giving an average concentration of about 4500 ppm.

Carbon dioxide detection is achieved through the use of the MG811 carbon dioxide sensor. Figures 14 and 15 give the variation of carbon dioxide in litres and ppm, respectively. From the 10th of October 2016, an increase in the output of carbon dioxide is noted. This is to be expected since the amount of methane has also relatively increased, which implies an overall increase in the bulk biogas produced at this time. The concentration of carbon dioxide peaks between the 28th of October 2016 and the 4th of November 2016. It should be noted that the sensors for methane and carbon dioxide concentration were momentarily exposed to the biogas just outside the digester through a hermetically sealed PVC conduit system that forms an extension of the biogas chamber due to fear of explosion. These sensors contain heating elements, and a faulty sensor could cause serious accident. Industrial type sensors are recommended. Hence, the concentration levels are close approximates; however, the readings do show the trend of concentrations involved with time.

Figure 16 shows the variation of the percentage danger level (% danger) inside the digester. A high percentage danger level value implied a high system breach. The danger level was elevated both at very low and very high pressures. At mid pressures the danger status was low as would be expected. However, the results failed to appreciably differentiate varying slurry displacements. The fuzzy algorithm and the direct proportional relationship concept between slurry displacement and pressure needed to be revised to take into consideration the varying densities of feedstock. However, the designed system shows a reasonable level of predicting the digester danger level.

4.2. Titration Measurements

The results obtained from titration of VFAs and alkalinity done on-site confirm that digester is stable during the period of observation from the 30th of September 2016 to the 18th of November 2016. Titrations are more accurate than the online measurement system and they do provide a reference point to improve the accuracy of the online measurements. The main disadvantage of titration method is its difficulty in direct online implementation and the fact that it is not advisable for the average user to perform titration measurements without the presence of an expert. The user is exposed to corrosive acid and danger of explosion if acid mixing method is wrongly followed. Hence, titrations are to be used only by the designer or expert to validate the accuracy of the online system.

In addition to providing alkalinity value, titrations also allow for the calculation of volatile fatty acids (VFAs) as a periodical offline compliment to access the stability of the digester in biogas generation. The stability of the digester is investigated by evaluating the ratio of VFAs to alkalinity.

The ratio of VFAs to alkalinity is interpreted as follows:(1)Ratio < 0.4 stable.(2)Ratio 0.4–0.8 some stability.(3)Ratio > 0.8 very unstable.

This ratio of VFAs to alkalinity is obtained from (5), by inputting the obtained titration values from measurement and experiment.where A stands for acids; TIC stands for total inorganic carbon; VFA and alkalinity are defined as before.

“Alkalinity [mmol/l] needs to be converted to TIC [mg/l CaCO3] by multiplying it with half the molecular weight of CaCO3 (100.084/2 = 50.042), as each molecule of CaCO3 can take up ” [42].

Using the titration procedure, a sample of the results is shown in Table 8. At the same time, when the value of alkalinity is being calculated from titration, the other measurements of pH, redox, and electrical conductivity are also done. The measurement results are distributed over a number of days.

4.3. Typical Biogas Related Actual LCD Readings

Figure 17 shows Information on the LCD about digester stability status only. Other LCD readings would be for biogas amount (showing methane and carbon dioxide components) and biogas fault detection and control.

4.4. Photovoltaics System

A laboratory scale photovoltaic system was implemented by using two ten watts (2 × 10 Watt) solar panels connected in series and two 12 V 15 Ah batteries also connected in series. This brings the test voltage to the level that is used in the full scale photovoltaic system, save for the current rating. To obtain valid current charging and voltage charging characteristics, the 24 Volt battery bank is first completely discharged through a 24 V load, preferably a parallel combination of 24 V vehicle indicator lamps, and then connected to the 24 V solar panel through the buck regulator. During the charging process, the charging voltage and charging currents are recorded at thirty-minute time intervals from the beginning until full charge is obtained.

The following results were achieved:(1)Constant current-constant voltage controlled battery charging.(2)Identification of faulty component (equipment) of PV system.(3)Solar panel shading detection.

Table 9 shows sample LCD readings for the photovoltaics system.

Figure 18 shows actual display readings for the photovoltaics system.

4.5. Results Contrasted with Other Detection Methods
4.5.1. Biogas System

A study performed by one research team [45] is based on the e-nose. The e-nose whose design is premised on the biological method is capable of sensing a large number of gases through pattern recognition and is able to evaluate the stability of the digester [45]. Figure 19 gives the results from one such research team. From our results, Figure 11 shows a dip in digester stability on the sixth measurement after an increase in feedstock. From Figure 19, the results of the other researchers, a dip in the stability of the digester is noted after overfeeding with rice meal.

The close comparison of both methods shows the accuracy of our design. Our design uses cheaper hardware and simple fuzzy logic algorithms compared to the complex pattern recognition (requiring training) algorithms. However, our method lacks the fine tuning achieved by other researchers [45].

Methane leakage control has also been performed by monitoring gas pressure, applying leakage sprays or foaming agents, gas sensors, lasers, and midrange infrared (IR) cameras [46]. The low pressures inside the digesters make the monitoring of pressure difficult, whilst foaming agents and the use of manual gas sensors are time consuming. This leaves the lasers and IR cameras as favourites for leak detection [46]. Although lasers and IR cameras are far more accurate at leak detection than our proposed leak detection method, they require initial heavy capital investment. Our far cheaper and simpler designed leak detection system performs suitably well for the intended rural household.

Although other researchers have successfully developed advanced systems to provide digester early warning failure, quantify biogas amount, and monitor internal digester parameters and operating status [12, 19, 21, 22], the concept of percentage danger level shown in Figure 16 is a unique design of this study. Furthermore, our design is meant for the relatively low income rural and urban household use.

4.5.2. Photovoltaic System

An online none complex PV fault detection system that compares ac output power to model data is developed by some researchers [47]. The model estimates the ac power output based on solar irradiance and panel temperature measurements. The models of normal operating conditions are developed from which normal low and high operating limits are defined as shown in Figure 20 [47].

Consequently the model outputs corresponding to faulty data are compared to the set operating limits to determine if and at what point a fault has occurred. A maximum of 51 faults were detected with a success rate of upto 96.23% [47]. However, the authors here do not mention the actual faults but do mention that these faults are solar panel related.

On the other hand, our design system only detects a handful of faults that are mainly involved in identifying or eliminating the faulty piece of equipment within the whole PV system. Our system as other developed systems will not identify the type fault, that is, if it is line-line, degradation, or open circuit [48]; however the scope of our research does not deter its usefulness. Other researchers [49] have developed a system that monitors faults on the DC side of the PV system and detects temporary panel shading. This is in sync with our developed system.

A PV fault detection system that more closely resembles the objectives of our designed system is developed [44]. Table 10 shows the fault types recognized by this system [44]. This system developed by other researcher incorporates artificial neural networks that would require training data. However, fault module detection is excellent. Our designed system performs relatively well within the defined scope.

5. Conclusions

The contributions of this study include (1) a new biogas system fault detection and control strategy which can be used on any size of digester, (2) a comprehensive photovoltaic system fault detection and control strategy, and (3) a biogas and photovoltaic system easily and quickly fixed by persons with no expertise at all in the respective fields. The success of the measurement and control system is considerably enhanced by the use of fuzzy logic algorithms as the basis for all the routines.

In this study software coding in C source codes is proposed. The Integrated Development Environment (MPLABXIDE) is adopted as the platform for all software development and programming of the PIC18F4550 microcontroller.

In the future, we will do research about connecting several intermixed systems based on Internet of Things (IoT) and realizing intelligent dispatch of the biogas and solar power besides the biogas and photovoltaics fault detection and control. Moreover, it is necessary to incorporate fuzzy logic method into machine learning algorithms to enhance the system intelligence.

Conflicts of Interest

All of the authors declare no conflicts of interest.

Authors’ Contributions

All of the authors have contributed to this research. Liston Matindife carried out the study and also prepared the manuscript draft under the supervision of Zenghui Wang and Yanxia Sun. All of the authors revised and approved the manuscript.

Acknowledgments

This research is supported partially by South African National Research Foundation Grants (nos. 112108 and 112142) and South African National Research Foundation Incentive Grants (nos. 81705 and 95687).