Power Factor Compensation Using Teaching Learning Based Optimization and Monitoring System by Cloud Data Logger

The main objective of this paper is to compensate power factor using teaching learning based optimization (TLBO), determine the capacitor bank optimization (CBO) algorithm, and monitor a system in real-time using cloud data logging (CDL). Implemented Power Factor Compensation and Monitoring System (PFCMS) calculates the optimal capacitor combination to improve power factor of the installation by measure of voltage, current, and active power. CBO algorithm determines the best solution of capacitor values to install, by applying TLBO in different phases of the algorithm. Electrical variables acquired by the sensors and the variables calculated are stored in CDL using Google Sheets (GS) to monitor and analyse the installation by means of a TLBO algorithm implemented in PFCMS, that optimizes the compensation power factor of installation and determining which capacitors are connected in real time. Moreover, the optimization of the power factor in facilities means economic and energy savings, as well as the improvement of the quality of the operation of the installation.


Introduction
Differently from residential loads, most commercial and industrial premises have a high uptake of inductive loads such as electric motors, inductive/resistor load, sodium vapour, and metal halide lighting, etc. These installations and operation of these devices distort power supply and reduce power factor. Normally, a lower power factor for facilities causes a huge amount of losses and may lead to a thermal problem in switchgear. Fortunately, power factor is controllable with properly designed power factor improvement methods.
At present, society is involved in a major digital transformation due to major advances in information and communication technologies. This digital transformation extends to the technological sector, offering very interesting development possibilities. New technologies developed include the Internet of things, big data, cloud computing, industry 4.0, and intelligent networks.
The application of new technologies to industry 4.0 allows monitoring the operating of the system and controlling the system with computers and mobile devices remotely. In this sense, the measurement and monitoring of electrical variables is interesting for studying the energy behaviour of installations. Excessive reactive energy consumption implies an increase in the electricity bill, so it must be reduced to achieve significant energy and economic savings.
To achieve energy and economic savings by correcting the power factor of the installation, it is necessary to solve an optimization problem. There are many optimization algorithms applied to the resolution of engineering problems, such as the Genetic Algorithm (GA), Particle Swarm A multitude of papers have emerged utilizing smart meter data, as a new smart voltage and current monitoring system technique proposed in [23,24], as well as a smart home electric energy saving system implemented by combining smart meter, smart plug, smart mobile devices, and database server. The meters measure consumption on a very fine scale, usually on a 15 min basis, and the data giving unprecedented granularity of consumption patterns at household level is analysed in [25].
This paper presents the development and implementation of PFCMS, using the open source Arduino platform where the TLBO algorithm is implemented to operate in real time. Therefore, the interest of the proposal is based on the advantage of the Arduino platform with a highly efficient algorithm such as TLBO, in order to reduce the calculation and operation times of PFCMS.
In the first phase, the design of a CB involves determining the number and capacity of the capacitors. For this, there should be a set of measurements of the electrical variables of the installation and a comprehensive analysis of the installed loads. In this research, the algorithm CBO developed calculates the optimal capacity of all capacitors to install. The number of capacitors influences the complexity of the problem decisively, in this sense to evaluate the size of the capacitors, TLBO algorithm reduces simulation times. CBO algorithm uses TLBO as the basis for optimization. The CBO algorithm has to be programmed in a high-level language, such as C, Python, MatLab, etc. This research uses MatLab as a programming environment.
The second phase, starting from the results of the optimal capacity to be installed, the compensation of the power factor is done using TLBO in real time. As proof, there was analysis with PFCMS: a series of tests were performed with different types of loads, such as lamps, motors and resistive-inductive loads, where the electrical variables of the installation are measured and monitored, using the sensors installed in PFCMS. Once the electrical variables were obtained, the TLBO algorithm was applied that determined the combination of capacitors at each moment in order to obtain the power factor nearest to the desired value. The experimental results demonstrate the feasibility of the proposal.
The measurement time can be adjusted from 0.2 to the desired time. Moreover, reduced measurement time, together with the speed of resolution of TLBO, allows using PFCMS in real time. Therefore, TLBO complies with the definition of the problem to be solved in this investigation.
The design of a CB involves determining the number and capacity of the capacitors. For this, there should be a set of measurements of the electrical variables of the installation and a comprehensive analysis of the installed loads. In this research the algorithm CBO developed calculates the optimal capacity of all capacitors to install. The number of capacitors influences the complexity of the problem decisively, in this sense to evaluate the size of the capacitors, TLBO algorithm reduces simulation times. CBO algorithm uses TLBO as the basis for optimization.
It is possible to integrate the PFCMS with Android applications to be used with mobile devices under this operating system. It is specially designed to work with an app developed for this type of device. The apps for Android devices have been developed with the free programming environment of Google MITAI [26].
All software development has been done with free programming environments, so that the system can be reproduced by any researcher without the need to acquire commercial software licenses.
To make the measurements of the electrical variables, the electric power meter PZEM-004t (PZEM) [27] (Ningbo Peacefair Electronic) was used. The measured variables are voltage, current, active power, and energy, from which reactive, apparent power and PF are derived, for system monitoring.
The aim of this work is to design and implement a power factor compensation system using a TLBO algorithm in real time, additionally developing an algorithm to obtain the optimal capacity of the CB, monitor the system in GS, and a smartphone application to monitor the installation in real time. PFCMS has been designed to correct power factor in different electric systems. The paper is organized as follows: Section 2 presents the relevant related theory power factor, algorithm TLBO, and optimal capacity algorithm, Section 3 deals with the hardware and software development of PFCMS. Section 4 defines the case studies and results. Finally Section 5 exposes the conclusion of the present investigation.

