ID: 1

1 Mid-Level Design Models

The mid-level design models elaborate each architectural layer and are organized in this section by layer.

ID: 2

1.1 Startup Layer Static Structure

The Startup layer is responsible for initializing the program as part of a fielded product or as a Web simulation, configuring the program according to the hardware available to it, and restoring the previous program state. The Startup layer has the static structure shown in Figure B-11-1.
This diagram adds only a few details to the architectural design structure—principally, the Tokenizer and TokenType classes and a few operations in the Configurer and AquaLushApplet classes. These additions are documented in Table B-11-2.

This object is linked to:
Startup Layer Decomposition
(25)
(IN)
Create and connect all runtime component
(11)
(IN)
The left-hand side of the user interface
(401)
(IN)
The right-hand side of the user interfac
(400)
(IN)
The simulation user interface must appea
(399)
(IN)
StartupLayer
(543)
(OUT)
startup
(542)
(OUT)
If AquaLush cannot read its persistent s
(396)
(IN)
If AquaLush cannot read its persistent s
(77)
(IN)
When power is applied to the system, the
(88)
(IN)
After establishing its configuration, Aqu
(90)
(IN)
A configuration file must be prepared at i
(35)
(IN)
All parameters set by users must remain
(7)
(IN)
Each elementary data item must be separa
(137)
(IN)
A configuration file must have the form (s
(136)
(IN)
The configuration file must be a text file
(135)
(IN)
After starting, AquaLush must close all
(91)
(IN)
When it starts, AquaLush must first read
(89)
(IN)
The curly braces and semicolon do not ne
(140)
(IN)
The configuration file must be named “confi
(141)
(IN)
AquaLush must record its system paramete
(144)
(IN)
System parameters include the following
(145)
(IN)
All characters between angle brackets mu
(139)
(IN)
The zone, sensor, and valve letters must
(138)
(IN)
The irrigation days must be a subset of
(151)
(IN)
A configuration file that cannot be found,
(142)
(IN)
The default sensor and valve operational
(188)
(IN)
The default irrigation time must be 0200
(185)
(IN)
The irrigation time of day must be a 24-
(152)
(IN)
The irrigation time must specify both th
(150)
(IN)
The mode must be either manual or automa
(149)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
AquaLush must recover from power failure
(198)
(IN)
The default water allocation must be 100
(186)
(IN)
The default irrigation day must be the s
(184)
(IN)
The water allocation must be an integer
(153)
(IN)
The default mode must be automatic.
(183)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)
The default zone critical moisture level
(187)
(IN)

This object has external links to:
startup/(EXT OUT)


ID: 530

Figure B-11-1 Startup Layer Mid-Level Static Structure


ID: 3

1.1.1 Startup Layer Local Module Responsibilities

