## 1. Introduction

Energy harvesting is defined as the practice of capturing energy available in the environment as, for instance, sunlight [

1], heat [

2], movement [

3], and others, and converting it into electric energy to be stored or consumed [

4]. A common usage for the harvested energy is to power low-power electronic devices as sensors and microcontroller-based boards and some applications are, for example, wireless sensors networks for environmental monitoring [

5], aeronautics applications [

6], and photovoltaic panels monitoring [

7].

Thermal energy is one of most used sources in energy harvesting, because heat is generated by many applications and released in the environment [

8]. Many thermal sources have already been exploited, for example, body heat [

9], rooftops [

10], and aircraft [

11]. However, early evaluating the energy potential of a thermal source is a hard task if the source is located in a hard-to-access place.

In order to convert thermal energy into electric energy, generally, thermoelectric generators (TEGs) are used. A TEG is a device made of an array of

pn semiconductor junctions connected electrically in series and thermally in parallel by two ceramic plates [

12]. Thermal energy is converted into electric energy when a difference of temperature is on the TEG’s faces (the ceramic plates).

To early evaluate the energy-generating potential of thermal sources in a remote way, an emulation system capable of applying any thermal pattern onto a TEG and verifying the generated voltage was proposed in [

13]. The main contribution of this system is the online emulation, that is, while the difference of temperature is measured in the remote energy source to be tested, this difference of temperature is being emulated in a thermal platform in a laboratory located far away from the thermal source.

In [

13], a conventional Proportional-Integral-Derivative (PID) controller was projected to control a thermal emulation platform. Although more than 90% of the controllers used in the industrial sector are PID [

14], this type of controller is not suitable for non-linear and time variant systems [

15,

16], as an example the proposed platform [

17]. In this way, many research opportunities have taken place, such as: intelligent controllers [

18], adaptive [

19], hybrids [

20], etc. However, although these controllers can be implemented in other ways, implementations based on Fuzzy Logic are more effective, because control strategies lies on the designer experience [

21] instead of mathematical models. In addition, Fuzzy-based controllers are implemented with many inputs activating the outputs only when certain conditions are established, making Fuzzy Logic computationally efficient in the control of systems that presents non-linear and time variant behavior [

22,

23].

The main goal of this work is the development of a Fuzzy-PI system to control the thermal emulation platform described in [

13] in order to emulate remotely and optimally the thermal patterns obtained from an interesting thermal source, tree trunks [

5].

The main obtained results of this work are: (a) The development of a Fuzzy-PI controller to the platform capable of stabilizing the temperature onto TEG faces with a maximum steady state error equal to 0.091 ${}^{\circ}$C (53% less when compared with the steady state error obtained from the PID controller); (b) achievement of robustness to external disturbances and plant parameters variation; and (c) the capacity to emulate thermal patterns using an intelligent controller based on Fuzzy Logic.

This work is structured as follows: in

Section 2, the online thermal emulation system responsible for measuring the temperatures of a thermal source and emulating remotely are discussed. In

Section 3, the Fuzzy controller implementation is discussed, from the definition of input variables to the definitions of the rules. In

Section 4, validation tests of the proposed Fuzzy controller, and results analysis are shown. Finally, the final considerations are presented in

Section 5.

## 2. Proposed System

In [

13], a remote thermal emulation platform was presented that allows to acquire temperature values from a remote thermal source and, at the same time, to emulate these in laboratory. Then, the platform is very useful to early validate remotely the energy potential of hard-to-access sources. In

Figure 1, the platform diagram is shown. Its main components are:

- 1
Two temperature sensors to measure the remote thermal source: ${\mathrm{T}}_{1}^{\mathrm{meas}}$(t) and ${\mathrm{T}}_{2}^{\mathrm{meas}}$(t);

- 2
TX: RF radio transmitter;

- 3
RX: RF radio receiver;