Introduction to Compensation Power Factor
Power factor is the ratio between the active power P and the apparent power S in an electrical load. It is simply a measure of how efficiently the load current is being converted into useful work output. The lower the power factor of a system, the less economically it operates. A low power factor can be the result of a significant phase difference between voltage and current at load terminals.
Generally, it is the use of inductive loads such as IM, power transformers, induction furnaces, and so on that causes a current to lag behind voltage. A poor power factor resulting from inductive loads can be improved by power factor correction method. Since power factor in inductive loads is generally lower, they have to be supplied with reactive power in order to reduce increased power consumption of the facilities.
All inductive loads require P to perform the actual work, and reactive power Q to maintain the magnetic field. This Q is necessary for the equipment to operate, but imposes an undesirable weight on the supply, causing the current to be out of phase with the voltage (current lags the voltage). Low power factor can also result when inactive motors operate at less than full load, etc.
PFC is applied to neutralize as much of the magnetizing current as possible and to reduce losses in the distribution systems [28][29][30]. A new approach for real time voltage control of distribution networks that has improvements over the conventional voltage control models is [31]. It offers many benefits to the commercial electrical consumer, including reduced utility bills by eliminating charges on reactive power, reduced losses making extra S available from the existing supply. Thus, it improves energy efficiency.

Compensation Power Factor Theory
The design of the device for compensating the adverse effects of inductive Q is a crucial task in designing any PFC systems. The capacitive current supplied by the capacitors is directly connected across the industrial load terminals or electrical installation. The consumer advises to improve the power factor beyond the value of magnetizing kVAr rating of the load [14].
Lower power factors can dramatically increase the required current being consumed by an appliance to work correctly. The following equation calculates the amount of reactive power that is wanted to be produced by the bank of capacitors connected in parallel to the load: where ϕ V is the angle of the voltage signal and ϕ I is the angle of the current signal, and Q C is the reactive power the capacitor must provide; and (ϕ V − ϕ I ) is the angle we want for the power factor once it is corrected. This involves a detailed survey of loads connected to the system and performing measurements of the electrical variables of the facilities during that period that allows us to determine the optimum capacity of the CB. The Q C requirement value changes with the load variation, hence the algorithm control developed such that the reactive power requirement near the load terminals is maintained at a constant by varying the capacitive reactive power and the power factor is maintained nearer to unity.
Knowing that the resistance of a capacitance is dependable on the frequency, it is known that the capacitance needed to correct a certain amount of reactive power in single phase is where C is the capacitance in Farads, f is the frequency, and V is the voltage. In the three-phase systems, it can be connected to CB in wye (W) and delta (D). In the case of the wye connection, the voltage phase to phase V PP is the voltage per phase by the square root of 3, and the equation will be In the three-phase system connected in delta, the voltage phase to phase is equal to the voltage per phase, the equation will be

