{'fraction_non_alphanumeric': 0.02240650665816123, 'fraction_numerical': 0.008292799617255403, 'mean_word_length': 4.280842105263158, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Design of Smart Hybrid Power Supply using Logic Circuits

DOI: http://dx.doi.org/10.24018/ejers.2020.5.12.2257 Vol 5 | Issue 12 | December 2020 34 Abstract — Production of electrical power from sources that depends on diesel produce large amounts of pollutants to the environment. Power sources that depend on renewable energy are becoming widely implemented to decrease the dependence on diesel oil. However, different electrical sources from renewable energies work at different weather conditions which make each not a fully independent solution. In this paper, we propose a design of a smart hybrid power supply system that mixes the output power of three sources of electricity which are solar panel, battery tank and the power grid. The system prioritizes the use of each source according to its availability and its environmental impact. The solar panel has the highest priority while the power grid has the lowest priority. A design that is based on logic gates is proposed and simulated using Simulink in Matlab. The simulation results agree with the theoretical expectations.


I. INTRODUCTION 1
One of the aims of the Sustainable Development Goals is to guarantee the availability of energy for the use of human beings [1]. But due to the use of power extracted from fossil oil, there is tremendous amount of pollutants that are being dismissed to the environment when electrical power is generated [2]. Bad weather conditions and diseases which have been seen in younger and younger ages have become common nowadays [2]. The use of renewable energies is one main solution to the growing problem of pollution, but each renewable energy generator works under different weather conditions. For example, the solar panels produce electricity during sunlight duration. Wind turbines can produce enough acceptable electricity at certain minimums and maximums of the wind speed. That is why smart systems that can intelligently help the user define best times of the day when each renewable energy source can be used are most needed [2]. Jaya et al. proposes the use of microgrids as a new method to integrate different forms of renewable energies with the national power grids [3]. At the same time, it reduces the times of power cut off or failures in the energy delivery [3]. The reliability and power quality can be insured with energy storage and backup generators to sustain loads for optimizing renewable energy usage [4,5]. Many research papers have been published to propose smart hybrid power production systems which suit the needs of different places and countries. The following is a summary of some of the most recent efforts.
Meskani et al. proposes a hybrid energy plant containing photovoltaic system and battery to form an integrated solution for the problem of energy production [2]. The system uses fuzzy logic to control the times at which each can be best used to serve the needs from the electrical energy to form a robust and efficient solution [2]. Stumberger et al. proposes the design of a hybrid hydro and solar system for producing the needs of different places in Indonesia from electricity [6]. The study has shown that the designed power plant is sufficient to provide required loads of electricity for the people and that extra generated power can be sold to other areas [6].
Berardi et al. discusses the problem of the need for a reliable source of electrical energy generator for the army camps which keep moving while in service [7]. They proposed using renewable energy resources for electricity production instead of depending on diesel fuel [7]. A Smart Hybrid Energy System to combine diesel generator and solar power panels, energy storage devices and heat recovery tools in one micro-grid to produce sufficient electrical energy for the needs of the camp is proposed by the authors [7]. Kabir et al. suggests a design of a hybrid energy system to make Bangladesh overcome the shortage in the production of electricity for its domestic uses [8]. A combination of solar energy, wind energy and diesel generators can form a perfect mix to satisfy the needs of the people in Bangladesh [8].
In Canada, the pollution resulting from the dependence on diesel oil to produce electrical energy is a threat to the environment [9]. Kaluthanthrige et al. studies a proposed design of a hybrid renewable energy system from the perspectives of component selection, optimum sizing, performance evaluation and reliability [9]. The study concluded that a power plant that mixes power from photovoltaic cells, fossil fuel dependent power grid and batteries serves well in decreasing the environmental pollutants and at the same time providing a reliable uninterrupted source of electrical energy [9].
India suffers from a fossil dependent grid for providing electrical energy to its inhabitants and it is not even sufficient to suffice the needs of the people [1]. That is why integrating the output power from renewable energy systems and the national power grid through micro-grids is important [1]. A hybrid renewable energy micro-grid is proposed to provide a source of electrical energy that is sustainable, reliable, and modern [1].
In this paper, we want to design a Smart Hybrid Power Supply Management System (SHPSM) that prioritizes the sources which can be used to supply electric power for any load. Solar panels generate electricity from sun waves which is renewable and one of the cleanest sources of energy to the environment. Battery tanks can save energy from any power source and be used later as a clean source @ Design of Smart Hybrid Power Supply using Logic Circuits Ahmed M. D. E. Hassanein of electrical power. The power grid needs to be used the least as it usually depends on diesel to generate electricity. We define conditions that must be met to prioritize the use of these three power sources namely solar panels, battery tank and power grid. The rest of the paper is organized as follows. The design of an SHPSM for a house load is discussed in section two. The design is programmed on Simulink in section three to simulate results and compare them with the expected ones. Simulink is a simulation tool in the Matlab package. Finally, conclusions and future work are discussed in section four.

II. DESIGN OF LOGIC CIRCUITS
In this section, we discuss the procedures obeyed to design an electronic circuit based on digital logic to prioritize the sources of power providing electrical energy to a house.  The four inputs and four outputs for our proposed SHPSM is shown in fig. 1 and defined in table I. We aim to design a system based on logic circuits to control the power supply to a house load according to the following conditions: 1) The highest priority is to supply power needed by the house from the solar panels.
2) The second highest priority is to supply power needed by the house from the battery tank.
3) No charging of the battery is done if upper threshold sensor is true. 4) No charging of the battery is done if upper threshold sensor is false and the lower threshold is true, and the battery is being used as a power source. 5) If both thresholds are false, then charging of battery is done.
6) Lowest priority is to supply power needed by the house from the main grid.
For the four inputs, we have sixteen possible combinations as shown in Table II.   TABLE II: STATE TRUTH TABLE FOR Table II, we can find that the second, third, tenth and eleventh possibilities are invalid since the lower threshold 4 S is false and the upper threshold 5 S is true. This scenario is not possible in real life as it means that the upper threshold is true without the lower threshold for a battery tank. In the possibilities eight up till fifteen, we have 3 1 S = which means that the solar power is available to supply the house with electricity. Power from solar panel has the highest priority and so 1 = P which means that the solar panels are used as a power supplier. In the possibilities eight up till thirteen, the output 1 = C which means the battery tank is being charged from the solar panels. Charging of the battery is done due to 5 0 S = which means the upper threshold of the battery is false and the battery needs charging. In the possibilities five up till seven, we which means the battery tank is used as a power supplier. In those possibilities, we have either 4 S and 5 S are both true or just 4 S is true which means battery is ready for providing electricity because either both thresholds are true or the lower threshold is true. In the fourth possibility, we have 4 1 S = , 5 0 S = and ( ) 0 = t B which means lower threshold of the battery tank is true, the upper threshold is not and battery is not used as a power supplier respectively. Battery tank is almost half full. In this case, the outputs are 1 = M and 1 = C which means main grid is used as a power supplier and battery tank is charged from the main grid. In the zeros and first possibilities, we have 3 0 S = , 4 0 S = and 5 0 S = which means solar panel is not ready to give power, lower threshold of the battery tank is false and the upper threshold is false respectively. Battery tank is almost empty. We get the same output as in the fourth possibility, main grid is used as a power supplier and battery tank is charged from the main grid. The sixteen possibilities listed in Table II are represented in the mealy state machine diagram shown in Fig. 2. In Fig. 2 . The inputs and outputs are placed over each arrow and are represented as follows: We can see six scenarios where 3 1 S = which means that the solar panel is available to provide electrical power to the load. For the six scenarios, the arrow is pointing to which means the battery is not used to provide electrical power to the house. The solar panel is having a higher priority than the battery and so whenever solar power is available it is used to provide electricity. That is why, in all six scenarios, we have 1 = P . Next, we discuss the Karnaugh maps for the four outputs to get their logical equations.  The four variable Karnaugh maps for the outputs P in in Table III b are shown. The input variables of the Karnaugh maps are the four inputs for our system.  The four variable Karnaugh maps for the outputs M in Table IVa and C in Table IVb are shown. The input variables of the Karnaugh maps are the four inputs for our system.
From Table IIIa, the equation for the solar power output '    (1).
The P function which is represented in Eq. 1 is composed of one OR gate with two inputs, two AND gates and one NOT gate. The logic circuit is connected on Simulink as shown in Fig. 3.
function which is represented in Eq. 2 is composed of one OR gate with two inputs, two AND gates and two NOT gates. The logic circuit is connected on Simulink as shown in Fig. 4. The M function which is represented in Eq. 3 is composed of one OR gate with two inputs, two AND gates and four NOT gates. The logic circuit is connected on Simulink as shown in Fig. 5. The C function which is represented in Eq. 4 is composed of one OR gate with three inputs, three AND gates and three NOT gates. The logic circuit is connected on Simulink as shown in Fig. 6. In Fig. 7, the digital circuits shown in Fig. 3 fig. 7 showing points at which readings are taken.
In Fig. 8, the readings taken from the probes shown in Fig. 7 are graphed in Fig. 8. Beside each line, the graphed variable is shown, and the number of the probe is given. The results came to confirm the suggested outputs shown in table II. We can see that as long 3 S is true the next state ( ) 1 Bt+ is false whatever the value of the present state

( )
Bt . This means that as long as the solar power is available to supply electricity the battery tank is not used even if it is previously used.

IV. CONCLUSION AND FUTURE WORK
In this section, a summary of the achieved results in this paper is given and possible future work is mentioned. A smart hybrid power supply the sources of power from three different sources which are solar panel, battery tank and power grid. The solar panels are environmentally friendly and are given the highest priority while the power grid is diesel dependent and is given the least priority. The power tank is charged using either sources or is kept as a standby to minimize the dependency on the power grid. The simulation results of the system come in accordance with what is expected from the Karnaugh maps and the truth table. In the future cleaner sources of energy can be added to create a system that is fully environmentally friendly.