Title: CS445 CS645 ECE451 Software Requirements Specification and Analysis
1CS445 / CS645 / ECE451Software Requirements
Specification and Analysis
2A simple UML example
- The bicycle computer
- Take from an old midterm
- We want
- Use cases
- Domain model
- State diagrams
3Problem description
- A simple bicycle computer consists of a sensor, a
magnet, a wire, a chronometer, and a control
unit. - A magnet is attached to the spoke of the
bicycle's wheel. - The sensor is attached to the front fork, so that
it detects when the magnet passes the front fork
(indicating one complete rotation of the wheel).
- A wire connects the sensor and the computer's
control unit, which is attached to the bicycle's
handle bar. - A battery-powered chronometer sends a signal to
the control unit once per second, after which
calculations are made and appropriate speed /
distance / time information is sent to the
display.
4Problem description
- The control unit recalculates the bicycle's
current speed in km/h once per second (after
receiving a tick'' from the chronometer), and
displays the value in the middle of the display.
- One other stat is displayed at the bottom, based
on the mode selected using the mode button - elapsed time (TM),
- maximum speed (MXS),
- distance travelled (DST), and
- average speed (AVS).
- A two or three letter code appears at the left of
the display it identifies which stat is being
displayed at the bottom.
5Problem description
- The control unit recalculates and displays the
following values each second - Speed The current speed in km/hr is calculated
using previously store values of wheel
circumference in cm, and the number of wheel
rotations made since the last second. This value
is displayed each second, regardless of whether
the mode functions are suspended or not. - Elapsed time The elapsed time measured since
the last time the system was RESET. The
display goes from 00000 to 95959 (10 hours,
or 36,000 seconds). - Max speed The maximum of the current speed and
the previous maximum speed recorded. - Distance The total distance since the last
RESET. The display range is 0.00 km to 999.99 km
in 0.01 increments. - Average speed The average speed based on
elapsed time and distance covered since last
RESET.
6Problem description
- The rider can interact with the system by
pressing two buttons (or both at once) - Mode button Toggles which mode function is
displayed (and which mode indicator also) TM,
MXS, DST, or AVS. - Start Stop button Pauses / resumes calculation
of the mode function values. While the system is
paused, the last active values of the mode
functions are kept in memory but are not updated.
When resumed, the values are calculated once per
second. - RESET When the mode and start/stop buttons are
pressed at the same time, all mode function
values are cleared and reset to zero.
7(No Transcript)
8The solution
- This is a partial first pass, well probably make
some mistakes, - Dont treat the diagrams etc. as correct or
authoritative
9Use cases
- Lets start with the system-level use cases to
get a feel for the system - What are the actors?
- What are the environmental entities?
- Which are the shared phenomena?
10Hidden slide
Shared phenomena
Environment
SUD
display
biker
Start/stop button
Mode button
magnet
sensor
wire
wheel
chronometer
11Hidden slide
- The actors are
- Biker
- Sensor
- Chronometer
12Hidden slide
- Major system-level use cases?
- UC 0 Biker looks at display
- Not really! Theres no system behaviour
association with this!) - UC1 Biker presses start / stop button
- UC2 Biker presses mode button
- UC3 Biker presses both buttons
- UC4 Sensor ticks
- UC5 Chronometer ticks
- UC6 Display updates
- Not really, this is a result of chronometer ticks
(or its the same UC)
13Hidden slide UC scenarios
- Biker presses SS button
- normal The system was paused and has now
resumed - normal the system was running and is now paused
- Biker presses mode button
- Mode displayed is shifted one slot
- Q Whether paused or not?
- A Yes, paused only controls whether you
collect mode data - Biker presses both buttons
- System is reset
- Is timer running or not? Good question!
14Hidden slide UC scenarios
- Sensor ticks
- If system running, increment of wheel ticks
- Chronometer ticks
- Running
- Incr time in system
- Calculate stats
- Display current speed appropriate mode stat
- Paused
- Calculate current speed and display it
- Note that we wont bother with sequence diagrams.
15Identify classes
- Look through the problem statement (and any other
appropriate documentation) for nouns. - Categorize each as
- irrelevant, redundant, attribute, operation,
implementation construct, environmental entity,
or NOTA (none-of-the-above) - Your candidate classes will be NOTA plus some
environmental entities (shared phenomena or
involved in a use case actors). - Keep the attributes around for later use.
16- bicycle
- computer
- sensor
- magnet
- wire
- control unit
- spoke
- wheel
- fork
- rotation
- handlebar
- display
- memory
- wheel size
- wheel circumference
- current speed
- max speed
- avg speed
- elapsed time
- trip distance
- starting point
- current point
- display range
- hours
- minutes
- seconds
- mode button
- current mode
- start/stop button
- chronometer
17(No Transcript)
18Identify associations
- Look through the problem statement (and any other
appropriate documentation) for verbs. - Discard those that are irrelevant, redundant, or
implementation constructs. - Examples
- computer consists of ...
- magnet is attached to spoke
- sensor is attached to front fork
- sensor detects when magnet
- wire connects sensor and CU
- wire is attached to handlebar
- chronometer sends a signal to the CU
- speed / distance / time information is sent to
the display - CU recalculates current speed
19(No Transcript)
20Identify other relationships
- Look for associations that are compositions
(has-a) - Look for inheritance
- Add any interesting multiplicities
- Add role names as desired
- Add association classes
21(No Transcript)
22(No Transcript)
23reset
reset
reset
24Note that reset is a global event triggered for
anyone to react to. Events must be global if
multiple objects may respond to them o/w you
can specify the unique object who will respond.
Non-global events are safer and easier to
understand/read.
25Rotation counter
StartStopButton pressing
Lets expand this
ModeButton pressing
Not quite right correct version to follow
Message sent only to Display
26Correct version of third concurrent sub-state of
previous slide.
27(No Transcript)
28(No Transcript)
29CS445 / CS645 / ECE451Software Requirements
Specification and Analysis