TLBO Algorithm
TLBO is a global stochastic optimization algorithm, based on populations and oriented to large-scale problems. It is based on modeling the behavior of a class of students formed by a set of known candidate solutions [32].
These solutions are progressively improved by simulating both the teaching process of a teacher and the interaction between students. The main characteristic of TLBO is its performance and its lack of specific search parameters, since it is only necessary to specify the population size and the number of cycles as required.
To achieve this, TLBO relies on two fundamental steps per cycle, the phase of the teacher (Teacher Phase (TP)) and that of the students (Learners Phase (LP)).
The TP difference between the respective mean result of each subject and the corresponding result of the teacher for each subject is where, X teacher is the best individual, X i is other individual, X mean is the current mean of the individuals, T F is the teaching factor which decides the value of mean, and X new is the influence for student X i by the difference between the teacher´s knowledge and the qualities of all students. In the LP, two possible solutions are selected, each final individual i from the previous stage is paired with another, different from himself, j. Next, we try to move the individual i from his current position in a direction that depends on its relative value with respect to j, finally, the individual i will only be updated if his value is improved after the change.
Problem Formulation The objective of optimal PFC problem of electrical installations is to optimize the objective function, defined as the difference between power factor desired (PF DES ) and power factor obtained (PF OBT ) while satisfying all operational constraints.
The optimization function used to obtain the compensation of the power factor in real time is given by where cos(ϕ des ) is the PF DES , q(t) is the reactive power, p(t) is the active power, and v(t) is the voltage of the installation for a time t, C j are the capacities of the capacitors and f is the frequency of the installation. The constraint used in the formulation of the problem for the developed TLBO algorithm has been taken: 0.95 ≤ cos ϕ ≤ 1 (9) PFC depend on the current legislation in each country. Each country has intervals defined between 0.9 and 0.95 as a minimum value to apply surcharge for excessive reactive energy consumption, in Spain it is 0.95, this value is set for the constraint. The maximum constraint value is set to 1, because if the limit is exceeded the power factor changes from inductive to capacitive.
The limit values of the constraints can be adjusted to the legislation in each country, or to the needs of the installation where the PFCMS is implanted.
To define the population (pop), 2 n possible states are considered, where n is the number of capacitors used. Each state shows the combination of turning on or off the n capacitors. Figure 1 shows TLBO flow chart.
PFC depend on the current legislation in each country. Each country has intervals defined between 0.9 and 0.95 as a minimum value to apply surcharge for excessive reactive energy consumption, in Spain it is 0.95, this value is set for the constraint. The maximum constraint value is set to 1, because if the limit is exceeded the power factor changes from inductive to capacitive.
The limit values of the constraints can be adjusted to the legislation in each country, or to the needs of the installation where the PFCMS is implanted.
To define the population (pop), 2 n possible states are considered, where n is the number of capacitors used. Each state shows the combination of turning on or off the n capacitors.  This algorithm will be implemented in the PFCMS in real time. In addition, it will be used within the optimization algorithm of point 2.4.

CBO Algorithm
The power factor compensation study of electrical installations is necessary to perform a set of measurements of the electrical variables involved. Once the measurements have been done, the capacities of the different capacitors that formed the CB can be determined.
In this research a CBO algorithm is proposed to obtain the optimal capacity of each of the capacitors. This algorithm allows calculating a capacitors bank composed of 2...n units, achieving an optimal compensation. If the number of capacitors increases, a better PF compensation is obtained, but it implies higher installation costs and a more complex control.
The implementation of the CBO algorithm takes place in three phases: (i) obtain the possible solutions to cover the maximum and minimum power factor, (ii) with the set of the possible solutions, choose those that make it possible to compensate the entire acquired field of measurements, (iii) with the chosen solutions, select the one with the lowest capacity. Figure 2 shows CBO flow chart. Modify solution based on the best solution X new =X i +r*(X teacher -T F *X mean ) This algorithm will be implemented in the PFCMS in real time. In addition, it will be used within the optimization algorithm of point 2.4.

CBO Algorithm
The power factor compensation study of electrical installations is necessary to perform a set of measurements of the electrical variables involved. Once the measurements have been done, the capacities of the different capacitors that formed the CB can be determined.
In this research a CBO algorithm is proposed to obtain the optimal capacity of each of the capacitors. This algorithm allows calculating a capacitors bank composed of 2 . . . n units, achieving an optimal compensation. If the number of capacitors increases, a better PF compensation is obtained, but it implies higher installation costs and a more complex control. The implementation of the CBO algorithm takes place in three phases: (i) obtain the possible solutions to cover the maximum and minimum power factor, (ii) with the set of the possible solutions, choose those that make it possible to compensate the entire acquired field of measurements, (iii) with the chosen solutions, select the one with the lowest capacity. Figure 2 shows CBO flow chart.

PFCMS Design
The proposed system takes 230 V 50 Hz mains supply as a power source. The sampled voltage signals and current signals receive of power grid and process through the voltage sensor and the current sensor circuit and introduce in the microcontroller, that performs power factor calculations using TLBO and switches capacitors of CB. Moreover, results are stored and monitored in CDL using GS, and can also be displayed on Android application. Figure 3 shows the functional block diagram of the complete project. A smart sensor network that allows inspecting an electrical installation in a non-intrusive way is presented in [33], developing an open-architecture smart sensor network, based on FPGA technology, which is able to continuously monitor PQ in industrial facilities, public buildings, and residential homes.

PFCMS Design
The proposed system takes 230 V 50 Hz mains supply as a power source. The sampled voltage signals and current signals receive of power grid and process through the voltage sensor and the current sensor circuit and introduce in the microcontroller, that performs power factor calculations using TLBO and switches capacitors of CB. Moreover, results are stored and monitored in CDL using GS, and can also be displayed on Android application. Figure 3 shows the functional block diagram of the complete project. A smart sensor network that allows inspecting an electrical installation in a non-intrusive way is presented in [33], developing an open-architecture smart sensor network, based on FPGA technology, which is able to continuously monitor PQ in industrial facilities, public buildings, and residential homes.

