Abstract
Stateflow is a graphical language for modeling hierarchical transition systems, well-known for the complexity of its semantics, which is only informally explained in its user manual. Formal analysis and verification of Stateflow models usually proceed by first translating a subset of Stateflow to a formal language with precise semantics. Most existing work address only “safe” subset of Stateflow and ignore the most complex semantic issues. Moreover, it is difficult to balance simplicity of the translation algorithm with conciseness of the resulting model. In this paper, we describe a two-stage process for translating a large subset of Stateflow to Hybrid CSP, where the first stage is mostly syntax-directed and addresses each feature of Stateflow separately, and the second stage is a code optimization step that simplifies the resulting model using information from static analysis. We thoroughly validate the translation process using a hand-designed set of benchmarks, as well as larger case studies from existing work.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
Source code and examples available at https://gitee.com/bhzhan/mars.
References
Ahmad, E., Dong, Y., Larson, B.R., Lü, J., Tang, T., Zhan, N.: Behavior modeling and verification of movement authority scenario of Chinese train control system using AADL. Sci. China Inf. Sci. 58(11), 1–20 (2015)
Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley Series in Computer Science. World Student Series Edition. Addison-Wesley, Boston (1986)
Chen, C., Sun, J., Liu, Y., Dong, J.S., Zheng, M.: Formal modeling and validation of stateflow diagrams. Int. J. Softw. Tools Technol. Transf. 14(6), 653–671 (2012)
Duggirala, P.S., Mitra, S., Viswanathan, M., Potok, M.: C2E2: a verification tool for stateflow models. In: Baier, C., Tinelli, C. (eds.) TACAS 2015. LNCS, vol. 9035, pp. 68–82. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46681-0_5
Fan, C., Qi, B., Mitra, S., Viswanathan, M., Duggirala, P.S.: Automatic reachability analysis for nonlinear hybrid models with C2E2. In: Chaudhuri, S., Farzan, A. (eds.) CAV 2016. LNCS, vol. 9779, pp. 531–538. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-41528-4_29
Hamon, G.: A denotational semantics for stateflow. In: Proceedings of the 5th ACM International Conference on Embedded Software EMSOFT 2005, Jersey City, NJ, USA, 18–22 September 2005, pp. 164–172 (2005)
Hamon, G., Rushby, J.M.: An operational semantics for stateflow. Int. J. Softw. Tools Technol. Transf. 9(5–6), 447–456 (2007)
Harel, D.: Statecharts: a visual formalism for complex systems. Sci. Comput. Program. 8(3), 231–274 (1987)
Harel, D., Naamad, A.: The STATEMATE semantics of statecharts. ACM Trans. Softw. Eng. Methodol. 5(4), 293–333 (1996)
Helke, S., Kammüller, F.: Formalizing statecharts using hierarchical automata. Archive of Formal Proofs 2010 (2010)
Hoare, C.A.R.: Communicating Sequential Processes. Prentice-Hall, Hoboken (1985)
Hooman, J., Ramesh, S., de Roever, W.P.: A compositional axiomatization of statecharts. Theor. Comput. Sci. 101(2), 289–335 (1992)
Jifeng, H.: From CSP to Hybrid Systems, pp. 171–189. Prentice Hall International (UK) Ltd., Great Britain (1994)
Lin, Q., Wang, S., Zhan, B., Gu, B.: Modelling and verification of real-time publish and subscribe protocol using Uppaal and Simulink/Stateflow. J. Comput. Sci. Technol. 35(6), 1324–1342 (2020)
Liu, J., et al.: A calculus for hybrid CSP. In: Ueda, K. (ed.) APLAS 2010. LNCS, vol. 6461, pp. 1–15. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-17164-2_1
MathWorks: Simulink® User’s Guide (2018). http://www.mathworks.com/help/pdf_doc/simulink/sl_using.pdf
MathWorks: Stateflow® User’s Guide (2018). http://www.mathworks.com/help/pdf_doc/stateflow/sf_ug.pdf
Nielson, F., Nielson, H.R., Hankin, C.: Principles of Program Analysis. Springer, Heidelberg (1999). https://doi.org/10.1007/978-3-662-03811-6
Scaife, N., Sofronis, C., Caspi, P., Tripakis, S., Maraninchi, F.: Defining and translating a “safe” subset of Simulink/Stateflow into Lustre. In: Proceedings of the Fourth ACM International Conference on Embedded Software, EMSOFT 2004, Pisa, Italy, 27–29 September 2004, pp. 259–268 (2004)
Tiwari, A., Shankar, N., Rushby, J.M.: Invisible formal methods for embedded control systems. Proc. IEEE 91(1), 29–39 (2003)
Wang, S., Zhan, N., Zou, L.: An improved HHL prover: an interactive theorem prover for hybrid systems. In: Butler, M., Conchon, S., Zaïdi, F. (eds.) ICFEM 2015. LNCS, vol. 9407, pp. 382–399. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-25423-4_25
Yang, Y., Jiang, Y., Gu, M., Sun, J.: Verifying simulink stateflow model: timed automata approach. In: Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering, ASE 2016, Singapore, 3–7 September 2016, pp. 852–857 (2016)
Zhan, N., Wang, S., Zhao, H. (eds.): Formal Verification of Simulink/Stateflow Diagrams, A Deductive Approach. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-47016-0
Zhao, H., Yang, M., Zhan, N., Gu, B., Zou, L., Chen, Y.: Formal verification of a descent guidance control program of a lunar lander. In: Jones, C., Pihlajasaari, P., Sun, J. (eds.) FM 2014. LNCS, vol. 8442, pp. 733–748. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-06410-9_49
Chaochen, Z., Ji, W., Ravn, A.P.: A formal description of hybrid systems. In: Alur, R., Henzinger, T.A., Sontag, E.D. (eds.) HS 1995. LNCS, vol. 1066, pp. 511–530. Springer, Heidelberg (1996). https://doi.org/10.1007/BFb0020972
Zou, L., Zhan, N., Wang, S., Fränzle, M.: Formal verification of simulink/stateflow diagrams. In: Finkbeiner, B., Pu, G., Zhang, L. (eds.) ATVA 2015. LNCS, vol. 9364, pp. 464–481. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-24953-7_33
Zou, L., Zhan, N., Wang, S., Fränzle, M., Qin, S.: Verifying simulink diagrams via a hybrid hoare logic prover. In: Proceedings of the International Conference on Embedded Software, EMSOFT 2013, Montreal, QC, Canada, 29 September–4 October 2013, pp. 9:1–9:10 (2013)
Acknowledgement
This work was partially supported by the National Natural Science Foundation of China under Grant Nos. 61972385, 62032024, and the Chinese Academy of Sciences Pioneer 100 Talents Program under Grant No. Y9RC585036.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Guo, P., Zhan, B., Xu, X., Wang, S., Sun, W. (2021). Translating a Large Subset of Stateflow to Hybrid CSP with Code Optimization. In: Qin, S., Woodcock, J., Zhang, W. (eds) Dependable Software Engineering. Theories, Tools, and Applications. SETTA 2021. Lecture Notes in Computer Science(), vol 13071. Springer, Cham. https://doi.org/10.1007/978-3-030-91265-9_1
Download citation
DOI: https://doi.org/10.1007/978-3-030-91265-9_1
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-91264-2
Online ISBN: 978-3-030-91265-9
eBook Packages: Computer ScienceComputer Science (R0)