Module
Responsibilities
Tokenizer
Create and connect runtime components ba
(39)
(IN)
Startup layer configuration module(s), p
(856)
(IN)
Each elementary data item must be separa
(137)
(IN)
A configuration file must have the form (s
(136)
(IN)
The curly braces and semicolon do not ne
(140)
(IN)
All characters between angle brackets mu
(139)
(IN)
The zone, sensor, and valve letters must
(138)
(IN)
Process configuration reader input character by character to produce a stream of tokens that the Configurer can parse to interpret the configuration specification.
Tokenizer
(562)
(OUT)
Tokenizer.java(EXT OUT)
TokenType
Create and connect runtime components ba
(39)
(IN)
Startup layer configuration module(s), p
(856)
(IN)
Each elementary data item must be separa
(137)
(IN)
A configuration file must have the form (s
(136)
(IN)
The curly braces and semicolon do not ne
(140)
(IN)
All characters between angle brackets mu
(139)
(IN)
The zone, sensor, and valve letters must
(138)
(IN)
Provide a type-safe token type enumeration for communication between the Tokenizer and the Configurer.
TokenType
(551)
(OUT)
TokenType.java(EXT OUT)

ID: 14

1.1.2 Startup Layer Local Module Interface Specifications


ID: 15

1.1.2.1 Services Provided

All operations with preconditions on parameters throw IllegalArgumentExceptions if the preconditions are violated.

ID: 16

1.1.2.1.1 Applet start

This object is linked to:
Ask the Simulation layer to create all G
(33)
(IN)
start
(580)
(OUT)

This object has external links to:
AquaLushApplet.java(EXT OUT)

Syntax:
start()
Pre:
None.
Post:
The AquaLush simulated clock is started.

ID: 27

1.1.2.1.2 Applet stop

This object is linked to:
Ask the Simulation layer to create all G
(33)
(IN)
stop
(587)
(OUT)

This object has external links to:
AquaLushApplet.java(EXT OUT)

Syntax:
stop()
Pre:
None.
Post:
The AquaLush simulated clock is stopped.

ID: 38

1.1.2.1.3 Configurer construction

This object is linked to:
Create and connect runtime components ba
(39)
(IN)
configure
(594)
(OUT)

Syntax:
Configure( d : DeviceFactory )
Pre:
d is not null.
Post:
The Configurer is ready to configure the program.

ID: 49

1.1.2.1.4 Get next token

This object is linked to:
nextToken
(725)
(OUT)

This object has external links to:
Tokenizer.java(EXT OUT)

Syntax:
nextToken() : TokenType
Pre:
None.
Post:
Gets the next token from the configuration input stream and returns its type.

ID: 60

1.1.2.1.5 Get the text of the current token

This object is linked to:
Create and connect runtime components ba
(39)
(IN)
getToken
(664)
(OUT)

This object has external links to:
Tokenizer.java(EXT OUT)

Syntax:
getToken() : String
Pre:
nextToken() has been called at least once.
Post:
The text of the current token is returned. Returns null if the precondition is violated.

ID: 71

1.1.2.1.6 Get the type of the current token

This object is linked to:
Create and connect runtime components ba
(39)
(IN)
getTokenType
(682)
(OUT)

This object has external links to:
Tokenizer.java(EXT OUT)

Syntax:
getTokenType() : TokenType
Pre:
nextToken() has been called at least once.
Post:
The type of the current token is returned. Returns TokenType.UNKNOWN if the precondition is violated.

ID: 82

1.2 Startup Layer Behavior

The Tokenizer can execute a state machine to recognize configuration file tokens.The diagram in Figure B-11-4 models the tokenizing state machine.
In this diagram all events are either the end of the input file, and therefore treated as a character, or single-character inputs. Labels with a single character designate that character; other labels mean the following:
eof—The end of the input file. white space—A blank, tab, newline, or carriage return character. digit—The characters “0” through “9.” other—Any character not labeling another arrow emanating from the same state.
The pushback action means that the character last consumed is placed back on the input stream.

This object is linked to:
Create and connect runtime components ba
(39)
(IN)
The left-hand side of the user interface
(401)
(IN)
The right-hand side of the user interfac
(400)
(IN)
The simulation user interface must appea
(399)
(IN)
startup
(542)
(OUT)
If AquaLush cannot read its persistent s
(396)
(IN)
If AquaLush cannot read its persistent s
(77)
(IN)
When power is applied to the system, the
(88)
(IN)
After establishing its configuration, Aqu
(90)
(IN)
A configuration file must be prepared at i
(35)
(IN)
Each elementary data item must be separa
(137)
(IN)
A configuration file must have the form (s
(136)
(IN)
The configuration file must be a text file
(135)
(IN)
After starting, AquaLush must close all
(91)
(IN)
When it starts, AquaLush must first read
(89)
(IN)
The curly braces and semicolon do not ne
(140)
(IN)
The configuration file must be named “confi
(141)
(IN)
All characters between angle brackets mu
(139)
(IN)
The zone, sensor, and valve letters must
(138)
(IN)
A configuration file that cannot be found,
(142)
(IN)
The default sensor and valve operational
(188)
(IN)
The default irrigation time must be 0200
(185)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
AquaLush must recover from power failure
(198)
(IN)
The default water allocation must be 100
(186)
(IN)
The default irrigation day must be the s
(184)
(IN)
The default mode must be automatic.
(183)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)
The default zone critical moisture level
(187)
(IN)

This object has external links to:
startup/(EXT OUT)


ID: 84

Figure B-11-4 Tokenizer State Machine

This object is linked to:
Statechart
(976)
(OUT)


ID: 83

1.3 Simulation Layer Static Structure

The Simulation layer includes components that simulate the environment of the program, including system hardware. The Simulation layer contains almost all the user interface code implementing the GUI for the simulation, written using Java Swing components. Most of these entities are not visible at the architectural level. The mid-level design also adds devices that are not explicitly present in the architectural view. Only the details added to the architectural specification are documented in Figure B-11-5, which depicts the detailed structure of the Simulation layer.

This object is linked to:
Implement components simulating hardware
(23)
(IN)
Simulation Layer Decomposition
(75)
(IN)
The simulation must provide a realistic
(95)
(IN)
The failed devices controls must behave
(403)
(IN)
The simulation must simulate valve and s
(104)
(IN)
The evaporation controls must behave as
(406)
(IN)
The left-hand side of the user interface
(401)
(IN)
The simulation must provide controls to
(105)
(IN)
The simulation must display the simulate
(100)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must provide controls to
(101)
(IN)
The irrigation site display must behave
(404)
(IN)
The simulation must simulate water evapo
(102)
(IN)
The right-hand side of the user interfac
(400)
(IN)
Each simulated irrigation zone must simu
(98)
(IN)
Each simulated irrigation zone must simu
(97)
(IN)
The simulation must provide controls to
(103)
(IN)
The simulation must provide a representa
(96)
(IN)
The simulation must provide means for co
(99)
(IN)
The simulation user interface must appea
(399)
(IN)
The simulated time controls must behave
(405)
(IN)
simulation
(76)
(OUT)
Simulation Layer
(120)
(OUT)
The irrigated site must be divided into
(108)
(IN)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
The default simulated rate of water evap
(190)
(IN)
The default simulation speed must be 1 (
(189)
(IN)
AquaLush must be operated from a single
(196)
(IN)
There must be four buttons on each side
(218)
(IN)
It must include eight push buttons adjac
(217)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a monochrome screen that
(216)
(IN)
Valve failures must be detectable when a
(213)
(IN)
An irrigation zone location must be a st
(112)
(IN)
The zone’s critical moisture level must
(113)
(IN)
A sensor identifier must consist of the l
(119)
(IN)
A sensor location must be a string of 0
(120)
(IN)
An irrigation zone identifier must consis
(111)
(IN)
The simulated time of day must be a 24-h
(179)
(IN)
The simulated time consists of the simul
(177)
(IN)
The operational status must be a Boolean
(133)
(IN)
A valve identifier must consist of the le
(129)
(IN)
A valve location must be a string of 0 t
(131)
(IN)
A valve type must be a string of 0 to 16
(130)
(IN)
The simulated day must be an element of
(178)
(IN)
A flow rate must be an integer in the ran
(132)
(IN)
The operational status must be a Boolean
(121)
(IN)
The simulated water evaporation rate mus
(181)
(IN)
The simulation speed must be a multiple
(180)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(IN)
The default sensor and valve operational
(188)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)
The default zone critical moisture level
(187)
(IN)

This object has external links to:
simulation/(EXT OUT)
test/simulation/(EXT OUT)


ID: 531

Figure B-11-5 Simulation Layer Mid-Level Static Structure


ID: 85

1.3.1 Simulation Layer Local Module Responsibilities

Module
Responsibilities
SimEnvironment
Simulate hardware devices and the real w
(83)
(IN)
The failed devices controls must behave
(403)
(IN)
The simulation must simulate valve and s
(104)
(IN)
The evaporation controls must behave as
(406)
(IN)
The left-hand side of the user interface
(401)
(IN)
The simulation must provide controls to
(105)
(IN)
The simulation must display the simulate
(100)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The irrigation site display must behave
(404)
(IN)
The simulation must simulate water evapo
(102)
(IN)
Each simulated irrigation zone must simu
(98)
(IN)
Each simulated irrigation zone must simu
(97)
(IN)
The simulation must provide controls to
(103)
(IN)
The simulation must provide a representa
(96)
(IN)
The simulation must provide means for co
(99)
(IN)
The simulation user interface must appea
(399)
(IN)
The simulated time controls must behave
(405)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
A Swing panel containing all the displays and controls for the simulated environment, including display of the irrigation site and controls for the simulated time, evaporation rate, and hardware failures and repairs.
SimEnvironment
(138)
(OUT)
SimEnvironment.java(EXT OUT)
SimEnvironmentTest.java(EXT OUT)
SimControlPanel
Simulate a 16-line-by-40-character monoc
(89)
(IN)
Simulate hardware devices and the real w
(83)
(IN)
The simulation must provide a realistic
(95)
(IN)
The simulation must simulate valve and s
(104)
(IN)
The simulation must provide controls to
(105)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The right-hand side of the user interfac
(400)
(IN)
The simulation must provide controls to
(103)
(IN)
The simulation user interface must appea
(399)
(IN)
At least 70% of users must agree that th
(203)
(IN)
AquaLush must be operated from a single
(196)
(IN)
There must be four buttons on each side
(218)
(IN)
It must include eight push buttons adjac
(217)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a monochrome screen that
(216)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(IN)
A Swing panel containing all the widgets for the AquaLush control panel, including the simulated display, screen buttons, and keypad.
SimControlPanel
(103)
(OUT)
SimControlPanel.java(EXT OUT)
SimControlPanelTest.java(EXT OUT)
SimKeypad
Simulate hardware devices and the real w
(83)
(IN)
The simulation must provide a realistic
(95)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The right-hand side of the user interfac
(400)
(IN)
The simulation user interface must appea
(399)
(IN)
At least 70% of users must agree that th
(203)
(IN)
AquaLush must be operated from a single
(196)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(IN)
A Swing panel simulating a keypad with 12 buttons.
SimKeypad
(167)
(OUT)
SimKeypad.java(EXT OUT)
SimKeypadTest.java(EXT OUT)
SimTimeControl
Simulate hardware devices and the real w
(83)
(IN)
The left-hand side of the user interface
(401)
(IN)
The simulation must display the simulate
(100)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must provide controls to
(101)
(IN)
The simulation must provide means for co
(99)
(IN)
The simulation user interface must appea
(399)
(IN)
The simulated time controls must behave
(405)
(IN)
At least 70% of users must agree that th
(203)
(IN)
The default simulation speed must be 1 (
(189)
(IN)
The simulated time of day must be a 24-h
(179)
(IN)
The simulated time consists of the simul
(177)
(IN)
The simulated day must be an element of
(178)
(IN)
The simulation speed must be a multiple
(180)
(IN)
A Swing panel displaying and controlling the simulated time.
SimTimeControl
(291)
(OUT)
SimTimeControl.java(EXT OUT)
SimTimeControlTest.java(EXT OUT)
SimEvapControl
Simulate hardware devices and the real w
(83)
(IN)
The evaporation controls must behave as
(406)
(IN)
The left-hand side of the user interface
(401)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must simulate water evapo
(102)
(IN)
The simulation must provide controls to
(103)
(IN)
The simulation must provide means for co
(99)
(IN)
The simulation user interface must appea
(399)
(IN)
At least 70% of users must agree that th
(203)
(IN)
The default simulated rate of water evap
(190)
(IN)
The simulated water evaporation rate mus
(181)
(IN)
A Swing panel displaying and controlling the simulated water evaporation rate.
SimEvapControl
(148)
(OUT)
SimEvapControl.java(EXT OUT)
SimEvapControlTest.java(EXT OUT)
SimSiteView
Simulate hardware devices and the real w
(83)
(IN)
The left-hand side of the user interface
(401)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The irrigation site display must behave
(404)
(IN)
Each simulated irrigation zone must simu
(98)
(IN)
Each simulated irrigation zone must simu
(97)
(IN)
The simulation must provide a representa
(96)
(IN)
The simulation user interface must appea
(399)
(IN)
The irrigated site must be divided into
(108)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
The default simulated rate of water evap
(190)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The operational status must be a Boolean
(133)
(IN)
The operational status must be a Boolean
(121)
(IN)
The simulated water evaporation rate mus
(181)
(IN)
The default sensor and valve operational
(188)
(IN)
The default zone critical moisture level
(187)
(IN)
A Swing panel displaying the irrigation site.
SimSiteView
(259)
(OUT)
SimSiteView.java(EXT OUT)
SimSiteViewTest.java(EXT OUT)
SimFailureControl
Simulate hardware devices and the real w
(83)
(IN)
The failed devices controls must behave
(403)
(IN)
The simulation must simulate valve and s
(104)
(IN)
The left-hand side of the user interface
(401)
(IN)
The simulation must provide controls to
(105)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must provide means for co
(99)
(IN)
The simulation user interface must appea
(399)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The operational status must be a Boolean
(133)
(IN)
The operational status must be a Boolean
(121)
(IN)
The default sensor and valve operational
(188)
(IN)
A Swing panel displaying and controlling the failure status (failed or running) of the simulated valves and sensors.
SimFailureControl
(165)
(OUT)
SimFailureControl.java(EXT OUT)
SimFailureControlTest.java(EXT OUT)
SimSite
Simulate hardware devices and the real w
(83)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must simulate water evapo
(102)
(IN)
The irrigated site must be divided into
(108)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Valves must be openable and closable.
(212)
(IN)
The default simulated rate of water evap
(190)
(IN)
The simulated water evaporation rate mus
(181)
(IN)
The default zone critical moisture level
(187)
(IN)
A collection keeping track of the simulated site evaporation rate and irrigation zones. It is responsible for adjusting the moisture levels in each SimZone.
SimSite
(255)
(OUT)
SimSite.java(EXT OUT)
SimSiteTest.java(EXT OUT)
SimZone
Simulate a moisture sensor.
(92)
(IN)
Simulate an irrigation valve.
(95)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must simulate water evapo
(102)
(IN)
Each simulated irrigation zone must simu
(98)
(IN)
Each simulated irrigation zone must simu
(97)
(IN)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
At least 70% of users must agree that th
(203)
(IN)
An irrigation zone location must be a st
(112)
(IN)
The zone’s critical moisture level must
(113)
(IN)
An irrigation zone identifier must consis
(111)
(IN)
The default zone critical moisture level
(187)
(IN)
A collection holding a SimSensor and the four SimValves in a portion of the simulated irrigation site.
SimZone
(334)
(OUT)
SimZone.java(EXT OUT)
SimZoneTest.java(EXT OUT)

ID: 117

1.3.2 Simulation Layer Local Module Interface Specifications


ID: 118

1.3.2.1 Services Provided

All operations with preconditions on parameters throw IllegalArgumentExceptions if the preconditions are violated.

ID: 120

1.3.2.1.1 Provide simulated persistent store (SimEnvironment)

This object is linked to:
Provide simulated persistent store
(113)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
getStore
(246)
(OUT)

Syntax:
getStore() : SimStore
Pre:
None.
Post:
The simulated storage object is returned.

ID: 131

1.3.2.1.2 Provide a simulated valve (SimEnvironment, SimSite, SimZone)

This object is linked to:
Provide a simulated valve
(124)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
getValve
(271)
(OUT)

This object has external links to:
SimEnvironment.java(EXT OUT)
SimEnvironmentTest.java(EXT OUT)

Syntax:
SimEnvironment.getValve( name : String ) : SimValve
Pre:
name is not null.
Post:
The simulated valve whose identifier is named is returned, or null is returned if no such valve exists.

ID: 142

1.3.2.1.3 Provide a simulated sensor (SimEnvironment, SimSite, SimZone)

This object is linked to:
Provide a simulated sensor
(135)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
getSensor
(214)
(OUT)

This object has external links to:
SimEnvironment.java(EXT OUT)
SimEnvironmentTest.java(EXT OUT)
SimZone.java(EXT OUT)
SimZoneTest.java(EXT OUT)

Syntax:
getSensor( name : String ) : SimSensor
Pre:
name is not null.
Post:
The simulated sensor whose identifier is named is returned, or null is returned if no such sensor exists.

ID: 153

1.3.2.1.4 Provide the simulated display (SimControlPanel)

This object is linked to:
Provide the simulated display
(146)
(IN)
The simulation must provide a realistic
(95)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
getDisplay
(132)
(OUT)
AquaLush must be operated from a single
(196)
(IN)

This object has external links to:
SimControlPanel.java(EXT OUT)
SimControlPanelTest.java(EXT OUT)

Syntax:
getDisplay() : SimDisplay
Pre:
None.
Post:
The simulated display object is returned.

ID: 164

1.3.2.1.5 Register a Keypad listener (SimControlPanel)

This object is linked to:
Register a keypad listener
(157)
(IN)
setKeypadListener
(141)
(OUT)
At least 70% of users must agree that th
(203)
(IN)

This object has external links to:
SimControlPanel.java(EXT OUT)
SimControlPanelTest.java(EXT OUT)

Syntax:
setKeypadListener( l : KeypadListener )
Pre:
None.
Post:
KeypadListener l will start to receive notifications of simulated keypad key presses.

ID: 175

1.3.2.1.6 Register a Keypad listener (SimKeypad)

This object is linked to:
Register a keypad listener
(157)
(IN)
setListener
(216)
(OUT)
At least 70% of users must agree that th
(203)
(IN)
AquaLush must be operated from a single
(196)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(IN)

This object has external links to:
SimKeypad.java(EXT OUT)
SimKeypadTest.java(EXT OUT)

Syntax:
setListener( l : KeypadListener )
Pre:
None.
Post:
KeypadListener l will start to receive notifications of simulated keypad key presses.

ID: 186

1.3.2.1.7 Register a ScreenButton listener (SimControlPanel)

This object is linked to:
Register a screen button listener
(168)
(IN)
setScreenButtonListener
(161)
(OUT)
At least 70% of users must agree that th
(203)
(IN)
AquaLush must be operated from a single
(196)
(IN)
There must be four buttons on each side
(218)
(IN)
It must include eight push buttons adjac
(217)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(IN)

This object has external links to:
SimControlPanel.java(EXT OUT)
SimControlPanelTest.java(EXT OUT)

Syntax:
setScreenButtonListener( l : ScreenButtonListener )
Pre:
None.
Post:
ScreenButtonListener l will start to receive notifications of simulated screen button presses.

ID: 197

1.3.2.1.8 Register a ScreenButton listener (SimDisplay)

This object is linked to:
Register a screen button listener
(168)
(IN)
setListener
(142)
(OUT)
At least 70% of users must agree that th
(203)
(IN)
AquaLush must be operated from a single
(196)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a monochrome screen that
(216)
(IN)

This object has external links to:
SimDisplay.java(EXT OUT)
SimDisplayTest.java(EXT OUT)

Syntax:
setListener( l : ScreenButtonListener )
Pre:
None.
Post:
ScreenButtonListener l will start to receive notifications of simulated screen button presses.

ID: 208

1.3.2.1.9 Set a sensor’s moisture level (SimSensor)

This object is linked to:
Simulate a moisture sensor.
(92)
(IN)
The evaporation controls must behave as
(406)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must simulate water evapo
(102)
(IN)
setLevel
(300)
(OUT)
At least 70% of users must agree that th
(203)
(IN)
Sensors must be readable and provide dat
(210)
(IN)

This object has external links to:
SimSensor.java(EXT OUT)
SimSensorTest.java(EXT OUT)

Syntax:
setLevel( l : int )
Pre:
0 <= l <= 100.
Post:
The SimSensor’s moisture level is changed.

ID: 219

1.3.2.1.10 Set the failure status of a sensor (SimSensor)

This object is linked to:
Simulate a moisture sensor.
(92)
(IN)
The failed devices controls must behave
(403)
(IN)
The simulation must simulate valve and s
(104)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must provide means for co
(99)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
The operational status must be a Boolean
(121)
(IN)
The default sensor and valve operational
(188)
(IN)

This object has external links to:
SimSensor.java(EXT OUT)
SimSensorTest.java(EXT OUT)

Syntax:
setIsFailed( value : Boolean )
Pre:
None.
Post:
The SimSensor’s failure status is set as indicated by value.

ID: 230

1.3.2.1.11 Set the failure status of a sensor (SimValve)

This object is linked to:
Simulate an irrigation valve.
(95)
(IN)
The failed devices controls must behave
(403)
(IN)
The simulation must simulate valve and s
(104)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must provide means for co
(99)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The operational status must be a Boolean
(133)
(IN)
The default sensor and valve operational
(188)
(IN)

This object has external links to:
SimValve.java(EXT OUT)
SimValveTest.java(EXT OUT)

Syntax:
setIsFailed( value : Boolean )
Pre:
None.
Post:
The SimValve’s failure status is set as indicated by value.

ID: 241

1.3.2.2 Services Required

The SimStore class will use Java services for persistent storage provided by the java.util.Properties class. Properties will be stored in a file called “AquaLushState.xml.”

This object is linked to:
Simulate a persistent store. A real file
(86)
(IN)


ID: 242

1.3.3 Implementation Notes

The SimSite is supposed to represent reality, so the SimZones and their SimSensors and SimValves are set up explicitly with code in the various class constructors.

This object is linked to:
Simulate a moisture sensor.
(92)
(IN)
Simulate an irrigation valve.
(95)
(IN)
simulation
(76)
(OUT)

This object has external links to:
simulation/(EXT OUT)
test/simulation/(EXT OUT)


ID: 243

1.4 Simulation Layer Behavior

The SimSite observes SimTime using the Observer pattern. When a minute passes, the SimSite passes its evaporationRate attribute (which is in percent per hour) to each SimZone. The SimZones determine how to change the moisture level of each SimSensor. The SimSite notifies its observer (the SimSiteView) when the sensors or valves change. As an optimization, the SimSiteView is not updated on the minute because the SimZones may be in the process of changing. The sequence diagram in Figure B-11-8 models this interaction.
One additional feature must be noted about the Simulation layer’s structure and behavior. The SimTimeControl has a button that jumps the simulated time to one hour before the next scheduled irrigation time. This feature does not fit into the architecture because it requires the Simulation layer to use the Irrigation layer, in violation of the layering constraint. This single violation of the Layered style cannot be avoided. However, its effects can be minimized as follows:

This object is linked to:
Simulate a moisture sensor.
(92)
(IN)
Implement components simulating hardware
(23)
(IN)
Simulation Layer Decomposition
(75)
(IN)
Simulate the passage of time. Notify oth
(98)
(IN)
The simulation must provide a realistic
(95)
(IN)
The failed devices controls must behave
(403)
(IN)
The simulation must simulate valve and s
(104)
(IN)
The evaporation controls must behave as
(406)
(IN)
The left-hand side of the user interface
(401)
(IN)
The simulation must provide controls to
(105)
(IN)
The simulation must display the simulate
(100)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
The simulation must provide controls to
(101)
(IN)
The irrigation site display must behave
(404)
(IN)
The simulation must simulate water evapo
(102)
(IN)
The right-hand side of the user interfac
(400)
(IN)
Each simulated irrigation zone must simu
(98)
(IN)
Each simulated irrigation zone must simu
(97)
(IN)
The simulation must provide controls to
(103)
(IN)
The simulation must provide a representa
(96)
(IN)
The simulation must provide means for co
(99)
(IN)
The simulation user interface must appea
(399)
(IN)
The simulated time controls must behave
(405)
(IN)
simulation
(76)
(OUT)
SimSite_Update
(73)
(OUT)
The irrigated site must be divided into
(108)
(IN)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
AquaLush must be operated from a single
(196)
(IN)
There must be four buttons on each side
(218)
(IN)
It must include eight push buttons adjac
(217)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a monochrome screen that
(216)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The zone’s critical moisture level must
(113)
(IN)
The simulated time of day must be a 24-h
(179)
(IN)
The simulated time consists of the simul
(177)
(IN)
The operational status must be a Boolean
(133)
(IN)
The simulated day must be an element of
(178)
(IN)
The operational status must be a Boolean
(121)
(IN)
The simulated water evaporation rate mus
(181)
(IN)
The simulation speed must be a multiple
(180)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(IN)
The default sensor and valve operational
(188)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)
The default zone critical moisture level
(187)
(IN)

This object has external links to:
simulation/(EXT OUT)
test/simulation/(EXT OUT)


ID: 532

Figure B-11-8 SimSite.update() Behavior


ID: 244

The SimTimeControl is passed a reference to the Irrigator object. It can interrogate the Irrigator when its jump button is pressed to obtain the next irrigation time and day. Thus, the Irrigator does not use the Simulation layer as required in the architecture.

This object is linked to:
Implement components simulating hardware
(23)
(IN)
Simulation Layer Decomposition
(75)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)


ID: 245

The AquaLush applet gets a reference to the Irrigator from the Configurer and passes it to the Simulation object, which passes it to SimEnvironment, which passes it to SimTimeControl. Thus, no parts of the program are involved in this violation of architectural constraints except for the applet and the Simulation layer, which causes the problem and is never part of a fielded product.

This object is linked to:
Implement components simulating hardware
(23)
(IN)
Simulation Layer Decomposition
(75)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
Create and connect runtime components ba
(39)
(IN)


ID: 246

1.5 Device Interface Layer Static Structure

The Device Interface layer provides virtual devices to hide the real or simulated devices used by the program. The mid-level design of this layer merely adds the devices conforming to the interfaces specified at the architectural level of detail. The diagram in Figure B-11-9 includes various “real” device classes. These are placeholders for one or more device drivers for actual hardware devices.
The mid-level static structure of the Device Interface layer is shown in Figure B-11-9.

This object is linked to:
Device Interface Layer Decomposition
(315)
(IN)
Guarantee that a module registered as a
(344)
(IN)
Provide virtual clock hardware that keep
(323)
(IN)
Provide a virtual 16-line-by-40-characte
(332)
(IN)
Provide a virtual 12-key keypad hardware
(341)
(IN)
Provide a virtual hardware device with e
(347)
(IN)
Provide abstract factory methods for cre
(356)
(IN)
Implement virtual devices providing inte
(20)
(IN)
Provide virtual moisture sensor hardware
(335)
(IN)
Provide virtual irrigation valve hardwar
(338)
(IN)
Guarantee that a module listening to the
(326)
(IN)
Provide virtual persistent storage of na
(329)
(IN)
Guarantee that a module registered as a
(350)
(IN)
device
(81)
(OUT)
Device Interface
(88)
(OUT)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
AquaLush must be operated from a single
(196)
(IN)
If AquaLush cannot read its persistent s
(396)
(IN)
Valve failures must be detectable when a
(213)
(IN)
If the user presses the “Accept New Sett
(312)
(IN)
The current day and time displays must c
(298)
(IN)
The message about failure to write to pe
(391)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
AquaLush must eventually control a varie
(206)
(IN)
The current day must be an element of {
(155)
(IN)
The Persistent Store Failure state must
(393)
(IN)
The Set Clock state must allow users to
(296)
(IN)
The Device Failure state must be entered
(385)
(IN)
The current time consists of the current
(14)
(IN)
AquaLush must either not allow an invali
(15)
(IN)
If a valve cannot be manipulated after t
(72)
(IN)
If a sensor cannot be read, then AquaLus
(65)
(IN)
AquaLush must allow users to set the cur
(13)
(IN)
AquaLush must do the following during an
(53)
(IN)
The current time is recorded in the syst
(154)
(IN)
If AquaLush cannot read its persistent s
(75)
(IN)
If a valve can be manipulated within thr
(71)
(IN)
If a valve cannot be manipulated (opened
(70)
(IN)
If a sensor cannot be read after three t
(67)
(IN)
If a sensor can be read within three tri
(66)
(IN)
If a new time setting fails validation,
(16)
(IN)
AquaLush must detect valve and sensor fa
(38)
(IN)
If AquaLush cannot write to its persiste
(74)
(IN)
All parameters set by users must remain
(7)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)

This object has external links to:
device/(EXT OUT)
test/device/(EXT OUT)


ID: 525

Figure B-11-9 Device Interface Layer Mid-Level Static Structure


ID: 247

1.6 Irrigation Layer Static Structure

The Irrigation layer is the central module of the application. It controls automatic irrigation and acts as the user’s agent during manual irrigation. The architectural view of this module presents a façade for controlling manual and automatic irrigation and for retrieving reports about the state of irrigation for display to the user. The mid-level design view adds the classes and operations necessary to realize the system configuration and control irrigation. The mid-level design structure is illustrated in Figure B-11-10.

This object is linked to:
Control both manual and automatic irriga
(17)
(IN)
Irrigation Layer Decomposition
(593)
(IN)
Irrigation
(97)
(OUT)
irrigation
(72)
(OUT)
The irrigated site must be divided into
(108)
(IN)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
An irrigation zone location must be a st
(112)
(IN)
The zone’s critical moisture level must
(113)
(IN)
A sensor identifier must consist of the l
(119)
(IN)
A sensor location must be a string of 0
(120)
(IN)
An irrigation zone identifier must consis
(111)
(IN)
The operational status must be a Boolean
(133)
(IN)
A valve identifier must consist of the le
(129)
(IN)
A valve location must be a string of 0 t
(131)
(IN)
A valve type must be a string of 0 to 16
(130)
(IN)
A flow rate must be an integer in the ran
(132)
(IN)
The operational status must be a Boolean
(121)
(IN)
AquaLush must either not allow an invali
(20)
(IN)
If the current time is set so that an ir
(18)
(IN)
The length of time the valve has been op
(165)
(IN)
Setting the mode to a different value mu
(11)
(IN)
Setting the mode to its current value mu
(10)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
AquaLush must eventually control a varie
(206)
(IN)
The current day must be an element of {
(155)
(IN)
AquaLush must allow the days and time of
(19)
(IN)
If a new irrigation time setting fails v
(21)
(IN)
The Device Failure state must be entered
(385)
(IN)
AquaLush must run in one of two modes: m
(8)
(IN)
If a valve cannot be manipulated after t
(72)
(IN)
AquaLush must do the following during an
(53)
(IN)
The current time is recorded in the syst
(154)
(IN)
If a sensor cannot be read after three t
(67)
(IN)
AquaLush must allow moisture levels that
(24)
(IN)
If a new critical moisture level setting
(26)
(IN)
AquaLush must monitor the amount of wate
(37)
(IN)
If the user presses the “Propagate Setti
(366)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
AquaLush must allow operation in either
(36)
(IN)
If a sensor cannot be read after three t
(69)
(IN)
AquaLush must display the total water us
(47)
(IN)
If the water allocation is set when auto
(32)
(IN)
If a new water allocation setting fails
(31)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
If no valves have failed, then AquaLush
(79)
(IN)
AquaLush must provide reports of failed
(78)
(IN)
AquaLush must allow the maximum amount o
(29)
(IN)
AquaLush must either not allow an invali
(30)
(IN)
If the critical moisture level is set wh
(27)
(IN)
If the irrigation time is set when autom
(22)
(IN)
AquaLush must either not allow an invali
(25)
(IN)
The following data must be displayed for
(158)
(IN)
The associated sensor moisture level mus
(167)
(IN)
The valve identifier and location must be
(164)
(IN)
The following data must be recorded for
(115)
(IN)
The following data must be recorded for
(123)
(IN)
In automatic-mode operation, AquaLush mu
(51)
(IN)
AquaLush must set the total water used i
(48)
(IN)
When no valve is open in manual irrigati
(49)
(IN)
In automatic-mode operation, AquaLush mu
(52)
(IN)
The amount of water used by the valve mu
(166)
(IN)
AquaLush must make no attempt to resume
(92)
(IN)
If valves or sensors have failed, then A
(81)
(IN)
When told that a failed valve or sensor
(85)
(IN)
When told that a failed valve or sensor
(86)
(IN)
If no sensors have failed, then AquaLush
(80)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
The Zone field must display data just as
(293)
(IN)
If the user presses the “Repaired” scree
(322)
(IN)
The failed sensor or valve identifier mus
(174)
(IN)
Failure reports must display the followi
(171)
(IN)
The failed sensor or valve identifier
(172)
(IN)
The screen buttons must work just as in
(291)
(IN)
The region between the dashed lines must
(270)
(IN)
The Set Moisture Levels state must allow
(358)
(IN)
The total water used during manual irrig
(168)
(IN)
The Gallons Used display must work just
(295)
(IN)
The Valve field must display data just as
(292)
(IN)
The failed devices summary in row eight
(329)
(IN)
The Fix Failures state must allow users
(314)
(IN)
The Wet% field must display the percent s
(282)
(IN)
The Water Used field must show the number
(285)
(IN)
The Time field must display the time that
(284)
(IN)
The Zone field must display the zone iden
(281)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
The region between the dashed lines must
(290)
(IN)
If the valve’s zone moisture sensor has
(283)
(IN)
The failed sensor or valve location
(173)
(IN)
The region between the dashed lines must
(316)
(IN)
The region between the dashed lines must
(360)
(IN)
The Set Up Auto Irrigation state must al
(330)
(IN)
If the user presses the “Accept New Sett
(356)
(IN)
If a new irrigation time is only partial
(357)
(IN)
The Set Irrigation Times state must allo
(332)
(IN)
Each displayed value must be updated eve
(169)
(IN)
If the user presses the “Open/Close Valv
(276)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
The Valve field must show the identifier a
(278)
(IN)
AquaLush must accommodate implementation
(207)
(IN)
The failed sensor or valve location must
(175)
(IN)
If the failed device is a valve, then th
(388)
(IN)
If the user presses the “Accept New Sett
(377)
(IN)
If the failed device is a sensor, then t
(389)
(IN)
If the user presses the “Accept New Sett
(384)
(IN)
The Set Water Allocation state must allo
(378)
(IN)
After establishing its configuration, Aqu
(90)
(IN)
After starting, AquaLush must close all
(91)
(IN)
AquaLush must record its system paramete
(144)
(IN)
System parameters include the following
(145)
(IN)
The irrigation days must be a subset of
(151)
(IN)
The default sensor and valve operational
(188)
(IN)
The default irrigation time must be 0200
(185)
(IN)
The irrigation time of day must be a 24-
(152)
(IN)
The irrigation time must specify both th
(150)
(IN)
The mode must be either manual or automa
(149)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
The default water allocation must be 100
(186)
(IN)
The default irrigation day must be the s
(184)
(IN)
The water allocation must be an integer
(153)
(IN)
The default mode must be automatic.
(183)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)
The default zone critical moisture level
(187)
(IN)

This object has external links to:
irrigation/(EXT OUT)
test/irrigation/(EXT OUT)


ID: 533

Figure B-11-10 Irrigation Layer Mid-Level Static Structure


ID: 248

1.6.1 Irrigation Layer Local Module Responsibilities

Module
Responsibilities
Devices
The objects in the Irrigation layer, plu
(868)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
Keep track of all devices to make it easier to obtain reports about them and change their failure statuses.
Devices
(94)
(OUT)
IrrigationCycle
The objects in the Irrigation layer, plu
(868)
(IN)
Record providing data about the state of
(616)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
Obtain irrigation cycle data
(721)
(IN)
The irrigated site must be divided into
(108)
(IN)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
AquaLush must monitor the amount of wate
(37)
(IN)
AquaLush must make no attempt to resume
(92)
(IN)
When told that a failed valve or sensor
(86)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
The Fix Failures state must allow users
(314)
(IN)
Abstract super-class for all irrigation cycles.
IrrigationCycle
(155)
(OUT)
IrrigationCycle.java(EXT OUT)
IrrigationCycleTest.java(EXT OUT)
AutoCycle
The objects in the Irrigation layer, plu
(868)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
AquaLush must run in one of two modes: m
(8)
(IN)
AquaLush must do the following during an
(53)
(IN)
AquaLush must allow operation in either
(36)
(IN)
If a sensor cannot be read after three t
(69)
(IN)
If the water allocation is set when auto
(32)
(IN)
AquaLush must allow the maximum amount o
(29)
(IN)
In automatic-mode operation, AquaLush mu
(52)
(IN)
The Set Moisture Levels state must allow
(358)
(IN)
The Set Up Auto Irrigation state must al
(330)
(IN)
The Set Irrigation Times state must allo
(332)
(IN)
If the user presses the “Accept New Sett
(384)
(IN)
The Set Water Allocation state must allo
(378)
(IN)
The default sensor and valve operational
(188)
(IN)
The default zone critical moisture level
(187)
(IN)
Control an automatic irrigation cycle.
AutoCycle
(79)
(OUT)
AutoCycle.java(EXT OUT)
AutoCycleTest.java(EXT OUT)
ManualCycle
The objects in the Irrigation layer, plu
(868)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
Start and end manual irrigation cycles
(699)
(IN)
AquaLush must run in one of two modes: m
(8)
(IN)
AquaLush must allow operation in either
(36)
(IN)
AquaLush must display the total water us
(47)
(IN)
AquaLush must set the total water used i
(48)
(IN)
When no valve is open in manual irrigati
(49)
(IN)
The Zone field must display data just as
(293)
(IN)
The screen buttons must work just as in
(291)
(IN)
The total water used during manual irrig
(168)
(IN)
The Gallons Used display must work just
(295)
(IN)
The Valve field must display data just as
(292)
(IN)
The Wet% field must display the percent s
(282)
(IN)
The Water Used field must show the number
(285)
(IN)
The Time field must display the time that
(284)
(IN)
The Zone field must display the zone iden
(281)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
If the valve’s zone moisture sensor has
(283)
(IN)
If the user presses the “Open/Close Valv
(276)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
The Valve field must show the identifier a
(278)
(IN)
Control a manual irrigation cycle.
ManualCycle
(283)
(OUT)
ManualCycle.java(EXT OUT)
ManualCycleTest.java(EXT OUT)
Zone
Record providing data about irrigation z
(607)
(IN)
Get zone data
(732)
(IN)
The objects in the Irrigation layer, plu
(868)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
Set or get a zone’s critical moisture le
(688)
(IN)
Add a zone
(644)
(IN)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
An irrigation zone location must be a st
(112)
(IN)
The zone’s critical moisture level must
(113)
(IN)
An irrigation zone identifier must consis
(111)
(IN)
AquaLush must do the following during an
(53)
(IN)
AquaLush must monitor the amount of wate
(37)
(IN)
If the user presses the “Propagate Setti
(366)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
If the water allocation is set when auto
(32)
(IN)
If the critical moisture level is set wh
(27)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
The Zone field must display data just as
(293)
(IN)
The screen buttons must work just as in
(291)
(IN)
The Set Moisture Levels state must allow
(358)
(IN)
The Zone field must display the zone iden
(281)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The region between the dashed lines must
(316)
(IN)
The region between the dashed lines must
(360)
(IN)
The Set Up Auto Irrigation state must al
(330)
(IN)
If the user presses the “Accept New Sett
(377)
(IN)
The default zone critical moisture level
(187)
(IN)
Hold zone data and manage automatic irrigation of the zone.
Zone
(384)
(OUT)
Zone.java(EXT OUT)
ZoneTest.java(EXT OUT)
Sensor
Record providing data about the state of
(613)
(IN)
The objects in the Irrigation layer, plu
(868)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
Record containing ValveReport and Sensor
(619)
(IN)
Add a sensor
(655)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
A sensor identifier must consist of the l
(119)
(IN)
A sensor location must be a string of 0
(120)
(IN)
The operational status must be a Boolean
(121)
(IN)
If a sensor cannot be read after three t
(67)
(IN)
The following data must be recorded for
(115)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
If the user presses the “Repaired” scree
(322)
(IN)
The failed sensor or valve identifier mus
(174)
(IN)
Failure reports must display the followi
(171)
(IN)
The failed sensor or valve identifier
(172)
(IN)
The Fix Failures state must allow users
(314)
(IN)
The Wet% field must display the percent s
(282)
(IN)
If the valve’s zone moisture sensor has
(283)
(IN)
The failed sensor or valve location
(173)
(IN)
The region between the dashed lines must
(316)
(IN)
The failed sensor or valve location must
(175)
(IN)
AquaLush must allow users to indicate th
(84)
(IN)
The default sensor and valve operational
(188)
(IN)
Hold sensor data and read a SensorDevice.
Sensor
(316)
(OUT)
Sensor.java(EXT OUT)
SensorTest.java(EXT OUT)
Valve
Record providing data about the state of
(610)
(IN)
The objects in the Irrigation layer, plu
(868)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
Record containing ValveReport and Sensor
(619)
(IN)
Add a valve
(666)
(IN)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The operational status must be a Boolean
(133)
(IN)
A valve identifier must consist of the le
(129)
(IN)
A valve location must be a string of 0 t
(131)
(IN)
A valve type must be a string of 0 to 16
(130)
(IN)
A flow rate must be an integer in the ran
(132)
(IN)
The length of time the valve has been op
(165)
(IN)
AquaLush must eventually control a varie
(206)
(IN)
If a valve cannot be manipulated after t
(72)
(IN)
AquaLush must do the following during an
(53)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
The following data must be displayed for
(158)
(IN)
The associated sensor moisture level mus
(167)
(IN)
The valve identifier and location must be
(164)
(IN)
The following data must be recorded for
(123)
(IN)
The amount of water used by the valve mu
(166)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
If the user presses the “Repaired” scree
(322)
(IN)
The failed sensor or valve identifier mus
(174)
(IN)
Failure reports must display the followi
(171)
(IN)
The failed sensor or valve identifier
(172)
(IN)
The screen buttons must work just as in
(291)
(IN)
The region between the dashed lines must
(270)
(IN)
The Gallons Used display must work just
(295)
(IN)
The Valve field must display data just as
(292)
(IN)
The Fix Failures state must allow users
(314)
(IN)
The Water Used field must show the number
(285)
(IN)
The Time field must display the time that
(284)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
The region between the dashed lines must
(290)
(IN)
The failed sensor or valve location
(173)
(IN)
The region between the dashed lines must
(316)
(IN)
Each displayed value must be updated eve
(169)
(IN)
If the user presses the “Open/Close Valv
(276)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
The Valve field must show the identifier a
(278)
(IN)
The failed sensor or valve location must
(175)
(IN)
AquaLush must allow users to indicate th
(84)
(IN)
The default sensor and valve operational
(188)
(IN)
Hold valve data, keep track of how much water a valve uses during irrigation, and control a ValveDevice.
Valve
(354)
(OUT)
Valve.java(EXT OUT)
ValveTest.java(EXT OUT)

ID: 274

1.6.2 Irrigation Layer Local Module Interface Specifications


ID: 275

1.6.2.1 Services Provided

All operations with preconditions on parameters throw IllegalArgumentExceptions if the preconditions are violated.

ID: 276

1.6.2.1.1 Create an automatic irrigation cycle (AutoCycle)

This object is linked to:
Hold irrigation parameters, oversee irri
(601)
(IN)
AutoCycle
(79)
(OUT)
AquaLush must allow the maximum amount o
(29)
(IN)
The Set Water Allocation state must allo
(378)
(IN)

This object has external links to:
AutoCycle.java(EXT OUT)
AutoCycleTest.java(EXT OUT)

Syntax:
create( allocation:int, zones:Collection )
Pre:
0 < allocation and no irrigation cycle is in progress.
Post:
A new automatic irrigation cycle is created and immediately starts.

ID: 287

1.6.2.1.2 Create a manual irrigation cycle (ManualCycle)

This object is linked to:
Hold irrigation parameters, oversee irri
(601)
(IN)
ManualCycle
(283)
(OUT)

This object has external links to:
ManualCycle.java(EXT OUT)
ManualCycleTest.java(EXT OUT)

Syntax:
create( zones : Collection)
Pre:
No irrigation cycle is in progress.
Post:
A new manual irrigation cycle is created.

ID: 298

1.6.2.1.3 One minute passes (IrrigationCycle, Zone, Valve)

This object is linked to:
Hold irrigation parameters, oversee irri
(601)
(IN)
tick
(530)
(OUT)
tick
(472)
(OUT)
tick
(225)
(OUT)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
AquaLush must do the following during an
(53)
(IN)
AquaLush must monitor the amount of wate
(37)
(IN)
If a sensor cannot be read after three t
(69)
(IN)
In automatic-mode operation, AquaLush mu
(52)
(IN)
When told that a failed valve or sensor
(86)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
Each displayed value must be updated eve
(169)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)

This object has external links to:
IrrigationCycle.java(EXT OUT)
IrrigationCycleTest.java(EXT OUT)
Valve.java(EXT OUT)
ValveTest.java(EXT OUT)
Zone.java(EXT OUT)
ZoneTest.java(EXT OUT)

Syntax:
tick()
Pre:
None.
Post:
Time dependent actions are completed:
AutoCycle ticks the current zone and checks if zone irrigation is complete.
ManualCycle ticks all zones. Zone ticks its valves and then updates water used. Valve (if open) updates minutes open.

ID: 309

1.6.2.1.4 See if a cycle is ended

This object is linked to:
Hold irrigation parameters, oversee irri
(601)
(IN)
isDone
(173)
(OUT)
AquaLush must do the following during an
(53)
(IN)
If the water allocation is set when auto
(32)
(IN)
In automatic-mode operation, AquaLush mu
(52)
(IN)
The default sensor and valve operational
(188)
(IN)
The default zone critical moisture level
(187)
(IN)

This object has external links to:
IrrigationCycle.java(EXT OUT)
IrrigationCycleTest.java(EXT OUT)

Syntax:
isDone() : Boolean
Pre:
None.
Post:
Returns true if automatic irrigation is complete, false otherwise.

ID: 320

1.6.2.1.5 A cycle is ended (IrrigationCycle)

This object is linked to:
Hold irrigation parameters, oversee irri
(601)
(IN)
end
(163)
(OUT)
When no valve is open in manual irrigati
(49)
(IN)
In automatic-mode operation, AquaLush mu
(52)
(IN)

This object has external links to:
IrrigationCycle.java(EXT OUT)
IrrigationCycleTest.java(EXT OUT)

Syntax:
end()
Pre:
None.
Post:
All valves are closed.

ID: 331

1.6.2.1.6 Check for auto irrigation completion (Zone)

This object is linked to:
Hold irrigation parameters, oversee irri
(601)
(IN)
isIrrigated
(480)
(OUT)
Each irrigation zone must have exactly o
(109)
(IN)
If the critical moisture level is set wh
(27)
(IN)
The default zone critical moisture level
(187)
(IN)

This object has external links to:
Zone.java(EXT OUT)
ZoneTest.java(EXT OUT)

Syntax:
isIrrigated() : boolean
Pre:
None.
Post:
Zone returns true if auto irrigation is completed.

ID: 342

1.6.2.1.7 Open or close all valves in a zone

This object is linked to:
Hold irrigation parameters, oversee irri
(601)
(IN)
closeAllValves
(473)
(OUT)
openAllValves
(510)
(OUT)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
AquaLush must eventually control a varie
(206)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
The screen buttons must work just as in
(291)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
The default sensor and valve operational
(188)
(IN)

This object has external links to:
Zone.java(EXT OUT)
ZoneTest.java(EXT OUT)

Syntax:
closeAllValves() openAllValves()
Pre:
None.
Post:
All the valves in the zone are opened or closed.

ID: 353

1.6.2.1.8 Manually open or close a valve (Irrigator)

This object is linked to:
Manually open or close a valve
(710)
(IN)
openValve
(535)
(OUT)
closeValve
(348)
(OUT)
Setting the mode to a different value mu
(11)
(IN)
AquaLush must eventually control a varie
(206)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
The screen buttons must work just as in
(291)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
If the user presses the “Open/Close Valv
(276)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
The default sensor and valve operational
(188)
(IN)

Syntax:
openValve( id : String )
closeValve( id : String )
Pre:
id is not null and names a registered valve.
Post:
A valve is opened or closed. Attempts to open or close failed valves do nothing.

ID: 364

1.6.2.1.9 Get sensor data (Irrigator)

This object is linked to:
Get sensor data
(743)
(IN)
getSensorReports
(518)
(OUT)
getSensorReport
(481)
(OUT)
Each irrigation zone must have exactly o
(109)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
The operational status must be a Boolean
(121)
(IN)
If a sensor cannot be read after three t
(67)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
The Wet% field must display the percent s
(282)
(IN)
If the valve’s zone moisture sensor has
(283)
(IN)

Syntax:
getSensorReports() : Collection getSensorReport( id : String ) : SensorReport
Pre:
id is not null and names a registered sensor.
Post:
If no sensor is identified, a collection of SensorReports, one for each registered sensor, is populated and returned. If a sensor is identified, a report for that sensor is populated and returned.

ID: 375

1.6.2.1.10 Get valve data (Irrigator)

This object is linked to:
Get valve data
(754)
(IN)
getValveReports
(532)
(OUT)
getValveReport
(531)
(OUT)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The operational status must be a Boolean
(133)
(IN)
A flow rate must be an integer in the ran
(132)
(IN)
The length of time the valve has been op
(165)
(IN)
AquaLush must eventually control a varie
(206)
(IN)
If a valve cannot be manipulated after t
(72)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
The following data must be displayed for
(158)
(IN)
The associated sensor moisture level mus
(167)
(IN)
The valve identifier and location must be
(164)
(IN)
The amount of water used by the valve mu
(166)
(IN)
The region between the dashed lines must
(270)
(IN)
The Gallons Used display must work just
(295)
(IN)
The Valve field must display data just as
(292)
(IN)
The Water Used field must show the number
(285)
(IN)
The Time field must display the time that
(284)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
The region between the dashed lines must
(290)
(IN)
Each displayed value must be updated eve
(169)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
The Valve field must show the identifier a
(278)
(IN)

This object has external links to:
Irrigator.java(EXT OUT)
IrrigatorTest.java(EXT OUT)

Syntax:
getValveReports() : Collection getValveReport( id : String ) : ValveReport
Pre:
id is not null and names a registered valve.
Post:
If no valve is identified, a collection of ValveReports, one for each registered valve, is populated and returned. If a valve is identified, a report for that valve is populated and returned.

ID: 386

1.6.2.1.11 Get a failed hardware report (Irrigator)

This object is linked to:
Get a failed hardware report
(765)
(IN)
getFailureReport
(419)
(OUT)
Sensor failures must be detectable when
(211)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The Device Failure state must be entered
(385)
(IN)
If a valve cannot be manipulated after t
(72)
(IN)
If a sensor cannot be read after three t
(67)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
If no valves have failed, then AquaLush
(79)
(IN)
AquaLush must provide reports of failed
(78)
(IN)
If valves or sensors have failed, then A
(81)
(IN)
If no sensors have failed, then AquaLush
(80)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
The failed sensor or valve identifier mus
(174)
(IN)
Failure reports must display the followi
(171)
(IN)
The failed sensor or valve identifier
(172)
(IN)
The failed devices summary in row eight
(329)
(IN)
The Fix Failures state must allow users
(314)
(IN)
The failed sensor or valve location
(173)
(IN)
The region between the dashed lines must
(316)
(IN)
The failed sensor or valve location must
(175)
(IN)
If the failed device is a valve, then th
(388)
(IN)
If the failed device is a sensor, then t
(389)
(IN)
The default sensor and valve operational
(188)
(IN)

This object has external links to:
Irrigator.java(EXT OUT)
IrrigatorTest.java(EXT OUT)

Syntax:
getFailureReport() : FailureReport
Pre:
None.
Post:
A new FailureReport is created and populated. It will contain ValveReports and SensorReports only for failed devices.

ID: 397

1.6.2.1.12 Mark a device as repaired (Irrigator)

This object is linked to:
Mark a device as repaired
(776)
(IN)
repairDevice
(536)
(OUT)
When told that a failed valve or sensor
(85)
(IN)
If the user presses the “Repaired” scree
(322)
(IN)
The Fix Failures state must allow users
(314)
(IN)
AquaLush must allow users to indicate th
(84)
(IN)

This object has external links to:
Irrigator.java(EXT OUT)
IrrigatorTest.java(EXT OUT)

Syntax:
repairDevice( id : String )
Pre:
id is not null and names a registered valve or sensor.
Post:
The indicated valve or sensor is marked as repaired. The change is recorded in persistent store.

ID: 408

1.6.3 Irrigation Layer Design Rationale

The Devices collection is not strictly necessary because each Zone can handle the Devices module responsibilities. However, the Zone class already has several responsibilities, so the reporting and repair status modification responsibilities are passed off to the Devices class to simplify the Zone class.
The AutoCycle class originally had full control over automatic irrigation. For example, the AutoCycle class would query each Zone to obtain its Sensor and critical moisture level, and then read the Sensor to compare it with the critical moisture level. The AutoCycle class would query the Zone to obtain its valve set; go through the set and query each Valve about its flow rate, its allocation, and how long the valve had been open to compute its water usage; and then compare this with its allocation to decide whether the allocation was exhausted. This design made for a very bloated and complex AutoCycle class. An alternative with distributed control lets each Zone decide whether irrigation is complete and lets each Valve decide whether it has used up its allocation. This simplifies the design and was chosen as the better design alternative.

This object is linked to:
irrigation
(72)
(OUT)
AquaLush must run in one of two modes: m
(8)
(IN)
AquaLush must allow operation in either
(36)
(IN)

This object has external links to:
irrigation/(EXT OUT)
test/irrigation/(EXT OUT)


ID: 409

1.7 Irrigation Layer Behavior

The central behavior of the Irrigation layer is its response time. The Irrigator object is an observer of the Clock. The behavior of the Irrigator update() operation is pictured in Figure B-11-13.

This object is linked to:
Control both manual and automatic irriga
(17)
(IN)
Irrigation Layer Decomposition
(593)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
Irrigator_Update
(550)
(OUT)
irrigation
(72)
(OUT)
The irrigated site must be divided into
(108)
(IN)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The operational status must be a Boolean
(133)
(IN)
The operational status must be a Boolean
(121)
(IN)
If the current time is set so that an ir
(18)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
AquaLush must eventually control a varie
(206)
(IN)
The current day must be an element of {
(155)
(IN)
AquaLush must run in one of two modes: m
(8)
(IN)
If a valve cannot be manipulated after t
(72)
(IN)
AquaLush must do the following during an
(53)
(IN)
The current time is recorded in the syst
(154)
(IN)
If a sensor cannot be read after three t
(67)
(IN)
AquaLush must monitor the amount of wate
(37)
(IN)
If the user presses the “Propagate Setti
(366)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
AquaLush must allow operation in either
(36)
(IN)
If a sensor cannot be read after three t
(69)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
If the irrigation time is set when autom
(22)
(IN)
In automatic-mode operation, AquaLush mu
(51)
(IN)
When no valve is open in manual irrigati
(49)
(IN)
In automatic-mode operation, AquaLush mu
(52)
(IN)
AquaLush must make no attempt to resume
(92)
(IN)
When told that a failed valve or sensor
(86)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
The failed sensor or valve identifier mus
(174)
(IN)
Failure reports must display the followi
(171)
(IN)
The failed sensor or valve identifier
(172)
(IN)
The screen buttons must work just as in
(291)
(IN)
The Set Moisture Levels state must allow
(358)
(IN)
The Fix Failures state must allow users
(314)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
The failed sensor or valve location
(173)
(IN)
The Set Up Auto Irrigation state must al
(330)
(IN)
If the user presses the “Accept New Sett
(356)
(IN)
If a new irrigation time is only partial
(357)
(IN)
The Set Irrigation Times state must allo
(332)
(IN)
Each displayed value must be updated eve
(169)
(IN)
If the user presses the “Open/Close Valv
(276)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
AquaLush must accommodate implementation
(207)
(IN)
The failed sensor or valve location must
(175)
(IN)
If the user presses the “Accept New Sett
(377)
(IN)
If the user presses the “Accept New Sett
(384)
(IN)
The Set Water Allocation state must allo
(378)
(IN)
AquaLush must record its system paramete
(144)
(IN)
System parameters include the following
(145)
(IN)
The irrigation days must be a subset of
(151)
(IN)
The default sensor and valve operational
(188)
(IN)
The default irrigation time must be 0200
(185)
(IN)
The irrigation time of day must be a 24-
(152)
(IN)
The irrigation time must specify both th
(150)
(IN)
The mode must be either manual or automa
(149)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
The default water allocation must be 100
(186)
(IN)
The default irrigation day must be the s
(184)
(IN)
The water allocation must be an integer
(153)
(IN)
The default mode must be automatic.
(183)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)
The default zone critical moisture level
(187)
(IN)

This object has external links to:
irrigation/(EXT OUT)
test/irrigation/(EXT OUT)


ID: 526

Figure B-11-13 Irrigator.update() Behavior


ID: 410

The Irrigator calls IrrigationCycle.tick() whenever a cycle is in process. The AutoCyle.tick() operation is modeled in Figure B-11-14.

This object is linked to:
AutoCycle_Tick
(546)
(OUT)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
AquaLush must do the following during an
(53)
(IN)
If the user presses the “Propagate Setti
(366)
(IN)
If a sensor cannot be read after three t
(69)
(IN)
If the water allocation is set when auto
(32)
(IN)
If the critical moisture level is set wh
(27)
(IN)
In automatic-mode operation, AquaLush mu
(52)
(IN)
When told that a failed valve or sensor
(86)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
The Set Moisture Levels state must allow
(358)
(IN)
The Fix Failures state must allow users
(314)
(IN)
The Set Up Auto Irrigation state must al
(330)
(IN)
If the user presses the “Accept New Sett
(356)
(IN)
If a new irrigation time is only partial
(357)
(IN)
The Set Irrigation Times state must allo
(332)
(IN)
If the user presses the “Accept New Sett
(377)
(IN)
If the user presses the “Accept New Sett
(384)
(IN)
The Set Water Allocation state must allo
(378)
(IN)
The default sensor and valve operational
(188)
(IN)
The default zone critical moisture level
(187)
(IN)


ID: 528

Figure B-11-14 AutoCyle.tick() Behavior


ID: 411

The ManualCycle.tick() operation is pictured in Figure B-11-15.

This object is linked to:
ManualCycle_Tick
(558)
(OUT)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
When told that a failed valve or sensor
(86)
(IN)
If AquaLush cannot read its persistent s
(76)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
The screen buttons must work just as in
(291)
(IN)
The Fix Failures state must allow users
(314)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
If the user presses the “Open/Close Valv
(276)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)


