A metamorphic controller for plant control system design

One of the major problems in the design of industrial control systems is the selection and parameterization of the control algorithm. In practice, the most common solution is the PI (proportional-integral) controller, which is simple to implement, but is not always the best control strategy. The use of more advanced controllers may result in a better efficiency of the control system. However, the implementation of advanced control algorithms is more time-consuming and requires specialized knowledge from control engineers. To overcome these problems and to support control engineers at the controller design stage, the paper describes a tool, i.e., a metamorphic controller with extended functionality, for selection and implementation of the most suitable control algorithm. In comparison to existing solutions, the main advantage of the metamorphic controller is its possibility of changing the control algorithm. In turn, the candidate algorithms can be tested through simulations and the total time needed to perform all simulations can be less than a few minutes, which is less than or comparable to the design time in the concurrent design approach. Moreover, the use of well-known tuning procedures, makes the system easy to understand and operate even by inexperienced control engineers. The application was implemented in the real industrial programmable logic controller (PLC) and tested with linear and nonlinear virtual plants. The obtained simulation results confirm that the change of the control algorithm allows the control objectives to be achieved at lower costs and in less time.


Introduction
In order to achieve reproducible product properties, but also to minimize production costs and the influence of human factor, which can be a source of errors, it is necessary to design and use control systems.It is especially important for continuous processes in the chemical, biotechnological or food industry, where the main task of control systems is to maintain key process parameters at desired levels.
The synthesis of the control system requires coop-eration between a process engineer and control engineers (experts), because the experts, being more experienced, posses sufficient knowledge to determine the controller structure and to tune its parameters in order to fulfill the control objectives (Groover, 2007;Seborg et al., 2010).In practice, the choice of the control algorithm depends on the simplicity of its implementation and the required knowledge of its operation.For these reasons, the most common industrial controller is the PID (proportional-integral-derivative) controller or its simplified form (the PI controller) without the derivative action (Li et al., 2006b;Kasprzyczak andMacha, 2008, 2015;Yu, 2006).In the case of more advanced control algorithms such as Fuzzy Logic Control (Budzan and Wyzgolik, 2014), B-BAC (Balance-Based Adaptive Control) (Czeczot, 2006) or a class of predictive controllers (e.g., DMC Dynamic Matrix Control or PFC Predictive Functional Control) (Laszczyk, 2001;Laszczyk et al., 2013), it is possible to achieve higher quality of control than in the case of using the classical PID controller.In other words, the formulated control objectives can be achieved at lower costs and in less time.However, the implementation of the advanced controllers is more difficult and requires more extensive knowledge (Figure 1a).One of the possibilities is to find an expert that is able to choose, implement and tune the most suitable control algorithm as the alternative to the classical PI controller.But in majority of cases, the experts usually specialize only in one type of the controller.Hence, to implement various control algorithms, it would be necessary to employ more experts.Depending on the control objectives and specified constraints, the experts would have to cooperate with each other to determine which type of the control algorithm to choose and how to tune its parameters (Figure 1b).
A great advantage of this approach is that the optional control algorithms can be implemented and tested concurrently based on a mathematical model of the controlled plant (Figure 1b).As a result, it is possible to reduce design time and to obtain the optimal controller structure.
However, such solution is often unacceptable in industrial practice because hiring more experts increases the overall costs.In effect, the performance of the majority of industrial control systems is not optimal (Eriksson and Isaksson, 1994;Hägglund, 1995;Huang et al., 1997).
Currently, the simulation techniques are becoming more popular in the design of control systems (Groover, 2007;Stebel and Metzger, 2012).Especially useful is the virtual commissioning technology in the design of manufacturing systems (Fratczak et al., 2013;Kim et al., 2011;Ko et al., 2013a,b;Ko and Park, 2014;Koo et al., 2011;Lee and Park, 2014), but also continuous processes (Barth and Fay, 2013;Bradu et al., 2009;Geist et al., 2013;Gerlach et al., 2013), where a real controller is tested through simulations with a virtual plant.Another possibility is to use supporting applications and tools that are offered by many manufacturers of the control equipment.One of the main tasks of these tools is to tune the controller according to some rules for the desired operating point (Li et al., 2006a) as shown, for instance, in Super Control software proposed by Yokogawa Electric Corporation that is based on fuzzy logic (Wilson and Callen, 2004), or Modular PID Control proposed by Siemens that provides tools for optimal parameterization of the PID controller.
However, the functionalities of these tools are usually limited to the parameterization of one type of controller, usually the PID control algorithm, with no possibilities of changing its structure.Because the stiff controller structure may limit the performance of the whole control system, therefore, the possibility of switching between various control algorithms may result in a better quality of control and lower costs.For these reasons, the multifunctional software PC7 Siemens, for example, provides supporting tools for implementation of both the PID controller and model predictive control (MPC) algorithm.Nonetheless, it does not support the control engineer in the selection of the control algorithm.In turn, to reduce design time and costs, the tool has to provide possibilities for parallel design as in the group of cooperating experts.
To face these problems, a tool, i.e., a metamorphic controller with extended functionality, is proposed in this paper that can replace the group of cooperating experts (Figure 1c).In effect, only one control engineer operating the metamorphic controller and cooperating with the process engineer, is enough to select the optimal controller.Moreover, the control engineer does not have to possess knowledge on how to implement and how to select the optimal control algorithm for a desired operating point of the process.The presented tool can also be helpful in normal operation of the plant, whenever the operating point of the process has to be changed.The proposed solution has been implemented and tested on a real industrial programmable logic controller (PLC).The next section describes the basic properties of the supporting software and its role in the control system design.The third section presents the idea of the metamorphic controller and the fourth section gives the implementation details.The fifth section presents the effectiveness of the proposed solution in comparison to the classical control algorithm (the PI controller).Finally, conclusions and future works are presented in the last section of the paper.sured inside the tank, and SP is a desired temperature of water.The controller will be changing the temperature, for example, by means of an electric heater, to minimize the control error.As mentioned in the introduction, the controller selection and its parameterization are fundamental problems at the controller design stage.Hence, the manufacturers of control equipment offer additional tools and supporting applications (intended mainly for the PID controllers) to facilitate the designing process.
To make the supporting tool useful and easy in operation for a wide spectrum of users, it must be based on well-known controller design methods.Therefore, most of these tools use a mathematical model of the controlled plant, which can be determined from mass and energy balances or, in a simplified manner, from step response of the plant for a given operating point (Gyöngy and Clarke, 2006).The latter approach is more preferable by control engineers, since the mathematical description of the controlled plant is simplified, can be easily derived, and is well-understood, even by inexperienced control engineers.In this case, a wide class of continuous industrial processes can be described by the first order plus time delay (FOPTD) model (Seborg et al., 2010) in the form of transfer function: where: s -complex variable in the Laplace domain, T -overall time constant, T 0 -time delay, k -plant gain.
The overall time constant T determines the response time of the plant to a change in its input signals, while the time delay T 0 determines the delay in response to the input signals.In turn, the plant gain k describes static properties of the controlled plant.For instance, in the water tank example, the larger the volume of water, the larger the overall time constant.In other words, it takes more time to reach new steady state or another operating point of the system, i.e., the new temperature of water followed by an increase or decrease of the heating power.And, if the plant gain is small it means that the water tank system will require more heating power to increase the temperature of water.Because these parameters describe static and dynamic behavior of the plant, they are crucial in parameterization of the controller, and the FOPTD model ( 1) is the basis for most tuning procedures that are based on the step response of the plant.It should be emphasized here that the FOPTD model is a linear approximation of the nonlinear plant around an operating point of the system, which is strictly determined by the input and output signals of the plant.Therefore, the parameter values in (1) may significantly differ for other operating points of the system.In turn, the choice of the operating point is dependent on the current control goals and technological requirements.
Irrespective of the selected control algorithm, the behavior of the control system is dependent on the controller parameters.Figure 2 presents three typical responses of the control system to a step change in the SP for three various sets of the controller parameters.
The maximum difference between P V max and a new steady state value defines the overshoot value (Figure 2), which can be used as a performance criterion in the controller designing problem, for instance, no over- shoot or overshoot less than 25%.Another important parameter is the settling time, which is defined as a time needed to achieve a new steady state with a specified accuracy (Figure 2).The settling time can also be used in controller tuning procedures.Hence, depending on the controller parameters, a new steady state can be achieved either quickly with overshoots (damped oscillations), which is more energetically expensive and increases wear on control equipment, or without overshoots (non-oscillatory response) for longer settling times.The critical case is a borderline case between the oscillatory and non-oscillatory responses.If the control system behavior and its performance can be described mathematically in a simple way, then the supporting tool will allow for use of the advanced control algorithms without having extensive knowledge in the field.Additionally, if the candidate control algorithms can be tested concurrently, then the supporting tool can replace the group of cooperating experts as shown in Figure 1.The answer is a metamorphic controller with extended functionality that allows for selection of the optimal control algorithm depending on the current control goals.The idea of the metamorphic controller and implementation details on the industrial PLC are presented in the next sections.

