Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Automatically Generating SystemC Code from HCSP Formal Models

Published: 30 January 2020 Publication History

Abstract

In model-driven design of embedded systems, how to generate code from high-level control models seamlessly and correctly is challenging. This is because hybrid systems are involved with continuous evolution, discrete jumps, and the complicated entanglement between them, while code only contains discrete actions. In this article, we investigate the code generation from Hybrid Communicating Sequential Processes (HCSP), a formal hybrid control model, to SystemC. We first introduce the notion of approximate bisimulation as a criterion to check the consistency between two different systems, especially between the original control model and the final generated code. We prove that it is decidable whether two HCSPs are approximately bisimilar in bounded time and unbounded time with some conditions, respectively. For both the cases, we present two sets of rules correspondingly for discretizing HCSPs and prove that the original HCSP model and the corresponding discretization are approximately bisimilar. Furthermore, based on the discretization, we define a transformation function to map a discretized HCSP model to SystemC code such that they are also approximately bisimilar. We finally implement a tool to automatically realize the translation from HCSP to SystemC code and illustrate our approach through some case studies.

References

[1]
[n.d.]. dSPACE Release 2019-A. Retrieved from https://www.dspace.com/.
[2]
[n.d.]. Rational Rose. 2017. Retrieved from http://www-03.ibm.com/software/products/en/rosemod.
[3]
[n.d.]. Simulink. 2017. Retrieved from https://cn.mathworks.com/products/simulink.html.
[4]
[n.d.]. Simulink Coder User’s Guide, R2019a. The MathWorks, Inc.
[5]
[n.d.]. SysML V 1.5. 2017. Retrieved from http://www.omg.org/spec/SysML/1.5/.
[6]
[n.d.]. TargetLink. 2017. Retrieved from https://www.dspace.com/en/inc/home/products/sw/pcgs/targetli.cfm.
[7]
J. Abrial. 2010. Modeling in Event-B: System and Software Design. Cambridge University Press, New York.
[8]
E. Ahmad, Y. Dong, S. Wang, N. Zhan, and L. Zou. 2014. Adding formal meanings to AADL with hybrid annex. In FACS 2014 (LNCS), Vol. 8997. Springer, 228--247.
[9]
R. Alur, R. Grosu, Y. Hur, V. Kumar, and I. Lee. 2000. Modular specification of hybrid systems in CHARON. In HSCC 2000 (LNCS), Vol. 1790. Springer, 6--19.
[10]
R. Alur, F. Ivancic, J. Kim, I. Lee, and O. Sokolsky. 2003. Generating embedded software from hierarchical hybrid models. Lang. Compilers Tools Embedded Syst. 38, 7 (2003), 171--182.
[11]
M. Anand, S. Fischmeister, Y. Hur, J. Kim, and I. Lee. 2010. Generating reliable code from hybrid-systems models. IEEE Trans. Computers 59, 9 (2010), 1281--1294.
[12]
D. Angeli. 2002. A Lyapunov approach to incremental stability properties. IEEE Trans. Automat. Control 47, 3 (2002), 410--421.
[13]
D. Angeli and E. Sontag. 1999. Forward completeness, unboundedness observability, and their Lyapunov characterizations. Syst. Control Lett. 38, 4 (1999), 209--217.
[14]
U. Ascher and L. Petzold. 1998. Computer Methods for Ordinary Differential Equations and Differential-Algebraic Equations (1st ed.). Society for Industrial and Applied Mathematics, Philadelphia, PA.
[15]
S. Bak, O. A. Beg, S. Bogomolov, T. T. Johnson, L. V. Nguyen, and C. Schilling. 2017. Hybrid automata: From verification to implementation. Int. J. Software Tools Technology Transfer (June 12, 2017).
[16]
R. Balzer. 1985. A 15 year perspective on automatic programming. IEEE Trans. Software Eng. 11, 11 (1985), 1257--1268.
[17]
G. Berry. 2000. The foundations of Esterel. In Proof, Language, and Interaction, Essays in Honour of Robin Milner. 425--454.
[18]
S. Bonfanti, M. Carissoni, A. Gargantini, and A. Mashkoor. 2017. Asm2C++: A tool for code generation from abstract state machines to Arduino. In NFM 2017 (LNCS), Vol. 10227. Springer, 295--301.
[19]
E. Börger and R. Stark. 2003. Abstract State Machines: A Method for High-level System Design and Analysis. Springer, New York.
[20]
O. Bouissou and M. Martel. 2006. GRKLib: A guaranteed Runge-Kutta library. In International Symposium on Scientific Computing, Computer Arithmetic and Validated Numerics. IEEE, Los Alamitos, CA.
[21]
O. Bouissou and M. Martel. 2008. Abstract interpretation of the physical inputs of embedded programs. In VMCAI (LNCS), Vol. 4905. Springer-Verlag, 37--51.
[22]
O. Bouissou and M. Martel. 2008. A hybrid denotational semantics for hybrid systems. In ESOP 2008 (LNCS), Vol. 4960. Springer-Verlag, 63--77.
[23]
T. Bourke, J. Colaço, B. Pagano, C. Pasteur, and M. Pouzet. 2015. A synchronous-based code generator for explicit hybrid systems languages. In CC 2015 (LNCS), Vol. 9031. Springer, 69--88.
[24]
C. Brooks, E. A. Lee, D. Lorenzetti, T. S. Nouidui, and M. Wetter. 2015. CyPhySim: A cyber-physical systems simulator. In HSCC 2015. ACM, New York, NY, 301--302.
[25]
N. Cataño and V. Rivera. 2016. EventB2Java: A code generator for Event-B. In NFM 2016 (LNCS), Vol. 9690. Springer, 166--171.
[26]
D. Champelovier, X. Clerc, H. Garavel, Y. Guerte, C. McKinty, V. Powazny, F. Lang, W. Serwe, and G. Smeding. 2015. Reference manual of the LNT to LOTOS translator (version 6.2). INRIA/VASY and INRIA/CONVECS (2015).
[27]
M. Chen, X. Han, T. Tang, S. Wang, M. Yang, N. Zhan, H. Zhao, and L. Zou. 2015. MARS: A toolchain for modeling, analysis and verification of hybrid systems. In ProCoS 2015. 39--58.
[28]
T. Chow. 1978. Testing software design modeled by finite-state machines. IEEE Trans. Software Eng. 4, 3 (1978), 178--187.
[29]
A. Deshpande, A. Göllü, and P. Varaiya. 1996. SHIFT: A formalism and a programming language for dynamic networks of hybrid automata. In Hybrid Systems IV. 113--133.
[30]
F. Dormoy. 2008. SCADE 6: A model based solution for safety critical software development. In ERTS 2008. 1--9.
[31]
J. Eker, J. W. Janneck, E. A. Lee, J. Liu, X. Liu, J. Ludvig, S. Neuendorffer, S. Sachs, and Y. Xiong. 2003. Taming heterogeneity - the Ptolemy approach. Proc. IEEE 91, 1 (2003), 127--144.
[32]
H. Evrard and F. Lang. 2017. Automatic distributed code generation from formal models of asynchronous processes interacting by multiway rendezvous. J. Log. Algebr. Meth. Program. 88 (2017), 121--153.
[33]
A. Fehnker and F. Ivancic. 2004. Benchmarks for hybrid systems verification. In HSCC 2004 (LNCS), Vol. 2993. Springer, 326--341.
[34]
A. Gawanmeh, A. Habibi, and S. Tahar. 2004. Enabling SystemC verification using abstract state machines. In FDL 2004. ECSI, 649--661.
[35]
A. Girard, A. Julius, and G. Pappas. 2008. Approximate simulation relations for hybrid systems. Discrete Event Dynamic Syst. 18, 2 (2008), 163--179.
[36]
A. Girard and G. Pappas. 2007. Approximation metrics for discrete and continuous systems. IEEE Trans. Autom. Control 52, 5 (2007), 782--798.
[37]
N. Halbwachs, P. Caspi, P. Raymond, and D. Pilaud. 1991. The synchronous dataflow programming language LUSTRE. In Proceedings of the IEEE. 1305--1320.
[38]
N. Halbwachs and P. Raymond. 2007. A Tutorial of Lustre. Retreived from http://francois.touchard.perso.luminy.univ-amu.fr/INFO5/Langages/lustre/tutorial.pdf.
[39]
D. Harel. 1987. Statecharts: A visual formalism for complex systems. Sci. Comput. Program. 8, 3 (1987), 231--274.
[40]
J. He. 1994. From CSP to hybrid systems. In A Classical Mind, Essays in Honour of C.A.R. Hoare. Prentice Hall International (UK) Ltd., 171--189.
[41]
T. Henzinger, P. Ho, and H. Wong-Toi. 1998. Algorithmic analysis of nonlinear hybrid systems. IEEE Trans. on Autom. Control 43, 4 (1998), 540--554.
[42]
T. Henzinger and J. Sifakis. 2006. The embedded systems design challenge. In FM 2006 (LNCS), Vol. 4085. Springer, 1--15.
[43]
T. A. Henzinger. 1996. The theory of hybrid automata. In LICS 1996. IEEE, 278--292.
[44]
Y. Hur, J. Kim, I. Lee, and J. Choi. 2004. Sound code generation from communicating hybrid models. In HSCC 2004 (LNCS), Vol. 2993. Springer, 432--447.
[45]
IEEE Std. 1666-2011. 2011. Open SystemC Language Reference Manual. IEEE Standards Association.
[46]
A. Julius, A. D’Innocenzo, M. Di Benedetto, and G. Pappas. 2009. Approximate equivalence and synchronization of metric transition systems. Syst. Control Lett. 58, 2 (2009), 94--101.
[47]
J. Kim and I. Lee. 2003. Modular code generation from hybrid automata based on data dependency. In The 9th IEEE Real-Time and Embedded Technology and Applications Symposium. 160--168.
[48]
R. Lanotte and S. Tini. 2005. Taylor approximation for hybrid systems. In HSCC 2005 (LNCS), Vol. 3414. Springer, 402--416.
[49]
E. A. Lee. 2000. What’s ahead for embedded software? Computer 33, 9 (2000), 18--26.
[50]
P. Li, J. Sun, and H. Wang. 2017. Towards code generation from design models. In SEKE 2017. KSI Research Inc. and Knowledge Systems Institute Graduate School, 242--247.
[51]
I. Llopard, C. Fabre, and A. Cohen. 2017. From a formalized parallel action language to its efficient code generation. ACM Trans. Embedded Comput. Syst. 16, 2 (2017), 37:1--37:28.
[52]
T. Low and F. Franchetti. 2017. High assurance code generation for cyber-physical systems. In HASE 2017. IEEE, 104--111.
[53]
L. Luhunu and E. Syriani. 2017. Survey on template-based code generation. In MODELS 2017. CEUR-WS.org, 468--471.
[54]
R. Majumdar and M. Zamani. 2012. Approximately bisimilar symbolic models for digital control systems. In CAV 2012 (LNCS), Vol. 7358. Springer, 362--377.
[55]
A. Malik, P. S. Roop, S. Andalam, M. Trew, and M. Mendler. 2017. Modular compilation of hybrid systems for emulation and large scale simulation. ACM Trans. Embed. Comput. Syst. 16, 5s (2017), 118:1--118:21.
[56]
W. Müller, J. Ruf, and W. Rosenstiel. 2003. An ASM based SystemC simulation semantics. In SystemC: Methodologies and Applications. 97--126.
[57]
X. Peng, H. Zhu, J. He, and N. Jin. 2006. An operational semantics of an event-driven system-level simulator. In SEW 2006. IEEE, 190--202.
[58]
V. Pham, A. Radermacher, S. Gérard, and S. Li. 2017. Complete code generation from UML state machine. In MODELSWARD 2017. SciTePress, 208--219.
[59]
A. Platzer. 2010. Differential-algebraic dynamic logic for differential-algebraic programs. J. Logic Comput. 20, 1 (2010), 309--352.
[60]
A. Platzer. 2012. The complete proof theory of hybrid systems. In LICS 2012. IEEE, 541--550.
[61]
G. Pola, A. Girard, and P. Tabuada. 2008. Approximately bisimilar symbolic models for nonlinear control systems. Automatica 44, 10 (2008), 2508--2516.
[62]
G. Pola, P. Pepe, and M. Di Benedetto. 2014. Symbolic models for networks of discrete-time nonlinear control systems. In ACC 2014. IEEE, 1787--1792.
[63]
R.-J. Back and J. Wright. 1998. Refinement Calculus: A Systematic Introduction. Springer.
[64]
B. Selic and S. Gérard. 2013. Modeling and Analysis of Real-Time and Embedded Systems with UML and MARTE: Developing Cyber-Physical Systems. Elsevier.
[65]
T. Shulga, E. Ivanov, M. Slastihina, and N. Vagarina. 2016. Developing a software system for automata-based code generation. Program. Comput. Software 42, 3 (2016), 167--173.
[66]
J. Stoer and R. Bulirsch. 2013. Introduction to Numerical Analysis. Springer.
[67]
J. Sun, J. Dong, J. Liu, and H. Wang. 2001. Object-Z web environment and projections to UML. In WWW 2001. ACM, 725--734.
[68]
M. Tiller. 2012. Introduction to Physical Modeling with Modelica. Springer.
[69]
A. Tiwari. 2008. Abstractions for hybrid systems. Formal Methods Syst. Design 32, 1 (2008), 57--83.
[70]
J. Tsinias, N. Kalouptsidis, and A. Bacciotti. 1987. Lyapunov functions and stability of dynamical polysystems. Math. Syst. Theory 19, 4 (1987), 333--354.
[71]
S. Wang, N. Zhan, and L. Zou. 2015. An improved HHL prover: An interactive theorem prover for hybrid systems. In ICFEM 2015 (LNCS), Vol. 9407. Springer, 382--399.
[72]
Y. Wang, J. Talpin, A. Benveniste, and P. Guernic. 2000. A semantics of UML state-machines using synchronous pre-order transition systems. In ISORC 2000. IEEE Computer Society, 96--103.
[73]
G. Yan, L. Jiao, Y. Li, S. Wang, and N. Zhan. 2016. Approximate bisimulation and discretization of hybrid CSP. In FM 2016 (LNCS), Vol. 9995. Springer, 702--720.
[74]
N. Zeng and W. Zhang. 2013. A SystemC semantics in guarded assignment systems and its applications with VERDS. In APSEC 2013. IEEE, 371--379.
[75]
N. Zeng and W. Zhang. 2014. An executable semantics of SystemC transaction level models and its applications with VERDS. In ICECCS 2014. IEEE, 198--201.
[76]
N. Zhan, S. Wang, and H. Zhao. 2013. Formal modelling, analysis and verification of hybrid systems. In Unifying Theories of Programming and Formal Engineering Methods (LNCS), Vol. 8050. Springer, 207--281.
[77]
N. Zhan, S. Wang, and H. Zhao. 2016. Formal Verification of Simulink/Stateflow Diagrams: A Deductive Way. Springer.
[78]
F. Zhang, M. Yeddanapudi, and P. J. Mosterman. 2008. Zero-crossing location and detection algorithms for hybrid system simulation. IFAC Proc. 41, 2 (2008), 7967--7972.
[79]
H. Zhao, M. Yang, N. Zhan, B. Gu, L. Zou, and Y. Chen. 2014. Formal verification of a descent guidance control program of a lunar lander. In FM 2014 (LNCS), Vol. 8442. Springer, 733--748.
[80]
C. Zhou, J. Wang, and A. Ravn. 1996. A formal description of hybrid systems. In Hybrid Systems 1996 (LNCS), Vol. 1066. Springer, 511--530.
[81]
H. Zhu, J. He, X. Peng, and N. Jin. 2008. Denotational approach to an event-driven system-level language. In UTP 2008 (LNCS), Vol. 5713. Springer, 258--278.
[82]
H. Zhu, F. Yang, and J. He. 2010. Generating denotational semantics from algebraic semantics for event-driven system-level language. In UTP 2010 (LNCS), Vol. 6445. Springer, 286--308.
[83]
H. Zhu, Y. Zhao, and J. He. 2009. Locality-based normal form approach to linking algebraic semantics and operational semantics for an event-driven system-level language. In ASWEC 2009. IEEE, 297--306.
[84]
L. Zou, J. Lv, S. Wang, N. Zhan, T. Tang, L. Yuan, and Y. Liu. 2014. Verifying Chinese train control system under a combined scenario by theorem proving. In VSTTE 2013 (LNCS), Vol. 8164. Springer, 262--280.
[85]
L. Zou, N. Zhan, S. Wang, and M. Fränzle. 2015. Formal verification of Simulink/Stateflow diagrams. In ATVA 2015 (LNCS), Vol. 9364. Springer, 464--481.
[86]
L. Zou, N. Zhan, S. Wang, M. Fränzle, and S. Qin. 2013. Verifying Simulink diagrams via a hybrid Hoare logic prover. In EMSOFT 2013. IEEE, 1--10.