ID: 527

Figure B-11-15 ManualCycle.tick() Behavior


ID: 412

1.8 User Interface Layer Static Structure

The User Interface layer coordinates interaction with a user by consuming input provided via a 12-key keypad and 8 screen buttons and providing output on a monochrome screen of 16 lines with 40 characters per line. This layer has a main UIController class that executes a state machine. Each state corresponds to a screen. Transitions occur when users press screen buttons. Internal actions are prompted by screen button and keypad key presses.
The details added in mid-level design are the classes representing the screen states and auxiliary classes. The static structure of the User Interface layer is shown in Figure B-11-16.
The Screen super-class is for “plain” screens without scrollable regions. It uses the Command pattern to assign actions for screen button presses and keypad key presses.

This object is linked to:
User Interface Layer Decomposition
(790)
(IN)
Implement a device-independent AquaLush
(14)
(IN)
UI
(548)
(OUT)
ui
(549)
(OUT)
AquaLush must be operated from a single
(196)
(IN)
If AquaLush cannot read its persistent s
(396)
(IN)
There must be four buttons on each side
(218)
(IN)
It must include eight push buttons adjac
(217)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a monochrome screen that
(216)
(IN)
An irrigation zone location must be a st
(112)
(IN)
The zone’s critical moisture level must
(113)
(IN)
A sensor identifier must consist of the l
(119)
(IN)
A sensor location must be a string of 0
(120)
(IN)
An irrigation zone identifier must consis
(111)
(IN)
A valve identifier must consist of the le
(129)
(IN)
A valve location must be a string of 0 t
(131)
(IN)
A valve type must be a string of 0 to 16
(130)
(IN)
A flow rate must be an integer in the ran
(132)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(IN)
The length of time the valve has been op
(165)
(IN)
If the user presses the “Accept New Sett
(312)
(IN)
The current day and time displays must c
(298)
(IN)
The message about failure to write to pe
(391)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
The current day must be an element of {
(155)
(IN)
The Persistent Store Failure state must
(393)
(IN)
The Set Clock state must allow users to
(296)
(IN)
AquaLush must allow the days and time of
(19)
(IN)
If a new irrigation time setting fails v
(21)
(IN)
The Device Failure state must be entered
(385)
(IN)
The current time is recorded in the syst
(154)
(IN)
If AquaLush cannot read its persistent s
(75)
(IN)
If a new time setting fails validation,
(16)
(IN)
If AquaLush cannot write to its persiste
(74)
(IN)
AquaLush must allow moisture levels that
(24)
(IN)
If a new critical moisture level setting
(26)
(IN)
If the user presses the “Propagate Setti
(366)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
AquaLush must display the total water us
(47)
(IN)
If a new water allocation setting fails
(31)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
If no valves have failed, then AquaLush
(79)
(IN)
AquaLush must provide reports of failed
(78)
(IN)
AquaLush must allow the maximum amount o
(29)
(IN)
The following data must be displayed for
(158)
(IN)
The associated sensor moisture level mus
(167)
(IN)
The valve identifier and location must be
(164)
(IN)
The amount of water used by the valve mu
(166)
(IN)
If valves or sensors have failed, then A
(81)
(IN)
If no sensors have failed, then AquaLush
(80)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
The Zone field must display data just as
(293)
(IN)
If the user presses the “Repaired” scree
(322)
(IN)
The failed sensor or valve identifier mus
(174)
(IN)
Failure reports must display the followi
(171)
(IN)
The failed sensor or valve identifier
(172)
(IN)
The screen buttons must work just as in
(291)
(IN)
The region between the dashed lines must
(270)
(IN)
The Set Moisture Levels state must allow
(358)
(IN)
The Gallons Used display must work just
(295)
(IN)
The Valve field must display data just as
(292)
(IN)
The failed devices summary in row eight
(329)
(IN)
The Fix Failures state must allow users
(314)
(IN)
The Wet% field must display the percent s
(282)
(IN)
The Water Used field must show the number
(285)
(IN)
The Time field must display the time that
(284)
(IN)
The Zone field must display the zone iden
(281)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
The region between the dashed lines must
(290)
(IN)
If the valve’s zone moisture sensor has
(283)
(IN)
The failed sensor or valve location
(173)
(IN)
The region between the dashed lines must
(316)
(IN)
The region between the dashed lines must
(360)
(IN)
The Set Up Auto Irrigation state must al
(330)
(IN)
If the user presses the “Accept New Sett
(356)
(IN)
If a new irrigation time is only partial
(357)
(IN)
The Set Irrigation Times state must allo
(332)
(IN)
If the user presses the “Open/Close Valv
(276)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
The Valve field must show the identifier a
(278)
(IN)
The failed sensor or valve location must
(175)
(IN)
If the failed device is a valve, then th
(388)
(IN)
AquaLush must display a reset current ti
(17)
(IN)
AquaLush must display the current mode t
(12)
(IN)
If the user presses the “Accept New Sett
(377)
(IN)
Users must be able to set the mode.
(9)
(IN)
AquaLush must display a reset irrigation
(23)
(IN)
The Fix Failures action must be a “Fix F
(250)
(IN)
AquaLush must display a reset water allo
(33)
(IN)
AquaLush must display the following data
(41)
(IN)
AquaLush must display a reset critical m
(28)
(IN)
AquaLush must allow users to indicate th
(84)
(IN)
If the failed device is a sensor, then t
(389)
(IN)
If the user presses the “Accept New Sett
(384)
(IN)
If the user attempts to enter an illegal
(309)
(IN)
The third digit must be in the range zer
(307)
(IN)
The Set Up Automatic Irrigation action m
(251)
(IN)
The Set Water Allocation state must allo
(378)
(IN)
The control panel must conform to the di
(238)
(IN)
The Finished action must be either a “Fi
(241)
(IN)
The manual mode menu must have an extra
(237)
(IN)
The Change Mode action must be a “Change
(239)
(IN)
Their mode indicators must be different
(236)
(IN)
The menu screens in the two modes must b
(235)
(IN)
The Set Clock action must be a “Set the
(249)
(IN)
The Cancel action must be a keypad ESC b
(248)
(IN)
The Finished action must be a “Finished”
(247)
(IN)
The Accept action must be an “Accept New
(246)
(IN)
The user may change to a menu screen wit
(234)
(IN)
The control panel must conduct a dialog
(233)
(IN)
AquaLush software must be configurable in
(193)
(IN)
AquaLush must have an interface that all
(195)
(IN)
The control panel must have a menu-based
(223)
(IN)
Pressing the ESC button on a child scree
(227)
(IN)
Pressing a screen button that does not h
(229)
(IN)
Pressing the ESC button on the main menu
(228)
(IN)
Pressing one of the screen buttons must
(225)
(IN)
Most screens must present a menu selecti
(224)
(IN)
The Display Data action must be a “Displ
(243)
(IN)
The Display Location action must be a “D
(242)
(IN)
The Control Irrigation action must be a
(240)
(IN)
The Main Menu state in this dialog map i
(245)
(IN)
The control panel must conform to the di
(244)
(IN)
Each child screen must have a menu item
(226)
(IN)
Pressing a keypad digit button or the DE
(230)
(IN)
Many screens have centered text. Text mu
(231)
(IN)
There must always be a current valve.
(274)
(IN)
The two middle screen buttons on the rig
(275)
(IN)
The status must be indicated by a single
(279)
(IN)
The list must scroll up to or down to th
(273)
(IN)
The Set Moisture action must be a “Set C
(253)
(IN)
If the user presses keypad digit keys wh
(302)
(IN)
If the user alters the current time, the
(299)
(IN)
If the user presses keypad digit keys, t
(301)
(IN)
If the user presses the DEL key, then ch
(300)
(IN)
Note that the Normal State is a placehol
(256)
(IN)
The Set Allocation action must be a “Set
(254)
(IN)
If the first digit is two, then the secon
(306)
(IN)
The valve identifier must be left-aligned
(280)
(IN)
Users must be constrained in entering di
(303)
(IN)
The first digit must be in the range zero
(304)
(IN)
The Manual Main state must be an alterna
(265)
(IN)
The Manual Main state must display the m
(266)
(IN)
Note that the day, time, number of faile
(267)
(IN)
The Auto Main state must display the mai
(262)
(IN)
The Manual Irrigation (Data) state must
(269)
(IN)
Note that the day, time, number of faile
(264)
(IN)
The Auto Main state must be the initial
(261)
(IN)
The valves must be listed in zone identi
(271)
(IN)
The middle, highlighted element is the c
(272)
(IN)
The control panel must conform to the di
(255)
(IN)
The OK action must be an “OK” screen but
(259)
(IN)
Note that the digits in the borders of F
(263)
(IN)
The Store Failure action must be an inab
(258)
(IN)
The Set Clock state must display the scr
(297)
(IN)
If the first digit is zero or one, then t
(305)
(IN)
The Device Failure action must be a dete
(257)
(IN)
The Set Times action must be a “Set Irri
(252)
(IN)
The Gallons Used display in row eight mu
(286)
(IN)
The Location field must display the valve
(294)
(IN)
The Manual Irrigation (Location) state m
(289)
(IN)
The Gallons Used display must be centere
(287)
(IN)
If AquaLush cannot read its persistent s
(77)
(IN)
A configuration file that cannot be found,
(142)
(IN)
If the user presses a screen key for a d
(310)
(IN)
The two middle screen buttons on the rig
(365)
(IN)
The fourth digit must be in the range ze
(308)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)
Tuesday must be abbreviated as “Tu.”
(347)
(IN)
If the user attempts to enter an illegal
(343)
(IN)
The Irrigation Days display must show th
(344)
(IN)
The fourth digit must be in the range ze
(342)
(IN)
The third digit must be in the range zer
(341)
(IN)
If the first digit is two, then the secon
(340)
(IN)
If the first digit is zero or one, then t
(339)
(IN)
The first digit must be in the range zero
(338)
(IN)
If the user presses keypad digit keys, t
(335)
(IN)
Monday must be abbreviated as “M.”
(346)
(IN)
Thursday must be abbreviated as “Th.”
(349)
(IN)
If the user presses a screen key for a d
(353)
(IN)
Saturday must be abbreviated as “Sa.”
(351)
(IN)
Sunday must be abbreviated as “Su.”
(352)
(IN)
The middle, highlighted element is the c
(362)
(IN)
The zones must be listed in zone identifi
(361)
(IN)
There must always be a current zone.
(364)
(IN)
The list must scroll up to or down to th
(363)
(IN)
If the user presses the ESC key, the irr
(355)
(IN)
If the user presses a screen key for a d
(354)
(IN)
The Set Moisture Levels state must displ
(359)
(IN)
The Fix Failures state must display the
(315)
(IN)
The middle, highlighted element is the c
(318)
(IN)
Wednesday must be abbreviated as “W.”
(348)
(IN)
Friday must be abbreviated as “F.”
(350)
(IN)
The Zone field must show the failed devic
(327)
(IN)
The Device field must show the identifier
(326)
(IN)
When a device is removed from the list a
(325)
(IN)
The failed sensors must be listed first,
(317)
(IN)
If the user presses the ESC key, the clo
(311)
(IN)
Users must be constrained in entering di
(337)
(IN)
The Set Irrigation Times state must disp
(333)
(IN)
If the user presses the DEL key, then ch
(334)
(IN)
The Set Up Auto Irrigation state must di
(331)
(IN)
The Location field must display the faile
(328)
(IN)
When a device is removed from the list a
(323)
(IN)
If the list is empty, there must be no c
(319)
(IN)
A non-empty list must scroll up to or do
(320)
(IN)
The two middle screen buttons on the rig
(321)
(IN)
When a device is removed from the list a
(324)
(IN)
If a new time is only partially entered
(313)
(IN)
The day set string must show the current
(345)
(IN)
If the user presses keypad digit keys wh
(336)
(IN)
The Persistent Store Failure state must
(394)
(IN)
When the user presses the “OK” button, t
(392)
(IN)
The third digit must be a zero, and it m
(372)
(IN)
The first two digits must be in the range
(371)
(IN)
If the user presses the ESC key, then no
(376)
(IN)
Users must be constrained in entering di
(370)
(IN)
The Location field must display the zone’
(375)
(IN)
The Level field must show the zone’s crit
(374)
(IN)
The Zone field must show the zone identifi
(373)
(IN)
If the user presses the DEL key, then ch
(367)
(IN)
When the user presses the “OK” button, t
(395)
(IN)
If the user presses keypad digit keys wh
(369)
(IN)
If the user presses keypad digit keys, t
(368)
(IN)
If the user presses keypad digit keys, t
(381)
(IN)
If the user presses the DEL key, then ch
(380)
(IN)
The Set Water Allocation state must disp
(379)
(IN)
The data displayed in rows three through
(390)
(IN)
If the user presses keypad digit keys wh
(382)
(IN)
The device identifier, zone, and location
(387)
(IN)
If the user presses the ESC key, the wat
(383)
(IN)
The Device Failure state must display th
(386)
(IN)