PFCMS Design
The proposed system takes 230 V 50 Hz mains supply as a power source. The sampled voltage signals and current signals receive of power grid and process through the voltage sensor and the current sensor circuit and introduce in the microcontroller, that performs power factor calculations using TLBO and switches capacitors of CB. Moreover, results are stored and monitored in CDL using GS, and can also be displayed on Android application. Figure 3 shows the functional block diagram of the complete project. A smart sensor network that allows inspecting an electrical installation in a non-intrusive way is presented in [33], developing an open-architecture smart sensor network, based on FPGA technology, which is able to continuously monitor PQ in industrial facilities, public buildings, and residential homes.

Microcontroller
A microcontroller is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals [34]. An AD1R1 microcontroller (based on ESP-8266EX) is used in this research, which has lots of libraries developed and available online for free. Table 1 shows the main characteristics of the microcontroller. Board AD1R1 allows access to Wi-Fi networks, and therefore uploading information to the Internet, in our case to GS with times less than 1 s. It makes it ideal for the dual function of a monitoring system and uploading information to the cloud.

Electric Power Meter
The PZEM model of the Ningbo Peacefair Electronic has been chosen as electrical meter, whose characteristics are in Table 2. This equipment can measure voltage, current, active power, and active energy. To measure the current, use a non-invasive toroidal transformer through which the phase cable passes into it. Inside, the PZEM module has two opto-couplers (PC817A) has a connection with pins 1 and 2 of the PZEM through a voltage divider with two resistors (R1 and R2) of 1 kΩ in series (extracting only 2.5 Vdc in this point). With the insertion of a resistor (R3) of 1 kΩ in parallel with the resistance R1, a new voltage divider is obtained at that point.

Software
Two programs are developed: (i) AD1R1, which performs the functions of reading electrical variables from PZEM, the optimization calculations and sends the data to GS; (ii) Android application, which monitors the data stored in GS, making it possible to display industry data in real time at any location using Smartphone or Tablet.
The measurements made with PZEM can be adjusted to different measurement times depending on the needs of the electrical installation, this time is independent of the Internet upload time.

Microcontroller Program
This part of the software should be responsible for several tasks: (i) the program must start the Wi-Fi system, the electric power meter PZEM, and the initialization of the four outputs to the relays that will activate the contactors to operate in output mode; (ii) read the electrical variables from PZEM; (iii) perform TLBO algorithm; (iv) data is uploaded to Internet. Figure 4 shows the flow diagram corresponding to the main program. This part of the software should be responsible for several tasks: (i) the program must start the Wi-Fi system, the electric power meter PZEM, and the initialization of the four outputs to the relays that will activate the contactors to operate in output mode; (ii) read the electrical variables from PZEM; (iii) perform TLBO algorithm; (iv) data is uploaded to Internet. Figure 4 shows the flow diagram corresponding to the main program.

Android App
The program developed for Android mobile devices allows visualizing the behavior of the installation in real time.
MITAI is used as development environment. This platform is free and available from Google for the online development of apps for Android devices.
The app developed with MITAI consists of two parts: (i) the development of screens using visual components such as buttons, lists, text boxes, and others, and non-visual components such as BT, Wi-Fi, etc.; (ii) programming through blocks that allows the development of the application with all the functionalities. Figure 5 shows the flow diagram of the application for mobile devices.

Android App
The program developed for Android mobile devices allows visualizing the behavior of the installation in real time.
MITAI is used as development environment. This platform is free and available from Google for the online development of apps for Android devices.
The app developed with MITAI consists of two parts: (i) the development of screens using visual components such as buttons, lists, text boxes, and others, and non-visual components such as BT, Wi-Fi, etc.; (ii) programming through blocks that allows the development of the application with all the functionalities. Figure 5 shows the flow diagram of the application for mobile devices. This part of the software should be responsible for several tasks: (i) the program must start the Wi-Fi system, the electric power meter PZEM, and the initialization of the four outputs to the relays that will activate the contactors to operate in output mode; (ii) read the electrical variables from PZEM; (iii) perform TLBO algorithm; (iv) data is uploaded to Internet. Figure 4 shows the flow diagram corresponding to the main program.

Android App
The program developed for Android mobile devices allows visualizing the behavior of the installation in real time.
MITAI is used as development environment. This platform is free and available from Google for the online development of apps for Android devices.
The app developed with MITAI consists of two parts: (i) the development of screens using visual components such as buttons, lists, text boxes, and others, and non-visual components such as BT, Wi-Fi, etc.; (ii) programming through blocks that allows the development of the application with all the functionalities. Figure 5 shows the flow diagram of the application for mobile devices.

Prototype
PFCMS built has external connections, each one connects with the capacitor. The communication between AD1R1 and Internet integrated inside the microcontroller, which allows data to be uploaded from the board, without the need for other external components.
Moreover, equipment is powered by an external adapter that provides the necessary voltage to AD1R1. There are other multiple ways of feeding the equipment, which can be implemented without any difficulty in other similar projects.
It is possible to work with contactors whose coil has a maximum current of 10 A, which is the one supported by the relays. In case of use contactors with coils whose current is greater than 10 A, it is easily realizable only by changing the relays to the next step of 30 A, which are easily found in the market.
PFCMS built, the connection of the components, the control panel and the equipment mounted in the container box is shown in Figure 6.

