## 1 Introduction  
In the last years, there is an increasing interest in making manufacturing systems more competitive. Some countries use different terms to refer to this phenomenon, for example it is known as Advanced Manufacturing in U.S., Industrie 4.0 in Germany and Factory of the Future in other European Countries [1, 2, 3]. Basically, this evolution consists in integrating all production systems to pass from long batches, which seek costs reduction through scale economies, to a flexible and personalized production [4]. In other words, all these initiatives have a common goal: achieving high quality production with zero defects [5, 6]. For this, they base on the so-called smart factory, composed by adaptive and smart manufacturing equipment and systems, which enables the automation, control and optimization of high-tech manufacturing processes while assuring the availability of the plant. The smart factories control all their processes, but at the same time, they should also be connected to the market, the supply, and the demand. This paradigm, generally referred as Industry 4.0, has countless applications both in academia and in Industry [7, 8, 9] since the birth of the term in 2011 [10, 11]. Dynamic reconfiguration is being adopted by current automation systems in order to ensure Quality of Service (QoS) requirements. In a production system the QoS requirements (also called non-functional requirements) can be regarded as those properties that improve product attractiveness, usability, accuracy, safety or reliability without modifying product functionality. Non-functional requirements demand specific behavior to the manufacturing system such as, for instance, reliability, availability, power consumption or response time optimization. In particular, the experience of large industrial companies has shown that two of the main qualities of advanced manufacturing systems are: _flexibility_ and _adaptability_, which characterize systems with the ability to quickly adapt to environment [12]. In general, all these reconfiguration mechanisms enable to switch in the most quick and cost-effective way from one configuration to another at runtime. As a result, the system response to sudden changes on customer demands or even to unpredictable events (e.g., failures or disruptions) is improved. This work is centered in automation production system flexibility, understood as the way to deal with non-functional requirements such as assuring control system availability under failure of a machine, components, network or controllers. According to different reviews and surveys [13; 14; 15] the term'reconfiguration' may make reference to: (1) product reconfiguration, as the flexibility to change or modify the final product. (2) Schedule reconfiguration, which is commonly understood as the capability to modify the execution order of plant operation, for enhancing efficiency or productivity [16; 17] or overcoming machine failures [18]. (3) Sometimes it also refers to machine operation reconfiguration. That is, modifying the functionality of a machine to enable it to perform other operations [12; 19; 20]. Finally, (4) control system reconfiguration refers to the relocation of the different functionalities within a distributed control system, for improving the controller performance [21] or battery consumption [22], or even avoiding service disruption in case of failures at controller or network [23; 24; 25]. These works provide a custom solution as they are focused on assuring a specific QoS (e.g., optimization of the production, fault tolerance at process or controller level and workload balance). Additionally, the majority make use of programming languages, like C/C++ or Java, which are not widely used in the factory automation area. Therefore, they are ad hoc solutions and/or they are not easily adopted in industrial environments. The goal of this work is twofold.