Keywords

1 Introduction

Developments in optimal control theory, robust control and adaptive control have expanded significantly the automation concept and the feasibility of automatic control in practice. However, these techniques rely on mathematical models for the plant and controllers.

On the other hand, intelligent control techniques try to control actions without resorting to complete or partial mathematical models. Otherwise, the ability of a human to find solutions to a particular problem is known as human intelligence. In short, human beings are able to deal with complicated processes based on inaccurate and/or approximate information. The strategy adopted by them is also of imprecise nature and usually capable of being expressed in linguistic terms. Thus, by means of Fuzzy Logic concepts, it is possible to model this type of information [1].

Artificial Intelligence (AI) has applications in various areas of knowledge, such as mathematical biology, neuroscience, computer science and others. The research area of intelligent computational systems aims to develop methods that try to mimic or approach the capabilities of humans to solve problems. These new methods seek to emulate human’s abilities to cope with very complex processes, based on inaccurate and/or approximated information.

In general, Fuzzy Cognitive Map (FCM) is a tool for modeling the human knowledge. It can be obtained through linguistic terms, inherent to Fuzzy Systems, but with a structure similar to the Artificial Neural Networks (ANN), which facilitates data processing, and has capabilities for training and adaptation. FCM is a technique based on the knowledge that inherits characteristics of Cognitive Maps and Artificial Neural Networks [24], with applications in different areas of knowledge and applications [510]. Besides the advantages and characteristics inherited from these primary techniques, FCM was originally proposed as a tool to build models or cognitive maps in various fields of knowledge. It makes the tool easier to abstract the information necessary for modeling complex systems, which are similar in the construction to the human reasoning. Dynamic Fuzzy Cognitive Maps (DFCM), need to be developed to model and manage behaviors of non-linear time-dependent system and often in real time. Examples of different DFCMs can be found in the recent literature, e.g., [1014].

This paper has two objectives. First objective is the development of two controllers using an acyclic DFCM with same knowledge as this of Fuzzy Controller, and with similar heuristic, thus producing comparable simulated results. Second aim is to show an embedded DFCM in the low cost and processing microcontroller Arduino.

To succeed the goals, we initially use the similar DFCM proposed in [11] to control an industrial mixing tank. In contrary to [11], we use a Hebbian algorithm to dynamically adapt the DFCM weights. In order to validate our DFCM controller, we compared its performance with a Fuzzy Logic Controller. This comparison is carried out with simulated data.

2 Development

To demonstrate the evolution of the proposed technique (DFCM) we will use a case study well known in the literature as seen in [3, 15, 16] and others. This case was selected to illustrate the need for refinement of a model based on FCM built exclusively with knowledge. The process shown in Fig. 1 consists of a tank with two inlet valves for different liquids, a mixer, and an outlet valve for removal of liquid produced by mixing and specific gravity meter that measures the specific gravity of the produced liquid. In this research, to illustrate and exemplify the operation of the industrial mixer, the liquids are water with specific gravity 1 and soybean oil with a specific gravity of about 0.9.

Fig. 1
figure 1

Mixer Tank (Source adapted from [17])

Valves (V1) and (V2) insert two different liquids (specific gravities) in the tank. During the reaction of the two liquids, a new liquid characterized by it’s a new specific gravity value is produced. At this time the valve (V3) empties the tank in accordance with a campaign output flow, but the liquid mixture should be in the specified levels of the volume and specific gravity.

Although relatively simple, this process is a TITO (Two Inputs Two Outputs) type with coupled variables. To establish the quality of the control system of the produced fluid, a weighting machine placed in the tank measures the (specific gravity) produced liquid.

When the value of the measured variable G (liquid mass) reaches the range of values between the maximum and minimum [Gmin, Gmax] specified, the desired mixed liquid is ready. The removal of liquid is only possible when the volume (V) is in a specified range between the values [Vmin and Vmax]. The control consists to keep these two variables in their operating ranges, as:

$$ {\text{V}}_{ \hbox{min} }\, < \,{\text{V}}\, <\, {\text{V}}_{ \hbox{max} } $$
(1)
$$ {\text{G}}_{ \hbox{min} } \, < \,{\text{G}}\, < \,{\text{G}}_{{{ \hbox{max} }.}} $$
(2)

In this study was tried to limit these values from approximately the range of 800–850 mg for the mass and approximately the range of 850–900 ml for the volume. The initial values for mass and volume are 800 mg and 850 ml respectively. According to Papageorgiou et al. [18], through the observation and analysis of operation of the process is possible for experts to define a list of key concepts related to physical quantities involved. The concepts and cognitive model are:

  • Concept 1—State of the valve 1 (closed, open or partially open).

  • Concept 2—State of the valve 2 (closed, open or partially open).

  • Concept 3—State of the valve 3 (closed, open or partially open).

  • Concept 4—quantity of mixture (volume) in the tank, which depends on the operational state of the valves V1, V2 and V3.

  • Concept 5—value measured by the G sensor for the specific gravity of the liquid.

Considering the initial proposed evolution for FCM we use a DFCM to control the mixer which should maintain levels of volume and mass within specified limits.

