- 2070 Bhadra · 8 marks
Bottle recycling machine state diagram
Short answer
Control unit states: Waiting (initial), On Run (composite with Working, Blocked, Failure Notification, Emptying sub-states), Receipt Printing, On Service. Transitions: bottleDetected starts On Run; jam moves to Blocked; timeout triggers Failure Notification; endPressed with sum>0 goes to Receipt Printing; serviceKey enters On Service; serviceFinished returns to Waiting.
Bottle recycling machine has a control unit, bottle sensor, belt-unit, the sum counter, the end button and the receipt printer. There are at least states such as waiting, on run, on service and receipt printing. The "on run" state can be refined with sub-states working, blocked, failure notification, emptying. You can add few new states according to your own realization. Draw a state diagram for the control unit.
Assumptions (extra states and events): Waiting is the initial state; entering Receipt Printing totals the deposit before printing; a Failure Notification leads to On Service. Events: bottleDetected, endPressed, jam, serviceKey, receiptPrinted, serviceFinished.
State diagram of the control unit
(*)
|
v
+--------------+ bottle detected +------------------+
| Waiting |--------------------->| On Run |
| do/ monitor |<---------------------| (composite) |
| sensor | timeout [sum = 0] +------------------+
+--------------+ | |
^ | ^ end button | | from Failure
| | | [sum > 0] | | Notification /
| | | v v call service
| | | +------------------+ +--------------+
| | +--------------| Receipt Printing | | On Service |
| | receipt printed | entry/ total sum | | do/ repair, |
| | / sum = 0 | do/ print | | maintenance |
| | +------------------+ +--------------+
| | service key | ^
| +---------------------------------------------|---+
+--------------- service finished ---------------+
Sub-states of "On Run"
+-----------------------------------------------------------+
| On Run |
| |
| (*) |
| | bottle accepted / sum += value (self-transition) |
| v |
| +---------+ storage full +----------+ |
| | Working |---------------------->| Emptying | |
| | |<----- emptied --------| | |
| +---------+ +----------+ |
| | ^ |
| | jam | cleared / |
| | / | restart belt |
| | stop| |
| v belt| |
| +---------+ timeout +----------------------+|
| | Blocked |---------------------->| Failure Notification ||
| +---------+ | entry/ raise alarm ||
| +----------------------+|
+-----------------------------------------------------------+
Transition table
| From | Event [guard] / action | To |
|---|---|---|
| Waiting | bottle detected | On Run (Working) |
| Working | bottle accepted / sum += value | Working |
| Working | jam detected / stop belt | Blocked |
| Blocked | cleared / restart belt | Working |
| Blocked | timeout > limit | Failure Notification |
| Working | storage full | Emptying |
| Emptying | emptied | Working |
| On Run | timeout [sum = 0] | Waiting |
| On Run | end button [sum > 0] | Receipt Printing |
| Receipt Printing | receipt printed / sum = 0 | Waiting |
| Waiting | service key | On Service |
| Failure Notification | call service | On Service |
| On Service | service finished | Waiting |
Entry/exit actions: entering Receipt Printing computes the total; leaving it resets the counter.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Coffee vending machine use case diagram · Object Oriented Analysis and Design, chapter 2
- Digital clock state diagram · Object Oriented Analysis and Design, chapter 2
- Student course department class diagram · Object Oriented Analysis and Design, chapter 2
- Bus service use cases with elaboration · Object Oriented Analysis and Design, chapter 2
- Video rental shop class diagram · Object Oriented Analysis and Design, chapter 2
- Marina class diagram implementation code · Object Oriented Analysis and Design, chapter 4
- Machine cycle, T-states, ANI 55H timing · Microprocessor, chapter 2
- ESL and replacement strategy for printing machines · Engineering Economics, chapter 5
- Silver: states per unit volume vs atoms · Electrical Engineering Material, chapter 2 · asked 2×
- Centronics printer with 8255A in mode 1 · Instrumentation II, chapter 2
All Object Oriented Analysis and Design chapter 2 questions →