## 5 Conclusions  
This paper presents an approach aiming at adding flexibility to automation production systems following Industry 4.0 issues. It adds this flexibility by reconfiguring the control \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**PSAs**} & **Dist.** & **1 st** & **2 nd** & **3 rd** & **4 th** & **5 th** & **6 th** & **7 th** & **8 th** \\  & **Alg.** & **Reconf** & **Reconf** & **Reconf** & **Reconf** & **Reconf** & **Reconf** & **Reconf** \\ \hline
2 & 5.29 & 610.04 & **1214.79** & & & & & \\ \hline
3 & 6.14 & 610.66 & 1216.09 & **1822.70** & & & & \\ \hline
4 & 8.36 & 612.20 & 1221.51 & 1830.35 & **2437.00** & & & \\ \hline
5 & 11.67 & 616.58 & 1236.59 & 1843.65 & 2450.43 & **3056.97** & & \\ \hline
6 & 12.72 & 617.41 & 1222.53 & 1827.60 & 2432.38 & 3065.81 & **3687.38** & & \\ \hline
7 & 16.98 & 625.51 & 1230.31 & 1837.61 & 2444.37 & 3050.74 & 3657.21 & **4262.64** & \\ \hline
8 & 17.49 & 622.99 & 1242.58 & 1851.25 & 2456.50 & 3062.99 & 3667.54 & 4275.75 & **4880.56** \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Distribution algorithm and reconfiguration times. Figure 19: Reconfiguration Time vs. Number of control software modules. Figure 18: Distribution Algorithm Time vs. Number of control software modules. system, i.e., relocating the different functionalities over the distributed control system, assuring the execution despite controller failure. The proposed approach defines FAPS as a set of Controller and Plant I4.0 interconnected components, which support reconfiguration according to QoS parameters. It assumes that a MAS-based middleware provides QoS management at runtime but it offers model-based support to specify flexibility needs of target systems and automatically generate: (1) the flexible automation project for each controller in the system, as well as; (2) the code of application dependent agents, being the AAS's component manager implementation for the system's components. Furthermore, a template for application dependent agents (controller and plant) has been defined to make FAM generic and customizable. These templates can be customized for specific processes. The core of the framework proposed by the authors is based on MDE that allows managing complex systems. In fact, a Model Editor guides designers along the design of automation production systems, offering means for characterizing the critical situations of the production services, and collecting this information in a Model. The automatic generation has been performed via M2M and M2T transformation rules having as input the model generated by the Editor. This avoids manual programming errors, very common in these such complex situations. The execution of the assessment has allowed to put in practice the proposed approach. As a result, several conclusions have been obtained:  
* The definition of the critical intervals in the manufacturing process, which is essential to manage flexibility properly, has proved to be a difficult task. To that end, it is necessary to rely on someone with a great knowledge of the manufacturing process, who has also taken part in the design process of the code for the controllers. As far as authors know, other approaches do not contemplate this task, as they consider that the state represents the whole process, and thus any situation should be recoverable. Nevertheless, the reality is very different. * The advantages of AutomationML for modeling and processing different types of data have been demonstrated. Interoperability is ensured with AutomationML as long as the integrators use PLCOpen, which is widely known and used by an increasing number of engineers and suppliers (e.g., Siemens allows to export hardware configuration to AutomationML). Despite it is a relatively new standard, it is receiving an increasing attention as exportation format for different types of data (information, code, etc.).