Formal modeling and validation of Stateflow diagrams

  • Chunqing ChenEmail author
  • Jun Sun
  • Yang Liu
  • Jin Song Dong
  • Manchun Zheng


Stateflow is an industrial tool for modeling and simulating control systems in model-based development. In this paper, we present our latest work on automatic verification of Stateflow using model-checking techniques. We propose an approach to systematically translate Stateflow diagrams to a formal modeling language called CSP# by precisely following Stateflow’s execution semantics, which is described by examples. A translator is developed inside the Process Analysis Toolkit (PAT) model checker to automate this process with the support of various Stateflow advanced modeling features. Formal analysis can be conducted on the transformed CSP# with PAT’s simulation and model-checking power. Using our approach, we can not only detect bugs in Stateflow diagrams, but also discover subtle semantics flaws in Stateflow user’s guide and demo cases.


Model-based development Transformation Validation Model checking Stateflow 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bacherini, S., Fantechi, A., Tempestini, M., Zingoni, N.: A story about formal methods adoption by a railway signaling manufacturer. In: FM’06: Proceedings of the 14th International Symposium on Formal Methods, pp. 179–189. Springer, Berlin (2006)Google Scholar
  2. 2.
    Banphawatthanarak, C., Krogh, B.H., Butts, K.: Symbolic verification of executable control specifications. In: CACSD’99: Proceedings of the 10th International Symposium on Computer Aided Control System Design, pp. 581–586. IEEE (1999)Google Scholar
  3. 3.
    Cavalcanti A.: Stateflow diagrams in circus. Electron. Notes Theor. Comput. Sci. 240, 23–41 (2009)CrossRefGoogle Scholar
  4. 4.
    Chen, C.: Formal analysis for stateflow diagrams. In: SSIRI-C’10: Proceedings of the 4th International Conference on Secure Software Integration and Reliability Improvement Companion, pp. 102–109. IEEE Computer Society (2010)Google Scholar
  5. 5.
    Edmund J., Clarke M., Grumberg O., Peled D.A.: Model Checking. MIT Press, Cambridge (1999)Google Scholar
  6. 6.
    Ferrari, A., Fantechi, A., Bacherini, S., Zingoni, N.: Formal development for railway signaling using commercial tools. In: FMICS’09: Proceedings of the 14th International Workshop on Formal Methods for Industrial Critical Systems, pp. 197–198. Springer, Berlin (2009)Google Scholar
  7. 7.
    Hamon, G.: A denotational semantics for Stateflow. In: EMSOFT’05: Proceedings of the 5th ACM International Conference on Embedded Software, pp. 164–172. ACM, New York (2005)Google Scholar
  8. 8.
    Hamon G., Rushby J.M.: An operational semantics for Stateflow. Int. J. Softw. Tools Technol. Transfer 9(5–6), 447–456 (2007)CrossRefGoogle Scholar
  9. 9.
    Harel D.: Statecharts: a visual formalism for complex systems. Sci. Comput. Program. 8(3), 231–274 (1987)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Harel D., Lachover H., Naamad A., Pnueli A., Politi M., Sherman R., Shtull-Trauring A., Trakhtenbrot M.B.: STATEMATE: a working environment for the development of complex reactive systems. IEEE Trans. Softw. Eng. 16(4), 403–414 (1990)CrossRefGoogle Scholar
  11. 11.
    Hinchey M., Jackson M., Cousot P., Cook B., Bowen J.P., Margaria T.: Software engineering and formal methods. Commun. ACM 51(9), 54–59 (2008)CrossRefGoogle Scholar
  12. 12.
    Hoare C.A.R.: Communicating Sequential Processes. Prentice-Hall, Englewood Cliffs (1985)zbMATHGoogle Scholar
  13. 13.
    Latella D., Majzik I., Massink M.: Automatic verification of a behavioural subset of UML Statechart diagrams using the SPIN model-checker. Form. Asp. Comput. 11(6), 637–664 (1999)CrossRefzbMATHGoogle Scholar
  14. 14.
    Liu, Y., Sun, J., Dong, J.S.: Analyzing hierarchical complex real-time systems. In: FSE’10: Proceedings of the 18th ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 365–366. ACM, New York (2010)Google Scholar
  15. 15.
    Liu, Y., Sun, J., Dong, J.S.: PAT 3: an extensible architecture for building multi-domain model checkers. In: ISSRE’11: Proceedings of the 22nd Annual International Symposium on Software Reliability Engineering, pp. 190–199. IEEE (2011)Google Scholar
  16. 16.
    The MathWorks. Simulink® Design VerifierTM 1—User’s Guide. September 2009Google Scholar
  17. 17.
    The MathWorks. Stateflow® and Stateflow® coderTM 7—User’s Guide. March 2009Google Scholar
  18. 18.
    Ng, L., Hubbard, P., O’Young, S.: Simulation of fully autonomous control of unmanned air vehicles for maritime surveillance. In: Proceedings of the 2010 Spring Simulation Multiconference, SpringSim’10, pp. 40:1–40:9. ACM, New York (2010)Google Scholar
  19. 19.
    Oliveira M., Cavalcanti A., Woodcock J.: A utp semantics for circus. Form. Asp. Comput. 21(1-2), 3–32 (2009)CrossRefzbMATHGoogle Scholar
  20. 20.
    Scaife, N., Sofronis, C., Caspi, P., Tripakis, S., Maraninchi, F.: Defining and translating a “safe” subset of Simulink/Stateflow into Lustre. In: EMSOFT’04: Proceedings of the 4th International Conference on Embedded Software, pp. 259–268. ACM, New York (2004)Google Scholar
  21. 21.
    Sims, S., Cleaveland, R., Butts, K., Ranville, S.: Automated validation of software models. In: ASE’01: Proceedings of the 16th IEEE International Conference on Automated Software Engineering, pp. 91–96. IEEE Computer Society (2001)Google Scholar
  22. 22.
    Sun, J., Liu, Y., Dong, J.S., Chen, C.: Integrating specification and programs for system modeling and verification. In: TASE’09: Proceedings of the 3rd IEEE International Symposium on Theoretical Aspects of Software Engineering, pp. 127–135. IEEE Computer Society (2009)Google Scholar
  23. 23.
    Sun, J., Liu, Y., Dong, J.S., Pang, J.: PAT: towards flexible verification under fairness. In: CAV’09: Proceedings of the 21th International Conference on Computer Aided Verification, pp. 709–714. Springer, Berlin (2009)Google Scholar
  24. 24.
    Tiwari, A.: Formal semantics and analysis methods for Simulink Stateflow models. Technical report, SRI International (2002).
  25. 25.
    Toyn, I., Galloway, A.: Proving properties of stateflow models using ISO standard Z and CADiZ. In: ZB’05: Proceedings of the 4th International Conference of B and Z Users, pp. 104–123. Springer, Berlin (2005)Google Scholar
  26. 26.
    Woodcock, J., Larsen, P.G., Bicarregui, J., Fitzgerald, J.S.: Formal methods: practice and experience. ACM Comput. Surveys 41(4), 1–36 (2009)Google Scholar

Copyright information

© Springer-Verlag 2012

Authors and Affiliations

  • Chunqing Chen
    • 1
    Email author
  • Jun Sun
    • 2
  • Yang Liu
    • 3
  • Jin Song Dong
    • 4
  • Manchun Zheng
    • 4
  1. 1.Hewlett-Packard Laboratories SingaporeSingaporeSingapore
  2. 2.Singapore University of Technology and DesignSingaporeSingapore
  3. 3.Temasek LaboratoriesNational University of SingaporeSingaporeSingapore
  4. 4.School of ComputingNational University of SingaporeSingaporeSingapore

Personalised recommendations