Simplified automatic VAR/Power factor compensator using fuzzy logic based on internet of things

In AC Power Systems, the compensation of reactive power is very important to support both of load and grid voltage. Generally, the objective of every reactive power compensators is to improve power factor that is the ratio of real power with apparent power to supplied the load. The main aim of this paper is twofold. Firstly, to design and realize a power factor corrector so the system’s power factor is kept high, secondly to monitor energy consumed by the load using IoT technology. The uniqueness of this work is that to improve system power factor, we used capacitor bank which are composed from several capacitor with different values. The software is embedded in a low-cost microcontroller then will activate a unique combination of the capacitor by using successive approximation algorithm such that the power factor compensator more reliable; in this case, the damage of one or several capacitors in bank will not degrade the performance of the power factor compensator too much.


Introduction
Recently, many researches have been conducted about power factor correction unit, but still have deficiency because zero crossing detector circuit usage in the device [1] [2]. Local monitoring is still employed and causes inflexibility of power monitoring [3]. The main aims of this paper are: (1) designing simplified power factor correction unit, (2) reducing hardware existence by optimizing software ability, and (3) telemetry unit to monitor power usage in household electricity.
Various methods are applied to achieve the simplicity of the device. By using T/4 delay OSG (orthogonal signal generator), voltage and current magnitude can be obtained [4]. PQ transformation is also used to calculate active power and reactive power [5]. Fuzzy logic control is also used to estimate capacitance values. Our proposed device is also equipped by IoT technology, allows to monitor the system performance from anywhere. Auxiliary tools such as digital filter is also used such as: FIR (finite impulse response) and exponential filter for reducing noise that is produced by sensor. To get optimum execution time rate, Fuzzy, digital filter, and PQ transformation are implemented using fix point arithmetic. Figure 1 and figure 2 show proposed hardware's block diagram and hardware setup which had been built. Voltage sensor ZMPT101B and current sensor ACS712 are used to measure electrical network voltage and current, then read by using 12 bits embedded ADC in STM32f10c8 microcontroller. ENC28j60 ethernet module is connected to microcontroller through SPI (Serial Peripheral Interface) communication protocol; connecting the microcontroller module to the Internet network.   Figure 4 shows software design for power factor correction unit. 12 bits ADC reads sensor analogue value and forwarded to 8th FIR digital filter. Active power (P) value and reactive value are obtained by PQ transformation calculation, whereas voltage and current magnitude are obtained by magnitude calculation method. Exponential filter takes place to smoothen computation results from magnitude and PQ transformation. Estimated capacitance values from fuzzy logic will be decomposed by successive approximation algorithm.

Digital filter
In this works, two types of digital filter are used; FIR and exponential filter provide smooth data to be used in other computations. FIR is designed with 7 delay units or 8 th order. Equation (1) represents FIR 8 th order formula, where x is filter output, u is filter input, and z is a delay unit.
Equation (2) represents exponential filter formula; it has a parameter that is α value in range from zero to one. The bigger α the less smooth filtering result, but filter's response is faster; the smaller α gives a smooth filtering result, but the filter's response is slower.

X(t)=α u(t)+(1-α)X(t-1)
(2) Exponential filter was chosen because a very smooth result is desired. Using FIR maybe can use up to 60 th order, which takes a lot of time for execution. Besides, by using exponential filter with 9.995 x 10 -4 for α value within fix point computation method, execution time is more efficient and faster.

Magnitude measuring based on T/4 delay OSG
Equation (3) shows that magnitude of a sinusoidal signal which is delayed by ¼ period is equal to cosine value of the present angle. Amplitude or magnitude of a signal can be revealed by using trigonometry identity in equation (4).
Frequency sampling that used in this work in 10 kHz. For sampling both voltage and current signal, every period of 50 Hz sine wave there are 200 sampling data. In order to delay ¼ period of 50 Hz sine wave using 10 kHz frequency sampling, the signal must be delayed 50 samples with assumption the sine wave is steady at 50 Hz frequency.

