ID: 1

1 Architectural Models

AquaLush is a Relaxed Layered system, as shown in the layer diagram in Figure B-10-1.

ID: 2

Figure B-10-1 AquaLush Layers Overview


ID: 3

Modules use only layers below them that they touch directly. A fielded system does not include the bottom Simulation layer, which is needed only as a stand-in for the hardware that would be present in a fielded system.


ID: 4

1.1 Layer Responsibilities

Layer
Responsibilities
Startup
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)
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)
Create and connect all runtime components based on a configuration specification and whether the program is a simulation or a fielded product. Restore the state of the system from persistent store.
Packaging
(484)
(OUT)
Startup Layer Static Structure
(2)
(OUT)
startup
(542)
(OUT)
startup/(EXT OUT)
User Interface
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 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)
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)
Implement a device-independent AquaLush text-based user interface.
Packaging
(484)
(OUT)
User Interface Layer Behavior
(481)
(OUT)
User Interface Layer Static Structure
(412)
(OUT)
ui
(549)
(OUT)
ui/(EXT OUT)
Irrigation
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)
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)
The Set Water Allocation state must allo
(378)
(IN)
After establishing its configuration, Aqu
(90)
(IN)
All parameters set by users must remain
(7)
(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)
Control both manual and automatic irrigation.
Packaging
(484)
(OUT)
Irrigation Layer Behavior
(409)
(OUT)
Irrigation Layer Static Structure
(247)
(OUT)
irrigation
(72)
(OUT)
irrigation/(EXT OUT)
test/irrigation/(EXT OUT)
Device Interface
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)
Implement virtual devices providing interfaces to all external entities, including hardware devices, a clock, and persistent storage.
Device Interface Layer (device)
(492)
(OUT)
Packaging
(484)
(OUT)
Device Interface Layer Static Structure
(246)
(OUT)
device
(81)
(OUT)
device/(EXT OUT)
test/device/(EXT OUT)
Simulation
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)
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)
Implement components simulating hardware devices, simulate an irrigation site, and provide views and controls for manipulating the simulation.
The AquaLush applet gets a reference to
(245)
(OUT)
The SimTimeControl is passed a reference
(244)
(OUT)
Simulated Device (simulation)
(494)
(OUT)
Packaging
(484)
(OUT)
Simulation Layer Static Structure
(83)
(OUT)
Simulation Layer Behavior
(243)
(OUT)
simulation
(76)
(OUT)
simulation/(EXT OUT)
test/simulation/(EXT OUT)

ID: 25

1.2 Startup Layer Decomposition

The Startup layer contains the main program class, which may be either an application or an applet, assuming the program is written in Java. The main program uses a Configurer, which sets up the program based on the available hardware (real or simulated) and whether it is a simulation or a fielded program, and restores the previous program state. The Configurer reads a configuration specification to determine what sort of hardware (or simulated hardware) the program must use. It reads a persistent store to reset the program state. Figure B-10-3 shows the decomposition of the Startup layer.

This object is linked to:
Packaging
(484)
(OUT)
Startup Layer Static Structure
(2)
(OUT)
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)
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)
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)
StartupOutsideView
(949)
(OUT)

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


ID: 876

Figure B-10-3 Startup Layer Structure


ID: 26

1.2.1 Startup Layer Module Responsibilities

Module
Responsibilities
AquaLushApplet
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)
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)
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 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 default zone critical moisture level
(187)
(IN)
Ask the Simulation layer to create all GUI components and simulated entities, and create a Configurer that uses these simulation objects to configure the program. Obtain the configuration specification. Call the Configurer to configure the program.
Applet start
(16)
(OUT)
Applet stop
(27)
(OUT)
AquaLushApplet
(554)
(OUT)
AquaLushApplet.java(EXT OUT)
AquaLush
If AquaLush cannot read its persistent s
(396)
(IN)
When power is applied to the system, the
(88)
(IN)
After establishing its configuration, Aqu
(90)
(IN)
Each elementary data item must be separa
(137)
(IN)
A configuration file must have the form (s
(136)
(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)
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 default zone critical moisture level
(187)
(IN)
Create a Configurer that uses real hardware. Obtain the configuration specifications. Call the Configurer to configure the program.
AquaLush
(75)
(OUT)
Configurer
If AquaLush cannot read its persistent s
(396)
(IN)
If AquaLush cannot read its persistent s
(77)
(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)
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 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 default zone critical moisture level
(187)
(IN)
Create and connect runtime components based on configuration specifications and whether the program is a simulation or a fielded product. Restore the state of the system from persistent store.
Get the text of the current token
(60)
(OUT)
The AquaLush applet gets a reference to
(245)
(OUT)
Configurer construction
(38)
(OUT)
Get the type of the current token
(71)
(OUT)
Startup Layer Behavior
(82)
(OUT)
Tokenizer
(9)
(OUT)
TokenType
(12)
(OUT)
Configurer
(559)
(OUT)
Configurer.java(EXT OUT)

ID: 40

1.2.2 Startup Layer Interface Specifications


ID: 41

1.2.2.1 Services Provided


ID: 42

1.2.2.1.1 Applet initialization

This object is linked to:
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)
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 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 default zone critical moisture level
(187)
(IN)
init
(568)
(OUT)

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

Syntax:
init()
Pre:
None.
Post:
The applet simulating AquaLush is initialized.

ID: 53

1.2.2.1.2 Program execution

This object is linked to:
If AquaLush cannot read its persistent s
(396)
(IN)
When power is applied to the system, the
(88)
(IN)
After establishing its configuration, Aqu
(90)
(IN)
Each elementary data item must be separa
(137)
(IN)
A configuration file must have the form (s
(136)
(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)
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 default zone critical moisture level
(187)
(IN)
main
(578)
(OUT)

Syntax:
main( args : String[] )
Pre:
None.
Post:
The AquaLush program is set up according to its local configuration and its state is reset to what it was when it was last executing.

ID: 64

1.2.2.2 Services Required


ID: 65

Simulation.create()—Create the AquaLush simulation, including GUI components simulating the control panel display, keypad, and screen buttons; the simulated irrigation site with valves and sensors; and simulated time and persistent store objects.

This object is linked to:
Simulation
(372)
(OUT)

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


ID: 66

DeviceFactory.createDeviceX()—Create various virtual devices already connected to real or simulated hardware.

This object is linked to:
createClockDevice
(153)
(OUT)
createValveDevice
(327)
(OUT)
createStorageDevice
(319)
(OUT)
createScreenButtonDevice
(262)
(OUT)
createKeypadDevice
(244)
(OUT)
createSensorDevice
(313)
(OUT)
createDisplayDevice
(188)
(OUT)

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


ID: 67

DeviceX.setListener()—Add a listener to a keypad or screen button virtual device.

This object is linked to:
setListener
(356)
(OUT)
setListener
(301)
(OUT)

This object has external links to:
KeypadDevice.java(EXT OUT)
KeypadDeviceTest.java(EXT OUT)
ScreenButtonDevice.java(EXT OUT)
ScreenButtonDeviceTest.java(EXT OUT)


ID: 68

Irrigator.create()—Create irrigation control objects.

This object is linked to:
Irrigator
(239)
(OUT)

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


ID: 69

Irrigator.addX()—Configure the Irrigator with zones, sensors, and valves, and configure the virtual devices controlling valve and sensor hardware.

This object is linked to:
addSensor
(304)
(OUT)
addZone
(314)
(OUT)
addValve
(311)
(OUT)

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


ID: 70

Irrigator.restoreState()—Restore the state of the program from persistent store.

This object is linked to:
restoreState
(537)
(OUT)

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


ID: 71

UserInterface.create()—Create the user interface.


ID: 72

UserInterface.setDisplay()—Configure the user interface with the virtual display.


ID: 73

Reader.read()—Obtain an input character from the configuration specification.


ID: 74

1.2.3 Startup Layer Design Rationale

The configuration task could have been placed in the applet and application classes, but then there would have been two versions of very similar code. Separating this task into a separate component (the Configurer) that can be reused makes it easier to change and correct as well as faster to implement, though it takes more work to design originally. Note: This component will make use of the Abstract Factory pattern for virtual devices, which we discuss in the next section.

This object is linked to:
startup
(542)
(OUT)

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


ID: 75

1.3 Simulation Layer Decomposition

The Simulation layer contains components that simulate the entire external environment during a simulation. Five of these are externally visible: a time simulator, a persistent storage simulator, a display device simulator, and sensor and valve simulators. In addition this layer has a façade class that hides other components (such as a simulated keypad, simulated screen buttons, the simulated site, and so forth). These components are pictured in Figure B-10-6.

This object is linked to:
The AquaLush applet gets a reference to
(245)
(OUT)
The SimTimeControl is passed a reference
(244)
(OUT)
Simulated Device (simulation)
(494)
(OUT)
Packaging
(484)
(OUT)
Simulation Layer Static Structure
(83)
(OUT)
Simulation Layer Behavior
(243)
(OUT)
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)
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)
Simulation Layer Outside View
(953)
(OUT)

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


ID: 877

Figure B-10-6 Simulation Layer Structure


ID: 76