This object has external links to:
ui/(EXT OUT)


ID: 534

Figure B-11-16 User Interface Layer Mid-Level Static Structure


ID: 413

1.8.1 User Interface Layer Local Module Responsibilities

Module
Responsibilities
Screen
Execute a state machine whose states are
(798)
(IN)
AquaLush must be operated from a single
(196)
(IN)
If AquaLush cannot read its persistent s
(396)
(IN)
There must be four buttons on each side
(218)
(IN)
It must include eight push buttons adjac
(217)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a monochrome screen that
(216)
(IN)
An irrigation zone location must be a st
(112)
(IN)
The zone’s critical moisture level must
(113)
(IN)
A sensor identifier must consist of the l
(119)
(IN)
A sensor location must be a string of 0
(120)
(IN)
An irrigation zone identifier must consis
(111)
(IN)
A valve identifier must consist of the le
(129)
(IN)
A valve location must be a string of 0 t
(131)
(IN)
A valve type must be a string of 0 to 16
(130)
(IN)
A flow rate must be an integer in the ran
(132)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(IN)
The length of time the valve has been op
(165)
(IN)
If the user presses the “Accept New Sett
(312)
(IN)
The current day and time displays must c
(298)
(IN)
The message about failure to write to pe
(391)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
The current day must be an element of {
(155)
(IN)
The Persistent Store Failure state must
(393)
(IN)
The Set Clock state must allow users to
(296)
(IN)
AquaLush must allow the days and time of
(19)
(IN)
If a new irrigation time setting fails v
(21)
(IN)
The Device Failure state must be entered
(385)
(IN)
The current time is recorded in the syst
(154)
(IN)
If AquaLush cannot read its persistent s
(75)
(IN)
If a new time setting fails validation,
(16)
(IN)
If AquaLush cannot write to its persiste
(74)
(IN)
AquaLush must allow moisture levels that
(24)
(IN)
If a new critical moisture level setting
(26)
(IN)
If the user presses the “Propagate Setti
(366)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
AquaLush must display the total water us
(47)
(IN)
If a new water allocation setting fails
(31)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
If no valves have failed, then AquaLush
(79)
(IN)
AquaLush must provide reports of failed
(78)
(IN)
AquaLush must allow the maximum amount o
(29)
(IN)
The following data must be displayed for
(158)
(IN)
The associated sensor moisture level mus
(167)
(IN)
The valve identifier and location must be
(164)
(IN)
The amount of water used by the valve mu
(166)
(IN)
If valves or sensors have failed, then A
(81)
(IN)
If no sensors have failed, then AquaLush
(80)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
The Zone field must display data just as
(293)
(IN)
If the user presses the “Repaired” scree
(322)
(IN)
The failed sensor or valve identifier mus
(174)
(IN)
Failure reports must display the followi
(171)
(IN)
The failed sensor or valve identifier
(172)
(IN)
The screen buttons must work just as in
(291)
(IN)
The region between the dashed lines must
(270)
(IN)
The Set Moisture Levels state must allow
(358)
(IN)
The Gallons Used display must work just
(295)
(IN)
The Valve field must display data just as
(292)
(IN)
The failed devices summary in row eight
(329)
(IN)
The Fix Failures state must allow users
(314)
(IN)
The Wet% field must display the percent s
(282)
(IN)
The Water Used field must show the number
(285)
(IN)
The Time field must display the time that
(284)
(IN)
The Zone field must display the zone iden
(281)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
The region between the dashed lines must
(290)
(IN)
If the valve’s zone moisture sensor has
(283)
(IN)
The failed sensor or valve location
(173)
(IN)
The region between the dashed lines must
(316)
(IN)
The region between the dashed lines must
(360)
(IN)
The Set Up Auto Irrigation state must al
(330)
(IN)
If the user presses the “Accept New Sett
(356)
(IN)
If a new irrigation time is only partial
(357)
(IN)
The Set Irrigation Times state must allo
(332)
(IN)
If the user presses the “Open/Close Valv
(276)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
The Valve field must show the identifier a
(278)
(IN)
The failed sensor or valve location must
(175)
(IN)
If the failed device is a valve, then th
(388)
(IN)
AquaLush must display a reset current ti
(17)
(IN)
AquaLush must display the current mode t
(12)
(IN)
If the user presses the “Accept New Sett
(377)
(IN)
Users must be able to set the mode.
(9)
(IN)
AquaLush must display a reset irrigation
(23)
(IN)
The Fix Failures action must be a “Fix F
(250)
(IN)
AquaLush must display a reset water allo
(33)
(IN)
AquaLush must display the following data
(41)
(IN)
AquaLush must display a reset critical m
(28)
(IN)
AquaLush must allow users to indicate th
(84)
(IN)
If the failed device is a sensor, then t
(389)
(IN)
If the user presses the “Accept New Sett
(384)
(IN)
If the user attempts to enter an illegal
(309)
(IN)
The third digit must be in the range zer
(307)
(IN)
The Set Up Automatic Irrigation action m
(251)
(IN)
The Set Water Allocation state must allo
(378)
(IN)
The control panel must conform to the di
(238)
(IN)
The Finished action must be either a “Fi
(241)
(IN)
The manual mode menu must have an extra
(237)
(IN)
The Change Mode action must be a “Change
(239)
(IN)
Their mode indicators must be different
(236)
(IN)
The menu screens in the two modes must b
(235)
(IN)
The Set Clock action must be a “Set the
(249)
(IN)
The Cancel action must be a keypad ESC b
(248)
(IN)
The Finished action must be a “Finished”
(247)
(IN)
The Accept action must be an “Accept New
(246)
(IN)
The user may change to a menu screen wit
(234)
(IN)
The control panel must conduct a dialog
(233)
(IN)
AquaLush software must be configurable in
(193)
(IN)
AquaLush must have an interface that all
(195)
(IN)
The control panel must have a menu-based
(223)
(IN)
Pressing the ESC button on a child scree
(227)
(IN)
Pressing a screen button that does not h
(229)
(IN)
Pressing the ESC button on the main menu
(228)
(IN)
Pressing one of the screen buttons must
(225)
(IN)
Most screens must present a menu selecti
(224)
(IN)
The Display Data action must be a “Displ
(243)
(IN)
The Display Location action must be a “D
(242)
(IN)
The Control Irrigation action must be a
(240)
(IN)
The Main Menu state in this dialog map i
(245)
(IN)
The control panel must conform to the di
(244)
(IN)
Each child screen must have a menu item
(226)
(IN)
Pressing a keypad digit button or the DE
(230)
(IN)
Many screens have centered text. Text mu
(231)
(IN)
There must always be a current valve.
(274)
(IN)
The two middle screen buttons on the rig
(275)
(IN)
The status must be indicated by a single
(279)
(IN)
The list must scroll up to or down to th
(273)
(IN)
The Set Moisture action must be a “Set C
(253)
(IN)
If the user presses keypad digit keys wh
(302)
(IN)
If the user alters the current time, the
(299)
(IN)
If the user presses keypad digit keys, t
(301)
(IN)
If the user presses the DEL key, then ch
(300)
(IN)
Note that the Normal State is a placehol
(256)
(IN)
The Set Allocation action must be a “Set
(254)
(IN)
If the first digit is two, then the secon
(306)
(IN)
The valve identifier must be left-aligned
(280)
(IN)
Users must be constrained in entering di
(303)
(IN)
The first digit must be in the range zero
(304)
(IN)
The Manual Main state must be an alterna
(265)
(IN)
The Manual Main state must display the m
(266)
(IN)
Note that the day, time, number of faile
(267)
(IN)
The Auto Main state must display the mai
(262)
(IN)
The Manual Irrigation (Data) state must
(269)
(IN)
Note that the day, time, number of faile
(264)
(IN)
The Auto Main state must be the initial
(261)
(IN)
The valves must be listed in zone identi
(271)
(IN)
The middle, highlighted element is the c
(272)
(IN)
The control panel must conform to the di
(255)
(IN)
The OK action must be an “OK” screen but
(259)
(IN)
Note that the digits in the borders of F
(263)
(IN)
The Store Failure action must be an inab
(258)
(IN)
The Set Clock state must display the scr
(297)
(IN)
If the first digit is zero or one, then t
(305)
(IN)
The Device Failure action must be a dete
(257)
(IN)
The Set Times action must be a “Set Irri
(252)
(IN)
The Gallons Used display in row eight mu
(286)
(IN)
The Location field must display the valve
(294)
(IN)
The Manual Irrigation (Location) state m
(289)
(IN)
The Gallons Used display must be centere
(287)
(IN)
If AquaLush cannot read its persistent s
(77)
(IN)
A configuration file that cannot be found,
(142)
(IN)
If the user presses a screen key for a d
(310)
(IN)
The two middle screen buttons on the rig
(365)
(IN)
The fourth digit must be in the range ze
(308)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)
Tuesday must be abbreviated as “Tu.”
(347)
(IN)
If the user attempts to enter an illegal
(343)
(IN)
The Irrigation Days display must show th
(344)
(IN)
The fourth digit must be in the range ze
(342)
(IN)
The third digit must be in the range zer
(341)
(IN)
If the first digit is two, then the secon
(340)
(IN)
If the first digit is zero or one, then t
(339)
(IN)
The first digit must be in the range zero
(338)
(IN)
If the user presses keypad digit keys, t
(335)
(IN)
Monday must be abbreviated as “M.”
(346)
(IN)
Thursday must be abbreviated as “Th.”
(349)
(IN)
If the user presses a screen key for a d
(353)
(IN)
Saturday must be abbreviated as “Sa.”
(351)
(IN)
Sunday must be abbreviated as “Su.”
(352)
(IN)
The middle, highlighted element is the c
(362)
(IN)
The zones must be listed in zone identifi
(361)
(IN)
There must always be a current zone.
(364)
(IN)
The list must scroll up to or down to th
(363)
(IN)
If the user presses the ESC key, the irr
(355)
(IN)
If the user presses a screen key for a d
(354)
(IN)
The Set Moisture Levels state must displ
(359)
(IN)
The Fix Failures state must display the
(315)
(IN)
The middle, highlighted element is the c
(318)
(IN)
Wednesday must be abbreviated as “W.”
(348)
(IN)
Friday must be abbreviated as “F.”
(350)
(IN)
The Zone field must show the failed devic
(327)
(IN)
The Device field must show the identifier
(326)
(IN)
When a device is removed from the list a
(325)
(IN)
The failed sensors must be listed first,
(317)
(IN)
If the user presses the ESC key, the clo
(311)
(IN)
Users must be constrained in entering di
(337)
(IN)
The Set Irrigation Times state must disp
(333)
(IN)
If the user presses the DEL key, then ch
(334)
(IN)
The Set Up Auto Irrigation state must di
(331)
(IN)
The Location field must display the faile
(328)
(IN)
When a device is removed from the list a
(323)
(IN)
If the list is empty, there must be no c
(319)
(IN)
A non-empty list must scroll up to or do
(320)
(IN)
The two middle screen buttons on the rig
(321)
(IN)
When a device is removed from the list a
(324)
(IN)
If a new time is only partially entered
(313)
(IN)
The day set string must show the current
(345)
(IN)
If the user presses keypad digit keys wh
(336)
(IN)
The Persistent Store Failure state must
(394)
(IN)
When the user presses the “OK” button, t
(392)
(IN)
The third digit must be a zero, and it m
(372)
(IN)
The first two digits must be in the range
(371)
(IN)
If the user presses the ESC key, then no
(376)
(IN)
Users must be constrained in entering di
(370)
(IN)
The Location field must display the zone’
(375)
(IN)
The Level field must show the zone’s crit
(374)
(IN)
The Zone field must show the zone identifi
(373)
(IN)
If the user presses the DEL key, then ch
(367)
(IN)
When the user presses the “OK” button, t
(395)
(IN)
If the user presses keypad digit keys wh
(369)
(IN)
If the user presses keypad digit keys, t
(368)
(IN)
If the user presses keypad digit keys, t
(381)
(IN)
If the user presses the DEL key, then ch
(380)
(IN)
The Set Water Allocation state must disp
(379)
(IN)
The data displayed in rows three through
(390)
(IN)
If the user presses keypad digit keys wh
(382)
(IN)
The device identifier, zone, and location
(387)
(IN)
If the user presses the ESC key, the wat
(383)
(IN)
The Device Failure state must display th
(386)
(IN)
Control the display and process user input and clock ticks (routed to it from UIController). Each Screen object is a state in a state machine.
Screen
(599)
(OUT)
Screen.java(EXT OUT)
ScrollingScreen
Execute a state machine whose states are
(798)
(IN)
Most screens must present a menu selecti
(224)
(IN)
Display a scrollable list in the center of the display and handle scrolling commands.
ScrollingScreen
(607)
(OUT)
ScrollingScreen.java(EXT OUT)
Item
An immutable class holding text and values for the scrollable list.
Item
(570)
(OUT)
Item.java(EXT OUT)
Prompt
Most screens must present a menu selecti
(224)
(IN)
Pressing a keypad digit button or the DE
(230)
(IN)
An immutable class holding text written to screens.
Prompt
(575)
(OUT)
Prompt.java(EXT OUT)
EventAction
Pressing the ESC button on a child scree
(227)
(IN)
Pressing a screen button that does not h
(229)
(IN)
Pressing the ESC button on the main menu
(228)
(IN)
Pressing one of the screen buttons must
(225)
(IN)
Pressing a keypad digit button or the DE
(230)
(IN)
Command pattern command class whose operation is called when events occur.
EventAction
(569)
(OUT)
EventAction.java(EXT OUT)

