110 likes | 263 Views
ECE 18-649 Soda Machine Example Status Update. February 19, 2010 Group 7 Justin Ray READ THE SLIDE NOTES FOR COMMENTARY ON THIS EXAMPLE. Overview. ButtonControl Design Process Use case: pressing the button Scenarios, Sequence Diagrams, Requirements Statecharts: to nest or not to nest
E N D
ECE 18-649Soda Machine ExampleStatus Update February 19, 2010 Group 7 Justin Ray READ THE SLIDE NOTES FOR COMMENTARY ON THIS EXAMPLE
Overview • ButtonControl Design Process • Use case: pressing the button • Scenarios, Sequence Diagrams, Requirements • Statecharts: to nest or not to nest • Design revisions • Missing inputs • Incorrect flashing behavior • Project Statistics • Lessons Learned Justin Ray
ButtonControl: Use Case and Scenario • U2. Customer pushes a soda button • Primary use case for soda vending • U4. Observe soda availability • Deals with the behavior of the button light • Scenario 2A: push button after paying • Precondition: 2 coins inserted • Scenario • The Customer pushes soda button ‘s’. • The light on the soda button ‘s’ begins flashing. • … (vend cycle) • The light on the soda button s stops flashing. • Postcondition: A soda has been vended. Justin Ray
Sequence Diagram 2A Button Customer ButtonLight VendControl CoinControl ButtonControl CoinCount==2 mVend == False 1a. Button s pressed 1b. Button[s](true) 1c. mButton[s](true) 16pt 1d. mCoinCount(2) Flashing light behavior indicates that a soda vend is in progress. 2a. ButtonLight[s](false) 2b. ButtonLight[s](true) 2a and 2b repeat until 5a. Note: Subset of the SD 2A relevant to the controller behavior. Justin Ray
Requirements • 6 Requirements total • R2.4 indicates a vend cycle is in progress • If • Button[s] True AND • mEmpty[s] False AND • mCoinCount equals SODA_COST AND • mVend False, • then • R2.4a. ButtonState shall be set to True. • R2.4b. ButtonLight[s] shall be commanded to blink with a period of 1s. Justin Ray
Statechart • Nested statechart avoids duplicating T2.2 and T2.3 • Early work on Proj 5 nested statechart is hard to implement S2.1 IDLE DO: ButtonLightOn mButton[s] False FlashCounter 0 S2.3 VEND T2.1 S2.4 FLASH_OFF DO: ButtonLightOff mButton[s] TRUE Increment FlashCounter T2.2 T2.6 T2.7 S2.2 EMPTY DO: ButtonLightOff mButton[s] False FlashCounter 0 T2.3 T2.4 T2.5 S2.4 FLASH_ON DO: ButtonLightOn mButton[s] TRUE Decrement FlashCounter T2.1 mButton[s] ← True AND mEmpty[s] ← False AND mVend ← False AND mCoinCount ← SODA_COST …. Justin Ray
Project Statistics Justin Ray
Lessons Learned & Open Issues • Problems that you have already solved • CoinControl missing a VEND state • Identified in reviews mVend input unused • ButtonControl defects • Identified in reviews incorrect flashing behavior • Team strategies • Sort out tools early • Only let one person edit a document at a time • Open issues • Refactor the ButtonControl statechart? • Decide between • more complex statechart that matches the code better • less complex statechart with duplicated transitions in code Justin Ray
Any Questions? Team 7 Justin ray – justinr2@ece.cmu.edu …
Statechart S2.1 IDLE DO: ButtonLightOn mButton[s] False FlashCounter 0 S2.3 VEND T2.1 S2.4 FLASH_OFF DO: ButtonLightOff mButton[s] TRUE Increment FlashCounter T2.2 T2.6 T2.7 S2.2 EMPTY DO: ButtonLightOff mButton[s] False FlashCounter 0 T2.3 T2.4 T2.5 S2.4 FLASH_ON DO: ButtonLightOn mButton[s] TRUE Decrement FlashCounter Justin Ray