Title: Weather Monitoring Station Requirements
1Weather Monitoring Station Requirements
- This system shall provide automatic monitoring of
various weather conditions. Specifically, it
must measure - wind speed and direction
- temperature
- barometric pressure
- humidity
- The system shall also proved the following
derived measurements - wind chill
- dew point temperature
- temperature trend
- barometric pressure trend
2Weather Monitoring System Requirements
- The system shall have the means of determining
the current time and date so that it can report
the highest and lowest values for any of the four
primary measurements during the previous 24 hour
period. - The system shall have a display that continuously
indicates all eight primary and derived
measurements, as well as current time and date. - Through he use of a keypad the user may direct
the system to display the 24 hour low or high of
any one primary measurement, with the time of the
reported value. - The system shall allow the user to calibrate its
sensors against known values, and set the current
time and date.
3Hardware Requirements
- Use a single board computer (486?)
- Time and date are supplied by an on-board clock
accessible via memory mapped I/O - Temperature, barometric pressure, and humidity
are measured by on board circuits with remote
sensors. - Wind direction and speed are measure from a boom
encompassing a wind vane (16 directions) and cups
(which advance a counter every revolution) - User input is provided through an off the shelf
keypad, managed by onboard circuit supplying
audible feed back for each key press. - Display is off the self LCD with a simple set of
graphics primitives. - An onboard timer interrupts the computer every
1/60 second.
4Physical Hardware (Nodes)
5Display and Keypad
- LCDDisplay Values and current system state
(Running, Calibrating, Selecting, Mode) - Operations drawtext, drawline, drawcircle,
settextsize, settextstyle, setpensize - Keypad allows user input and interaction
- Operations last key pressed
- Attributes key
N
Date Time Temp Pressure Humidity
Temp
Hum
Press
Wind
Time
Date
E
W
Select
Cal
Mode
S
6Use Diagrams
7Scenario Powering Up
- Power is turned on
- Each sensor is constructed
- User input buffer is initialized
- Static elements of display are drawn
- Sampling of sensors is initialized
- The past high/low values of each primary
measurement is set to the value and time of their
first sample. - The temperature and Pressure trends are flat.
- The input manager is in the Running state
8Scenario Setting Time and Date
- User presses Select key
- System displays selecting
- User presses any one of the keys Time or Date.
Any other key is ignored except Run - System flashes the corresponding label
- Users presses Up or Down to change date or time.
- Control passes back to step 3 or 5
- User may press Run to abandon the operation.
9Scenario Display highest and lowest
- User presses Select key
- System displays selecting
- User presses any one of the keys (Wind, Temp,
Humidity, Pressure). Any other key is ignored
except Run - System flashes the corresponding label
- Users presses Up or Down to select display of
highest or lowest in 24 hour period. Any other
key press is ignored except for Run - System displays value with time of occurrence
- Control passes back to step 3 or 5
- User may press Run to abandon the operation.
10Use Diagrams
11Scenario Calibrate Sensor
- User presses Calibrate key
- System displays Calibrating
- User presses any one of the keys (Wind, Temp,
Humidity, Pressure). Any other key is ignored
except Run - System flashes the corresponding label
- Users presses Up or Down to select high or low
value. - Display flashes the corresponding value
- User presses Up or Down to select to adjust value
- Control passes back to step 3 or 8
- User may press Run to abandon the operation.
12Scenario Setting Temperature Units
- User presses Mode key
- System displays Mode
- User presses any one of the keys (Wind, Temp,
Humidity, Pressure). Any other key is ignored
except Run - System flashes the corresponding label
- Users presses Up or Down to toggle units (Metric
or English). - System updates units
- Control passes back to step 3 or 5
- User may press Run to abandon the operation.
13Use Diagrams
14Identify Objects
- From the vocabulary of the domain
- User, clock, sensor, temperature, LCDDisplay,
Keypad, time, date, wind speed, humidity,
barometer, calibrator, metric units, English
units, input manager, sensor sampler, wind
direction, display manager, trend, pressure,
current time, current date, current temp, high
temp, low temp, change temp, change time, power
up, power down, input buffer, trend, key,
running, selecting
15Eliminate Terms
- Refine the model by eliminating
- Redundancy classes that represent same concept
- Irrelevant classes things you dont care about
- Vague classes ill defined boundaries
- Attributes describe parts of objects
- Operators sequence of actions are often
mistaken for classes - Roles what it is not the role it plays
- Implementation details save it for later
16New Data Dictionary
- Time Date
- Sensors Temperature, Pressure, Humidity, Wind
Speed, Wind Direction - Keypad
- Input Manager
- Display (LCD Device)
- Display Manager
- Timer (clock)
- Sensor Sampler
17Collaboration Diagram Display high/low
inputManager
Kkeypad
1 Select
2 select sensor
Ssensor
3 select high/low
1.1 Select
2.1 select sensor
display
3.1 select high/low
3.2 get high/low
1.2 display Select
2.2 display selected sensor
displayManager
3.3 display value
18Display High/Low Temp
19Collaboration Diagram Calibrate
inputManager
3.1 set value
Kkeypad
1 calibrate
2 select sensor
Ssensor
3 select value
1.1 calibrate
2.1 select
display
3.2 select value
1.2 display calibrate
2.2 display selected
displayManager
3.3 display value
20Collaboration Diagram Temp Units
inputManager
3.1 set value
Kkeypad
1 mode
2 select sensor
Ssensor
3 select value
1.1 mode
2.1 select
display
3.2 select value
1.2 display mode
2.2 display selected
displayManager
3.3 display value
21Collaboration Diagram Set Time/Date
inputManager
3.1 set value
Kkeypad
1 Select
2 select Time/Date
cclock
3 select value
1.1 Select
2.1 select Time/Date
display
3.2 select value
1.2 display Select
2.2 display selected sensor
displayManager
3.3 display value
22Class Sensors
- Humidity, Windspeed, Winddirection, Pressure,
Temperature - Types?
- Historical
- Trends
- Calibration
- Temperature Keep track of current temp
- Operations current temp, setLowTemp, setHighTemp
- Attributes Temperature
- Need a means of calibrating this sensor.
23Sensor Class Hierarchy
24Class Time Data
- Name TimeDate
- Responsibilities
- Keep track of the current time and date
- Operations
- currentTime
- currentDate
- setFormat
- setHour, setMinute, setSecond
- setMonth, setDay, setYear
- Attributes
- time
- date
25State Machine Time
26Timer
- Need an timer that intercepts all timed events
and dispatches a callback function accordingly.
Every 1/60 of a second a hardware interrupt is
intercepted by timer and it dispatches the client
supplied callback. - Operations setCallback()
27System Control
- Need an objects for the overall control and data
acquisition. - inputManager
- displayManager
- Mange layout of LCD device
- Draws figures and values
- sampler
- Acquire data from all sensors
- Sends information to displayManager
- Samples sensors
- Wind direction every 0.1 seconds
- Wind speed every 0.5 seconds
- Temperature, barometric pressure, and humidity
every 5 minutes.
28State Machine Input Manager
Running
Waiting
Mode
Mode
Run
wind
temp
Select
Run
Calibrate
Selecting
Temp
Wind
wind
temp
Run
Processing
Calibrating
Up/Down Toggle mode
29Sequence Diagram Sampler
30Sample and Display Classes
31Design/Architecture
32Computed Values
33Some Implementation
- typedef unsigned int Tick // 1/60 sec.
- class Timer
- static setCallback(void()Tick)
- static startTiming()
- static Tick numberOfTicks()
- private
- //
-
34- class Sampler
- public
- Sampler()
- Sampler()
- void setSamplingRate(SensorName, Tick)
- void sample(Tick)
- Tick samplingRate() const
- private
- //
-
35- Sampler sampler
- void acquire(Tick t)
-
- sampler.sample(t)
-
- main()
- TimersetCallback(acquire)
- TimerstartTiming()
- while(true)
- return 0
-
36- class Sensors protected Collection
- public
- Sensors()
- Sensors()
- void addSesnsor(const Sensor SensorName,
- int id 0)
- int numberOfSensors() const
- int numberOfSensors(SensorName) const
- Sensor sensor(SensorName, int id 0)
- protected
- //
-
37- class Sampler
- public
- Sampler()
- Sampler(Sensor, DisplayManager)
- Sampler()
- void setSamplingRate(SensorName, Tick)
- void sample(Tick)
- Tick samplingRate() const
- private
- Sensors sensors
- DisplayManager repDisplayManager
-
38- void Samplersample(Tick t)
-
- for (SensorName name Direction
- name lt Pressure
- name)
- for (int id 0
- id lt repSensors.numberOfSensors(name)
- id)
- if (!(tsamplingRate(name)))
- repDisplayManger.display(
- repSensors.sensor(name,id).currentValu
e(), - name,
- id)