- 4
Computer: run the Fuzzy controllers, using ${\mathrm{T}}_{1}^{\mathrm{meas}}$(t) and ${\mathrm{T}}_{2}^{\mathrm{meas}}$(t) as their set-points, and generate the actuating signals ${\mathrm{V}}_{1}^{\mathrm{ap}}$(t) and ${\mathrm{V}}_{2}^{\mathrm{ap}}$(t); and

- 5
Thermal platform: receive the

${\mathrm{V}}_{1}^{\mathrm{ap}}$(t) and

${\mathrm{V}}_{2}^{\mathrm{ap}}$(t) and, after passing through power drivers, apply them to the upper cooler (TEC

${}_{1}$) and the bottom cooler (TEC

${}_{2}$), respectively, resulting in the actual temperature, T

${}_{1}^{\mathrm{emu}}$(t) and T

${}_{2}^{\mathrm{emu}}$(t), that are applied onto the TEG-under-test faces. The TEG-under-test generates an electric voltage proportional to the temperature difference (

$\Delta \mathrm{T}\phantom{\rule{3.33333pt}{0ex}}=\phantom{\rule{3.33333pt}{0ex}}{\mathrm{T}}_{1}^{\mathrm{emu}}\left(\mathrm{t}\right)-{\mathrm{T}}_{2}^{\mathrm{emu}}\left(\mathrm{t}\right))$, as shown in the right side of the

Figure 2.

#### 2.1. Emulation Platform

The emulation platform was firstly proposed in [

24], the diagram and the physical structure of the platform is shown in

Figure 2 and

Figure 3, respectively. This platform features a symmetrical structure composed by two fans, two modules (TEC

${}_{1}$ and TEC

${}_{2}$), acting as thermoelectric coolers (TEC), and a module acting as a thermoelectric generator (the TEG-under-test or just TEG). Between each thermoelectric pair (TEC

${}_{1}$/TEG and TEG/TEC

${}_{2}$), there is a copper plate acting as a thermal reservoir, which conducts heat from/to a TEC to/from the TEG. The thermal reservoir works as thermal damp easing the control action. To measure temperature, 4 thermocouples have been used and they are placed on the surfaces of the upper and bottom faces of the thermal reservoirs.

The main proposal of this work was to improve the control of the variables T${}_{1}^{\mathrm{emu}}$(t) and T${}_{2}^{\mathrm{emu}}$(t) using two independent Fuzzy-PI controllers, one for each variable. As described earlier, the controller’s set-points are ${\mathrm{T}}_{1}^{\mathrm{meas}}$(t) and ${\mathrm{T}}_{2}^{\mathrm{meas}}$(t), and the proposed controllers act on the actuating voltage signal applied into the coolers TEC${}_{1}$ and TEC${}_{2}$, respectively, ${\mathrm{V}}_{1}^{\mathrm{ap}}$(t) and ${\mathrm{V}}_{2}^{\mathrm{ap}}$(t). The control system procedure was developed using LabView™ and the Data Acquisition (DAQ) Board PCIe-6321, by National Instruments.

#### 2.2. Fuzzy Controller

As discussed in [

17], Peltier cells suffer physical degradation in their life time. In this way, the parameters of a TEG, for instance, internal resistance, Seebeck coefficient, and thermal conductivity, vary along the time.

As a consequence, if a conventional PID controller is used to control the temperature levels on the TEG’s faces, the well known PID’s parameters

${K}_{p}$,

${K}_{i}$ and

${K}_{d}$, shown in Equation (

1) have to be periodically updated. Other observed issues in using a conventional PID controller is the presence of noise during the thermal emulation due to the ambient temperature variation and of electric noise due to the temperatures measurements.