The idea of metamorphic controller
In comparison to existing supporting tools, the main advantage of the metamorphic controller is its possibil-ity of changing the control algorithm.In the literature, the problem of switching between several controllers is generally known.For example, metamorphic controllers developed for the manufacturing systems have been described in Balasubramanian et al. (2001); Xu et al. (2002).In this case, the adaptation of the controller structure (its metamorphosis) results from constant changes in the manufacturing environment.The selection of a proper control algorithm can also be realized with the help of fuzzy logic rules.Such an approach was proposed in Abdullah et al. (2008) for autonomous vehicle control.In turn, the selection of the most suitable control algorithm presented in Paul et al. (2005); Wang et al. (2007) was realized by minimizing a criterion function.In the presented paper, the selection of the control algorithm depends on the desired operating point and behavior of the control system (Figure 2).The understanding of the control system behavior allows for translating the control objectives and constraints, such as energy expenditure, into a mathematical language which can be understood by the metamorphic controller.This can be achieved by means of performance indices, which characterize the behavior of the control system.In the presented case, three basic performance indices were taken into account: IAE (Integral of the Absolute Error), ITAE (Integral of Time multiplied by the Absolute Error), ISE (Integral Square Error) and their definitions are as follows (Davendra et al., 2010): where: e -control error at instant t, T f -final instant (dependent on the settling time).
The IAE index ensures small overshoots, the ITAE gives similar results as IAE, but weights error with time and ensures fast transients, i.e., relatively short settling times, in turn, the ISE index is a compromise between sufficiently fast transients and small overshoots (Davendra et al., 2010).
Depending on the control objectives and constrains, the idea is to test several candidate controllers with the FOPTD plant model (Figure 3).Then, the metamorphic controller selects the algorithm associated with the smallest value of the performance index.
As in many existing tools and applications, the metamorphic controller uses the FOPTD model (1) in tuning procedures.Figure 4 presents the basic units of the metamorphic controller that extend its functionality.The additional function units are responsible  (Laszczyk et al., 2012;Laszczyk and Czeczot, 2012)).In turn, for the DMC algorithm, it is not possible to find equivalent parameters.The DMC controller belongs to the family of predictive controllers and has a completely different structure than the PI controller.In this case, the tuning parameters of the DMC algorithm were chosen according to the rules given in (Laszczyk et al., 2013) to obtain fast responses of the closed-loop system that are similar to the responses of the control system with the PI controller.