The process model uses the mass conservation principle to derive a set of differential equations representing the process used to test the DFCM controller. As a result the tank volume is the volume over the initial input flow of the intake valves V1 and V2 minus the outflow valve V3, this valve V3 and the output campaign was introduced in this work for increase the complexity original process [17]. Similarly, the mass of the tank follows the same principle as shown below. The values used for me1 and me2 were 1.0 and 0.9, respectively.

$$ {\text{V}}_{\text{tank}} = {\text{V}}_{\text{i}} + {\text{V}}_{1} + {\text{V}}_{2} - {\text{V}}_{3} $$
(3)
$$ Weight_{tank} = \left. {M_{i} + (V_{1} m_{e1} } \right) + \left( {V_{2} m_{e2} } \right) - M_{out} $$
(4)

3 Fuzzy Controller Development

To establish a correlation and a future comparison between techniques, a Fuzzy Controller was also developed. The Fuzzy rule base uses the same heuristic control strategy and conditions.

Fuzzy Control is a technique used for decades, especially in process control [1]. It is a motivation for DFCM validation, and this study uses a same knowledge for two controllers, with two different formalisms. It isn’t scope discuss the development of the Fuzzy Controller. But, some details of structure are pertinent functions are triangles and trapezoidal and 6 rules are considered in its base. The surface of this controller is showed in Fig. 2. Moreover, the rules are symmetric and similar by two output valves; in this specific case the surface of valve 2 are same as in valve 1. The base rules are:

Fig. 2
figure 2

Fuzzy controller surfaces, V1 and V2

  1. 1.

    If (Level is low) or (Valve Out is high) then (V1 is high) and (V2 is high)

  2. 2.

    If (Level is medium) or (Valve Out is medium) then (V1 is medium) and (V2 is medium)

  3. 3.

    If (Level is high) or (Valve Out is low) then (V1 is low) and (V2 is low)

  4. 4.

    If (Weight is low) or (Valve Out is high) then (V1 is high) and (V2 is high)

  5. 5.

    If (Weight is medium) or (Valve Out is medium) then (V1 is medium) and (V2 is medium)

  6. 6.

    If (Weight is high) or (Valve Out is low) then (V1 is low) and (V2 is low)

4 DFCM Development

The structure of the DFCM controllers is similar to the developed Fuzzy Controllers, using same heuristics, e.g., in case the output valve (V3, in accordance to Fig. 1) increases, the inputs valves (V1 and V2) increase too. In other hand, in case volume and weights of the mixture increase, the input valves decrease. For example, the relationships W54 and W53, in the DFCM, are similar in effects or control actions of the Fuzzy Controller’s base rules.

The development of the DFCM is made through three distinct stages. First, the DFCM is developed as structure, concepts and causal relationships, similar to a classic FCM, where concepts and causal relationships are identified through sensors and actuators of the process. The concepts can be variables and/or control actions, as already mentioned. The output valve is defined by a positive relationship, i.e., when the campaign increases, the output (V3) flow also increases, similarly, the input valves increase too. Moreover, when Volume Mixture and Weight Mixture increase, V1 and V2 decrease. In both cases the flow of the valves increases or decreases proportionally. The second development stage is the benchmark well-known Genetic Algorithm [19]. The Fig. 3 shows the schematic graph of a DFCM controller.

Fig. 3
figure 3

DFCM controller

In this research, details of the G.A. are: the initial values of causal relationships are determined through genetic algorithms. The genetic algorithm used is a conventional one, with a population of 20 individuals, simple crossing and approximately 1 % of mutation. The chromosomes were generated by real numbers with all the DFCM weights, individuals were random and the initial method of classification was the tournament method with 3 individuals. Finally, the fitness function for simplicity considers the overall error of the two desired outputs.

Figure 4 shows an evolution; with 60 generations of the Genetic Algorithm proposed, it stabilizes and reaches the initial solution for the opening of the valves, approximately 42 %. It was obtained different generation values as the results, e.g., 45, 57, and 60 (which was the chosen value in this work); due G.A. being a classic random search method, used in this work. Table 1 shows initial values of the DFCM weighs. Different proposals and variations of this method applied in tuning FCM can be found [13].

Fig. 4
figure 4

Evolution of the weights in the genetic algorithm

Table 1 Initials casual relationship weights

The third stage of the DFCM development concerns the-line tuning or refinement of the model for dynamic response of the controller. In this case, when a change of output set-point in the campaign occurs, the weights of the causal relationships are dynamically tuned. To perform this function a new kind of concept and relation was included in the cognitive model.

In order to dynamically adapt the DFCM weights we used the Hebbian Learning algorithm for FCM that is an adaptation of the classic Hebbian method [2]. Different proposals and variations of this method applied in tuning or in learning for FCM are known in the literature [12]. In this paper, the method is used to update the intensity of causal relationships in a deterministic way according to the variation or error in the intensity of the concept or input variable. Specifically, the application of Hebb learning provides control actions as follows: if the weight or volume of the liquid mix increases, the intake valves have a causal relationship negatively intensified and tend to close more quickly. Conversely, if the volume or weight mixture decreases, the intake valves have a causal relationship positively intensified. The mathematical equation is presented in (5).