1.3.1 Simulation Layer Module Responsibilities

Module
Responsibilities
Simulation
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)
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)
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)
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 default zone critical moisture level
(187)
(IN)
Simulate hardware devices and the real world, and display the simulation using GUI components.
Simulation
(372)
(OUT)
SimTimeControl
(100)
(OUT)
SimKeypad
(97)
(OUT)
SimFailureControl
(109)
(OUT)
SimEvapControl
(103)
(OUT)
SimEnvironment
(91)
(OUT)
SimControlPanel
(94)
(OUT)
SimSite
(112)
(OUT)
SimSiteView
(106)
(OUT)
Simulation.java(EXT OUT)
SimulationTest.java(EXT OUT)
SimStore
The Web-based AquaLush simulation must r
(94)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Simulate a persistent store. A real file will be used if possible; if not, no real persistence will be simulated.
SimStore
(510)
(OUT)
Services Required
(241)
(OUT)
SimStore
(275)
(OUT)
SimDisplay
The left-hand side of the user interface
(401)
(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 monochrome screen that
(216)
(IN)
Simulate a 16-line-by-40-character monochrome textual display as a GUI component.
SimDisplay
(115)
(OUT)
Both the SimDisplayDevice and the SimScr
(487)
(OUT)
SimDisplay
(498)
(OUT)
SimDisplay
(502)
(OUT)
SimControlPanel
(94)
(OUT)
SimDisplay.java(EXT OUT)
SimDisplayTest.java(EXT OUT)
SimSensor
The simulation must simulate valve and s
(104)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
Each simulated irrigation zone must simu
(97)
(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)
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)
The default sensor and valve operational
(188)
(IN)
Simulate a moisture sensor.
SimSensor
(220)
(OUT)
SimSensor
(518)
(OUT)
Implementation Notes
(242)
(OUT)
SimZone
(115)
(OUT)
Simulation Layer Behavior
(243)
(OUT)
Set the failure status of a sensor (SimS
(219)
(OUT)
Set a sensor’s moisture level (SimSensor
(208)
(OUT)
SimSensor.java(EXT OUT)
SimSensorTest.java(EXT OUT)
SimValve
The simulation must simulate valve and s
(104)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
Each simulated irrigation zone must simu
(98)
(IN)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
At least 70% of users must agree that th
(203)
(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 default sensor and valve operational
(188)
(IN)
Simulate an irrigation valve.
SimValve
(295)
(OUT)
SimValve
(522)
(OUT)
Implementation Notes
(242)
(OUT)
SimZone
(115)
(OUT)
Set the failure status of a sensor (SimV
(230)
(OUT)
SimValve.java(EXT OUT)
SimValveTest.java(EXT OUT)
SimTime
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 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)
Simulate the passage of time. Notify other components of the passage of simulated time.
SimTime
(514)
(OUT)
The SimClockDevice relies on SimTime, wh
(488)
(OUT)
Simulation Layer Behavior
(243)
(OUT)
SimTime
(284)
(OUT)
SimTime.java(EXT OUT)
SimTimeTest.java(EXT OUT)

ID: 99

1.3.2 Simulation Layer Interface Specifications


ID: 311

1.3.2.1 Services Provided

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

ID: 100

1.3.2.1.1 Create the simulation object

This object is linked to:
Simulation
(372)
(OUT)

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

Syntax:
create()
Pre:
None.
Post:
All simulated entities are created.

ID: 113

1.3.2.1.2 Provide simulated persistent store

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

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

ID: 124

1.3.2.1.3 Provide a simulated valve

This object is linked to:
Provide a simulated valve (SimEnvironmen
(131)
(OUT)
The Web-based AquaLush simulation must r
(94)
(IN)
The default sensor and valve operational
(188)
(IN)
getValve
(507)
(OUT)

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

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

ID: 135

1.3.2.1.4 Provide a simulated sensor

This object is linked to:
Provide a simulated sensor (SimEnvironme
(142)
(OUT)
The Web-based AquaLush simulation must r
(94)
(IN)
The default sensor and valve operational
(188)
(IN)
getSensor
(476)
(OUT)

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

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

ID: 146

1.3.2.1.5 Provide the simulated display

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

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

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

ID: 157

1.3.2.1.6 Register a keypad listener

This object is linked to:
Register a Keypad listener (SimKeypad)
(175)
(OUT)
Register a Keypad listener (SimControlPa
(164)
(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)
setKeypadListener
(523)
(OUT)

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

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

ID: 168

1.3.2.1.7 Register a screen button listener

This object is linked to:
Register a ScreenButton listener (SimDis
(197)
(OUT)
Register a ScreenButton listener (SimCon
(186)
(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)
setScreenButtonListener
(525)
(OUT)

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

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

ID: 179

1.3.2.1.8 Record a value in simulated persistent store

This object is linked to:
The Web-based AquaLush simulation must r
(94)
(IN)
At least 70% of users must agree that th
(203)
(IN)
setData
(355)
(OUT)

Syntax:
setData( name : String, value : String )
Pre:
name and value are not null.
Post:
The name-value pair is recorded in persistent store. Throws DeviceFailureException if persistent store cannot be read.

ID: 190

1.3.2.1.9 Fetch a value from simulated persistent store

This object is linked to:
The Web-based AquaLush simulation must r
(94)
(IN)
At least 70% of users must agree that th
(203)
(IN)
getData
(315)
(OUT)

Syntax:
getData( name : String, default : String ) : String
Pre:
name is not null.
Post:
Returns the value associated with the name in persistent store. If no value is associated with name and default is not null, then associates the default with the name and returns it. If no value is associated with the name and the default is null, then returns null. Throws DeviceFailureException if persistent store cannot be read.

ID: 201

1.3.2.1.10 Remove data from simulated persistent store

This object is linked to:
The Web-based AquaLush simulation must r
(94)
(IN)
At least 70% of users must agree that th
(203)
(IN)
removeData
(330)
(OUT)

Syntax:
removeData( name : String )
Pre:
name is not null.
Post:
The name and associated value are removed from persistent store. Throws DeviceFailureException if persistent store cannot be read.

ID: 212

1.3.2.1.11 Write to the simulated display

This object is linked to:
The simulation must provide a realistic
(95)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
At least 70% of users must agree that th
(203)
(IN)
The AquaLush central control panel must
(215)
(IN)
It must include a monochrome screen that
(216)
(IN)
writeLine
(190)
(OUT)

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

Syntax:
write( line : int, str : String )
Pre:
0 <= line < 16 and str is not null.
Post:
String str is written to line number line of the simulated display, starting at position 0.

ID: 223

1.3.2.1.12 Read a simulated sensor

This object is linked to:
The simulation must simulate valve and s
(104)
(IN)
The Web-based AquaLush simulation must r
(94)
(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)
The default sensor and valve operational
(188)
(IN)
getLevel
(258)
(OUT)

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

Syntax:
getLevel() : int throws DeviceFailureException
Pre:
None.
Post:
The simulated moisture level for the sensor is returned. Throws DeviceFailureException if the sensor has a simulated failure.

ID: 234

1.3.2.1.13 Open a simulated valve

This object is linked to:
The simulation must simulate valve and s
(104)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The default sensor and valve operational
(188)
(IN)
open
(447)
(OUT)

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

Syntax:
open() throws DeviceFailureException
Pre:
None.
Post:
Opens a simulated valve. Throws DeviceFailureException if the valve has a simulated failure.

ID: 245

1.3.2.1.14 Close a simulated valve

This object is linked to:
The simulation must simulate valve and s
(104)
(IN)
The Web-based AquaLush simulation must r
(94)
(IN)
At least 70% of users must agree that th
(203)
(IN)
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(IN)
The default sensor and valve operational
(188)
(IN)
close
(383)
(OUT)

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

Syntax:
close() throws DeviceFailureException
Pre:
None.
Post:
Closes a simulated valve. Throws DeviceFailureException if the valve has a simulated failure.

ID: 256

1.3.2.1.15 Fetch the instance of SimTime

This object is linked to:
The simulation must display the simulate
(100)
(IN)

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

Syntax:
SimTime.instance() : SimTime
Pre:
None.
Post:
A single instance of the SimTime object will always be returned. The SimTime object always starts off with the current real time, but is stopped.

ID: 267

1.3.2.1.16 Get the simulated time

This object is linked to:
The simulation must display the simulate
(100)
(IN)
The simulation must provide means for co
(99)
(IN)
The simulated time controls must behave
(405)
(IN)
At least 70% of users must agree that th
(203)
(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)
getSecond
(966)
(OUT)
getMinute
(964)
(OUT)
getHour
(962)
(OUT)
getDay
(961)
(OUT)

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

Syntax:
getDay() : Day getHour() : int getMinute() : int getSecond() : int
Pre:
None.
Post:
Returns the requested component of the simulated time.

ID: 278

1.3.2.1.17 Set the simulated time

This object is linked to:
The simulation must display the simulate
(100)
(IN)
The simulated time controls must behave
(405)
(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)
setHour
(968)
(OUT)
setDay
(967)
(OUT)
setSecond
(970)
(OUT)
setMinute
(969)
(OUT)

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

Syntax:
setDay( d : Day ) setHour( h : int ) setMinute( h : int ) setSecond( s : int )
Pre:
0 <= h < 24 and 0 <= m, s < 60.
Post:
The simulated time is adjusted as indicated.

ID: 289

1.3.2.1.18 Start and stop the simulated time

This object is linked to:
The simulation must provide controls to
(101)
(IN)
The simulation must provide means for co
(99)
(IN)
The simulated time controls must behave
(405)
(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)
stop
(972)
(OUT)
start
(971)
(OUT)

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

Syntax:
start()
stop()
Pre:
None.
Post:
The simulated time is paused or resumed. Starting simulated time when it is already going or stopping it when it is already stopped has no effect.

ID: 300

1.3.2.1.19 Time notification
Syntax:
addObserver( o : Observer )
Pre:
None.
Post:
Observer o will be notified when simulated time is not stopped and a simulated second has passed.

ID: 312

1.3.2.2 Services Required

The Simulation layer requires the services of a GUI toolkit (such as Java Swing). It requires a Day enumeration type. It also requires a mechanism for regular notification of the passage of time occurring at least once per second and ideally much faster so that simulated time can be sped up.

This object is linked to:
Day
(178)
(OUT)

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


ID: 313

1.3.2.3 Usage Guide

The Simulation layer is needed only when AquaLush is being simulated. Create it first because it is used in every other layer and in constructing the objects in almost every other layer.

This object is linked to:
simulation
(76)
(OUT)

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


ID: 314

1.3.3 Simulation Layer Design Rationale

Many alternatives considered for the Simulation layer lacked various components or had functionality present in other layers. For example, the persistent store was not initially in this layer until it was realized that an applet may not be allowed to access a host operating system because of security concerns. Eventually it was realized that this layer needs to simulate everything in the environment of the software. As another example, in one alternative the simulation GUI construction process was left partly up to the applet, so that the applet requested a simulated control panel and a simulated environment from the Simulation layer, then combined them to form the applet. The present alternative is more cohesive.
The SimTime class is a singleton class. This was deemed necessary because having more than one simulated time object would certainly cause the program to fail. Once SimTime is made a singleton there is no need for an operation to retrieve it from the Simulation layer façade, the role played by the Simulation class.
SimTime is also a subject in the Observer pattern. If it were an invoker in the Command pattern, then it could have only a single reactor. However, several components in the simulation as well as the ClockDevice in the Device Interface layer need to be notified of the passage of simulated time.

This object is linked to:
simulation
(76)
(OUT)

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


ID: 315

1.4 Device Interface Layer Decomposition

The Device Interface layer provides virtual devices to hide the real or simulated external entities manipulated by the program. Writing the program to interact only with virtual devices makes AquaLush highly configurable. The virtual devices provided in this layer are pictured in Figure B-10-9.
Note that these entities are all interface types except for the Clock and the KeyPress enumeration. This layer also includes private realizations of these interfaces that actually do the work, but these are hidden at the architectural level of detail.

This object is linked to:
Device Interface Layer (device)
(492)
(OUT)
Packaging
(484)
(OUT)
Device Interface Layer Static Structure
(246)
(OUT)
device
(81)
(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)
Device Interface Outside View
(957)
(OUT)

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


ID: 878

Figure B-10-9 Device Interface Layer Structure


ID: 316

1.4.1 Device Interface Layer Module Responsibilities

Module
Responsibilities
ClockDevice Interface
If the user presses the “Accept New Sett
(312)
(IN)
The current day and time displays must c
(298)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
The current day must be an element of {
(155)
(IN)
The Set Clock state must allow users to
(296)
(IN)
The current time consists of the current
(14)
(IN)
AquaLush must either not allow an invali
(15)
(IN)
AquaLush must allow users to set the cur
(13)
(IN)
The current time is recorded in the syst
(154)
(IN)
If a new time setting fails validation,
(16)
(IN)
Provide virtual clock hardware that keeps track of the day of the week and the time of the day, accurate to the minute.
ClockDevice
(512)
(OUT)
Device Interface Layer Static Structure
(246)
(OUT)
ClockDevice
(100)
(OUT)
ClockDevice.java(EXT OUT)
ClockDeviceTest.java(EXT OUT)
TickListener Interface
Guarantee that a module listening to the ClockDevice implements a tick() operation, which is needed for the Command pattern.
Device Interface Layer Static Structure
(246)
(OUT)
TickListener
(396)
(OUT)
TickListener.java(EXT OUT)
TickListenerTest.java(EXT OUT)
StoreDevice Interface
If AquaLush cannot read its persistent s
(396)
(IN)
The message about failure to write to pe
(391)
(IN)
The Persistent Store Failure state must
(393)
(IN)
The Device Failure state must be entered
(385)
(IN)
If AquaLush cannot read its persistent s
(75)
(IN)
If AquaLush cannot write to its persiste
(74)
(IN)
All parameters set by users must remain
(7)
(IN)
Provide virtual persistent storage of name-value pairs.
StorageDevice
(508)
(OUT)
Device Interface Layer Static Structure
(246)
(OUT)
StorageDevice
(357)
(OUT)
StorageDevice.java(EXT OUT)
StorageDeviceTest.java(EXT OUT)
DisplayDevice Interface
AquaLush must be operated from a single
(196)
(IN)
Provide a virtual 16-line-by-40-character monochrome textual display device.
DisplayDevice
(496)
(OUT)
Device Interface Layer Static Structure
(246)
(OUT)
DisplayDevice
(174)
(OUT)
DisplayDevice.java(EXT OUT)
DisplayDeviceTest.java(EXT OUT)
SensorDevice Interface
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
If a sensor cannot be read, then AquaLus
(65)
(IN)
AquaLush must do the following during an
(53)
(IN)
If a sensor cannot be read after three t
(67)
(IN)
If a sensor can be read within three tri
(66)
(IN)
AquaLush must detect valve and sensor fa
(38)
(IN)
Provide virtual moisture sensor hardware.
SensorDevice
(516)
(OUT)
Device Interface Layer Static Structure
(246)
(OUT)
SensorDevice
(340)
(OUT)
SensorDevice.java(EXT OUT)
SensorDeviceTest.java(EXT OUT)
ValveDevice Interface
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(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 can be manipulated within thr
(71)
(IN)
If a valve cannot be manipulated (opened
(70)
(IN)
AquaLush must detect valve and sensor fa
(38)
(IN)
Provide virtual irrigation valve hardware.
ValveDevice
(520)
(OUT)
Device Interface Layer Static Structure
(246)
(OUT)
ValveDevice
(416)
(OUT)
ValveDevice.java(EXT OUT)
ValveDeviceTest.java(EXT OUT)
KeypadDevice Interface
AquaLush must be operated from a single
(196)
(IN)
Provide a virtual 12-key keypad hardware device.
KeypadDevice
(504)
(OUT)
Device Interface Layer Static Structure
(246)
(OUT)
KeypadDevice
(183)
(OUT)
KeypadDevice.java(EXT OUT)
KeypadDeviceTest.java(EXT OUT)
KeypadListener Interface
Guarantee that a module registered as a Keypad listener implements the keyPress() operation, which is needed for the Command pattern.
Device Interface Layer Static Structure
(246)
(OUT)
KeypadListener
(202)
(OUT)
KeypadListener.java(EXT OUT)
KeypadListenerTest.java(EXT OUT)
ScreenButtonDevice Interface
AquaLush must be operated from a single
(196)
(IN)
Provide a virtual hardware device with eight push buttons.
ScreenButtonDevice
(500)
(OUT)
Device Interface Layer Static Structure
(246)
(OUT)
ScreenButtonDevice
(250)
(OUT)
ScreenButtonDevice.java(EXT OUT)
ScreenButtonDeviceTest.java(EXT OUT)
ScreenButtonListener Interface
Guarantee that a module registered as a ScreenButton listener implements the screenButtonPress() operation, which is needed for the Command pattern.
Device Interface Layer Static Structure
(246)
(OUT)
ScreenButtonListener
(285)
(OUT)
ScreenButtonListener.java(EXT OUT)
ScreenButtonListenerTest.java(EXT OUT)
Clock
If the user presses the “Accept New Sett
(312)
(IN)
The current day and time displays must c
(298)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
The current day must be an element of {
(155)
(IN)
The Set Clock state must allow users to
(296)
(IN)
The current time consists of the current
(14)
(IN)
AquaLush must either not allow an invali
(15)
(IN)
AquaLush must allow users to set the cur
(13)
(IN)
The current time is recorded in the syst
(154)
(IN)
If a new time setting fails validation,
(16)
(IN)
Provide the day of the week and the time of day, accurate to one minute. Notify observers of the passage of time every minute. The Clock should be used by the rest of the system; it relies on the ClockDevice.
Clock
(89)
(OUT)
Clock.java(EXT OUT)
ClockTest.java(EXT OUT)
DeviceFactory Interface
Provide abstract factory methods for creating all virtual devices. This interface is needed as part of the Factory Method pattern.
Device Interface Layer Static Structure
(246)
(OUT)
DeviceFactory
(133)
(OUT)
DeviceFactory.java(EXT OUT)
DeviceFactoryTest.java(EXT OUT)

ID: 357

1.4.2 Device Interface Layer Interface Specifications


ID: 358

1.4.2.1 Services Provided

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

ID: 359

1.4.2.1.1 Set the time of the day (Clock and ClockDevice)

This object is linked to:
If the user presses the “Accept New Sett
(312)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
The current day must be an element of {
(155)
(IN)
The Set Clock state must allow users to
(296)
(IN)
The current time consists of the current
(14)
(IN)
AquaLush must either not allow an invali
(15)
(IN)
AquaLush must allow users to set the cur
(13)
(IN)
The current time is recorded in the syst
(154)
(IN)
If a new time setting fails validation,
(16)
(IN)
setTime
(294)
(OUT)
setTime
(228)
(OUT)

This object has external links to:
Clock.java(EXT OUT)
ClockDevice.java(EXT OUT)
ClockDeviceTest.java(EXT OUT)
ClockTest.java(EXT OUT)

Syntax:
setTime( milTime : int )
Pre:
milTime is a legitimate military time specification.
Post:
The clock device is reset to milTime.

ID: 370

1.4.2.1.2 Get the time of the day (Clock and ClockDevice)

This object is linked to:
The current day and time displays must c
(298)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
The current day must be an element of {
(155)
(IN)
The current time consists of the current
(14)
(IN)
The current time is recorded in the syst
(154)
(IN)
getTime
(193)
(OUT)
getTime
(180)
(OUT)

This object has external links to:
Clock.java(EXT OUT)
ClockDevice.java(EXT OUT)
ClockDeviceTest.java(EXT OUT)
ClockTest.java(EXT OUT)

Syntax:
getTime() : int
Pre:
None.
Post:
The current time is returned, accurate to the minute, in military time format.

ID: 381

1.4.2.1.3 Set the day of the week (Clock and ClockDevice)

This object is linked to:
If the user presses the “Accept New Sett
(312)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
The current day must be an element of {
(155)
(IN)
The Set Clock state must allow users to
(296)
(IN)
The current time consists of the current
(14)
(IN)
AquaLush must either not allow an invali
(15)
(IN)
AquaLush must allow users to set the cur
(13)
(IN)
The current time is recorded in the syst
(154)
(IN)
If a new time setting fails validation,
(16)
(IN)
setDay
(205)
(OUT)
setDay
(231)
(OUT)

This object has external links to:
Clock.java(EXT OUT)
ClockDevice.java(EXT OUT)
ClockDeviceTest.java(EXT OUT)
ClockTest.java(EXT OUT)

Syntax:
setDay( d : Day )
Pre:
None.
Post:
The clock device is reset to day d.

ID: 392

1.4.2.1.4 Get the day of the week (Clock and ClockDevice)

This object is linked to:
The current day and time displays must c
(298)
(IN)
The current time of day must be a 24-hou
(156)
(IN)
The current day must be an element of {
(155)
(IN)
The current time consists of the current
(14)
(IN)
The current time is recorded in the syst
(154)
(IN)
getDay
(154)
(OUT)
getDay
(144)
(OUT)

This object has external links to:
Clock.java(EXT OUT)
ClockDevice.java(EXT OUT)
ClockDeviceTest.java(EXT OUT)
ClockTest.java(EXT OUT)

Syntax:
getDay() : Day
Pre:
None.
Post:
The current day of the week is returned.

ID: 403

1.4.2.1.5 Set the ClockDevice listener

This object is linked to:
setListener
(248)
(OUT)

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

Syntax:
setListener( l : TickListener )
Pre:
None.
Post:
TickListener l will start to receive notifications of the passage of time every minute. Any previous TickListener is replaced.

ID: 414

1.4.2.1.6 Register a Clock observer
Syntax:
addObserver( o : Observer )
Pre:
o is not null.
Post:
Observer o will start to receive notifications every minute. Throws an exception if the precondition is violated.

ID: 425

1.4.2.1.7 Register a ScreenButton listener

This object is linked to:
AquaLush must be operated from a single
(196)
(IN)
setListener
(356)
(OUT)

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

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

ID: 436

1.4.2.1.8 Register a Keypad listener

This object is linked to:
AquaLush must be operated from a single
(196)
(IN)
setListener
(301)
(OUT)

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

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

ID: 447

1.4.2.1.9 Record a value in persistent store

This object is linked to:
If AquaLush cannot read its persistent s
(396)
(IN)
The message about failure to write to pe
(391)
(IN)
The Persistent Store Failure state must
(393)
(IN)
The Device Failure state must be entered
(385)
(IN)
If AquaLush cannot write to its persiste
(74)
(IN)
All parameters set by users must remain
(7)
(IN)
setData
(494)
(OUT)

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

Syntax:
setData( n : String, v : String )
Pre:
n and v are not null.
Post:
The name-value pair is recorded in persistent store.

ID: 458

1.4.2.1.10 Fetch a value from persistent store

This object is linked to:
If AquaLush cannot read its persistent s
(396)
(IN)
The Persistent Store Failure state must
(393)
(IN)
If AquaLush cannot read its persistent s
(75)
(IN)
All parameters set by users must remain
(7)
(IN)
getData
(422)
(OUT)

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

Syntax:
getData( n : String, v : String ) : String
Pre:
n is not null.
Post:
Return the value associated with n in persistent store. If no value is associated with n and v is not null, then associate v with n and return v. If no value is associated with n and v is null, return null.

ID: 469

1.4.2.1.11 Remove data from persistent store

This object is linked to:
If AquaLush cannot read its persistent s
(396)
(IN)
The message about failure to write to pe
(391)
(IN)
The Persistent Store Failure state must
(393)
(IN)
The Device Failure state must be entered
(385)
(IN)
If AquaLush cannot write to its persiste
(74)
(IN)
All parameters set by users must remain
(7)
(IN)
removeData
(450)
(OUT)

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

Syntax:
removeData( n : String )
Pre:
n is not null.
Post:
Remove the association between n and a value (if any) from persistent store.

ID: 480

1.4.2.1.12 Clear the display

This object is linked to:
clear
(277)
(OUT)

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

Syntax:
clear()
Pre:
None.
Post:
The display is blanked.

ID: 491

1.4.2.1.13 Clear all display highlighting

This object is linked to:
clearHighlight
(310)
(OUT)

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

Syntax:
clearHighlight()
Pre:
None.
Post:
All highlighted lines are returned to regular display; the text is unaltered.

ID: 502

1.4.2.1.14 Clear a line of the display

This object is linked to:
clearLine
(336)
(OUT)

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

Syntax:
clearLine( line : int )
Pre:
0 <= line < 16.
Post:
The text (and highlighting) are removed from the designated line.

ID: 513

1.4.2.1.15 Highlight a display line

This object is linked to:
highlight
(395)
(OUT)

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

Syntax:
highlight( line : int, col : int, length : int )
Pre:
0 <= line < 16 and 0 <= col < 40 and 0 <= length.
Post:
The portion of line starting at the column and extending for the length of the characters (or until the end of the line) is highlighted.

ID: 524

1.4.2.1.16 Write a string to the display

This object is linked to:
write
(397)
(OUT)

Syntax:
write( line : int, col : int, str : String )
Pre:
0 <= line < 16 and 0 <= col <= 40 and str is not null.
Post:
String str is written to line number line and column col of the simulated display. If str is too long to fit on the line it is truncated to fit. The line is not highlighted.

ID: 535

1.4.2.1.17 Write a line to the display

This object is linked to:
writeLine
(403)
(OUT)

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

Syntax:
writeLine( line : int, str : String )
Pre:
0 <= line < 16 and str is not null.
Post:
String str is written to line number line of the simulated display, starting at position 0. If str is more than 40 characters it is truncated to 40 characters. If it is less than 40 characters, then it is padded with blanks until it is 40 characters. The line is not highlighted.

ID: 546

1.4.2.1.18 Read a sensor

This object is linked to:
Sensors must be readable and provide dat
(210)
(IN)
Sensor failures must be detectable when
(211)
(IN)
If a sensor cannot be read, then AquaLus
(65)
(IN)
AquaLush must do the following during an
(53)
(IN)
If a sensor cannot be read after three t
(67)
(IN)
If a sensor can be read within three tri
(66)
(IN)
AquaLush must detect valve and sensor fa
(38)
(IN)
read
(433)
(OUT)

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

Syntax:
read() : int throws DeviceFailureException
Pre:
None.
Post:
Returns the moisture level. Throws DeviceFailureException if the sensor fails.

ID: 557

1.4.2.1.19 Open a valve

This object is linked to:
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(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 can be manipulated within thr
(71)
(IN)
If a valve cannot be manipulated (opened
(70)
(IN)
AquaLush must detect valve and sensor fa
(38)
(IN)
open
(500)
(OUT)

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

Syntax:
open() throws DeviceFailureException
Pre:
None.
Post:
Opens a valve. Throws DeviceFailureException if the valve fails.

ID: 568

1.4.2.1.20 Close a valve

This object is linked to:
Valves must be openable and closable.
(212)
(IN)
Valve failures must be detectable when a
(213)
(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 can be manipulated within thr
(71)
(IN)
If a valve cannot be manipulated (opened
(70)
(IN)
AquaLush must detect valve and sensor fa
(38)
(IN)
close
(467)
(OUT)

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

Syntax:
close() throws DeviceFailureException
Pre:
None.
Post:
Closes a valve. Throws DeviceFailureException if the valve fails.

ID: 579

1.4.2.1.21 Create virtual devices

This object is linked to:
createClockDevice
(153)
(OUT)
createValveDevice
(327)
(OUT)
createStorageDevice
(319)
(OUT)
createScreenButtonDevice
(262)
(OUT)
createKeypadDevice
(244)
(OUT)
createSensorDevice
(313)
(OUT)
createDisplayDevice
(188)
(OUT)

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

Syntax:
createSensorDevice( id : String ) : SensorDevice createValveDevice( id : String, rate ) : ValveDevice createDisplayDevice() : DisplayDevice createKeypadDevice() : KeypadDevice createScreenButtonDevice() : ScreenButtonDevice createClockDevice() : ClockDevice createStorageDevice() : StorageDevice
Pre:
id is not null.
Post:
The desired virtual device is created. The virtual device is fully configured and connected to real or simulated hardware.

ID: 590

1.4.2.2 Services Required

The Device Interface layer uses actual or simulated hardware. The details of these services vary: That is the point of having a device interface layer. This layer also requires a Day enumeration type and a DeviceFailureException class. The ClockDevice requires some sort of real or simulated device that notifies it when one minute has passed.

This object is linked to:
device
(81)
(OUT)
Day
(178)
(OUT)

This object has external links to:
Day.java(EXT OUT)
DeviceFailureException.java(EXT OUT)
device/(EXT OUT)
test/device/(EXT OUT)


ID: 591

1.4.2.3 Usage Guide

The Clock, not the ClockDevice, is the main time and time notification service provider. The Clock is a singleton, so it is globally visible. It is also an observable, so it can be accessed from any layer and arbitrarily many observers can register with it for time notifications.
The extra parameter in getData() is there to make it easy to initialize the persistent store when the program is run for the first time. Default persistent values are supplied, and they will be written to the persistent store even if the store did not previously exist.
All sensors, valves, and zones are identified across layers using String identifiers. Hence these must match up and be hooked into whatever mechanism is used to associate virtual devices with real or simulated hardware.

This object is linked to:
device
(81)
(OUT)

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


ID: 592

1.4.3 Device Interface Layer Design Rationale

Other versions of this layer did not include the DeviceFactory. The DeviceFactory is part of the Abstract Factory pattern, which allows the details of virtual device configuration to be hidden inside concrete factories and makes it very easy to change the configuration. Design alternatives that include the Abstract Factory pattern are clearly superior.
A question that was revisited several times was how the clock should be handled. Does there need to be a Clock distinct from a ClockDevice? On the one hand, the ClockDevice is supposed to provide a virtual device as an interface to real or simulated hardware, while a Clock provides time and notification services to clients. These are distinct responsibilities, so it appears that there ought to be two entities. On the other hand, in practice the services provided by a Clock are almost identical to those of a ClockDevice, and it is not good to multiply entities beyond necessity. In the end the alternative with a distinct Clock and ClockDevice was chosen to maintain uniformity with the rest of the modules in the Device Interface layer.
Having resolved the issue of whether the Clock is distinct from the ClockDevice, the question of where the Clock should reside arises. On the one hand, the Clock is responsible for providing time and notification services rather than a uniform interface to hardware, suggesting that it should not be in the Device Interface layer. On the other hand, a Clock is a kind of device and it does not fit particularly well in any other layer, so perhaps the best home for it is the Device Interface layer. The latter argument seems slightly more persuasive, so the Clock is in the Device Interface layer. It could be moved easily, however.

This object is linked to:
device
(81)
(OUT)

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


ID: 593

1.5 Irrigation Layer Decomposition

The Irrigation layer is the core of AquaLush in the sense that it realizes the program’s main function of controlling irrigation. Its architectural structure is quite simple: It contains a façade module that provides operations for configuration, setting irrigation parameters, and controlling manual irrigation. These operations depend on an enumeration type and several classes that merely package data about the state of the program for return from query functions. The class diagram in Figure B-10-12 illustrates this structure. The classes with the «constant» stereotype are immutable data containers that simply hold values returned by query operations.

This object is linked to:
Packaging
(484)
(OUT)
Irrigation Layer Behavior
(409)
(OUT)
Irrigation Layer Static Structure
(247)
(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
(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 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 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)
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)
The Set Water Allocation state must allo
(378)
(IN)
After establishing its configuration, Aqu
(90)
(IN)
All parameters set by users must remain
(7)
(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)
Irrigation Outside View
(950)
(OUT)

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


ID: 879

Figure B-10-12 Irrigation Layer Structure


ID: 594

1.5.1 Irrigation Layer Module Responsibilities

Module
Responsibilities
Irrigator
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)
The zone’s critical moisture level must
(113)
(IN)
The operational status must be a Boolean
(133)
(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)
The current time is recorded in the syst
(154)
(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)
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)
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)
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)
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 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 default zone critical moisture level
(187)
(IN)
Hold irrigation parameters, oversee irrigation cycles, and provide a façade to the rest of the irrigation-layer facilities.
Devices
(254)
(OUT)
The AquaLush applet gets a reference to
(245)
(OUT)
The SimTimeControl is passed a reference
(244)
(OUT)
Detailed Design Rationale
(489)
(OUT)
Create a manual irrigation cycle (Manual
(287)
(OUT)
ManualCycle
(263)
(OUT)
Irrigation Layer Behavior
(409)
(OUT)
AutoCycle
(260)
(OUT)
See if a cycle is ended
(309)
(OUT)
Check for auto irrigation completion (Zo
(331)
(OUT)
Zone
(266)
(OUT)
One minute passes (IrrigationCycle, Zone
(298)
(OUT)
Open or close all valves in a zone
(342)
(OUT)
IrrigationCycle
(257)
(OUT)
Create an automatic irrigation cycle (Au
(276)
(OUT)
Valve
(272)
(OUT)
Sensor
(269)
(OUT)
A cycle is ended (IrrigationCycle)
(320)
(OUT)
Irrigator
(239)
(OUT)
Irrigator.java(EXT OUT)
IrrigatorTest.java(EXT OUT)
Mode
AquaLush must run in one of two modes: m
(8)
(IN)
AquaLush must allow operation in either
(36)
(IN)
The default mode must be automatic.
(183)
(IN)
Enumeration values for program modes.
Mode
(90)
(OUT)
Mode.java(EXT OUT)
ModeTest.java(EXT OUT)
ZoneReport
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
The zone’s critical moisture level must
(113)
(IN)
AquaLush must allow moisture levels that
(24)
(IN)
The Zone field must display data just as
(293)
(IN)
The Zone field must display the zone iden
(281)
(IN)
The region between the dashed lines must
(360)
(IN)
Record providing data about irrigation zones.
Zone
(266)
(OUT)
ZoneReport
(410)
(OUT)
ZoneReport.java(EXT OUT)
ZoneReportTest.java(EXT OUT)
ValveReport
Each irrigation zone must have 1 to 32 i
(110)
(IN)
The operational status must be a Boolean
(133)
(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
(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)
AquaLush must display the following data
(41)
(IN)
Record providing data about the state of a valve.
Valve
(272)
(OUT)
ValveReport
(374)
(OUT)
ValveReport.java(EXT OUT)
ValveReportTest.java(EXT OUT)
SensorReport
Each irrigation zone must have exactly o
(109)
(IN)
The operational status must be a Boolean
(121)
(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)
Record providing data about the state of a sensor.
Sensor
(269)
(OUT)
SensorReport
(326)
(OUT)
SensorReport.java(EXT OUT)
SensorReportTest.java(EXT OUT)
IrrigationReport
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)
The total water used during manual irrig
(168)
(IN)
Record providing data about the state of an irrigation cycle.
IrrigationCycle
(257)
(OUT)
IrrigationReport
(197)
(OUT)
FailureReport
The Device Failure state must be entered
(385)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
AquaLush must provide reports of failed
(78)
(IN)
If valves or sensors have failed, then A
(81)
(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)
Record containing ValveReport and SensorReport instances for failed valves and sensors.
Valve
(272)
(OUT)
Sensor
(269)
(OUT)
FailureReport
(108)
(OUT)
FailureReport.java(EXT OUT)
FailureReportTest.java(EXT OUT)

ID: 620

1.5.2 Irrigation Layer Interface Specifications


ID: 621

1.5.2.1 Services Provided

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

ID: 622

1.5.2.1.1 Create irrigation objects

This object is linked to:
Irrigator
(239)
(OUT)

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

Syntax:
create( s : StorageDevice )
Pre:
s is not null.
Post:
Irrigation-layer objects are created and initialized.

ID: 633

1.5.2.1.2 Set and get irrigation parameters

This object is linked to:
AquaLush must either not allow an invali
(20)
(IN)
Setting the mode to a different value mu
(11)
(IN)
Setting the mode to its current value mu
(10)
(IN)
AquaLush must allow the days and time of
(19)
(IN)
If a new irrigation time setting fails v
(21)
(IN)
AquaLush must run in one of two modes: m
(8)
(IN)
AquaLush must allow operation in either
(36)
(IN)
If the water allocation is set when auto
(32)
(IN)
If a new water allocation setting fails
(31)
(IN)
AquaLush must allow the maximum amount o
(29)
(IN)
AquaLush must either not allow an invali
(30)
(IN)
If the irrigation time is set when autom
(22)
(IN)
AquaLush must set the total water used i
(48)
(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
(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 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 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)

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

Syntax:
setMode( m : Mode ) getMode() : Mode setAllocation( a : int ) getAllocation() : int setIrrigationTime( t : int )
getIrrigationTime() : t setIrrigationDays( s : Set )
getIrrigationDays() : Set
Pre:
0 < a and t is a valid military time specification and s is a set of Day.
Post:
The irrigation parameters are set or fetched. Changes are recorded in the persistent store.

ID: 644

1.5.2.1.3 Add a zone

This object is linked to:
Zone
(266)
(OUT)
The irrigated site must be divided into
(108)
(IN)
An irrigation zone location must be a st
(112)
(IN)
An irrigation zone identifier must consis
(111)
(IN)
addZone
(314)
(OUT)

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

Syntax:
addZone( id : String, loc : String )
Pre:
id and loc are not null; id is unique.
Post:
The layer is configured with a new zone.

ID: 655

1.5.2.1.4 Add a sensor

This object is linked to:
Sensor
(269)
(OUT)
Each irrigation zone must have exactly o
(109)
(IN)
A sensor identifier must consist of the l
(119)
(IN)
A sensor location must be a string of 0
(120)
(IN)
The default sensor and valve operational
(188)
(IN)
addSensor
(304)
(OUT)

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

Syntax:
addSensor( zid: String, id : String, loc : String, d : SensorDevice )
Pre:
No parameter is null and the designated zone does not have a sensor.
Post:
Adds a sensor to the designated zone. Throws an IllegalStateException if the zone already has a sensor.

ID: 666

1.5.2.1.5 Add a valve

This object is linked to:
Valve
(272)
(OUT)
Each irrigation zone must have 1 to 32 i
(110)
(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)
AquaLush must eventually control a varie
(206)
(IN)
The default sensor and valve operational
(188)
(IN)
addValve
(311)
(OUT)

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

Syntax:
addValve( zid: String, id : String, loc : String, rate : int, d : ValveDevice )
Pre:
No parameter is null and 0 < rate and the designated zone does not have 32 valves.
Post:
Adds a sensor to the designated zone. Throws an IllegalStateException if the zone already has 32 valves.

ID: 677

1.5.2.1.6 Restore program state

This object is linked to:
AquaLush must make no attempt to resume
(92)
(IN)
After establishing its configuration, Aqu
(90)
(IN)
All parameters set by users must remain
(7)
(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 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 default zone critical moisture level
(187)
(IN)
restoreState
(537)
(OUT)

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

Syntax:
restoreState()
Pre:
Layer configuration is complete.
Post:
Persistent store is read and the previous state of the program is restored.

ID: 688

1.5.2.1.7 Set or get a zone’s critical moisture level

This object is linked to:
Zone
(266)
(OUT)
The zone’s critical moisture level must
(113)
(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)
If the critical moisture level is set wh
(27)
(IN)
AquaLush must either not allow an invali
(25)
(IN)
The Set Moisture Levels state must allow
(358)
(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)
setCriticalMoistureLevel
(538)
(OUT)
getCriticalMoistureLevel
(415)
(OUT)

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

Syntax:
setCriticalMoistureLevel( zid : String, level : int ) getCriticalMoistureLevel( zid : String ) : int
Pre:
zid is not null and names a registered zone and 0 <= level <= 100.
Post:
The designated zone’s critical moisture level is set or returned and 0 <= result <= 100. The change is recorded in persistent store.

ID: 699

1.5.2.1.8 Start and end manual irrigation cycles

This object is linked to:
ManualCycle
(263)
(OUT)
AquaLush must set the total water used i
(48)
(IN)
When no valve is open in manual irrigati
(49)
(IN)
startManualCycle
(539)
(OUT)
endManualCycle
(404)
(OUT)

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

Syntax:
startManualCycle() endManualCycle()
Pre:
mode is MANUAL
Post:
A manual irrigation cycle is started or ended and waterUsed is set to zero when a cycle starts. Throws an IllegalStateException if mode is not MANUAL.

ID: 710

1.5.2.1.9 Manually open or close a valve

This object is linked to:
Manually open or close a valve (Irrigato
(353)
(OUT)
openValve
(535)
(OUT)
closeValve
(348)
(OUT)
AquaLush must eventually control a varie
(206)
(IN)
In manual-mode operation, AquaLush must
(40)
(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 id names a registered valve and mode is MANUAL.
Post:
A valve is opened or closed. Attempts to open or close failed valves do nothing. Throws an IllegalStateException if mode is not MANUAL.

ID: 721

1.5.2.1.10 Obtain irrigation cycle data

This object is linked to:
IrrigationCycle
(257)
(OUT)
AquaLush must display the total water us
(47)
(IN)
The total water used during manual irrig
(168)
(IN)
The default water allocation must be 100
(186)
(IN)
The default zone critical moisture level
(187)
(IN)
getIrrigationReport
(437)
(OUT)

Syntax:
getIrrigationReport() : IrrigationReport
Pre:
None.
Post:
The IrrigationReport is populated and returned.

ID: 732

1.5.2.1.11 Get zone data

This object is linked to:
Zone
(266)
(OUT)
Each irrigation zone must have 1 to 32 i
(110)
(IN)
Each irrigation zone must have exactly o
(109)
(IN)
The zone’s critical moisture level must
(113)
(IN)
The Zone field must display data just as
(293)
(IN)
The Zone field must display the zone iden
(281)
(IN)
The region between the dashed lines must
(360)
(IN)
getZoneReports
(534)
(OUT)
getZoneReport
(533)
(OUT)

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

Syntax:
getZoneReports() : Collection getZoneReport( id : String ) : ZoneReport
Pre:
id is not null and names a registered zone.
Post:
If no zone is identified, a collection of ZoneReports, one for each registered zone, is populated and returned. If a zone is identified, a report for that zone is populated and returned.

ID: 743

1.5.2.1.12 Get sensor data

This object is linked to:
Get sensor data (Irrigator)
(364)
(OUT)
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
(68)
(IN)
The Wet% field must display the percent s
(282)
(IN)
If the valve’s zone moisture sensor has
(283)
(IN)
The default sensor and valve operational
(188)
(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: 754

1.5.2.1.13 Get valve data

This object is linked to:
Get valve data (Irrigator)
(375)
(OUT)
getValveReports
(532)
(OUT)
getValveReport
(531)
(OUT)
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 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
(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)
The default sensor and valve operational
(188)
(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: 765

1.5.2.1.14 Get a failed hardware report

This object is linked to:
Get a failed hardware report (Irrigator)
(386)
(OUT)
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
(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: 776

1.5.2.1.15 Mark a device as repaired

This object is linked to:
Mark a device as repaired (Irrigator)
(397)
(OUT)
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: 787

1.5.2.2 Services Required

The Irrigation layer uses the following operations from the Device Interface layer: ValveDevice.open(), ValveDevice.close(), SensorDevice.read(), StorageDevice.setData(), StorageDevice.getData(), Clock.getTime(), Clock.setTime(), Clock.getDay(), Clock.setDay(), Clock.addObserver(). The Irrigator is the Clock observer.

This object is linked to:
setData
(494)
(OUT)
getData
(422)
(OUT)
getDay
(144)
(OUT)
setDay
(205)
(OUT)
getTime
(180)
(OUT)
setTime
(228)
(OUT)
open
(500)
(OUT)
read
(433)
(OUT)
close
(467)
(OUT)

This object has external links to:
Clock.java(EXT OUT)
ClockTest.java(EXT OUT)
SensorDevice.java(EXT OUT)
SensorDeviceTest.java(EXT OUT)
StorageDevice.java(EXT OUT)
StorageDeviceTest.java(EXT OUT)
ValveDevice.java(EXT OUT)
ValveDeviceTest.java(EXT OUT)


ID: 788

1.5.2.3 Usage Guide

The Irrigation layer should be completely configured using the addX() operations before the restoreState() operation is called. The restoreState() operation uses the Irrigation layer configuration to obtain system state values such as device failure states; if the configuration is not complete, these state values will not be set correctly.
The Irrigator registers itself with the Clock, so a client should not do this.
The various report classes are merely containers for groups of values. They are intended to be used by the User Interface layer to populate screens with data about the state of the system, especially during manual irrigation. They are supposed to provide a wide range of information so they will not have to be changed even if the user interface is changed. Note that because the system is changing during irrigation, the values in the report become stale, so they need be retrieved anew every minute or after every change.

This object is linked to:
irrigation
(72)
(OUT)
All parameters set by users must remain
(7)
(IN)

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


ID: 789

1.5.3 Irrigation Layer Design Rationale

There are many design alternatives that expose the internals of the Irrigation layer by making the Zone, Sensor, and Valve classes part of the layer interface. This makes the Irrigator class much simpler and obviates the need for the many report classes used to return data about the configuration, the state of irrigation, and device states. Such alternatives have two problems: By exposing the internal structure of this layer they make it much harder to change in the future because they do not hide information, and they make it much harder to enforce constraints on irrigation behavior. To illustrate this last point, the alternative previously documented does not allow valves to be manually opened or closed unless the mode is automatic. Allowing direct access to valves would make it harder to enforce this constraint. It seems clear that the previous alternative is the best choice because it favors information hiding and control over simplicity.

This object is linked to:
irrigation
(72)
(OUT)

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


ID: 790

1.6 User Interface Layer Decomposition

The User Interface layer is responsible for coordinating user interaction with output on a monochrome textual display and input from a 12-key keypad and 8 screen buttons. This layer has a UIController that executes a state machine derived from the user interface dialog map. The controller dispatches input from the keypad, screen buttons, and the clock to the currently active screen.

This object is linked to:
Packaging
(484)
(OUT)
User Interface Layer Static Structure
(412)
(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)
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 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)
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)
UI Outside View
(959)
(OUT)

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


ID: 880

Figure B-10-15 User Interface Layer Structure


ID: 791

1.6.1 User Interface Layer Module Responsibilities

Module
Responsibilities
UIController
The AquaLush central control panel must
(215)
(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)
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 AquaLush cannot write to its persiste
(74)
(IN)
AquaLush must allow moisture levels that
(24)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
If a valve cannot be manipulated after t
(73)
(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)
If a sensor cannot be read after three t
(68)
(IN)
Failure reports must display the followi
(171)
(IN)
The Set Moisture Levels state must allow
(358)
(IN)
The Manual Irrigation (Location) state m
(288)
(IN)
The Set Up Auto Irrigation state must al
(330)
(IN)
The Set Irrigation Times state must allo
(332)
(IN)
The Manual Irrigation (Data) state must
(268)
(IN)
AquaLush must display a reset current ti
(17)
(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 a reset critical m
(28)
(IN)
AquaLush must allow users to indicate th
(84)
(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)
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)
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)
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)
The Set Moisture action must be a “Set C
(253)
(IN)
Note that the Normal State is a placehol
(256)
(IN)
The Set Allocation action must be a “Set
(254)
(IN)
The Manual Main state must be an alterna
(265)
(IN)
The Auto Main state must be the initial
(261)
(IN)
The control panel must conform to the di
(255)
(IN)
The OK action must be an “OK” screen but
(259)
(IN)
The Store Failure action must be an inab
(258)
(IN)
The Device Failure action must be a dete
(257)
(IN)
The Set Times action must be a “Set Irri
(252)
(IN)
If AquaLush cannot read its persistent s
(77)
(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)
Execute a state machine whose states are screens from the dialog map. Dispatch user input and clock notifications to the current screen.
Notify a screen that time has passed
(446)
(OUT)
Usage Guide
(479)
(OUT)
Activate a screen when it becomes curren
(435)
(OUT)
User Interface Layer Behavior
(481)
(OUT)
Screen
(419)
(OUT)
ScrollingScreen
(422)
(OUT)
Notify a screen that a screen button has
(457)
(OUT)
Notify a screen that a keypad key has be
(468)
(OUT)
The UIController simply passes keypad pr
(482)
(OUT)
UIController
(611)
(OUT)
UIController.java(EXT OUT)

ID: 799

1.6.2 User Interface Layer Interface Specifications


ID: 800

1.6.2.1 Services Provided

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

ID: 801

1.6.2.1.1 Create the user interface

This object is linked to:
UIController
(611)
(OUT)

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

Syntax:
create( d : DisplayDevice, w : Irrigator )
Pre:
d and w are not null.
Post:
The user interface controller is created and the initial screen in the program is activated.

ID: 812

1.6.2.2 Services Required

The User Interface layer uses almost all the operations from the Irrigation layer. From the Device Interface layer, it uses all the services provided by the DisplayDevice and the Clock, which it observes. This layer also uses the KeyPress enumeration from the Device Interface layer.

This object is linked to:
KeyPress
(102)
(OUT)
DisplayDevice
(174)
(OUT)
irrigation
(72)
(OUT)
Clock
(89)
(OUT)

This object has external links to:
Clock.java(EXT OUT)
ClockTest.java(EXT OUT)
DisplayDevice.java(EXT OUT)
DisplayDeviceTest.java(EXT OUT)
KeyPress.java(EXT OUT)
KeyPressTest.java(EXT OUT)
irrigation/(EXT OUT)
test/irrigation/(EXT OUT)


ID: 813

1.6.2.3 Usage Guide

The UIController must be registered as the listener for the KeypadDevice and the ScreenButtonDevice to receive notifications from them. It registers itself with the Clock.

This object is linked to:
ui
(549)
(OUT)

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


ID: 814

1.6.3 User Interface Layer Design Rationale

Although the intent is for this layer to implement a state machine realizing the user interface dialog map, the architecture description is so general that any sort of implementation is possible: The UIController can be treated as a façade hiding all sorts of alternative implementations. This is perhaps the best reason to prefer this architectural alternative. Other alternatives would provide more detail that would constrain the detailed design alternatives.

This object is linked to:
ui
(549)
(OUT)

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


ID: 815

1.7 Runtime Components

Figure B-10-18 depicts the runtime configuration of AquaLush.
The Startup component executes first and configures the remaining parts of the program using the data it reads from the AquaLush Configuration data store. The User interacts with the AquaLush Control Panel, which interacts with the User Interface. The User Interface translates the User’s desires into interactions with the Irrigation Control component to set the mode of the program, set program parameters, and control manual irrigation. The Irrigation Control component maintains a copy of its state in the AquaLush State data store and uses it to recover its state when it starts up after loss of power. The Irrigation Control component interacts with the Valves/Sensors component, which reads hardware (or simulated) Sensors and controls hardware (or simulated) Valves.

This object is linked to:
SimSensor
(220)
(OUT)
SimKeypad
(167)
(OUT)
SimDisplay
(115)
(OUT)
SimValve
(295)
(OUT)
Configurer
(559)
(OUT)
Tokenizer
(562)
(OUT)
DisplayDevice
(174)
(OUT)
ScreenButtonDevice
(250)
(OUT)
ClockDevice
(100)
(OUT)
SimStore
(275)
(OUT)
StorageDevice
(357)
(OUT)
KeypadDevice
(183)
(OUT)
ValveDevice
(416)
(OUT)
SimTime
(284)
(OUT)
SensorDevice
(340)
(OUT)
irrigation
(72)
(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)
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)
Valve failures must be detectable when a
(213)
(IN)
It must include a 12-key keypad.
(219)
(IN)
The keypad must have 10 numeric keys, a
(220)
(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)
AquaLush must allow the days and time of
(19)
(IN)
The Device Failure state must be entered
(385)
(IN)
If a valve cannot be manipulated after t
(72)
(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 a sensor cannot be read after three t
(67)
(IN)
AquaLush must detect valve and sensor fa
(38)
(IN)
AquaLush must allow moisture levels that
(24)
(IN)
AquaLush must monitor the amount of wate
(37)
(IN)
In manual-mode operation, AquaLush must
(40)
(IN)
If a valve cannot be manipulated after t
(73)
(IN)
AquaLush must allow the maximum amount o
(29)
(IN)
The following data must be recorded for
(115)
(IN)
The following data must be recorded for
(123)
(IN)
When told that a failed valve or sensor
(85)
(IN)
If a sensor cannot be read after three t
(68)
(IN)
If the user presses the “Repaired” scree
(322)
(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 Set Up Auto Irrigation state must al
(330)
(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)
Users must be able to set the mode.
(9)
(IN)
The Set Water Allocation state must allo
(378)
(IN)
If AquaLush cannot read its persistent s
(77)
(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)
The configuration file must be a text file
(135)
(IN)
When it starts, AquaLush must first read
(89)
(IN)
The configuration file must be named “confi
(141)
(IN)
AquaLush must record its system paramete
(144)
(IN)
A configuration file that cannot be found,
(142)
(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 AquaLush simulation must be installa
(201)
(IN)
UIController
(611)
(OUT)
DeviceFactory
(133)
(OUT)
Clock
(89)
(OUT)

This object has external links to:
Clock.java(EXT OUT)
ClockDevice.java(EXT OUT)
ClockDeviceTest.java(EXT OUT)
ClockTest.java(EXT OUT)
Configurer.java(EXT OUT)
DeviceFactory.java(EXT OUT)
DeviceFactoryTest.java(EXT OUT)
DisplayDevice.java(EXT OUT)
DisplayDeviceTest.java(EXT OUT)
KeypadDevice.java(EXT OUT)
KeypadDeviceTest.java(EXT OUT)
ScreenButtonDevice.java(EXT OUT)
ScreenButtonDeviceTest.java(EXT OUT)
SensorDevice.java(EXT OUT)
SensorDeviceTest.java(EXT OUT)
SimDisplay.java(EXT OUT)
SimDisplayTest.java(EXT OUT)
SimKeypad.java(EXT OUT)
SimKeypadTest.java(EXT OUT)
SimSensor.java(EXT OUT)
SimSensorTest.java(EXT OUT)
SimTime.java(EXT OUT)
SimTimeTest.java(EXT OUT)
SimValve.java(EXT OUT)
SimValveTest.java(EXT OUT)
StorageDevice.java(EXT OUT)
StorageDeviceTest.java(EXT OUT)
Tokenizer.java(EXT OUT)
UIController.java(EXT OUT)
ValveDevice.java(EXT OUT)
ValveDeviceTest.java(EXT OUT)
irrigation/(EXT OUT)
test/irrigation/(EXT OUT)


ID: 816

Figure B-10-18 AquaLush Runtime Structure


ID: 817

2 Mapping Between Models

Table B-10-19 indicates the uses relations between layers and their constituents. The layers in the rows use the classes in the columns.
  User Interface
Irrigation
Device Interface
Simulation
Startup
startup
(542)
(OUT)
startup/(EXT OUT)
UIController
UIController
(611)
(OUT)
UIController.java(EXT OUT)
Irrigator
Irrigator
(239)
(OUT)
Irrigator.java(EXT OUT)
IrrigatorTest.java(EXT OUT)
DeviceFactory KeypadDevice ScreenButtonDevice
ScreenButtonDevice
(250)
(OUT)
KeypadDevice
(183)
(OUT)
DeviceFactory
(133)
(OUT)
DeviceFactory.java(EXT OUT)
DeviceFactoryTest.java(EXT OUT)
KeypadDevice.java(EXT OUT)
KeypadDeviceTest.java(EXT OUT)
ScreenButtonDevice.java(EXT OUT)
ScreenButtonDeviceTest.java(EXT OUT)
Simulation
Simulation
(372)
(OUT)
Simulation.java(EXT OUT)
SimulationTest.java(EXT OUT)
User Interface
ui
(549)
(OUT)
ui/(EXT OUT)
  Irrigator
Irrigator
(239)
(OUT)
Irrigator.java(EXT OUT)
IrrigatorTest.java(EXT OUT)
Clock
DisplayDevice
DisplayDevice
(174)
(OUT)
Clock
(89)
(OUT)
Clock.java(EXT OUT)
ClockTest.java(EXT OUT)
DisplayDevice.java(EXT OUT)
DisplayDeviceTest.java(EXT OUT)
 
Irrigation
irrigation
(72)
(OUT)
irrigation/(EXT OUT)
test/irrigation/(EXT OUT)
    Clock
ValveDevice SensorDevice StorageDevice
StorageDevice
(357)
(OUT)
ValveDevice
(416)
(OUT)
SensorDevice
(340)
(OUT)
Clock
(89)
(OUT)
Clock.java(EXT OUT)
ClockTest.java(EXT OUT)
SensorDevice.java(EXT OUT)
SensorDeviceTest.java(EXT OUT)
StorageDevice.java(EXT OUT)
StorageDeviceTest.java(EXT OUT)
ValveDevice.java(EXT OUT)
ValveDeviceTest.java(EXT OUT)
 
Device Interface
device
(81)
(OUT)
device/(EXT OUT)
test/device/(EXT OUT)
      SimTime
SimDisplay
SimValve
SimSensor
SimStore
SimSensor
(220)
(OUT)
SimDisplay
(115)
(OUT)
SimValve
(295)
(OUT)
SimStore
(275)
(OUT)
SimTime
(284)
(OUT)
SimDisplay.java(EXT OUT)
SimDisplayTest.java(EXT OUT)
SimSensor.java(EXT OUT)
SimSensorTest.java(EXT OUT)
SimTime.java(EXT OUT)
SimTimeTest.java(EXT OUT)
SimValve.java(EXT OUT)
SimValveTest.java(EXT OUT)

ID: 849

The runtime components shown in Figure B-10-18 are comprised of the modules and data stores shown in Table B-10-20.

Runtime Component
Modules
Startup
Startup layer configuration module(s), plus DeviceInterface.DeviceFactory
Tokenizer
(9)
(OUT)
TokenType
(12)
(OUT)
Configurer
(559)
(OUT)
Tokenizer
(562)
(OUT)
DeviceFactory
(133)
(OUT)
Configurer.java(EXT OUT)
DeviceFactory.java(EXT OUT)
DeviceFactoryTest.java(EXT OUT)
Tokenizer.java(EXT OUT)
AquaLush Configuration
Configuration specification (file or applet parameters)
Control Panel
DeviceInterface.DisplayDevice, DeviceInterface.KeypadDevice, and DeviceInterface.ScreenButtonDevice; display, keypad, and screen button hardware or Simulation.SimDisplay and a simulated keypad
SimKeypad
(167)
(OUT)
SimDisplay
(115)
(OUT)
DisplayDevice
(174)
(OUT)
ScreenButtonDevice
(250)
(OUT)
KeypadDevice
(183)
(OUT)
DisplayDevice.java(EXT OUT)
DisplayDeviceTest.java(EXT OUT)
KeypadDevice.java(EXT OUT)
KeypadDeviceTest.java(EXT OUT)
ScreenButtonDevice.java(EXT OUT)
ScreenButtonDeviceTest.java(EXT OUT)
SimDisplay.java(EXT OUT)
SimDisplayTest.java(EXT OUT)
SimKeypad.java(EXT OUT)
SimKeypadTest.java(EXT OUT)
User Interface
UserInterface.UIController
UIController
(611)
(OUT)
UIController.java(EXT OUT)
Irrigation Control
The objects in the Irrigation layer, plus DeviceInterface.StorageDevice, DeviceInterface.Clock, DeviceInterface.ClockDevice, Simulation.SimStore, or a configuration file, and Simulation.SimTime or real clock hardware
Devices
(254)
(OUT)
ManualCycle
(263)
(OUT)
AutoCycle
(260)
(OUT)
Zone
(266)
(OUT)
IrrigationCycle
(257)
(OUT)
Valve
(272)
(OUT)
Sensor
(269)
(OUT)
ClockDevice
(100)
(OUT)
SimStore
(275)
(OUT)
StorageDevice
(357)
(OUT)
SimTime
(284)
(OUT)
irrigation
(72)
(OUT)
Clock
(89)
(OUT)
Clock.java(EXT OUT)
ClockDevice.java(EXT OUT)
ClockDeviceTest.java(EXT OUT)
ClockTest.java(EXT OUT)
SimTime.java(EXT OUT)
SimTimeTest.java(EXT OUT)
StorageDevice.java(EXT OUT)
StorageDeviceTest.java(EXT OUT)
irrigation/(EXT OUT)
test/irrigation/(EXT OUT)
Valves/Sensors
DeviceInterface.ValveDevice, DeviceInterface.SensorDevice
ValveDevice
(416)
(OUT)
SensorDevice
(340)
(OUT)
SensorDevice.java(EXT OUT)
SensorDeviceTest.java(EXT OUT)
ValveDevice.java(EXT OUT)
ValveDeviceTest.java(EXT OUT)
Valves and Sensors
Simulation.SimValve, Simulation.SimSensor, or actual hardware sensors and valves
SimSensor
(220)
(OUT)
SimValve
(295)
(OUT)
SimSensor.java(EXT OUT)
SimSensorTest.java(EXT OUT)
SimValve.java(EXT OUT)
SimValveTest.java(EXT OUT)

ID: 875

3 Architectural Design Rationale

The layers in this program are rather unusual, but they are arranged as they are to satisfy one of the most important AquaLush quality attributes: configurability. Because the core software, principally the contents of the Irrigation layer, must run unchanged in a simulation or in a fielded product, the program must be configurable so that all interactions with its environment can be changed. This includes things that are usually not considered part of the environment, such as time (because simulated time may be faster, slower, or even stop), and things that are usually taken for granted (such as the persistent store, which may not be accessible in an applet).
There is no reasonable alternative except to have a Device Interface layer. It uses the Simulation layer to provide the entire external environment during a simulation and hardware devices, a file system, and the system clock in a fielded program. In either case, the Device Interface layer shields the rest of the program from having to deal with the differences occasioned by these radically different environments.
User interfaces are usually coded using the user interface toolkit provided by a programming environment. However, since the AquaLush simulation uses a GUI and the fielded program uses ATM-like hardware, the user interface must either be coded in several versions or coded once in a device-independent component that uses virtual devices. The latter alternative is clearly preferable. Furthermore, it makes sense to separate the User Interface layer from the Irrigation layer so that the latter can be unchanged even if the user interface is altered.
Finally, the complexity of the configuration problem suggests the need for a layer responsible for configuring the program at startup. Isolating this task in one place makes it easier to code, test, and modify. The Startup layer is responsible for this task.

This object is linked to:
Detailed Design Rationale
(489)
(OUT)
simulation
(76)
(OUT)
startup
(542)
(OUT)
ui
(549)
(OUT)
irrigation
(72)
(OUT)
device
(81)
(OUT)

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

Produced by DOORS 9.3.0.2