Prototype
PFCMS built has external connections, each one connects with the capacitor. The communication between AD1R1 and Internet integrated inside the microcontroller, which allows data to be uploaded from the board, without the need for other external components.
Moreover, equipment is powered by an external adapter that provides the necessary voltage to AD1R1. There are other multiple ways of feeding the equipment, which can be implemented without any difficulty in other similar projects.
It is possible to work with contactors whose coil has a maximum current of 10 A, which is the one supported by the relays. In case of use contactors with coils whose current is greater than 10A, it is easily realizable only by changing the relays to the next step of 30 A, which are easily found in the market.
PFCMS built, the connection of the components, the control panel and the equipment mounted in the container box is shown in Figure 6. Programmer includes PFDES and capacitors values into the microprocessor. Depending on the difference between the PFDES and power factor installation (PFINST), the TLBO algorithm adjusts the switching schemes of capacitors banks.
Optimal solutions and measured electrical variables are stored in GS with the fixed measurement interval. The spreadsheet represents the graphs of voltage, current, power factor, and active, reactive, and apparent powers over time.

Results and Discussion
A CB of four units is used to do the tests, divided into two phases: (i) obtain the optimal capacities for the four capacitors in each case studied, (ii) with the optimal capabilities perform the tests in real time using PFCSM.

Test Machine
The case studies have been done in the electrical machinery laboratory of the Electrical Engineering Department of the University of Jaen. In this laboratory, there are several trainers of electrical machines, in the power range of 0.3 kW and electric machine of 1.5 kW.
This trainer has a machine that can simulate the behavior as resistant torque, speed control, and different applications such as cranes, water pumps, etc. This machine has a control panel to allow all Optimal solutions and measured electrical variables are stored in GS with the fixed measurement interval. The spreadsheet represents the graphs of voltage, current, power factor, and active, reactive, and apparent powers over time.

Results and Discussion
A CB of four units is used to do the tests, divided into two phases: (i) obtain the optimal capacities for the four capacitors in each case studied, (ii) with the optimal capabilities perform the tests in real time using PFCSM.

Test Machine
The case studies have been done in the electrical machinery laboratory of the Electrical Engineering Department of the University of Jaen. In this laboratory, there are several trainers of electrical machines, in the power range of 0.3 kW and electric machine of 1.5 kW.
This trainer has a machine that can simulate the behavior as resistant torque, speed control, and different applications such as cranes, water pumps, etc. This machine has a control panel to allow all these functions. In this case, only the resistive torque mode has been used, to obtain the different PF for each motor curves and be able to compare results.
The CB has some capacity positions and dissipate a power of up to 825 VAr.

Used Machines
For the studies, three types of motors have been used, two squirrel cage rotors (3-phase) of 1.5 and 0.37 kW, and a squirrel cage rotor (1-phase) with star capacitor. Table 3 illustrates the characteristics of the machines used.

Load Lamps (Electric Ballast)
For the studies, two types of lamps have been used, the sodium vapour and metal halide. Table 4 illustrate the characteristics of the lighting used. In the [35] presents a comparative study of the operational characteristics of the HPS lamp when fed by conventional ballast versus electronic ballast.
Metal halide and sodium vapour lamps have ballast with a highly non-linear load which changes during the warm-up period.

Resistance-Inductance Load
The loads connected to the electrical system are mostly resistive-inductive. Moreover, resistors and inductances have seven positions and a power of up to 1200 W and 900 VAr respectively. Table 5 shows the characteristics of these resistances and inductances.

Capacitor Bank Optimization
The measurements carried out in the different equipment studied allow obtaining the optimum capacity installed in the CB. The algorithm developed in 2.4 applies to the different loads to obtain the optimum in each case.
This algorithm is developed in MatLab, since the measurements made are very extensive, and need a longer calculation time.
The best solutions reported by this algorithm are in Table 6. As this algorithm requires a fine tuning of controlling parameters to get the optimum results, hence the results obtained by this algorithm may not be the global optimum solutions. However, to find out the optimum values of the common controlling parameters such as population size and the number of iterations, the algorithm is executed a number of times with different population sizes and number of iterations. At this point, it is important to clarify that in the TLBO algorithm, TP updates the solution as well as in the LP. Table 6. Comparison of optimization results of capacity for CB.

Type Load
Capacitor Values (µF) Step

Best Solution C 1 -C 2 -C 3 -C 4 (µF)
Motor One phase 0.5 . . .  Table 6 shows the range of capacities, the possible solutions, the optimal solutions, and the best solution for the time interval analysed, in each of the tests. Each test has {[max(C i )-min(C i )]/step} n maximum solutions.
With the optimal solution obtained for each case of Table 6, algorithm 2.3 applies to verify that the solution is correct in the range of measurements made.
In addition, Table 7 provides the statistical results of objective function obtained by different loads, in which all the performance indices of TLBO are shown. Here, the initiation sets are included in Table 6. Table 7 shows the average, standard deviation, maximum and minimum difference between PF OBT and PF DES , of the best solution obtained for the measurements made in each case.