$$ W_{i} (k) = W_{ij} \left( {k - 1} \right) \,\pm\, \gamma\Delta A_{i} $$
(5)

where: ∆Ai is the concept variation resulting from causal relationship, and it is given by ∆Ai = Ai(k) − Ai(k − 1), γ is the learning rate at iteration k.

This version of the Hebbian algorithm is an evolution of the two proposals of Matsumoto et al. [20].

Causal relationships that have negative causality has negative sign and similarly to positive causal relationships. The equations applied in this work are adapted of the original version.

$$ W_{i} \left( k \right) = k_{p}\, *\,(W_{ij} \left( {k - 1} \right) - \gamma \,*\,\Delta A_{i} ) $$
(6)

where: γ = 1 for all, and kp is different for every weights pairs. It is had their assigned values empirically by observing the dynamics of process performance, recursive method, kp = 40 for (W14; W23), kp = 18 for (W13; W24) and kp = 2.5 for (W53; W54), with normalized values.

The DFCM inference is similar to Classic FCM [2], and the inference equations are shown below (Eqs. 7 and 8).

$$ {\text{A}}_{\text{i}} = \int {\left( {\mathop \sum \limits_{{\begin{array}{*{20}c} {j = 1} \\ {j \ne i} \\ \end{array} }}^{\text{n}} \left( {{\text{A}}_{\text{j}} \times {\text{W}}_{\text{ji}} } \right)} \right) + {\text{A}}_{\text{i}}^{\text{previous}} } $$
(7)
$$ {\text{f}}\left( {\text{x}} \right) = \frac{1}{{1 + {\text{e}}^{{ -\uplambda{\text{x}}}} }} $$
(8)

Figure 5 shows the results of Hebbian Learning Algorithm for FCM considering the variations ΔAi of the concepts concerning volume, weight and outlet valve, while in the is displayed the weights of the causal relationship in the process. This figure also shows the evolution of the weights of the causal relationships during the process into a range FCM definition [−1, 1].

Fig. 5
figure 5

Evolution of the weights in the Hebbian Learning

5 Simulated Experimental Results

The results of DFCM are shown in Fig. 6, which show the behavior of the controlled variables within the predetermined range for the volume and the weight of the mixture. It is noteworthy that the controller keeps the variables in the control range and pursues a trajectory according to a campaign, where the output flow is also predetermined. In this initial experiment, a campaign with a sequence of values ranging from 7, 5 and 11 ml/min can be seen as a set-point output flow (outlet valve). Similarly, the results of the Fuzzy Controller are shown in Fig. 7.

Fig. 6
figure 6

Valves and results of the DFCM controller

Fig. 7
figure 7

Valves and results of the fuzzy controller

Table 2 shows that the simulated numeric results of the DFCM controller had a similar performance compared to the conventional Fuzzy Logic Controller, and DFCM embedded in Arduino with low difference in same conditions, with noise and with disturb (instant locked valve).

Table 2 Quantitative results

In order to extend the applicability of this work, the developed DFCM controller is embedded into an Arduino platform which ensures the portability of the FCM generated code. Arduino is an open-source electronics prototyping platform which uses ATMega® series microcontrollers.

The equations for level and weight are calculated by Matlab simulating the process. Through a serial communication established with Arduino, Matlab sends the current values of Volume, weight and output valve to Arduino that receives these data, calculates the values of the concept 1 (valve 1) and concept 2 (valve 2) and then returns these data to Matlab. After this, new values of Volume and Weight are recalculated. Details on how this technique can be used are presented in Matlab Tutorial and Arduino codes, by accessing the link [21]. The cycle of communication between Arduino to Matlab can be checked in [20].

Figure 8 shows the results obtained with the Arduino platform providing data of the actuators, Valve 1 and Valve 2, with Matlab performing data acquisition. The algorithm switches the sets of causal relations that operate similarly to a DFCM simulated with noise and disturb in the valve 1. The noise in Fig. 8 is the sum of the real noise, observed in data transference between Arduino and Matlab, plus a simulated white noise. Equation (9) shows the composition of the experiment noise.

$$ Noise_{Experiment} = Noise_{Simulated} + Noise_{{Arduino-Matlab}} $$
(9)
Fig. 8
figure 8

Valves and results of the DFCM embedded in Arduino

6 Conclusions

The contribution of this study focuses on the introduction of Fuzzy Cognitive Maps in the embedded control area. In simulated data, the results are similar for the two controllers, with small advantage for DFCM with or without Arduino, observed that DFCM Controller is adaptive. From the data obtained from Arduino Microcontroller, based on the variations of the DFCM embedded in the platform, it is observed that the controlled variables were in well-behaved ranges, which suggests that the DFCM codes have low computational complexity due to the simplicity of its inference mathematical processing. Thus, we can emphasize the portability and the possibility of developing DFCM controllers on low cost platforms. In short, this work showed that DFCM can be embedded.

Future studies will address more simulations with different campaigns, for a more general conclusion. Other methods of dynamic adaptation can be used for comparison ground, e.g., Reinforcement Learning for DFCM.