Cited By

View all
  • (2025)Hybrid dynamical systems logic and its refinementsScience of Computer Programming10.1016/j.scico.2024.103179239(103179)Online publication date: Jan-2025
  • (2024)Formally Verified C Code Generation from Hybrid Communicating Sequential Processes2024 ACM/IEEE 15th International Conference on Cyber-Physical Systems (ICCPS)10.1109/ICCPS61052.2024.00018(123-134)Online publication date: 13-May-2024
  • (2024)An algebraic approach to simulation and verification for cyber-physical systems with shared-variable concurrencyJournal of Logical and Algebraic Methods in Programming10.1016/j.jlamp.2024.100973139(100973)Online publication date: Jun-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Software Engineering and Methodology
ACM Transactions on Software Engineering and Methodology  Volume 29, Issue 1
January 2020
317 pages
ISSN:1049-331X
EISSN:1557-7392
DOI:10.1145/3375995
  • Editor:
  • Mauro Pezzè
Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 30 January 2020
Accepted: 01 August 2019
Revised: 01 August 2019
Received: 01 May 2018
Published in TOSEM Volume 29, Issue 1

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Hybrid CSP
  2. approximate bisimulation
  3. code generation

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • NSFC
  • Open Project of Shanghai Key Laboratory of Trustworthy Computing

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)36
  • Downloads (Last 6 weeks)1