Implementation of the metamorphic controller in the PLC
The application of the metamorphic controller was implemented and tested in the industrial PLC Siemens S7-300 series (Szczypka, 2011).The interaction with the metamorphic controller is realized by means of a human machine interface (HMI) application created in the Siemens ProTool software installed on a computer and connected to the real PLC via the Ethernet network.The implemented application is composed of several functions (FC) and function blocks (FB) according to the IEC 61499 standard (Vyatkin, 2012), which is suitable for the design of distributed control systems and multi-agent-based systems.In the presented case, the functions may contain function blocks with additional DataBlocks (DB) to store parameters values for the next call of the FB.According to the IEC 61499 standard, there is a distinction between data and event inputs in each function or function block.For instance, once the calculations in FC1 are finished, the function FC8 receives the acknowledgement signal from FC1 and data (Figure 5).At the beginning of the whole procedure, the control engineer specifies a new operating point (a SP value) of the plant, the performance index, and the initial amplitude of the CV signal for model identification purposes.Then, the controller selection procedure, which is a sequence of consecutive steps (Figure 5), starts.Figure 6 presents the list of all functions and function blocks used in the implemented application.
Step 1. Initialization of parameters -parameters entered by the control engineer are assigned to variables in the function FC6.
Step response of the plant -the function FC2 uses the initial amplitude of the CV to obtain the step response of the plant.At controller design stage, the step response can be obtained from the mathematical model of the plant.During normal operation of the control system, the step response can be obtained either from the real plant or from its model.The former case gives accurate data, but due to long settling times (even up to several hours), this approach may be useless in practice.In this paper, the real plant is replaced by its mathematical model and implemented by means of function blocks: FB3 (model of delay), FB7 Figure 4: The general scheme of the metamorphic controller and its connection with the plant.
The mathematical models used in this study are presented in the results section.Finally, the step response data is sent to the function FC1.
Step 3. Identification of the FOPTD model -based on the well-known two-point method, the function FC1 determines the plant gain k, the overall time constant T , and the time delay T 0 .Then, the obtained parameters are sent to another function FC8 and to the HMI application.
Step 4. Controller parameterization -the function FC8 is responsible for the controller tuning.First, based on the FOPTD model, the parameters of the PI controller are determined.Then, the obtained parameters are used to calculate the controller parameters for the DMC and B-BAC algorithms according to the methods presented in (Laszczyk and Czeczot, 2012;Laszczyk et al., 2013;Stebel et al., 2014).As a result, if there is a new set-point for the plant, the controller parameters can be easily determined by using the new parameters of the FOPTD model.
Step 5. Test simulations -once the controller parameters are determined, the function FC7 performs test simulations of the control system for the plant described by the FOPTD model (identified in Step 3) and for each of the controllers.Although these tests are performed sequentially, the total time needed to perform all simulations is less than a few minutes, provided that the simulations are based on the FOPTD model of the controlled plant, which is independent on the plant complexity.In general, the simulation time will be dependent on the time step size.In turn, the size of the time step is dependent on the overall time constant T in the FOPTD model.In effect, the metamorphic controller can mimic the parallel design process.
Step 6. Selection of the optimal controller -the results of the test simulations are used in function FC3 to calculate the selected performance index for each of the potential controllers.The performance indices are calculated in function blocks FB10 (ITAE), FB11 (ISE) and FB12 (IAE).The obtained results are also sent to the HMI application.The function block FB31 selects the control algorithm associated with the smallest value of the given performance index.
Step 7. Calculation of the maximum control error E max -for each potential controller, the function FC4 calculates the E max index, which is a maximum overshot in the control system.The E max value is then sent to the HMI application for information purposes only.
Step 8. Implementation of the optimal controller -the function FC5 calls one of the function blocks that corresponds to the selected controller: PI (FB21), DMC (FB22) and B-BAC (FB23).
Step 9.The end of the controller selection procedure -the selected controller is confirmed by the control engineer and connected to the plant.After approval of the new controller structure, the sys-tem switches to the new controller in a bumpless manner.
Figure 6: Program structure in the PLC.
If the controller selection procedure is based on the mathematical model of the plant implemented in the function FC2, then the whole procedure may take up to a few minutes to complete.It depends on the time step size required for numerical stability and accuracy.Otherwise, the time required to complete the procedure is dependent on the plant dynamics, i.e., the settling time after a step change in the CV.