Considering this scenario, a Fuzzy-PI controller is proposed to control T${}_{1}^{\mathrm{emu}}$(t) and T${}_{2}^{\mathrm{emu}}$(t). The controller has two input variables, namely, the temperature error, ${\mathrm{E}}_{\mathrm{i}\left(\mathrm{t}\right)}={\mathrm{T}}_{\mathrm{i}}^{\mathrm{meas}}\left(\mathrm{t}\right)-{\mathrm{T}}_{\mathrm{i}}^{\mathrm{emu}}\left(\mathrm{t}\right)$ and the error temperature variation, $\Delta {\mathrm{E}}_{\mathrm{i}\left(\mathrm{t}\right)}={\mathrm{E}}_{\mathrm{i}\left(\mathrm{t}\right)}-{\mathrm{E}}_{\mathrm{i}(\mathrm{t}}-\mathrm{T})$, where i =1, 2 (1 for the first Fuzzy controller and 2 for the second one) and T is the sampling period.

The Fuzzy controller output in an instant t is given by Equation (

2), providing an action of integration to the system.

## 3. Controller Implementation

In the project of a Fuzzy controller there are plenty of choices and options, different from conventional controllers. The configuration considering two inputs (error and error variation) showed up to be more frequently used, providing good results in many applications as, speed control to synchronous motors [

25] and DC motor [

26], gas turbine [

27], electromagnetic launchers [

28], hydraulic excavator [

29], and others.

Table 1 summarizes the studies on Fuzzy-PI controllers cited above.

On the other hand, the controller performance depends on adjustments that can be made by trial and error, or even using evolutionary strategies using genetic algorithm, for example. The main advantages of a Fuzzy controller is that: (1) The designer does not need to know the exact model of the system. (2) The Fuzzy controller is able to handle possible variations in the system. (3) The rules can be established using natural language based on the designer’s experience [

25]. In this section, the steps taken in order to implement the Fuzzy-PI temperature controller for the emulation platform are described. The steps were taken considering the Fuzzy diagram shown in

Figure 4.

#### 3.1. Range of the Variables

The first step to implement the proposed Fuzzy controller is the fuzzification of the input variables. As the chosen main application of the described thermal emulation platform is to harvest energy from tree trunks (

Smart Tree) [

5], two reference temperatures were considered, namely, the internal tree temperature in a depth of 100 mm and the external ambient temperature. In this case, two temperature sensors were installed into a tree trunk at the Federal University of Paraiba (UFPB), located in the city of João Pessoa, Brazil, a city near to the equator line.

The ranges of the controller variables are: (a) Temperature: it was considered that the temperatures can vary from 20

${}^{\circ}$C (

${T}_{min}\left(t\right)$) to 40

${}^{\circ}$C (

${T}_{max}\left(t\right)$); (b) temperature error: the range of the temperatures error was considered varying from −20

${}^{\circ}$C (

${T}_{min}\left(t\right)-{T}_{max}\left(t\right)$) to 20

${}^{\circ}$C (

${T}_{max}\left(t\right)-{T}_{min}\left(t\right)$); (c) temperature error variation: from the system behavior, it was verified that the maximum temperature error variation is 0.3

${}^{\circ}$C; (d) applied voltage variation: the output voltage can assume values from −10 V to 10 V, however, in order to have softer and more stable variations, the range of −3 V to 3 V was chosen.

Table 2 shows these values.

#### 3.2. Fuzzification

As the system is complex and non linear, the input and output variables were grouped in seven different categories in order to make the system more robust, namely: Positive big (PB), medium (PM), positive small (PS); zero (Z); negative big (NB), negative medium (NM), and negative small (NS). The numerical limits to each category were defined considering the previous knowledge about the platform behavior, and the chosen membership function was the triangular one, since it is one of the most popular [

30] mainly because of its advantage of simplicity using straight lines.

Specifically, the sets according to the defined categories are:

The fuzzified variables are shown in

Figure 5.

#### 3.3. Rules Determination

In order to define the Fuzzy rules, the response of an undamped system was considered.

Figure 6 shows some particular cases of situations that can occur in the system.

The rules were extracted considering the points shown in

Figure 6 and are the following: A1: the error is positive and big (PB) and the variation is null (Z), so the voltage variation should be positive and big (PB); B1: the error is null (Z) and the variation is positive and big (PB), so the voltage variation should be negative and big (NB) to decrease the variation; C1: the error is negative and big (NB) and the variation is null (Z), so the voltage should be negative and big (NB); D1: The error is null (Z) and the variation is negative and big (NB), so the voltage variation should be positive and big. For the the remaining points, the logic was the same, obtaining the rules described in the