ID: 433

1.8.2 User Interface Layer Local Module Interface Specifications


ID: 434

1.8.2.1 Services Provided

All operations with preconditions on parameters throw IllegalArgumentExceptions if the preconditions are violated.

ID: 435

1.8.2.1.1 Activate a screen when it becomes current

This object is linked to:
Execute a state machine whose states are
(798)
(IN)
activate
(785)
(OUT)

This object has external links to:
Screen.java(EXT OUT)

Syntax:
activate()
Pre:
None.
Post:
The display screen is cleared and all prompts are written to it. If activationAction is not null, its do() operation is called with arg set to null.

ID: 446

1.8.2.1.2 Notify a screen that time has passed

This object is linked to:
Execute a state machine whose states are
(798)
(IN)
tick
(834)
(OUT)

This object has external links to:
Screen.java(EXT OUT)

Syntax:
tick()
Pre:
None.
Post:
If tickAction is not null, its do() operation is called with arg set to null.

ID: 457

1.8.2.1.3 Notify a screen that a screen button has been pressed

This object is linked to:
Execute a state machine whose states are
(798)
(IN)
screenButtonPress
(832)
(OUT)
Pressing one of the screen buttons must
(225)
(IN)

This object has external links to:
Screen.java(EXT OUT)

Syntax:
screenButtonPress( button : int ) : Screen
Pre:
None.
Post:
If buttonPressAction[button] is not null, its do() operation is called with arg set to the button value. If transition[button] is –1, the result is the current screen; otherwise, the result is screen with number transition[button].

