unified modeling language umlrobotics.unibg.it/teaching/srt/pdf/18_uml.pdf · unified modeling...
TRANSCRIPT
![Page 1: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/1.jpg)
Corso di Embedded Real Time Systems
Prof. Davide Brugali
Università degli Studi di Bergamo
Unified Modeling Language
UML
![Page 2: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/2.jpg)
Unified Modeling Language
•It is a Specification Language for Complex systems
•The goals of UML are to:
•Provide a common, expressive visual modeling for capturing
object model semantics
•Provide a model with a formal and rigorous semantic basis that
doesn’t require too much formalism by the user
•Provide a metamodel which may be tailored and extended by
the user
•Be independent of PL and development process
2Corso di Sistemi Real Time AA 2010-2011 Prof. Brugali
![Page 3: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/3.jpg)
Basic Building Blocks Of UML
•Use Cases and Use Case Diagrams
•Class Diagrams
•Sequence Diagrams
•Component Diagrams
•Deployment Diagrams
•State Chart Diagrams
•Collaboration Diagrams
3Corso di Sistemi Real Time AA 2010-2011 Prof. Brugali
![Page 4: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/4.jpg)
Use Cases and Use Case Diagrams
![Page 5: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/5.jpg)
Class Diagram
![Page 6: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/6.jpg)
Sequence Diagram
![Page 7: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/7.jpg)
Component Diagrams
![Page 8: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/8.jpg)
Deployment Diagrams
![Page 9: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/9.jpg)
State chart Diagrams
![Page 10: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/10.jpg)
Collaboration Diagrams
![Page 11: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/11.jpg)
State Charts
![Page 12: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/12.jpg)
State chart Diagrams
![Page 13: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/13.jpg)
Specifiche del problema
13
Si progetti il sistema di regolazione automatica della velocità di un’autovettura. Il conducente interagisce con il sistema usando tre dispositivi:
leva di regolazione,
freno,
acceleratore.
Il sistema interagisce con il motore attraverso due dispositivi:
encoder che rileva la velocità dell’albero motore
Iniettore di benzina che varia la velocità del motore
Le condizioni iniziali di funzionamento del sistema di regolazione prevedono che:
il conducente abbia acceso il motore
il conducente stia usando l’auto manualmente
![Page 14: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/14.jpg)
Specifiche del problema
14
Successivamente il conducente interagisce con il sistema di controllo secondo le seguenti modalità:M1: il conducente sposta la leva su ACCEL mantenendola in quella posizione. Il
sistema inizia l’accelerazione automatica e l’auto acceleraM2: il conducente rilascia la leva per mantenere la velocità raggiunta. Il sistema
smette di accelerare e mantiene la velocità raggiunta dell’auto, che viene memorizzata per riferimenti futuri.
M3: il conducente usa il freno per disabilitare il sistema di guida automatico. L’auto è sotto il controllo manuale
M4: il conducente sposta la leva sulla posizione di RESUME per ripristinare il sistema di guida. Il sistema inizia una accelerazione (o decelerazione) per raggiungere la velocità precedentemente memorizzata
M5: quando la velocità memorizzata viene raggiunta questa viene mantenuta dal sistema
M6: il conducente sposta la leva sulla posizione OFF. Il sistema disabilita il controllo automatico e l’auto è sotto il controllo manuale
M7: il conducente ferma l’auto e spegne il motore
![Page 15: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/15.jpg)
Eventi scambiati con l’ambiente esterno
15
Input del conducente e reazioni del sistema
Leva
evento Accel causa accelerazione automatica se non viene premuto il freno
evento Cruise attiva il sistema di controllo e può solo seguire evento Accel
evento Resume deve essere preceduto da disabilitazione del sistema di controllo e
memorizzazione della velocità raggiunta
evento Off disabilita sempre il sistema di controllo
Freno
evento Brake Pressed disabilita il sistema di guida automatico. Il controllo automatico del
veicolo non è possibile mentre il freno è premuto. Dopo aver rilasciato il freno il controllo
automatico può essere ripristinato
Motore
evento Engine On azzera la velocità desiderata
evento Engine Off disabilita ogni attività del sistema
![Page 16: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/16.jpg)
Cruise Control statechart
Idle
Cruising OffInitial
Accelerating
Do/Increase SpeedExit/Select Desired Speed
Resuming
Do/Resume Cruising
Cruising
Do/Maintain Speed
Engine On
Engine Off
Engine Running
Accel [Brake Off]
Automated Control
Accel
AccelCruise Reached Cruising
Off
Brake Pressed
Off
Resume [Brake Off]
Accel [Brake Off]
Statechart
16
![Page 17: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/17.jpg)
Condizioni
definiscono un aspetto del sistema che puo` essere vero o falso in un certo momento
sono associate agli events
Notazione
➢ event [condition]
17
![Page 18: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/18.jpg)
Evento ̀ `Timer``
evento speciale che specifica un evento dopo un certo intervallo di tempo
Notazione
➢ after (elapsed time)
➢ after (10 seconds)
18
![Page 19: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/19.jpg)
Esempio di Condizioni
ATM partial statechart
19
![Page 20: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/20.jpg)
Azioni
Computazione eseguita come risultato di una
transizione
Eseguita istantaneamente durante la transizione
Notazione
➢ event/action
20
![Page 21: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/21.jpg)
Esempio di Azioni
ATM partial statechart
21
![Page 22: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/22.jpg)
Azioni Entry
Azione eseguita tutte le volte che si entra in uno stato
Eseguita prima di qualsiasi attività interna
Si usa se c`è più di una transizione che va in uno stato
Notazione
➢ entry/action
22
![Page 23: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/23.jpg)
Esempio di azioni entry
ATM partial statechart
23
![Page 24: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/24.jpg)
Azione Exit
Azione eseguita tutte le volte che si esce da uno stato
Eseguita solo dopo il completamento di tutte le attivita`interne
Si usa se c`è più di una transizione che lascia uno stato
Notazione
➢ exit/action
24
![Page 25: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/25.jpg)
Esempio di azione exit
Cruise Control partial statechart
25
![Page 26: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/26.jpg)
Attività
Sono computazioni eseguite per tutta la
durata di uno stato
Sono abilitate all`entrata in uno stato e
disabilitate all`uscita di uno stato
Notazioni
➢ event/enable activity
➢ event/disable activity
➢ do/activity
26
![Page 27: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/27.jpg)
Cruise Control statechart
27
![Page 28: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/28.jpg)
Off Light Brightpress? press?
press?
press?
WANT: if press is issued twice quickly
then the light will get brighter; otherwise the light is
turned off.
Timed Automata
Intelligent Light Control
![Page 29: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/29.jpg)
Off Light Brightpress? press?
press?
press?
WANT: if press is issued twice quickly
then the light will get brighter; otherwise the light is
turned off.
Timed Automata
Intelligent Light Control
X:=0 X<=3
X>3
![Page 30: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/30.jpg)
Linee guida per sviluppo di statecharts
Nome dello stato deve riflettere un intervallo di
tempo reale
Nome dello stato unico
Deve essere possibile uscire da ogni stato
STATI
30
![Page 31: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/31.jpg)
Linee guida per sviluppo di statecharts
Non confondere evento (causa) con azione
(effetto)
Nomi di eventi e azioni non ambigui
Condizioni sugli eventi hanno valore booleano
Azioni e condizioni sono opzionali: da usare solo
se necessario
AZIONI EVENTI
31
![Page 32: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/32.jpg)
Confezionamento cioccolatini
![Page 33: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/33.jpg)
Confezionamento cioccolatini
Il sistema di confezionamento cioccolatini è composto da un nastro
trasportatore azionato da un motore, una telecamera posta
verticalmente sopra il nastro, un pistone per rimuovere i cioccolatini
dal nastro e depositarli nella confezione aperta e un pistone per
sostituire la confezione piena con una vuota.
Sul nastro trasportatore vengono depositati (a sinistra nell’immagine)
due tipi di cioccolatini (uno alla volta):
FR : Ferrero Rocher
PC : Pocket Coffee
I cioccolatini arrivano in ordine casuale.
Ogni confezione deve contenere due cioccolatini di tipo FR e un
cioccolatino di tipo PC. Viene riempita una confezione alla volta.
![Page 34: Unified Modeling Language UMLrobotics.unibg.it/teaching/srt/pdf/18_UML.pdf · Unified Modeling Language •It is a Specification Language for Complex systems •The goals of UML are](https://reader033.vdocuments.us/reader033/viewer/2022050505/5f96e182f5fe53305e5c1e14/html5/thumbnails/34.jpg)
Confezionamento cioccolatini
Il nastro trasportatore è un sottosistema regolato che mantiene la
velocità costante. Quando un cioccolatino entra nel campo visivo
della telecamera posta sopra il nastro, il sistema di confezionamento
riconosce di che tipo è il cioccolatino. Se il cioccolatino rispetta una
delle sequenze possibili (es. FR FR PC) viene azionato il pistone
che lo deposita nella confezione aperta. Se invece il cioccolatino non
rispetta una delle sequenze possibili (es. FR PC PC) viene lasciato sul
nastro trasportatore.
Quando una confezione è completa, viene rimossa e sostituita con
una vuota.
Nello stato iniziale il nastro trasportatore è in movimento ma non ci
sono cioccolatini; la confezione aperta non contiene cioccolatini.