Visual State Machine
Visual State Machine
Agenda
Lidt historie samt firma prsentation
visualSTATE Grundlggende visualSTATE opbygning
Designeren og UML Formel verifikation Test / Validering samt prototyping Kodegenerering og RealLink Dokumentation
1985 1987 1989 1991 1993 1995 1997 1999 2001 University B&O R&D B&O Technology Beologic A/S Baan IAR
Today
visualSTATE
programming tool for Design, Prototyping, Code Generation, Test & Documentation
Embedded Workbench
development toolkit based on C/C++ compilers
Intel OKI Hitachi Mitsubishi NEC Motorola Atmel Zilog Microchip Technologies
32-bit
Sharp
8-bit
DSP
16-bit
ITT
National Semiconductor
A complete development suite for embedded development: Project management functionality Editors for source code and binary files ANSI C & Embedded C++ compilers Assembler Linker & librarian Debugger (Simulator, Emulator & ROM-monitor)
IAR MakeApp
automatic code generators for device drivers
BlueTooth
StarterKit
PreQual
Consultant services
Project startup Project preview project development
Training
Product training Technology training (C++, EC++, UML, BT, etc)
Tidskrav
Eksekverings-tid / Real-time Deterministisk
Kvalitet / plidelighed
Analysis
Informal analysis
UML SDL
SA
Informal method
Design
Incomplete design
Verification
Coding
Integration
Manual coding
Manual coding
State machines designed in IAR visualSTATE can be designed using two notations :
S/E notation based on the Mealy notation
SE_RESET
S1
E1 / A2A3
E1 / A1
S2
S3
E1!S4/A2A3
Hvad er en tilstandsmaskine ?
En maskine/system med en tilstands-orienteret dynamisk opfrsel Et dynamisk system, der reagerer p pvirkninger afhngig af tid og tilstand
Et tilstandsdiagram beskriver
Livs-forlbet af et system Hvordan systemet reagerer p pvirkninger i alle situationer
Eksempler
Mobiltelefoner Automater (kaffe, slik, cigaretter, Dankort, ...) Operatr-paneler Symaskiner Reguleringer (varme, lys, fugtighed, ...)
Events
Hndelser, der pvirker tilstandsmaskinen Har i princippet ingen tidsmssig udstrkning (forekommer momentant og asynkront)
States
Beskriver systemets tilstand mellem to events Har tidsmssig udstrkning
Actions
Beskriver systemets pvirkning p omgivelserne Har i princippet ingen tidsmssig udstrkning (udfres momentant og uden afbrydelser)
switch ( current_state ) { case ALARM : if ( event == ALARM_KVITTERING ) { StopAlarm(); current_state = INGEN_ALARM; } break; case ... : }
Rule notation
Each state machine is always in one and only one state State changes (transitions) are triggered by one and only one event
visualSTATE Fundamentals
Event Queue
Real Life Real Life
x=port(0);
visualSTATE enigne
port(1) = 1;
Events
Action functions
Technological concept
Mathematical proof of correct code through binary arrays with unique interpretation
Well defined set of mathematical operations
Patented
Modeling
Run-time
Pa te
nte d
State analysis
Manuel test
Event1 Event3 Event7 Event4 ... Event6() /
Event1() / A Event3() / Event4() / D Event5() / B Event2() /
Event6() /
Automatisk test
Fejl hvis Event1 og state1 og state2 {
Kodegenerering
Event1() / A Event3() / Event4() / C D Event5() / B Event2() / Event6() /
Dokumentation
Event1() / A
Event2() /
Designer / UML
Hvad er UML
UML, Unified Modeling Language UML er en metode / notation der prver at samle nogle af de forskellige objekt orienterede metoder. OMG godkendte UML som standard i 1997. 3 modeller
Kravmodeller (USE-case diagram og sekvensdiagram) Strukturer (klassediagrammer) Opfrsel (tilstandsdiagrammer)
Hvorfor UML
Veldefineret objekt model Uafhngig af implementerings sprog Mulighed for genbrug Samme platform uafhngig af type applikation Bred vifte af vrktjer Bred vifte af litteratur, trning og konsulentydelser Efterhnden udbredt p undervisnings institutioner
Designing a stereo...
Transition
Event
Super state
The states STOPPED, PLAYING and RECORDING are only active when state TAPE is active
Concurrency is introduced
Composite state
Concurrent substate
State PLAYING or state STOPPED and state CD or state NO_CD are active
Entry actions are activated each time a state in entered Exit actions are activated each time a state is left
Initial states
Initial state
Initial states are used to initialize the statecharts and as default states in superstates
History states
History state
Variables
Variable
Signals
Signal
Internal transitions
Internal transition
Each state machine is always in one and only one state State changes (transitions) are triggered by one and only one event / event group / signal Upon receipt of a trigger, all state combinations are frozen until all transitions have been handled, and all variables are double buffered (if necessary)
Assignment
Force state
Signal
Design / metode
De 6 trin :
1. Identificr events og actions 2. Identificr states 3. Gruppr efter hierarki 4. Gruppr efter concurrency 5. Tilfj transitioner 6. Tilfj synkroniseringer
Actions er systemets pvirkning p omgivelserne = output fra tilstandsmaskinen Actions er systemets reaktion p de eksterne pvirkninger
Dren kan vre ben eller lukket Dren kan vre lst eller ulst Switchen kan vre i en af de tre positioner Lyset kan tndt eller slukket
Med denne gruppering modelleres, at dren ikke kan vre ben eller lukket, nr den er lst. Modellen indkapsler muligheden for at bne en dr kun muligt, nr dren er ulst
Det skal vre muligt at bne, lukke og lse dren samtidigt med at switchen ndres og samtidigt med at lyset skifter
Bemrk, at der er indfrt yderligere hierarki af design hensyn n transition til hver switch-position
Nr dren bnes mens switchen er i sensitive, s skal lyset tndes.... .... etc.
Formel verifikation
S11 S21
S13
Unreachable Transition
Verificator settings
Exhaustive computation 7 different checks Use of elements Reachable transitions Conflicting transitions Activation of elements State dead end Local dead end System dead end Forward / Backward mode Backward = no dead-end check
AD
E3() /
AC
Prototyping
Why prototyping
You can build a model that looks and behave like your final product You can get feedback from marketing, sales and customers and therefore make corrections in a much earlier state in your development process and therefore save money. It will help you increase the awareness and knowledge of your product before it is launched With visualSTATE your final product will behave in a way 100% identical to that of your prototype.
Visual C / C++
App note 10743: Prototyping in Visual C++ with IAR visualSTATE
Visual Basic
App note 45079: Prototyping in Visual Basic with visualSTATE expert DLL.
Delphi
App note 45079: Prototyping in Visual Basic with visualSTATE expert DLL.
Kodegenerering og RealLink
Advantages
SW-consistency between design and actual code is guaranteed Avoid manual coding, spaghetti coding and reverse engineering
Automatic codegeneration
Application
Model
Device Drivers
8-/16-/32-bit
*) Foot print: 600 bytes to 2K
TCP/IP
Direct
Real-Link Server
Wire
Real-Link Agent*
*) Foot print: ~1K (RS232 interface)
Documentation
Advantages
100% consistent with current implementation Customized documentation/manual Up-to-date documentation
Our customers
Automotive Telecom Medical Electronics Aerospace & Defense Financial Industrial machinery Industrial instruments Consulting & Education Multimedia & Entertainment
Case Stories
Husqvarna Viking, MMI for sewing machine Grundfos Group, Pumps Bang & Olufsen, TV, video and stereo Danfoss A/S, MMI for flow meters P.I.V. Eldutronik, frequency controller Spark Holland, laboratory equipment Wittenborg A/S, Vending machines http://www.iar.com/Products/vS/References
Other Customers
Canon Inc. LG Electronics Digianswer A/S DE-VI A/S DEIF A/S Migatronic A/S FBI laboratory
KONE Corporation Lego Systems A/S Novo Nordisk A/S Scanvgt International A/S Siemens Elema AB Siemens AG Terma Elektronic A/S
Questions