ID: 468

1.8.2.1.4 Notify a screen that a keypad key has been pressed

This object is linked to:
Execute a state machine whose states are
(798)
(IN)
keyPress
(811)
(OUT)
Pressing one of the screen buttons must
(225)
(IN)

This object has external links to:
Screen.java(EXT OUT)

Syntax:
keyPress( key : KeyPress )
Pre:
None.
Post:
If keyPressAction is not null, its do() operation is called with arg set to the key value.

ID: 479

1.8.2.2 Usage Guide

The UIController must create and initialize all the Screen and EventAction objects. It must then execute the state machine by keeping track of the current screen. The UIController calls a screen’s activate() operation when it becomes current. The UIController must also direct one-minute clock ticks, screen button presses, and keypad key presses to the current screen whenever they occur. Note that the UIController is an observer of the Clock, but the screens are not. This way only the current screen gets time notifications.

This object is linked to:
Execute a state machine whose states are
(798)
(IN)
ui
(549)
(OUT)

This object has external links to:
ui/(EXT OUT)


ID: 480

1.8.3 User Interface Layer Design Rationale

There are many alternative ways to implement the state machine that the UIController must realize. Among the alternatives considered were those with many specialized Screen sub-classes. For example, there might be a TimeSettingScreen class and an AllocationSettingScreen class. This alternative is more complicated but less flexible, so it was decided to give the Screen super-class a very general mechanism for handling events.

