Formal Modeling and Verification of Embedded Real-Time Systems: An Approach and Practical Tool Based on Constraint Time Petri Nets
Abstract
:1. Introduction
- TPN-based tools normally depend on a special case implementation of the computational state graph based on the over-approximation, which in some cases can furnish more strict predictions of the WCRT of tasks.
- The tool depends on the state graph built by Uppaal on a reduced TA model of a source C-TPN net. A reduced model, with over-approximation, can be thoroughly analyzed by exhaustive model checking and the overall schedulability rigorously assessed along with the WCRT of tasks. In addition, the Statistical Model Checker of Uppaal can be exploited for the graphical monitoring of particular executions of a real-time task set, for example, to observe the preemptions/suspensions and the subsequent resumes of specific task actions/transitions. All of this can help the modeler’s reasoning and expectations about the behavior of a real-time model.
- Both statically and dynamically defined task priorities are supported. This way, more general schedulability schemes can be studied, including the EDF scheduling policy [3,4,5], which has been demonstrated to be capable of better exploitation of the computing resources and can be a choice of the RTOS managing a final model implementation.
2. Constraint Time Petri Nets
2.1. Syntax
- is a non-empty set of places,
- is a non-empty set of transitions, , ;
- is the flow relation: , that is, the set of possible directed arcs connecting input places to transitions and transitions to output places;
- is the weighting function of arcs: ;
- M0 is the initial marking of the model: M0: ;
- and functions specify, respectively, the Earliest Firing Time and the Latest Firing Time statically associated with each transition [7]: , :, ;
- is the constraint function of a transition, false by default when not specified. A true value of mirrors the fact that at a given moment, the transition is constrained by the model state, and its clock must be stopped. Clock advancement is resumed as soon as evaluates to false. The definition of is model-dependent and purposely can express scheduling concerns like a static or dynamic priority assigned to the transition, along with the processor, on top of which the transition is assigned for execution (see later in this paper).
2.2. Formal Operational Semantics
- is the set of enabled transitions in marking M;
- is the set of active transitions in marking M;
- is the set of suspended transitions in marking M;
- is the set of fireable transitions in marking M.
2.3. Delay Transition
2.4. Action Transition
3. Reducing C-TPN onto Uppaal
3.1. Data Structures
- The (ackward matrix, used for checking transition enabling and for assisting the withdrawal sub-step during transition firing;
- The (orward matrix, which supports the deposit sub-step of transition firing;
- The I(nterval matrix, which holds the EFT/LFT of transitions, and the int const (e.g., −1) is used to specify ∞ as LFT;
- The (arking vector, which holds the net marking.
3.2. Transition Automata
- , transition t is not enabled;
- , transition t is active, that is, it is enabled and unconstrained;
- , transition t is suspended, that is, it is enabled but constrained;
- , transition t has started its firing by just executing the withdrawal sub-step;
- , transition t is terminating its firing by executing its deposit sub-step.
3.3. Model Initialization
3.4. System Declaration
4. Modeling and Verification Examples
4.1. First Example
4.1.1. Schedulability Analysis under Fixed Priorities (FP)
4.1.2. Schedulability Analysis under Dynamic Priorities
4.2. Second Example
4.3. Third Example
4.3.1. Schedulability Analysis under Fixed Priorities
4.3.2. Schedulability Analysis under Dynamic Priorities
Pr[<=300](<>M[p5]>1)
Pr[<=300](<>M[p9]+M[p10]+M[p11]+M[p12]>1)
Pr[<=300](<>M[p14]+M[p15]+M[p16]>1)
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Lee, E.A.; Seshia, S.A. Introduction to Embedded Systems—A Cyber-Physical Systems Approach. 2011. Available online: https://ptolemy.berkeley.edu/books/leeseshia/ (accessed on 16 February 2024).
- Yousif, A.; Bashir, M.B.; Ali, A. An Evolutionary Algorithm for Task Clustering and Scheduling in IoT Edge Computing. Mathematics 2024, 12, 281. [Google Scholar] [CrossRef]
- Buttazzo, G. Hard Real-Time Computing Systems, 3rd ed.; Springer: New York, NY, USA, 2011. [Google Scholar]
- Sha, L.; Abdelzaher, T.; Årzén, K.-E.; Cervin, A.; Baker, T.; Burns, A.; Buttazzo, G.; Caccamo, M.; Lehoczky, J.; Mok, A.K. Real time scheduling theory: A historical perspective. Real-Time Syst. 2004, 28, 101–155. [Google Scholar] [CrossRef]
- Shaw, A.C. Real-Time Systems and Software; John Wiley and Sons, Inc.: Hoboken, NJ, USA, 2001. [Google Scholar]
- Cassez, F.; Larsen, K.G. The impressive power of stopwatches. In Proceedings of the CONCUR 2000, State College, PA, USA, 22–25 August 2000; LNCS 1877. Springer: Berlin/Heidelberg, Germany, 2000; pp. 138–152. [Google Scholar]
- Merlin, P.; Farber, D.J. Recoverability of communication protocols. IEEE Trans. Commun. 1976, 24, 1036–1043. [Google Scholar] [CrossRef]
- Lime, D.; Roux, O.H. Expressiveness and analysis of scheduling extended time Petri nets. In Proceedings of the IFAC 2003, Singapore, 11–14 November 2003; Volume 36, pp. 189–197. [Google Scholar]
- Roux, O.H.; Lime, D. Time Petri nets with inhibitor hyperarcs formal semantics and state space computation. In Proceedings of the ICATPN 2004, Bologna, Italy, 21–25 June 2004; Springer: Berlin/Heidelberg, Germany, 2004; pp. 371–390. [Google Scholar]
- Lime, D.; Roux, O.H.; Seidner, C.; Traonouez, L.M. Romeo: A parametric model-checker for Petri nets with stopwatches. In Proceedings of the TACAS 2009, York, UK, 22–29 March 2009; LNCS. Springer: Berlin/Heidelberg, Germany, 2009; Volume 5505, pp. 54–57. [Google Scholar]
- Berthomieu, B.; Lime, D.; Roux, O.; Vernadat, F. Reachability problems and abstract state spaces for time Petri nets with stopwatches. Discret. Event Dyn. Syst. 2007, 17, 133–158. [Google Scholar] [CrossRef]
- TINA On-Line 2024. Available online: https://projects.laas.fr/tina/home.php (accessed on 16 February 2024).
- Bucci, G.; Fedeli, A.; Sassoli, L.; Vicario, E. Timed state space analysis of real time preemptive systems. IEEE Trans. Softw. Eng. 2004, 30, 97–111. [Google Scholar] [CrossRef]
- Bucci, G.; Carnevali, L.; Ridi, L.; Vicario, E. Oris: A tool for modeling, verification and evaluation of real-time systems. Int. J. Softw. Tools Technol. Transf. 2010, 12, 391–403. [Google Scholar] [CrossRef]
- Abdelli, A. Time distance-based computation of the DBM over-approximation of preemptive real-time systems. J. Log. Algebr. Methods Program. 2024, 136, 100927. [Google Scholar] [CrossRef]
- Alur, R.; Dill, D. A theory of timed automata. Theor. Comput. Sci. 1994, 126, 183–235. [Google Scholar] [CrossRef]
- Behrmann, G.; David, A.; Larsen, K.G. A tutorial on UPPAAL. In Formal Methods for the Design of Real-Time Systems; Bernardo, M., Corradini, F., Eds.; LNCS 3185; Springer: Berlin/Heidelberg, Germany, 2004; pp. 200–236. [Google Scholar]
- David, A.; Larsen, K.G.; Legay, A.; Mikucionis, M.; Poulsen, D.B. Uppaal SMC tutorial. Int. J. Softw. Tools Technol. Transf. 2015, 17, 397–415. [Google Scholar] [CrossRef]
- Cicirelli, F.; Furfaro, A.; Nigro, L.; Pupo, F. Development of a schedulability analysis framework based on pTPN and UPPAAL with stopwatches. In Proceedings of the IEEE/ACM 16th International Symposium on Distributed Simulation and Real Time Applications, Dublin, Ireland, 25–27 October 2012; pp. 57–64. [Google Scholar]
- Cicirelli, F.; Furfaro, A.; Nigro, L. Model checking time-dependent system specifications using Time Stream Petri Nets and Uppaal. Appl. Math. Comput. 2012, 218, 8160–8186. [Google Scholar] [CrossRef]
- Pimkote, A.; Vatanawood, W. Simulation of preemptive scheduling of the independent tasks using timed automata. In Proceedings of the 10th International Conference on Software and Computer Applications, Kuala Lumpur, Malaysia, 23–26 February 2021; pp. 7–13. [Google Scholar]
- Agha, G.; Palmskog, K. A Survey of Statistical Model Checking. ACM Trans. Model. Comput. Simul. 2018, 28, 1–39. [Google Scholar] [CrossRef]
- Baek, H.; Lee, J. Contention-Free Scheduling for Single Preemption Multiprocessor Platforms. Mathematics 2023, 11, 3547. [Google Scholar] [CrossRef]
- Murata, T. Petri Nets: Properties, analysis and applications. Proc. IEEE 1989, 77, 541–580. [Google Scholar] [CrossRef]
- Plotkin, G. A Structural Approach to Operational Semantics; Tech. Report DAIMI FN-19; Computer Science Department, Aarhus University: Aarhus, Denmark, 1981. [Google Scholar]
- Bowman, H.; Gomez, R.; Su, L. A tool for the syntactic detection of zeno-timelocks in Timed Automata. Electron. Notes Theor. Comput. Sci. 2005, 139, 25–47. [Google Scholar] [CrossRef]
- Uppaal On-Line. 2024. Available online: http://www.uppaal.org (accessed on 16 February 2024).
- Cicirelli, F.; Nigro, L. Analyzing stochastic reward nets by model checking and parallel simulation. Simul. Model. Pract. Theory 2022, 116, 102467. [Google Scholar] [CrossRef]
- Cicirelli, F.; Nigro, L. Admission control in Home Energy Management Systems using Theatre with hybrid actors. Modelling 2021, 2, 288–307. [Google Scholar] [CrossRef]
- Uppaal Tutorial. 1999. Available online: https://www.cis.upenn.edu/~lee/09cis480/lec-part-3-uppaal-inside.pdf (accessed on 16 February 2024).
- Cicirelli, F.; Nigro, L.; Sciammarella, P.F. Model continuity in Cyber-Physical Systems: A control centered methodology based on Agents. Simul. Model. Pract. Theory 2018, 83, 93–107. [Google Scholar] [CrossRef]
- Zagan, I.; Gaitan, V.G. Designing a custom cpu architecture based on hardware RTOS and dynamic preemptive scheduler. Mathematics 2022, 10, 2637. [Google Scholar] [CrossRef]
- Qiu, Q.; Maillart, L.M.; Prokopyev, O.A.; Cui, L. Optimal condition-based mission abort decisions. IEEE Trans. Reliab. 2022, 72, 408–425. [Google Scholar] [CrossRef]
- Nigro, L. Parallel Theatre: An actor framework in Java for high performance computing. Simul. Model. Pract. Theory 2021, 106, 102189. [Google Scholar] [CrossRef]
- Khaleel, M.I.; Safran, M.; Alfarhood, S.; Zhu, M. Workflow Scheduling Scheme for Optimized Reliability and End-to-End Delay Control in Cloud Computing Using AI-Based Modeling. Mathematics 2023, 11, 4334. [Google Scholar] [CrossRef]
Transition | Constraint Function C(t) |
---|---|
t4 | false |
t5 | M[p1]>0 |
t6 | M[p1]+M[p2]>0 |
Task | BCRT | WCRT |
---|---|---|
T1 | 10 | 20 |
T2 | 18 | 60 |
T3 | 30 | 150 |
Transition | Constraint Function C(t) |
---|---|
t4 | M[p2]>0 && 100-x[t3]<50-x[t1] || M[p3]>0 && 150-x[t5]<50-x[t1] |
t5 | M[p1]>0 && 50-x[t1]<100-x[t3] || M[p3]>0 && 150-x[t5]<100-x[t3] |
t6 | M[p1]>0 && 50-x[t1]<150-x[t5] || M[p2]>0 && 100-x[t3]<150-x[t5] |
Task | BCRT | WCRT |
---|---|---|
T1 | 10 | 39 |
T2 | 18 | 40 |
T3 | 34 | 83 |
Transition | Constraint Function C(t) |
---|---|
t6 (cpu1) | false |
t7 (cpu1) | M[p1]>0 |
t8 (cpu2) | false |
t9 (cpu2) | M[p3]>0 |
t10 (cpu2) | M[p3]+M[p4]>0 |
Task | BCRT | WCRT |
---|---|---|
T1 (cpu1) | 10 | 20 |
T2 (cpu1) | 18 | 76 |
T3 (cpu2) | 20 | 28 |
T4 (cpu2) | 24 | 58 |
T5 (cpu2) | 28 | 96 |
Transition | Constraint Function C(t) |
---|---|
t6 (cpu1) | M[p2]>0 && 80-x[t2]<50-x[t1] |
t7 (cpu1) | M[p1]>0 && 50-x[t1]<80-x[t2] |
t8 (cpu2) | M[p4]>0 && 200-x[t4]<150-x[t3] || M[p5]>0 && 250-x[t5]<150-x[t3] |
t9 (cpu2) | M[p3]>0 && 150-x[t3]<200-x[t4] || M[p5]>0 && 250-x[t5]<200-x[t4] |
t10 (cpu2) | M[p3]>0 && 150-x[t3]<250-x[t5] || M[p4]>0 && 200-x[t4]<250-x[t5] |
Task | BCRT | WCRT |
---|---|---|
T1 (cpu1) | 10 | 47 |
T2 (cpu1) | 18 | 47 |
T3 (cpu2) | 20 | 28 |
T4 (cpu2) | 24 | 57 |
T5 (cpu2) | 28 | 90 |
Transition | Constraint Function C(t) |
---|---|
t2, t3, t6, t7 (cpu1) | M[p11]>0 |
t9 (cpu1) | M[p1]+M[p4]+M[p7]+M[p11]>0 |
t11, t12, t14 (cpu1) | M[p1]+M[p4]+M[p5]+M[p7]>0 |
t16, t17, t18 (cpu2) | false |
Task | BCRT | WCRT |
---|---|---|
T1 | 16 | 43 |
T2 | 28 | 40 |
T3 | 42 | 128 |
T4 | 16 | 28 |
Transition | Constraint Function C(t) |
---|---|
t2…t7 (T1) | M[p5]>0 && 100-x[t8]<50-x[t1] || M[p9]+M[p11]+M[p12]>0 && 150-x[t10]<50-x[t1] || M[p9]+M[p11]+M[p12]>0 && 150-x[t10]<50-x[t1] |
t9 (T2) | M[p1]+M[p4]+M[p7]>0 && 50-x[t1]<100-x[t8] || M[p9]+M[p11]+M[p12]>0 && 150-x[t10]<100-x[t8] || M[p14]+M[p16]>0 && 150-x[t15]<100-x[t8] |
t11…t14 (T3) | M[p1]+M[p4]+M[p7]>0 && 50-x[t1]<150-x[t10] || M[p5]>0 && 100-x[t8]<150-x[t10] || M[p14]+M[p16]>0 && 150-x[t15]<150-x[t10] |
t16…t18 (T4) | M[p1]+M[p4]+M[p7]>0 && 50-x[t1]<150-x[t15] || M[p5]>0 && 100-x[t8]<150-x[t15] || M[p9]+M[p11]+M[p12]>0 && 150-x[t10]<150-x[t15] |
Task | BCRT | WCRT |
---|---|---|
T1 | 16 | 34 |
T2 | 26 | 39 |
T3 | 45 | 90 |
T4 | 40 | 69 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Nigro, L.; Cicirelli, F. Formal Modeling and Verification of Embedded Real-Time Systems: An Approach and Practical Tool Based on Constraint Time Petri Nets. Mathematics 2024, 12, 812. https://doi.org/10.3390/math12060812
Nigro L, Cicirelli F. Formal Modeling and Verification of Embedded Real-Time Systems: An Approach and Practical Tool Based on Constraint Time Petri Nets. Mathematics. 2024; 12(6):812. https://doi.org/10.3390/math12060812
Chicago/Turabian StyleNigro, Libero, and Franco Cicirelli. 2024. "Formal Modeling and Verification of Embedded Real-Time Systems: An Approach and Practical Tool Based on Constraint Time Petri Nets" Mathematics 12, no. 6: 812. https://doi.org/10.3390/math12060812
APA StyleNigro, L., & Cicirelli, F. (2024). Formal Modeling and Verification of Embedded Real-Time Systems: An Approach and Practical Tool Based on Constraint Time Petri Nets. Mathematics, 12(6), 812. https://doi.org/10.3390/math12060812