Compensation Power Factor Test in Real Time
The energy supply companies increase the electricity bill through a surcharge for excessive consumption of reactive energy. The usual values are surcharge below 0.95 and without surcharge between 0.95 and 1. PF DES to perform the tests is 0.95. Different loads used are motors, lamps (ballasts), and resistive and inductive loads. This equipment performs the measurements of the PFC tests and analyses the data obtained in real time.
PFCMS has implemented the algorithm described in point 2.3 to obtain the optimal combination of capacitors installed in the CB.
The optimum capacity is defined by the Equations (3)- (5), if CB is connected in single-phase, three-phase, in star or triangle, respectively. In addition, value obtained cannot be adjusted to a combination of capacitors with standard capacities existing on the market. The capacitance obtained is the capacitance selected in the CB at each moment by using TLBO.
Moreover, the graphs for each of the tests carried out show the difference between the calculated optimum capacity and the capacity obtained by TLBO in PFCMS to control the CB.

Motors Load
Three scenarios are defined to perform this test.
The capacity values used for TBLO Algorithm are 0.5-0.5-0.5-0.5 µF for the three-phase motor in D and W, obtained from CBO algorithm shown in Table 6.
The torque changes every 40 s from no load to 0.6 Nm with a step of 0.1 Nm, with the test machine. The acquisition of data has been done with PZEM configured to measure each 1 s.
Moreover, the test results of motor D and W connection, in Figures 7-9, show the evolution of the obtained vs optimum capacity, PF INST and PF OBT , and the difference between PF OBT and PF DES , for 1 s application.

Compensation Power Factor Test in Real Time
The energy supply companies increase the electricity bill through a surcharge for excessive consumption of reactive energy. The usual values are surcharge below 0.95 and without surcharge between 0.95 and 1. PFDES to perform the tests is 0.95. Different loads used are motors, lamps (ballasts), and resistive and inductive loads. This equipment performs the measurements of the PFC tests and analyses the data obtained in real time.
PFCMS has implemented the algorithm described in point 2.3 to obtain the optimal combination of capacitors installed in the CB.
The optimum capacity is defined by the Equations (3)-(5), if CB is connected in single-phase, three-phase, in star or triangle, respectively. In addition, value obtained cannot be adjusted to a combination of capacitors with standard capacities existing on the market. The capacitance obtained is the capacitance selected in the CB at each moment by using TLBO.
Moreover, the graphs for each of the tests carried out show the difference between the calculated optimum capacity and the capacity obtained by TLBO in PFCMS to control the CB.

Motors Load
Three scenarios are defined to perform this test. The capacity values used for TBLO Algorithm are 0.5-0.5-0.5-0.5 F for the three-phase motor in D and W, obtained from CBO algorithm shown in Table 6.
The torque changes every 40 s from no load to 0.6 Nm with a step of 0.1 Nm, with the test machine. The acquisition of data has been done with PZEM configured to measure each 1 s.
Moreover, the test results of motor D and W connection, in Figures 7-9, show the evolution of the obtained vs optimum capacity, PFINST and PFOBT, and the difference between PFOBT and PFDES, for 1 s application.              The capacity values used for TBLO algorithm are 0.5-0.5-1-2.5 µF for the single-phase motor, obtained with CBO algorithm are in Table 6.
The test results of motor one-phase, shown in Figures 11 and 12, are the evolution of the obtained vs optimum capacity, the PF INST and power factor obtained (PF OBT ), and the difference between PF OBT and PF DES , for 1 s of TLBO algorithm application. Figure 11a shows a PF INST greater than 0.95, with an optimal capacity less than zero and the obtained capacity equal to zero. The capacity values used for TBLO algorithm are 0.5-0.5-1-2.5 F for the single-phase motor, obtained with CBO algorithm are in Table 6.
The test results of motor one-phase, shown in Figures 11 and 12, are the evolution of the obtained vs optimum capacity, the PFINST and power factor obtained (PFOBT), and the difference between PFOBT and PFDES, for 1 s of TLBO algorithm application. Figure 11a shows a PFINST greater than 0.95, with an optimal capacity less than zero and the obtained capacity equal to zero.  The difference between PFOBT and PFDES, for three-phase motors in D and W, is lower than 0.0332 and 0.0483 respectively, and for the single-phase motor it is lower than 0.0174. The results obtained indicate that TLBO algorithm is applicable to this type of problems.

