Clone Detection In Matlab Stateflow Models
State Machine , Model , Stateflow
Matlab Simulink is one of the leading tools for model based software development in the automotive industry. One extension to Simulink is Stateflow, which allows the user to embed Statecharts as components in a Simulink Model. These state machines contain nested states, an action language that describes events, guards, conditions and actions and complex transitions. As Stateflow has become increasingly important in Simulink models for the automotive sector, we extend previous work on clone detection of Simulink models to Stateflow components. In this thesis, we present an approach for identifying Stateflow clones in Matlab Stateflow models. In order to leverage robust near-miss code clone technology, our approach is text-based. First, we transform the Stateflow textual representation into a hierarchical textual structure. We implement a SIMONE plugin that normalizes the initial input to remove irrelevant elements and rename irrelevant naming differences to make the process of clone identification more accurate. Finally, we identify potential clone candidates and cluster them into classes. We conducted experiments with our approach on the Matlab Simulink/Stateflow Demo set. Our approach showed promising results on the identification of Stateflow clones as an isolated component as well as an integrated component of the Simulink models that are hosting them. All of our results are manually validated.