Skip to Main Content
This paper describes a reengineering solution for a Smart House controllers system using model-based development approach, emphasizing automatic code generation. Starting with the analysis of an existing system, based on a network of controllers, named as Tiny-Domots, the behavioral models associated with each controller was built using state diagrams as primary modeling formalism. A set of rules for manual translation between state diagrams and IOPT Petri Nets (Input-Output Place-Transition nets) is proposed. Editing of IOPT nets models was accomplished using the tool Snoopy-IOPT, which allows generation of PNML representations. In this work a tool for automatic generating C code was used (PNML2C), allowing the deployment of the generated code into the selected implementation platform (which is the PIC18F4620 low-cost microcontroller from Microchip). In this sense, a system of smart house controllers exhibiting the same features of the existing system was obtained, however, created with the support from model based automatic code generation tools. A comparative analysis between the two types of code is produced (manual and automatically generated). Starting with the IOPT net model, addition of new features to the current system were introduced and successful deployed into the Tiny-Domots controllers, taking advantage of model-based development flow and automatic code generation tool. In summary, the paper presents successful introduction of “reverse engineering” techniques in combination with model-based development techniques in the definition and validation of a methodology for embedded systems development in the Smart Houses application area; results obtained are applicable to other embedded systems application domains.