UML Diagrams Example-Weather Monitoring System
UML Diagrams Example-Weather Monitoring System
INDEX
i. UML-Introduction...……………………………..………….. 2
ii. Use Case Diagram……………………………………………3
iii. Problem Statement…………………………………………....4
iv. Functionalities of Use Case Diagram………………………...5
v. Class Diagram………………………………………………..6
vi. Sequence Diagram……………………………………………7
vii. Collaboration Diagram……………………………………….8
viii. State Diagram………………………………………………...9
ix. Activity Diagram……………………………………………..10
x. Physical Diagram
1. Component Diagram…………………………………...11
2. Deployment Diagram…………………………………..12
xi. Java Code Generation…………………………………………13
xii. Conclusion…………………………………………………….14
~2~
UML - INTRODUCTION
• User
• Structural
• Behavioral
• Implementation
• Environment
Structural View
Class Diagram
Object Diagram
Implementation View
Component Diagram
Behavioral View
Activity Diagram
Sequence Diagram
Collaboration Diagram
State Transition Diagram
Environment View
Deployment Diagram
~3~
PROBLEM STATEMENT:
FUNCTIONALITIES OF USECASE:
1) Name
• Specify date and time
• Measuring temperature
• Measuring Pressure
• Measuring Humidity
• Sensor
• Display
• Keypad
2) Objective
To meaure various parameters like temperature,pressure,humidity by means of
sensors provided the controller should initiate the process.The authorised user is provided
with the results.
CLASS DIAGRAM:
The class diagram depicts the relationship among classes. The following are the classes
used.
Classes:
Person
Controller
Time & Date specification
Keypad
Temperature measurement
Pressure measurement
Humidity measurement
Display
Relationship:
The Person have to seek the permission of the Controller to enter into the system.
The Person specifies the Time and Date.
The Time and Date is being specified through Keypad.
The Admin controls the temperature, pressure, humidity sensor.
The three systems display the values recorded by the sensor.
SEQUENCE DIAGRAM :
COLLABORATION DIAGRAM :
STATE DIAGRAM:
• The initial state is the state where the person enters the system.
• The Person is validated at the second level. If he is not a valid user, then he is
stopped which is represented using an aborted state .
• The date and time are specified by the person.
• The sensors are enabled.
• The temperature, pressure and humidity are measured and at a particular level
they are joined using a horizontal join.
• After that the values are moved to display interface.
• Finally the accepting state is reached.
ACTIVITY DIAGRAM :
• After the initial state , the person specifies the date and time.
• An activity group is formed at the second level. In the group, validation is done, if
he is not a valid user he is stopped from entering the system.
• The second activity in this group, is that the sensors are initiated by the controller.
• The sensors start measuring the parameters.
• The temperature, pressure and humidity are measured and at a particular level
they are joined using a horizontal cork.
• After that the values are moved to display interface.
• Finally the activity of displaying is done.
PHYSICAL DIAGRAMS:
1. COMPONENT DIAGRAM
Each component is provided for a purpose.
The person component specifies time and date which is given to
the controller.
The controller internally does many activities to check whether the
person is valid or not.
The controller delegates the sensors.
The sensors component is initiated by the controller. They in turn
measure temperature, pressure, humidity etc.
The values which are produced by the sensors are displayed
~ 12 ~
2. DEPLOYMENT DIAGRAM
JAVA CODE :
Humidity_Measurement
public class Humidity_Measurement
{
}
Pressure_Measurement
public class Pressure_Measurement
{
}
Sensors
public class Sensors
{
}
Temperature_Measurement
public class Temperature_Measurement
{
}
~ 14 ~
Pressure Sensor
public class Pressure Sensor
{
private int pressure;
public void CurrentPres () {
}
public void setLowPres () {
}
public void setHighPres () {
}
}
Temperature Sensor
public class Temperature Sensor
{
private int temperature;
public void currentTemp () {
}
public void setLowtemp () {
}
public void setHightemp () {
}
}
Humidity Sensor
public class Humidity Sensor
{
public void CurrentHum () {
}
public void setHighHum () {
}
public void setLowHum () {
}
Keypad
public class Keypad
{
private int type;
public void Press () {
}
}
Person
public class Person
{
private String Name;
private int Age;
~ 15 ~
Controller
Public class controller
{
}
Conclusion
Thus, considering the weather monitoring system, analysis is made and design is
obtained through various UML diagrams.