Evaluation results
The goal of this section is to show that by changing the control algorithm in the metamorphic controller, it is possible to obtain a better control quality.The effectiveness of the metamorphic controller was assessed based on the simulation approach.Mathematical models of the controlled plants were implemented in the metamorphic controller by means of the function FC2 and numerically integrated using Euler's method with a time step ∆t=100[ms], which is achieved by the cyclic interrupts in the controller.The cycle time of 100 [ms] was sufficient to perform the necessary calculations.For comparison reasons, the tests were performed for linear and nonlinear plants for two chosen operating points of the control system.The models used are representatives of continuous processes that are commonly encountered in industry for a chosen operating point.The linear plants, presented in the form of transfer functions, and their FOPTD models have been shown in Table 1.
In the case of linear plants, the FOPTD models (transfer functions with lower index 'M') are the same, irrespective of the operating point of the system.The last case presents a nonlinear model of the hydraulic system, i.e., a conical tank with a varying cross-sectional area, and its mathematical model is as follows: where: h -liquid level in the tank ( ḣ -time derivative of h), F in -input flow rate, c 1 , c 2 , A 1 , A 2 (h), h o -model parameters.
The liquid level h in the tank, which is the process variable (PV), and the input flow rate F in , which is the control variable (CV), determine the operating point of the controlled plant.For comparison reasons, two operating points of the nonlinear system (3)-( 4) were chosen.Hence, the transfer functions K M 4a (s) and K M 4b (s) are the linear approximations of the nonlinear plant (3)-( 4) at the chosen operating points.Depending on the operating point, the parameters of the FOPTD models can significantly vary: 1.25 3.75s + 1 (5) Table 1 shows the obtained results for each performance index and for each candidate control algorithm.
The optimal controller structures, determined by the metamorphic controller, were marked by bold numbers.In each case, the whole procedure took up to four minutes.Figure 7 presents exemplary step responses of the control system around two operating points of the plant K 3 (s) for each potential control algorithm.For instance, if the new operating point of the system has to be reached quickly with small overshoots (ITAE index), the DMC algorithm should be used (Figure 7).As can be clearly noticed (Table 1), depending on the chosen performance index and operating point of the plant, the advanced control algorithms allow to achieve much better performance than the classical PI controller, which is often the only option in other supporting applications.For instance, in the case of the nonlinear plant (3)-( 4), the PI controller was the optimal solution only for a the second operating point and the   IAE performance index.In other cases, a much better performance was obtained for more advanced control algorithms, included in the metamorphic controller.This justifies a modification of the controller structure at the controller design stage and during normal operation of the system.Owing to the metamorphic controller, the change of the control algorithm and the application of more advanced controllers can be carried out without the help of cooperating experts.