Lamps Load
The facilities use a variety of lamps for lighting. This test utilizes sodium vapour and metal halide lamps. In order to perform this test, it defines two scenarios.
The tests illustrate the process of starting the lamps up to the permanent operating mode. The starting time is approx. 2 min. Moreover, graphs show 240 s of operation, the permanent regime reach The capacity values used for TBLO algorithm are 0.5-0.5-1-2.5 F for the single-phase motor, obtained with CBO algorithm are in Table 6.
The test results of motor one-phase, shown in Figures 11 and 12, are the evolution of the obtained vs optimum capacity, the PFINST and power factor obtained (PFOBT), and the difference between PFOBT and PFDES, for 1 s of TLBO algorithm application. Figure 11a shows a PFINST greater than 0.95, with an optimal capacity less than zero and the obtained capacity equal to zero.  The difference between PFOBT and PFDES, for three-phase motors in D and W, is lower than 0.0332 and 0.0483 respectively, and for the single-phase motor it is lower than 0.0174. The results obtained indicate that TLBO algorithm is applicable to this type of problems.

Lamps Load
The facilities use a variety of lamps for lighting. This test utilizes sodium vapour and metal halide lamps. In order to perform this test, it defines two scenarios.
The tests illustrate the process of starting the lamps up to the permanent operating mode. The starting time is approx. 2 min. Moreover, graphs show 240 s of operation, the permanent regime reach The difference between PF OBT and PF DES , for three-phase motors in D and W, is lower than 0.0332 and 0.0483 respectively, and for the single-phase motor it is lower than 0.0174. The results obtained indicate that TLBO algorithm is applicable to this type of problems.

Lamps Load
The facilities use a variety of lamps for lighting. This test utilizes sodium vapour and metal halide lamps. In order to perform this test, it defines two scenarios.
The tests illustrate the process of starting the lamps up to the permanent operating mode. The starting time is approx. 2 min. Moreover, graphs show 240 s of operation, the permanent regime reach to 120 s. The capacity values used for TBLO algorithm are 5-5.5-7-8 and 5-5-7-8 µF for metal halide and sodium vapour respectively, obtained from CBO algorithm show in Table 6. Figures 13-15 show the evolution of the obtained vs optimum capacity, PF INST and PF OBT , and the difference between PF OBT and PF DES for different lamps, with an application time of 1 s for TLBO algorithm. to 120 s. The capacity values used for TBLO algorithm are 5-5.5-7-8 and 5-5-7-8 F for metal halide and sodium vapour respectively, obtained from CBO algorithm show in Table 6. Figures 13-15 show the evolution of the obtained vs optimum capacity, PFINST and PFOBT, and the difference between PFOBT and PFDES for different lamps, with an application time of 1 s for TLBO algorithm.   to 120 s. The capacity values used for TBLO algorithm are 5-5.5-7-8 and 5-5-7-8 F for metal halide and sodium vapour respectively, obtained from CBO algorithm show in Table 6. Figures 13-15 show the evolution of the obtained vs optimum capacity, PFINST and PFOBT, and the difference between PFOBT and PFDES for different lamps, with an application time of 1 s for TLBO algorithm.  The difference between PFOBT and PFDES, for sodium vapour and metal halide lamps, is less than 0.0458 and 0.0469 respectively. The results obtained indicate that the TLBO algorithm is applicable to lighting installations.
Once the assembly is done in the laboratory, it remains in the shape shown in Figure 16. The difference between PF OBT and PF DES , for sodium vapour and metal halide lamps, is less than 0.0458 and 0.0469 respectively. The results obtained indicate that the TLBO algorithm is applicable to lighting installations.
Once the assembly is done in the laboratory, it remains in the shape shown in Figure 16. The difference between PFOBT and PFDES, for sodium vapour and metal halide lamps, is less than 0.0458 and 0.0469 respectively. The results obtained indicate that the TLBO algorithm is applicable to lighting installations.
Once the assembly is done in the laboratory, it remains in the shape shown in Figure 16.

Resistance and Inductance Load
In order to do this test, it defines two scenarios, in which the load was taken resistance fixed and the inductance change. In this case, the defined scenarios are as follows: 1. Resistance-Inductance series load 2. Resistance-Inductance parallel load Tests show the different operating states of the loads. The reactance variation time is 40 seconds approximately. Moreover, capacity values used are 0.5-2-4-7.5 and 0.5-1.5-2.5-2 μF, for parallel and series respectively, obtained from the CBO algorithm show in Table 6.
The test results reflect in Figure 17-19, the evolution of the obtained vs optimum capacity, PFINST and PFOBT, and the difference between PFOBT and PFDES, with an application time of 1 s for the TLBO algorithm.

