Download presentation
Presentation is loading. Please wait.
Published byMatilda Ellis Modified over 9 years ago
1
Statecharts Copyright, 2003 © Jerzy R. Nawrocki Jerzy.Nawrocki@put.poznan.plwww.cs.put.poznan.pl/jnawrocki/mss/ Models & Analysis of Software Lecture 6
2
J. Nawrocki, Models of Software (6) Plan of the lecture IntroductionIntroduction Clustering and refinementClustering and refinement OrthogonalityOrthogonality ActionsActions ActivitiesActivities Condition and selection entrancesCondition and selection entrances TimeoutsTimeouts Parameterised statesParameterised states
3
J. Nawrocki, Models of Software (6)Introduction Transformational system output= f(input) Transformational system output= f(input) InputOutput Reactive system STATE Reactive system STATEStimuliResponse Stimuli Response
4
J. Nawrocki, Models of Software (6)Introduction ABe(c)e(c) e - event c - condition e - event c - condition How about the exponential blow-up problem? How about the exponential blow-up problem?
5
J. Nawrocki, Models of Software (6)Introduction Kind of statements that should be taken into account: In all airborne states, when yellow handle is pulled seat will be ejected.In all airborne states, when yellow handle is pulled seat will be ejected. Gearbox change of state is independent of braking system.Gearbox change of state is independent of braking system. Display-mode consists of time-display, date-display and stopwatch-display.Display-mode consists of time-display, date-display and stopwatch-display.
6
J. Nawrocki, Models of Software (6)Introduction In all airborne states, when yellow handle is pulled seat will be ejected. Ability to cluster states into a superstate.
7
J. Nawrocki, Models of Software (6)Introduction Gearbox change of state is independent of braking system. Independence or orthogonality.
8
J. Nawrocki, Models of Software (6)Introduction Display-mode consists of time-display, date-display and stopwatch-display. Refinement of states.
9
J. Nawrocki, Models of Software (6)Introduction Statecharts = state-diagrams + depth + orthogonality + broadcast-communication
10
J. Nawrocki, Models of Software (6) Plan of the lecture IntroductionIntroduction Clustering and refinementClustering and refinement OrthogonalityOrthogonality SummarySummary ActionsActions ActivitiesActivities Condition and selection entrancesCondition and selection entrances TimeoutsTimeouts Parameterised statesParameterised states
11
J. Nawrocki, Models of Software (6) Clustering and refinement A C (P) B D A C B
12
J. Nawrocki, Models of Software (6) Clustering and refinement D A C B D B D B A C (P)
13
J. Nawrocki, Models of Software (6) Clustering and refinement D A C B (P) A C
14
J. Nawrocki, Models of Software (6) Clustering and refinement D B D A C B (P)
15
J. Nawrocki, Models of Software (6) Clustering and refinement A C (P) B D A C B
16
J. Nawrocki, Models of Software (6) Clustering and refinement A B H H C A B H H C
17
J. Nawrocki, Models of Software (6) Clustering and refinement A B C H H D E G F J A B C H H D E G F J *
18
J. Nawrocki, Models of Software (6) Clustering and refinement A B C H H D E G F K * A B C H H D E G F J H H
19
J. Nawrocki, Models of Software (6) Clustering and refinement C D E G F H H A B C D E G F H H
20
J. Nawrocki, Models of Software (6) Clustering and refinement C D E G F H H C D E G F H H
21
J. Nawrocki, Models of Software (6) Clustering and refinement A B C H H D E G J
22
J. Nawrocki, Models of Software (6) Plan of the lecture IntroductionIntroduction Clustering and refinementClustering and refinement OrthogonalityOrthogonality ActionsActions ActivitiesActivities Condition and selection entrancesCondition and selection entrances TimeoutsTimeouts Parameterised statesParameterised states
23
J. Nawrocki, Models of Software (6)Orthogonality B C (in G) A E F G D
24
J. Nawrocki, Models of Software (6)Orthogonality BC (in G) A EFG D
25
J. Nawrocki, Models of Software (6)Orthogonality BC (in G) A EFG D
26
J. Nawrocki, Models of Software (6)Orthogonality BC (in G) A EFG D
27
J. Nawrocki, Models of Software (6)Orthogonality BC (in G) A EFG D
28
J. Nawrocki, Models of Software (6)Orthogonality BC (in G) A EFG D
29
J. Nawrocki, Models of Software (6)Orthogonality BC (in G) A EFG D
30
J. Nawrocki, Models of Software (6)Orthogonality BC (in G) A EFG D
31
J. Nawrocki, Models of Software (6)Orthogonality BC (in G) A EFG D
32
J. Nawrocki, Models of Software (6) Plan of the lecture IntroductionIntroduction Clustering and refinementClustering and refinement OrthogonalityOrthogonality ActionsActions ActivitiesActivities Condition and selection entrancesCondition and selection entrances TimeoutsTimeouts Parameterised statesParameterised states
33
J. Nawrocki, Models of Software (6)Actions AB e(c) / a e - event c - condition a - action e - event c - condition a - action Examples: sending a signal, sending a signal, assignment statement. assignment statement. Action: an instantaneous occurrencean instantaneous occurrence ideally takes zero time.ideally takes zero time.
34
J. Nawrocki, Models of Software (6)Actions while (x != y) if (x > y) if (x > y) x -= y; x -= y; else y -= x; else y -= x; while (x != y) if (x > y) if (x > y) x -= y; x -= y; else y -= x; else y -= x; E S Loop XY (x>y) / x-=y (y>x) / y-=x B (x=y) x: y:
35
J. Nawrocki, Models of Software (6)Actions E S Loop XY (x>y) / x-=y (y>x) / y-=x B (x=y) x: 6 y: 9
36
J. Nawrocki, Models of Software (6)Actions E S Loop XY (x>y) / x-=y (y>x) / y-=x B (x=y) x: 6 y: 9
37
J. Nawrocki, Models of Software (6)Actions E S Loop XY (x>y) / x-=y y>x (y>x) / y-=x B (x=y) x: 6 y: 9
38
J. Nawrocki, Models of Software (6)Actions E S Loop XY (x>y) / x-=y (y>x) / y-=x B (x=y) x: 6 y: 3
39
J. Nawrocki, Models of Software (6)Actions E S Loop XY x>y (x>y) / x-=y (y>x) / y-=x B (x=y) x: 6 y: 3
40
J. Nawrocki, Models of Software (6)Actions E S Loop XY (x>y) / x-=y (y>x) / y-=x B (x=y) x: 3 y: 3
41
J. Nawrocki, Models of Software (6)Actions E S Loop XY (x>y) / x-=y (y>x) / y-=x B x=y (x=y) x: 3 y: 3
42
J. Nawrocki, Models of Software (6)Actions E S Loop XY (x>y) / x-=y (y>x) / y-=x B (x=y) x: 3 y: 3
43
J. Nawrocki, Models of Software (6)Actions A entry s exit , t throughout x E entry u B entry v F D C / w
44
J. Nawrocki, Models of Software (6)Actions E S L X entry x-=y true(x>y)true(y>x) B true(x=y) x: y: Y entry y-=x
45
J. Nawrocki, Models of Software (6) Plan of the lecture IntroductionIntroduction Clustering and refinementClustering and refinement OrthogonalityOrthogonality ActionsActions ActivitiesActivities Condition and selection entrancesCondition and selection entrances TimeoutsTimeouts Parameterised statesParameterised states
46
J. Nawrocki, Models of Software (6)Activities Activity: similar to action butsimilar to action but takes a nonzero amount of timetakes a nonzero amount of time Examples: reading input reading input beeping beeping displaying displaying lengthy computations lengthy computations
47
J. Nawrocki, Models of Software (6)ActivitiesActionsstart(A)stop(A)suspend(A)resume(A)start(A)stop(A)suspend(A)resume(A) Conditionsactive(A)hanging(A)active(A)hanging(A)Eventsstarted(A)stopped(A)started(A)stopped(A)
48
Activities entry start(Freeze) entry stop(Freeze) true(CT > R)true(CT < R)
49
J. Nawrocki, Models of Software (6) Plan of the lecture IntroductionIntroduction Clustering and refinementClustering and refinement OrthogonalityOrthogonality ActionsActions ActivitiesActivities Condition and selection entrancesCondition and selection entrances TimeoutsTimeouts Parameterised statesParameterised states
50
J. Nawrocki, Models of Software (6) Condition and selection entrances (e) (f) (d) (e) (f)(d) C
51
J. Nawrocki, Models of Software (6) Condition and selection entrances C BA S BA C
52
J. Nawrocki, Models of Software (6) Plan of the lecture IntroductionIntroduction Clustering and refinementClustering and refinement OrthogonalityOrthogonality ActionsActions ActivitiesActivities Condition and selection entrancesCondition and selection entrances TimeoutsTimeouts Parameterised statesParameterised states
53
J. Nawrocki, Models of Software (6)Timeouts timeout (event, number) timeout (entered state, number) < 2 sec. timeout
54
J. Nawrocki, Models of Software (6) Plan of the lecture IntroductionIntroduction Clustering and refinementClustering and refinement OrthogonalityOrthogonality ActionsActions ActivitiesActivities Condition and selection entrancesCondition and selection entrances TimeoutsTimeouts Parameterised statesParameterised states
55
J. Nawrocki, Models of Software (6) Parameterised states 0 1 2 43 9 5 6 7 8 i i+1 mod 10 i [0..9]
56
J. Nawrocki, Models of Software (6) Parameterised states 0 1 2 43 9 5 6 7 8 0 1 9 ii+1 i [1..8]
57
J. Nawrocki, Models of Software (6)Summary Statecharts: Reactive systems State diagrams Clustering and refinement Orthogonality
58
J. Nawrocki, Models of Software (6)Summary Actions (short) Activities (long) Conditions and selections Timeouts Parameterised states
59
J. Nawrocki, Models of Software (6) Further readings D. Harel, Statecharts: A Visual Formalism for Complex Systems, Science of Computer Programming, vol. 8 (1987) 231 - 274. D. Harel et al., STATEMATE: A working environment for the development of complex reactive systems, IEEE Transactions on Software Eng.,vol. 16 (1990), no. 4, 403 - 414.
60
J. Nawrocki, Models of Software (6)Homework Describe your TV set with statecharts. Using statecharts solve the problem of readers and writers.
61
J. Nawrocki, Models of Software (6) Quality assessment 1. What is your general impression ? 2. Was it too slow or too fast ? 3. Did you learn something important to you ? 4. What to improve and how ?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.