This paper presents a study on the development of smart factory in the context of the manufacturing industry. We show that such systems must be agile, i.e. able to adapt quickly to changing contexts such as a particular production or material faults. In this study we model the control system of these systems by a layered and generic approach. We distinguish several classes of models to manage different categories of flexibility. The main objective of the study is to provide a rigorous and systematic method for modeling and verifying systematically, rigorously and effectively this type of system.