Table 3.

#### 3.4. Defuzzification

From the rules, the defuzzification process was done using the Center of Area method.

Figure 7 shows a surface with error and error variation as the inputs and the voltage variation as the output (

$\Delta {V}_{i}^{ap}\left(t\right)=f({E}_{i}\left(t\right),\Delta {E}_{i}\left(t\right))$), and

Figure 8 shows an upper view of the surface.

In

Figure 7, the surface can be divided in sub-regions, namely: (a)

**Saturation region**: the surface has two regions of saturation (negative saturation in blue and positive saturation in yellow) with values equal to

$\pm 3\mathrm{V}$. The output of the system reaches this values when the error or/and the voltage variation are far away from zero; (b)

**Steady region**: this region is indicated in light blue and represents the state where the voltage variation is almost null. This occurs when the error is very small or when the error is relatively high, but the error variation is already big enough; and (c)

**Convergence region**: this region indicates the other cases, when the system is operating in the intermediate regions in order to reach the surface center.

## 4. Results

Using the thermal emulation platform, 3 distinct experiments were carried out in order to compare the efficiency of the proposed Fuzzy controller with a conventional PID controller. The gains of the PID controller were obtained using Ziegler–Nichols method followed by small adjustments, the optimum parameters were obtained comparing the steps responses of the adjusted gains. The experiments are: (a) Step response: temperature steps were applied into the system and the temporal response was verified; (b) perturbation: an external perturbation was applied into the system and the response of the controller was verified; (c) online emulation experiment: the thermal platform was used to emulate a thermal pattern in an remote way, the thermal patterns are composed by two temperatures, the internal temperature of a tree trunk in a depth of 100 mm and the external temperature.

#### 4.1. Step Response

To compare the behavior of the controllers, temperature steps were applied into one face of the TEG, while the temperature in the other face was constant. Then, the main parameters of a step response were obtained from both controllers. The results obtained from the Fuzzy controller and the conventional PID controller are shown in

Figure 9 and

Figure 10, respectively.

The results obtained from a temperature variation from 32

${}^{\circ}$C to 35

${}^{\circ}$C are described in

Table 4. It can be seen that, for the Fuzzy controller, a settling time (

${T}_{s}$) equal to 78 s was obtained, while the

${T}_{s}$ for the PID controller was 189 s. The maximum steady state error was 0.091

${}^{\circ}$C for the Fuzzy controller, while the maximum steady state error for the PID controller was 0.17

${}^{\circ}$C. Thus, the Fuzzy controller was faster and more accurate than the conventional PID controller.

#### 4.2. Perturbation Experiment

To evaluate the robustness of the Fuzzy controller against external perturbations, the following procedure was done for both controllers.

After the system reached equilibrium at room temperature, a temperature set-point equal to 32 ${}^{\circ}$C was defined onto one face of the TEG;

After the system reached the steady state, a cooler fan, placed very near to the platform, was turned on;

By convection, the cooler fan introduces an external perturbation into the system.

The complete experiment is shown in

Figure 11 and

Figure 12, considering the Fuzzy and PID controllers, respectively. Considering the Fuzzy controller, it can be observed that, when the fan cooler is turned on at t = 263 s, there was a high temperature variation because of the convection. However, the projected Fuzzy controller was robust enough to compensate this perturbation. Considering the PID controller, the cooler was turned on at t = 313 s, and as it can be seen that the system takes almost 50 s to return to the steady state condition, proving that the Fuzzy controller is more suitable to deal with external perturbations.

#### 4.3. Online Emulation

Using the complete system proposed in