Resistance and Inductance Load
In order to do this test, it defines two scenarios, in which the load was taken resistance fixed and the inductance change. In this case, the defined scenarios are as follows: 1.
Resistance-Inductance parallel load Tests show the different operating states of the loads. The reactance variation time is 40 s approximately. Moreover, capacity values used are 0.5-2-4-7.5 and 0.5-1.5-2.5-2 µF, for parallel and series respectively, obtained from the CBO algorithm show in Table 6.
The test results reflect in Figures 17-19, the evolution of the obtained vs optimum capacity, PF INST and PF OBT , and the difference between PF OBT and PF DES , with an application time of 1 s for the TLBO algorithm.    The difference between PFOBT and PFDES, for series and parallel loads, is less than 0.050. The results obtained with the TLBO algorithm indicate the correct operation for different loads.   The difference between PFOBT and PFDES, for series and parallel loads, is less than 0.050. The results obtained with the TLBO algorithm indicate the correct operation for different loads. The difference between PF OBT and PF DES , for series and parallel loads, is less than 0.050. The results obtained with the TLBO algorithm indicate the correct operation for different loads.

Daily Use of IM
Data used correspond to one day (86,400 s) of 1.5 kW motor operation. The capacity values used for TBLO algorithm are 1.5-10-9.5-6.5, obtained from the CBO algorithm show in Table 6.
The result of the measure data is reflected in the three graphs, Figures 20-22, the evolution of the obtained vs optimum capacity, PF INST and PF OBT , and the difference between PF OBT and PF DES, applying the TLBO algorithm every second. Figure 21 shows a PF INST greater than 0.95 in some time intervals, with an optimal capacity less than zero and the obtained capacity equal zero, as shown in Figure 20.
The difference between PF OBT and PF DES , for induction motors, is less than 0.03. The results obtained with the TLBO algorithm are applicable to these engines.
The result of the measure data is reflected in the three graphs, Figure 20-22, the evolution of the obtained vs optimum capacity, PFINST and PFOBT, and the difference between PFOBT and PFDES, applying the TLBO algorithm every second. Figure 21 shows a PFINST greater than 0.95 in some time intervals, with an optimal capacity less than zero and the obtained capacity equal zero, as shown in Figure 20.   obtained vs optimum capacity, PFINST and PFOBT, and the difference between PFOBT and PFDES, applying the TLBO algorithm every second. Figure 21 shows a PFINST greater than 0.95 in some time intervals, with an optimal capacity less than zero and the obtained capacity equal zero, as shown in Figure 20.   The difference between PFOBT and PFDES, for induction motors, is less than 0.03. The results obtained with the TLBO algorithm are applicable to these engines.

Cloud Data Logger
The previous tests reflect different time intervals, but in order to obtain the complete monitored of the industry, it is necessary to data stored during the whole period of operation of the equipment.
As an example, this section presents the evolution of the operation of the 1.5 kW motor during one week.
The data stores every second, which coincides with the time of completion of the measures. It is possible to modify the measurement interval depending on the monitoring needs. Also, data is available to download and visualize in the desired time interval. Figure 23 show the graphs in real time depending on the data uploaded during a week in GS. The difference between PFOBT and PFDES, for induction motors, is less than 0.03. The results obtained with the TLBO algorithm are applicable to these engines.

Cloud Data Logger
The previous tests reflect different time intervals, but in order to obtain the complete monitored of the industry, it is necessary to data stored during the whole period of operation of the equipment.
As an example, this section presents the evolution of the operation of the 1.5 kW motor during one week.
The data stores every second, which coincides with the time of completion of the measures. It is possible to modify the measurement interval depending on the monitoring needs. Also, data is available to download and visualize in the desired time interval. Figures 23 show the graphs in real time depending on the data uploaded during a week in GS.

App in Real Time
Finally, it has been tested the operation making use of the apps developed for Android systems. The application developed makes it possible to monitor the installation via Wi-Fi or 4G connection

App in Real Time
Finally, it has been tested the operation making use of the apps developed for Android systems. The application developed makes it possible to monitor the installation via Wi-Fi or 4G connection The app shows the last 160 values measured by compensation power factor, therefore, taking into account that the measurements are made every second, the last 160 measurements made that will correspond to the last 160 s of operation. In addition to the graphs, the spreadsheet shows the measured instant data The test was done on a Smartphone and Tablet. Following are screenshots of each of the capacity needed and calculated to different loads, shown in Figure 24.
The app shows the last 160 values measured by compensation power factor, therefore, taking into account that the measurements are made every second, the last 160 measurements made that will correspond to the last 160 seconds of operation. In addition to the graphs, the spreadsheet shows the measured instant data The test was done on a Smartphone and Tablet. Following are screenshots of each of the capacity needed and calculated to different loads, shown in Figure 24.

Conclusion
This project performs the design and implements the compensation power factor using TLBO, determines the best solution by CBO algorithm, and monitors the system in real-time using CDL. Results obtained with the TLBO algorithm, allow us to reduce the processing time of the measured data to achieve the best solution, that determines the switching of capacitors in order to compensate demand of excessive reactive power, thus bringing the power factor near to desired level by means of the CBO algorithm, the values of the optimal capacitors to obtain and install. The data stored in the cloud enables the analysis and improvement of the operation of the installation.
The model of PFCMS shown in this paper allows significant economic savings, both in equipment cost and wiring. That allows visualizing the electrical variables without needing to be present in the place where the measurements are being made.