This object is linked to:
ui
(549)
(OUT)
AquaLush must allow users to set the cur
(13)
(IN)

This object has external links to:
ui/(EXT OUT)


ID: 481

1.9 User Interface Layer Behavior

The user interface changes state based on user input. If each screen represents a state, then user interface states are captured by the dialog map in the SRS. The state diagram in Figure B-11-19 brings the dialog maps in the SRS together and adds internal actions to them.
Events B0 through B7 are presses of screen buttons 0 through 7. States in this diagram are represented by instances of the Screen class. The internal actions are handled either by the screen object or by command objects registered with the screen object.

This object is linked to:
Implement a device-independent AquaLush
(14)
(IN)
Execute a state machine whose states are
(798)
(IN)
ui
(549)
(OUT)
StatechartDiagram
(703)
(OUT)
AquaLush must be operated from a single
(196)
(IN)
If AquaLush cannot read its persistent s
(396)
(IN)
There must be four buttons on each side
(218)
(IN)
It must include eight push buttons adjac
(217)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a monochrome screen that
(216)
(IN)
An irrigation zone location must be a st
(112)
(IN)
The zone’s critical moisture level must
(113)
(IN)
A sensor identifier must consist of the l
(119)
(IN)
A sensor location must be a string of 0
(120)
(IN)
An irrigation zone identifier must consis
(111)
(IN)
A valve identifier must consist of the le
(129)
(IN)
A valve location must be a string of 0 t
(131)
(IN)
A valve type must be a string of 0 to 16
(130)
(IN)
A flow rate must be an integer in the ran
(132)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(IN)
The length of time the valve has been op
(165)
(IN)
If the user presses the “Accept New Sett
(312)
(IN)
The current day and time displays must c
(298)
(IN)
The message about failure to write to pe
(391)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
The current day must be an element of {
(155)
(IN)
The Persistent Store Failure state must
(393)
(IN)
The Set Clock state must allow users to
(296)
(IN)
AquaLush must allow the days and time of
(19)
(IN)
If a new irrigation time setting fails v
(21)
(IN)
The Device Failure state must be entered
(385)
(IN)
AquaLush must allow users to set the cur
(13)
(IN)
The current time is recorded in the syst
(154)
(IN)
If AquaLush cannot read its persistent s
(75)
(IN)
If a new time setting fails validation,
(16)
(IN)
If AquaLush cannot write to its persiste
(74)
(IN)
AquaLush must allow moisture levels that
(24)
(IN)
If a new critical moisture level setting
(26)
(IN)
If the user presses the “Propagate Setti
(366)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
AquaLush must display the total water us
(47)
(IN)
If a new water allocation setting fails
(31)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
If no valves have failed, then AquaLush
(79)
(IN)
AquaLush must provide reports of failed
(78)
(IN)
AquaLush must allow the maximum amount o
(29)
(IN)
The following data must be displayed for
(158)
(IN)
The associated sensor moisture level mus
(167)
(IN)
The valve identifier and location must be
(164)
(IN)
The amount of water used by the valve mu
(166)
(IN)
If valves or sensors have failed, then A
(81)
(IN)
If no sensors have failed, then AquaLush
(80)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
The Zone field must display data just as
(293)
(IN)
If the user presses the “Repaired” scree
(322)
(IN)
The failed sensor or valve identifier mus
(174)
(IN)
Failure reports must display the followi
(171)
(IN)
The failed sensor or valve identifier
(172)
(IN)
The screen buttons must work just as in
(291)
(IN)
The region between the dashed lines must
(270)
(IN)
The Set Moisture Levels state must allow
(358)
(IN)
The Gallons Used display must work just
(295)
(IN)
The Valve field must display data just as
(292)
(IN)
The failed devices summary in row eight
(329)
(IN)
The Fix Failures state must allow users
(314)
(IN)
The Wet% field must display the percent s
(282)
(IN)
The Water Used field must show the number
(285)
(IN)
The Time field must display the time that
(284)
(IN)
The Zone field must display the zone iden
(281)
(IN)
If the user presses the “Propagate to Zo
(277)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
The region between the dashed lines must
(290)
(IN)
If the valve’s zone moisture sensor has
(283)
(IN)
The failed sensor or valve location
(173)
(IN)
The region between the dashed lines must
(316)
(IN)
The region between the dashed lines must
(360)
(IN)
The Set Up Auto Irrigation state must al
(330)
(IN)
If the user presses the “Accept New Sett
(356)
(IN)
If a new irrigation time is only partial
(357)
(IN)
The Set Irrigation Times state must allo
(332)
(IN)
If the user presses the “Open/Close Valv
(276)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
The Valve field must show the identifier a
(278)
(IN)
The failed sensor or valve location must
(175)
(IN)
If the failed device is a valve, then th
(388)
(IN)
AquaLush must display a reset current ti
(17)
(IN)
If the user presses the “Accept New Sett
(377)
(IN)
Users must be able to set the mode.
(9)
(IN)
AquaLush must display a reset irrigation
(23)
(IN)
The Fix Failures action must be a “Fix F
(250)
(IN)
AquaLush must display a reset water allo
(33)
(IN)
AquaLush must display the following data
(41)
(IN)
AquaLush must display a reset critical m
(28)
(IN)
AquaLush must allow users to indicate th
(84)
(IN)
If the failed device is a sensor, then t
(389)
(IN)
If the user presses the “Accept New Sett
(384)
(IN)
If the user attempts to enter an illegal
(309)
(IN)
The third digit must be in the range zer
(307)
(IN)
The Set Up Automatic Irrigation action m
(251)
(IN)
The Set Water Allocation state must allo
(378)
(IN)
The control panel must conform to the di
(238)
(IN)
The Finished action must be either a “Fi
(241)
(IN)
The manual mode menu must have an extra
(237)
(IN)
The Change Mode action must be a “Change
(239)
(IN)
Their mode indicators must be different
(236)
(IN)
The menu screens in the two modes must b
(235)
(IN)
The Set Clock action must be a “Set the
(249)
(IN)
The Cancel action must be a keypad ESC b
(248)
(IN)
The Finished action must be a “Finished”
(247)
(IN)
The Accept action must be an “Accept New
(246)
(IN)
The user may change to a menu screen wit
(234)
(IN)
The control panel must conduct a dialog
(233)
(IN)
AquaLush software must be configurable in
(193)
(IN)
AquaLush must have an interface that all
(195)
(IN)
The control panel must have a menu-based
(223)
(IN)
Pressing the ESC button on a child scree
(227)
(IN)
Pressing a screen button that does not h
(229)
(IN)
Pressing the ESC button on the main menu
(228)
(IN)
Pressing one of the screen buttons must
(225)
(IN)
Most screens must present a menu selecti
(224)
(IN)
The Display Data action must be a “Displ
(243)
(IN)
The Display Location action must be a “D
(242)
(IN)
The Control Irrigation action must be a
(240)
(IN)
The Main Menu state in this dialog map i
(245)
(IN)
The control panel must conform to the di
(244)
(IN)
Each child screen must have a menu item
(226)
(IN)
Pressing a keypad digit button or the DE
(230)
(IN)
Many screens have centered text. Text mu
(231)
(IN)
There must always be a current valve.
(274)
(IN)
The two middle screen buttons on the rig
(275)
(IN)
The status must be indicated by a single
(279)
(IN)
The list must scroll up to or down to th
(273)
(IN)
The Set Moisture action must be a “Set C
(253)
(IN)
If the user presses keypad digit keys wh
(302)
(IN)
If the user alters the current time, the
(299)
(IN)
If the user presses keypad digit keys, t
(301)
(IN)
If the user presses the DEL key, then ch
(300)
(IN)
Note that the Normal State is a placehol
(256)
(IN)
The Set Allocation action must be a “Set
(254)
(IN)
If the first digit is two, then the secon
(306)
(IN)
The valve identifier must be left-aligned
(280)
(IN)
Users must be constrained in entering di
(303)
(IN)
The first digit must be in the range zero
(304)
(IN)
The Manual Main state must be an alterna
(265)
(IN)
The Manual Main state must display the m
(266)
(IN)
Note that the day, time, number of faile
(267)
(IN)
The Auto Main state must display the mai
(262)
(IN)
The Manual Irrigation (Data) state must
(269)
(IN)
Note that the day, time, number of faile
(264)
(IN)
The Auto Main state must be the initial
(261)
(IN)
The valves must be listed in zone identi
(271)
(IN)
The middle, highlighted element is the c
(272)
(IN)
The control panel must conform to the di
(255)
(IN)
The OK action must be an “OK” screen but
(259)
(IN)
Note that the digits in the borders of F
(263)
(IN)
The Store Failure action must be an inab
(258)
(IN)
The Set Clock state must display the scr
(297)
(IN)
If the first digit is zero or one, then t
(305)
(IN)
The Device Failure action must be a dete
(257)
(IN)
The Set Times action must be a “Set Irri
(252)
(IN)
The Gallons Used display in row eight mu
(286)
(IN)
The Location field must display the valve
(294)
(IN)
The Manual Irrigation (Location) state m
(289)
(IN)
The Gallons Used display must be centere
(287)
(IN)
If AquaLush cannot read its persistent s
(77)
(IN)
A configuration file that cannot be found,
(142)
(IN)
If the user presses a screen key for a d
(310)
(IN)
The two middle screen buttons on the rig
(365)
(IN)
The fourth digit must be in the range ze
(308)
(IN)
The main AquaLush irrigation software co
(205)
(IN)
The AquaLush simulation must require no
(202)
(IN)
The AquaLush simulation must be installa
(201)
(IN)
AquaLush software must fail no more than
(199)
(IN)
Tuesday must be abbreviated as “Tu.”
(347)
(IN)
If the user attempts to enter an illegal
(343)
(IN)
The Irrigation Days display must show th
(344)
(IN)
The fourth digit must be in the range ze
(342)
(IN)
The third digit must be in the range zer
(341)
(IN)
If the first digit is two, then the secon
(340)
(IN)
If the first digit is zero or one, then t
(339)
(IN)
The first digit must be in the range zero
(338)
(IN)
If the user presses keypad digit keys, t
(335)
(IN)
Monday must be abbreviated as “M.”
(346)
(IN)
Thursday must be abbreviated as “Th.”
(349)
(IN)
If the user presses a screen key for a d
(353)
(IN)
Saturday must be abbreviated as “Sa.”
(351)
(IN)
Sunday must be abbreviated as “Su.”
(352)
(IN)
The middle, highlighted element is the c
(362)
(IN)
The zones must be listed in zone identifi
(361)
(IN)
There must always be a current zone.
(364)
(IN)
The list must scroll up to or down to th
(363)
(IN)
If the user presses the ESC key, the irr
(355)
(IN)
If the user presses a screen key for a d
(354)
(IN)
The Set Moisture Levels state must displ
(359)
(IN)
The Fix Failures state must display the
(315)
(IN)
The middle, highlighted element is the c
(318)
(IN)
Wednesday must be abbreviated as “W.”
(348)
(IN)
Friday must be abbreviated as “F.”
(350)
(IN)
The Zone field must show the failed devic
(327)
(IN)
The Device field must show the identifier
(326)
(IN)
When a device is removed from the list a
(325)
(IN)
The failed sensors must be listed first,
(317)
(IN)
If the user presses the ESC key, the clo
(311)
(IN)
Users must be constrained in entering di
(337)
(IN)
The Set Irrigation Times state must disp
(333)
(IN)
If the user presses the DEL key, then ch
(334)
(IN)
The Set Up Auto Irrigation state must di
(331)
(IN)
The Location field must display the faile
(328)
(IN)
When a device is removed from the list a
(323)
(IN)
If the list is empty, there must be no c
(319)
(IN)
A non-empty list must scroll up to or do
(320)
(IN)
The two middle screen buttons on the rig
(321)
(IN)
When a device is removed from the list a
(324)
(IN)
If a new time is only partially entered
(313)
(IN)
The day set string must show the current
(345)
(IN)
If the user presses keypad digit keys wh
(336)
(IN)
The Persistent Store Failure state must
(394)
(IN)
When the user presses the “OK” button, t
(392)
(IN)
The third digit must be a zero, and it m
(372)
(IN)
The first two digits must be in the range
(371)
(IN)
If the user presses the ESC key, then no
(376)
(IN)
Users must be constrained in entering di
(370)
(IN)
The Location field must display the zone’
(375)
(IN)
The Level field must show the zone’s crit
(374)
(IN)
The Zone field must show the zone identifi
(373)
(IN)
If the user presses the DEL key, then ch
(367)
(IN)
When the user presses the “OK” button, t
(395)
(IN)
If the user presses keypad digit keys wh
(369)
(IN)
If the user presses keypad digit keys, t
(368)
(IN)
If the user presses keypad digit keys, t
(381)
(IN)
If the user presses the DEL key, then ch
(380)
(IN)
The Set Water Allocation state must disp
(379)
(IN)
The data displayed in rows three through
(390)
(IN)
If the user presses keypad digit keys wh
(382)
(IN)
The device identifier, zone, and location
(387)
(IN)
If the user presses the ESC key, the wat
(383)
(IN)
The Device Failure state must display th
(386)
(IN)

This object has external links to:
ui/(EXT OUT)


ID: 523

Figure B-11-19 User Interface States


ID: 482

The UIController simply passes keypad presses and time notifications on to the current screen. However, a screen button press may cause a state change, meaning the interaction is more complex. Figure B-11-20 models the interaction that occurs when a screen button is pressed.

This object is linked to:
Execute a state machine whose states are
(798)
(IN)
UIController_ScreenButtonPress
(540)
(OUT)
Pressing a screen button that does not h
(229)
(IN)
Pressing one of the screen buttons must
(225)
(IN)
Pressing a keypad digit button or the DE
(230)
(IN)


ID: 529

Figure B-11-20 UIController Screen Button Press Handling


ID: 483

2 Low-Level Design Models

There are few tricky low-level details about this program: The data structures and algorithms are all quite straightforward, and no advanced language features are required, though some can be used to make the code smaller. Consequently, only the module packaging and a few operation specifications are supplied in this section.

ID: 484

2.1 Packaging

Java packages are used to implement the design packages for each layer. This keeps the code structure very similar to the static design structure, making it easy to find the code that corresponds to each part of the design. Specifically, the following Java packages are used:
startup—Startup-layer code modules.
ui—User Interface-layer code modules.
irrigation—Irrigation-layer code modules.
device—Device Interface-layer code modules.
device.sim—Code for virtual devices for simulated hardware.
device.real—Code for virtual devices for real hardware.
simulation—Simulation-layer code modules.
util—Utility code modules (such as widely used exceptions and enumerations).

This object is linked to:
Implement components simulating hardware
(23)
(IN)
Control both manual and automatic irriga
(17)
(IN)
User Interface Layer Decomposition
(790)
(IN)
Simulation Layer Decomposition
(75)
(IN)
Startup Layer Decomposition
(25)
(IN)
Device Interface Layer Decomposition
(315)
(IN)
Irrigation Layer Decomposition
(593)
(IN)
Create and connect all runtime component
(11)
(IN)
Implement a device-independent AquaLush
(14)
(IN)
Implement virtual devices providing inte
(20)
(IN)
simulation
(76)
(OUT)
startup
(542)
(OUT)
util
(105)
(OUT)
ui
(549)
(OUT)
irrigation
(72)
(OUT)
device
(81)
(OUT)

This object has external links to:
device/(EXT OUT)
device/sim/(EXT OUT)
irrigation/(EXT OUT)
simulation/(EXT OUT)
startup/(EXT OUT)
test/device/(EXT OUT)
test/device/sim/(EXT OUT)
test/irrigation/(EXT OUT)
test/simulation/(EXT OUT)
ui/(EXT OUT)
util/(EXT OUT)


ID: 485

3 Mapping Between Design Models

The virtual devices in the Device Interface layer use simulated hardware in the Simulation layer. The table indicates the mapping between virtual devices and simulated devices.
Device Interface Layer (device)
Device Interface Layer Decomposition
(315)
(IN)
Implement virtual devices providing inte
(20)
(IN)
device
(81)
(OUT)
device/(EXT OUT)
test/device/(EXT OUT)
Virtual Device (device.sim)
device/sim/(EXT OUT)
test/device/sim/(EXT OUT)
Simulated Device (simulation)
Implement components simulating hardware
(23)
(IN)
Simulation Layer Decomposition
(75)
(IN)
simulation
(76)
(OUT)
simulation/(EXT OUT)
test/simulation/(EXT OUT)
DisplayDevice
Provide a virtual 16-line-by-40-characte
(332)
(IN)
DisplayDevice
(174)
(OUT)
DisplayDevice.java(EXT OUT)
DisplayDeviceTest.java(EXT OUT)
SimDisplayDevice
SimDisplayDevice
(366)
(OUT)
SimDisplayDevice.java(EXT OUT)
SimDisplayDeviceTest.java(EXT OUT)
SimDisplay
SimDisplay
(115)
(OUT)
Simulate a 16-line-by-40-character monoc
(89)
(IN)
SimDisplay.java(EXT OUT)
SimDisplayTest.java(EXT OUT)
ScreenButtonDevice
Provide a virtual hardware device with e
(347)
(IN)
ScreenButtonDevice
(250)
(OUT)
ScreenButtonDevice.java(EXT OUT)
ScreenButtonDeviceTest.java(EXT OUT)
SimScreenButtonDevice
SimScreenButtonDevice
(440)
(OUT)
SimScreenButtonDevice.java(EXT OUT)
SimScreenButtonDeviceTest.java(EXT OUT)
SimDisplay
SimDisplay
(115)
(OUT)
Simulate a 16-line-by-40-character monoc
(89)
(IN)
SimDisplay.java(EXT OUT)
SimDisplayTest.java(EXT OUT)
KeypadDevice
Provide a virtual 12-key keypad hardware
(341)
(IN)
KeypadDevice
(183)
(OUT)
KeypadDevice.java(EXT OUT)
KeypadDeviceTest.java(EXT OUT)
SimKeypadDevice
SimKeypadDevice
(412)
(OUT)
SimKeypadDevice.java(EXT OUT)
SimKeypadDeviceTest.java(EXT OUT)
SimKeypad
SimKeypad
(167)
(OUT)
SimKeypad.java(EXT OUT)
SimKeypadTest.java(EXT OUT)
StorageDevice
Provide virtual persistent storage of na
(329)
(IN)
StorageDevice
(357)
(OUT)
StorageDevice.java(EXT OUT)
StorageDeviceTest.java(EXT OUT)
SimStorageDevice
SimStorageDevice
(461)
(OUT)
SimStorageDevice.java(EXT OUT)
SimStorageDeviceTest.java(EXT OUT)
SimStore
Simulate a persistent store. A real file
(86)
(IN)
SimStore
(275)
(OUT)
ClockDevice
Provide virtual clock hardware that keep
(323)
(IN)
ClockDevice
(100)
(OUT)
ClockDevice.java(EXT OUT)
ClockDeviceTest.java(EXT OUT)
SimClockDevice
SimClockDevice
(302)
(OUT)
SimClockDevice.java(EXT OUT)
SimClockDeviceTest.java(EXT OUT)
SimTime
Simulate the passage of time. Notify oth
(98)
(IN)
SimTime
(284)
(OUT)
SimTime.java(EXT OUT)
SimTimeTest.java(EXT OUT)
SensorDevice
Provide virtual moisture sensor hardware
(335)
(IN)
SensorDevice
(340)
(OUT)
SensorDevice.java(EXT OUT)
SensorDeviceTest.java(EXT OUT)
SimSensorDevice
SimSensorDevice
(443)
(OUT)
SimSensorDevice.java(EXT OUT)
SimSensorDeviceTest.java(EXT OUT)
SimSensor
SimSensor
(220)
(OUT)
Simulate a moisture sensor.
(92)
(IN)
SimSensor.java(EXT OUT)
SimSensorTest.java(EXT OUT)
ValveDevice
Provide virtual irrigation valve hardwar
(338)
(IN)
ValveDevice
(416)
(OUT)
ValveDevice.java(EXT OUT)
ValveDeviceTest.java(EXT OUT)
SimValveDevice
SimValveDevice
(501)
(OUT)
SimValveDevice.java(EXT OUT)
SimValveDeviceTest.java(EXT OUT)
SimValve
SimValve
(295)
(OUT)
Simulate an irrigation valve.
(95)
(IN)
SimValve.java(EXT OUT)
SimValveTest.java(EXT OUT)

ID: 486

There are two items to be noted about this mapping:


ID: 487

Both the SimDisplayDevice and the SimScreenButtonDevice virtual devices use the SimDisplay simulated device. It is easier to implement the GUI realizing the display and the screen buttons together as a single class, so this single simulated device provides two logically distinct services.

This object is linked to:
SimDisplay
(115)
(OUT)
Simulate a 16-line-by-40-character monoc
(89)
(IN)
SimScreenButtonDevice
(440)
(OUT)
SimDisplayDevice
(366)
(OUT)

This object has external links to:
SimDisplay.java(EXT OUT)
SimDisplayDevice.java(EXT OUT)
SimDisplayDeviceTest.java(EXT OUT)
SimDisplayTest.java(EXT OUT)
SimScreenButtonDevice.java(EXT OUT)
SimScreenButtonDeviceTest.java(EXT OUT)


ID: 488

The SimClockDevice relies on SimTime, which is not a simulated piece of hardware. SimTime keeps track of time in the simulated world. It would have been possible to create a SimClock entity, but it would only have mediated the communication between SimTime and SimClockDevice, so it was not used.

This object is linked to:
Simulate the passage of time. Notify oth
(98)
(IN)
SimClockDevice
(302)
(OUT)
SimTime
(284)
(OUT)

This object has external links to:
SimClockDevice.java(EXT OUT)
SimClockDeviceTest.java(EXT OUT)
SimTime.java(EXT OUT)
SimTimeTest.java(EXT OUT)


ID: 489

4 Detailed Design Rationale

The prevailing principles driving this design are the following:
▪ Adhere to the access constraints imposed by the layered architecture to maintain its integrity.
▪ Hide information, make coherent modules, and decouple modules as much as possible to make the program as changeable as possible.
▪ Take advantage of the conceptual model to make design models reflect the problem domain as closely as possible.
▪ Design to interfaces as much as possible.
▪ Take advantage of standard mid-level design patterns to solve design problems and make the design easy to understand.
These principles are used to help generate, evaluate, and select design alternatives. For example, the Irrigation layer’s design is based largely on the AquaLush conceptual model. The notification-driven behavior of the entire program is based on the Observer pattern, though it is implicit in the architecture as well.
A different set of guiding principles might have produced a different detailed design. For example, reuse is not emphasized in this design. Had it been, the Tokenizer class in the Startup layer would probably be based on the java.util.StreamTokenizer class rather than being written from scratch.
The only violation of architectural constraints is that the SimTimeControl uses the Irrigator to obtain the irrigation time and day. Much thought was given to ways to implement this feature without violating architectural principles, but it is impossible to do so: The SimTimeControl cannot work properly without data generated in higher layers of the program. Recognizing this, the next question was how to minimize the impact of the violation. One alternative considered was to make the SimTimeControl an observer of a higher-layer object such as a UI Screen or the Irrigator object. However, this would have required making these objects into subjects for no other reason.
It was realized that the SimTimeContol only needs a reference to the Irrigator, which already provides query functions for the data it needs, and that the AquaLush applet can query the Configurer to get an Irrigator object reference to pass to the Simulation object. This requires only a few lines of code in the applet, an extra query function in the Configurer, and extra functions in Simulation and SimEnvironment. This appears to be the simplest and least intrusive way to provide the data that SimTimeControl needs to realize its requirements.

This object is linked to:
Simulation
(372)
(OUT)
SimTimeControl
(291)
(OUT)
SimEnvironment
(138)
(OUT)
Configurer
(559)
(OUT)
Architectural Design Rationale
(875)
(IN)
Hold irrigation parameters, oversee irri
(601)
(IN)
Irrigator
(239)
(OUT)
AquaLushApplet
(554)
(OUT)

This object has external links to:
AquaLushApplet.java(EXT OUT)
Configurer.java(EXT OUT)
Irrigator.java(EXT OUT)
IrrigatorTest.java(EXT OUT)
SimEnvironment.java(EXT OUT)
SimEnvironmentTest.java(EXT OUT)
SimTimeControl.java(EXT OUT)
SimTimeControlTest.java(EXT OUT)
Simulation.java(EXT OUT)
SimulationTest.java(EXT OUT)

Produced by DOORS 9.3.0.2