PQ transformation
Reactive power and active power can be calculated by using equation (5).
Where vα and iα are real voltage and current value, while vβ and iβ are T/4 period delayed value from voltage and current data or delayed by 50 samples in this case. Value of vβ and iβ are obtained from T/4 delay OSG.

Fuzzy design with ANFIS
Fuzzy is design by using ANFIS method with two input voltage, that is value and reactive power value; and an output is capacitor value. Voltage value has range 200 to 240 V, while reactive power value has range 0 to 900 VAR.   As shown in figure 5 voltage magnitude is divided into three parts for fuzzification process. VL means voltage low. VM means voltage medium. VB means voltage big. Similarly, in figure 6 reactive power is also divided into three parts for fuzzification process. QL means reactive power low. QM means reactive power medium. QB means reactive power big. ANFIS training is done by MATLAB; after that, fuzzy rule set will be embedded to microcontroller as a usual fuzzy logic rule. The fuzzy rule base is shown in table 1. W1 until w9 mean the membership degrees weight after fuzzification process using "and" comparator. If the voltage and reactive power input are mapped, the capacitance values can also be mapped into 3D graphic as shown in figure 7. Increment of reactive power value will increase the capacitor; decreasing voltage value will increase the capacitor value and vice versa.

Successive approximation algorithm
Generally used in ADC, this algorithm has a function to changes ADC input value to binary value. Based on its function, the authors chose this algorithm to energize and de-energize capacitors based on total capacitance must be activated. As an example, figure 8 will describe how this algorithm works. The profit of using this algorithm are faster and simpler computation than any other approximation methods [6].     This algorithm will activate the biggest value first. In case, the present value is less than target value, then this algorithm will activate the next value. But if the present value is bigger than target value, this algorithm will deactivate recent activated value and activate the next value. This algorithm will iterate until the total activated value is equal to target value. For further explanation, figure 9 shows successive approximation algorithm flowchart, which has been used in this works.

Internet of things (IoT) setup
Message Queue Telemetry Transport (MQTT) is one of protocols for IoT for telemetering purpose. In this work, STM32 microcontroller will send data that contain power factor value, power usage value, and active capacitor as shown in figure 10. MQTT server that is used in this work is Thingspeak.com, for trial purpose ThingSpeak can be accessed and login directly to ThingSpeak website www.thingspeak.com. Data will be sent every 15 seconds.  Figure 10. Thingspeak user interface.

Experimental results and discussions
This section will show all experimental results and will be analysed. Various load type has been chosen to observe the performance of this device, such as: various fan type, lighting bulbs, and induction motor. The load will be activated individually and together to check the precision of this device. Load type experiment which shown in table 2 and figure 11 is one of experimental results with 2 motors load with 0.25 kW power.  Figure 11. Result with 2 motor 0.25 kW load.
Inductive load and resistive load are installed on the electrical network together and discretely. Based on table 2, the device can compensate reactive power and maintain the power factor at around unity value. This device measured reactive power and remove it by activating capacitor based on the needed capacitance value. This device also can rebuild the needed capacitances value from capacitors bank precisely. Active capacitor in table 2 is capacitor number in figure 3.
Beside compensating reactive power from the network, this device also can perform power usage monitoring by using Internet of Things technology, as shown in figure 10. The poverty of using Internet of things technology is the power cannot be monitor in hard real time. There is a delay time for each data to be sent to Thingspeak's server.

Conclusion
This project provides a simpler hardware design to overcome power losses and power usage efficiency in household. AC voltage and current is measured by T/4 delay OSG without using any other auxiliary circuit. PQ transformation calculates active power and reactive power shorter. Needed capacitance values can be estimated using fuzzy logic controller. Designing fuzzy logic with ANFIS method eases the authors at designing fuzzy logic. The software is embedded to low-cost microcontroller. Telemetering function also works properly to send various data to MQTT server in interval 15 seconds. Overall the main function of this project that is to maintain unity power factor value in household electricity can be achieved using these methods.