Concluding remarks
In this work, the metamorphic controller with extended functionality has been presented.The obtained results showed the possibility of using the metamorphic controller as a tool which supports control engineers at the controller design stage.Because the presented tool uses the mathematical model of the plant, the candidate control algorithms can be tested through simulations in less than a few minutes, thereby shortening design time and overall costs.In turn, during normal operation of the plant, the metamorphic controller can be used to select an optimal control algorithm for a given operating point of the plant with respect to technological constraints.Since, the tuning procedures use the FOPTD model ( 1), the metamorphic controller can be used for each plant that can be described by the model (1).Moreover, in comparison to existing tools and supporting applications, the metamorphic controller allows using more advanced control algorithms without the need of employing an expert or several cooperating experts which can be an expensive option.In this case, the role of the user (control engineer) is limited to the selection of the operating point and the performance index that determines the behavior of the control system.As a result, less experienced engineers are able to use more advanced controllers.A drawback of the approach is that the tuning methods use parameters of the linear model of the plant.Hence, it may turn out that an expert (or a group of experts) is able to provide better tuning parameters, i.e., the controller that ensures a better performance of the closed-loop system.This is the price we pay for replacing the expert with the metamorphic controller.As shown by the experimental results with the use of the typical industrial PLC and simulated plants, a change of the control algorithm may lead to a better performance of the control system.
The metamorphic controller can be further developed in many different directions, including implementation of more optional control algorithms.Compliance with the IEC 61499 standard simplifies implementation of the metamorphic controller in the distributed control system using various hardware plat-forms, but the versatility of the system makes it applicable in any time-determined networking environment (Polaków and Metzger, 2013).

Figure 1 :
Figure 1: The selection of the controller structure and its parameterization at the controller design stage: a) comparison of the available controllers; b) selection of the optimal controller by cooperation of experts; c) metamorphic controller as a tool for selection of the optimal controller structure.

Figure 2 :
Figure 2: Possible responses of the control system to a step change in the SP for three various sets of the controller parameters.

Figure 3 :
Figure 3: The idea of the metamorphic controller as the tool supporting control engineers.

Figure 7 :
Figure 7: Control system responses with the plant K 3 (s) to step changes in the SP value: a) for the first operating point (SP change at 100[s]); b) for the second operating point (SP change at 450[s]).

Table 1 :
Performance index values for two different operating points of the plant.