Reflects downloads up to 22 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2025)Hybrid dynamical systems logic and its refinementsScience of Computer Programming10.1016/j.scico.2024.103179239(103179)Online publication date: Jan-2025
  • (2024)Formally Verified C Code Generation from Hybrid Communicating Sequential Processes2024 ACM/IEEE 15th International Conference on Cyber-Physical Systems (ICCPS)10.1109/ICCPS61052.2024.00018(123-134)Online publication date: 13-May-2024
  • (2024)An algebraic approach to simulation and verification for cyber-physical systems with shared-variable concurrencyJournal of Logical and Algebraic Methods in Programming10.1016/j.jlamp.2024.100973139(100973)Online publication date: Jun-2024
  • (2024)Case Study: Modeling, Simulation, Verification, and Code Generation of an Automatic Cruise Control SystemThe Practice of Formal Methods10.1007/978-3-031-66673-5_12(226-246)Online publication date: 4-Sep-2024
  • (2023)Unified Graphical Co-modelling, Analysis and Verification of Cyber-physical Systems by Combining AADL and Simulink/StateflowACM SIGAda Ada Letters10.1145/3631483.363148743:1(46-49)Online publication date: 30-Oct-2023
  • (2023)Translating and verifying Cyber–Physical systems with shared-variable concurrency in SpaceExInternet of Things10.1016/j.iot.2023.10086423(100864)Online publication date: Oct-2023
  • (2022)Machine-Checked Executable Semantics of StateflowFormal Methods and Software Engineering10.1007/978-3-031-17244-1_25(421-438)Online publication date: 10-Oct-2022
  • (2021)Brief Industry Paper: Modeling and Verification of Descent Guidance Control of Mars Lander2021 IEEE 27th Real-Time and Embedded Technology and Applications Symposium (RTAS)10.1109/RTAS52030.2021.00051(457-460)Online publication date: May-2021
  • (2021)Unified Graphical Co-modeling, Analysis and Verification of Cyber-Physical Systems by Combining AADL and Simulink/StateflowTheoretical Computer Science10.1016/j.tcs.2021.11.008Online publication date: Nov-2021
  • (2021)Combining Forces: How to Formally Verify Informally Defined Embedded SystemsFormal Methods10.1007/978-3-030-90870-6_1(3-22)Online publication date: 20-Nov-2021
  • Show More Cited By

View Options

Get Access

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

HTML Format

View this article in HTML Format.

HTML Format

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media