Section 2, a thermal pattern was obtained and emulated in an remote way using the PID controller as described in [

13], then the same pattern was applied into the Fuzzy controller. This thermal pattern is composed of two temperature signals, namely: the internal temperature into a tree trunk at 100 mm depth (

${\mathrm{T}}_{1}^{\mathrm{meas}}$(t)) and the external temperature (

${\mathrm{T}}_{2}^{\mathrm{meas}}$(t)). After, this thermal pattern was emulated in an remote way, obtaining T

${}_{1}^{\mathrm{emu}}$(t) and T

${}_{2}^{\mathrm{emu}}$(t). The results are showed in

Figure 13 and

Figure 14.

In order to evaluate the controllers’ performance, the root mean square error (RMSE) was calculated using the Equation (

3), where

N is the total number of samples and

T is the sampling time.

Considering the internal emulated temperature (upper face), an RMSE equal to 0.04

${}^{\circ}$C and 0.07

${}^{\circ}$C were obtained by the Fuzzy controller and by the PID controller, respectively. Considering the external emulated temperature (bottom face), an RMSE equal to 0.15

${}^{\circ}$C and 0.14

${}^{\circ}$C were obtained by Fuzzy controller and by the PID controller, respectively. Although the RMSE considering the external temperature was 6.7% higher in the Fuzzy controller compared to the PID, the RMSE obtained from the Fuzzy controller was 57% smaller than the PID for the internal temperature emulation. This result is very reasonable considering that the temperature sensor responses are acquired with a sampling rate set up by a 12-bit ADC and transmitted by radio and, as a result, with the 12-bit ADC at 3.3 V reference voltage, the achieved overall resolution is 0.08

${}^{\circ}$C [

13].

Moreover, it can be seen in

Figure 15 the error’s distribution,

${E}_{1,2}\left(t\right)={T}_{1,2}^{meas}\left(t\right)-{T}_{1,2}^{emu}\left(t\right)$, related to the emulated temperatures in the

Figure 13 and

Figure 14, considering both controllers. In these histograms, all the 2523 samples were taken into consideration.

It can be seen that, for the internal temperature (upper face), the errors in both controllers are well distributed forming the shape of a Gaussian function. The mean value of the error distribution ($\mu $) was −0.004 ${}^{\circ}$C by the Fuzzy controller and 0.011 ${}^{\circ}$C by the PID controller. Considering the standard deviation ($\sigma $), a value equal to 0.037 ${}^{\circ}$C was obtained by the Fuzzy controller and 0.069 ${}^{\circ}$C by the PID.

Considering the external temperature (bottom face), the error in the Fuzzy controller was well distributed forming the shape of a Gaussian function, but this was not true when the PID controller was taken into consideration. The mean value of the Fuzzy controller’s error distribution ($\mu $) was almost 0.000 ${}^{\circ}$C and 0.011 ${}^{\circ}$C by the PID controller. Thus, a standard deviation ($\sigma $) equal to 0.151 ${}^{\circ}$C was obtained by the Fuzzy controller and 0.138 ${}^{\circ}$C by the PID.

The results are summarized in

Table 5 and

Table 6. As it can be seen, the performance of the Fuzzy controller in the online emulation is better than the PID.

## 5. Conclusions

In this work, Fuzzy controllers were proposed in order to control two distinct temperature levels in a system capable of emulating thermal patterns in a remote way. The obtained results show that the Fuzzy controller achieves a steady state error 53% smaller and a settling time 41.26% smaller when compared with a conventional PID controller. In addition, the proposed Fuzzy controller was robust enough to correct variations caused by external factors as, for example, variations at room temperature and convection. Considering thermal emulation, it was observed that the changes in the system dynamics introduced by the controller made the emulation more reliable, with an RMSE equal to 0.04 ${}^{\circ}$C and 0.15 ${}^{\circ}$C for the upper face and bottom face, respectively. Therefore, the Fuzzy controller shows up to be more suitable to the proposed application. As future work, the Fuzzy controller rules will be extracted automatically using neuro-fuzzy techniques, because one of the main limitations of the proposed approach is that the rules extraction depends exclusively on the designer’s knowledge.