UML Diagrams Example-Weather Monitoring System

15  12  Download (0)

Full text

(1)

Author : S.ARUL PATCHI PRASATH

Dept of CSE.

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

(2)

UML - INTRODUCTION

A software development method consists of a modeling language and a process. The Unified Modeling Language (UML) is called a modeling language, not a method. The modeling language is the notation that methods use to express designs. The process describes the steps taken in doing a design.

The Unified Modeling Language (UML) is developed as a graphical language for visualizing, specifying, constructing, and documenting the artifacts of a software-intensive system. In the UML, the five main views of the system are

• 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

(3)

USE CASE DIAGRAM:

• It consists of 7 use cases. Each use case depicting one use.

• The use cases are specify date and time, measuring temperature, measuring pressure, measuring humidity, display, sensors to measure the above parameters.

• The sensors provided mark the behavior of the various parameters. Hence the sensor extends the temperature, pressure and humidity.

• The keypad is used to specify time and date.

• Hence it is included by the use case specify time and date.

(4)

PROBLEM STATEMENT:

• The user has to specify the date and time.

• The controller is the person who monitors and manages the entire system.

• The Person is validated at the second level. If he is not a valid user, then he is stopped.

• The keypad is used to specify time and date.

• After the person had specified the date and time, the controller will instruct the sensor to sense and hence measure the temperature, pressure, humidity.

• Measuring temperature, measuring pressure, measuring humidity are the actions done by the sensors to measure the above parameters.

• The sensors provided mark the behavior of the various parameters. Hence the sensor extends the temperature, pressure and humidity.

• After measuring, the systems have to display the value. Each system will instruct to display.

(5)

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.

3) Precondition & Postcondition

The authorised user is allowed to enter the system. The results provided to the user should be exact.

4) Normal Flow & Alternate Flow

If the user is an authorised person,he will reach upto the display interface.

(6)

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.

(7)

SEQUENCE DIAGRAM :

• The sequence diagram describes the various sequences of events.

• After the person had specified the date and time, the controller will instruct the sensor to sense and hence measure the temperature, pressure, humidity.

• After measuring, the systems have to display the value. Each system will instruct to display.

• The lifeline of the objects will be over after getting displayed.

(8)

COLLABORATION DIAGRAM :

• The time order of messages is shown explicitly by sequence numbers.

• The designer is facilitated with a better understanding of links between objects and hence implementation becomes easier.

• The sequences are given an order in which they are executing.

• Process takes place in that order only.

• After the person had specified the date and time, the controller will instruct the sensor to sense and hence measure the temperature, pressure, humidity .

• After measuring, the systems have to display the value. Each system will instruct to display.

(9)

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.

(10)

ACTIVITY DIAGRAM :

• The activity diagram discusses about the activities used.

• 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.

(11)

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.

(12)

Screen shot of Component Diagram:

2. DEPLOYMENT DIAGRAM

• Some components are enclosed under a node.

• Here Person, Controller and Sensor are the nodes used.

• Under the Person node, the component used is specifying time and date.

• The person requests the controller.

• Under the controller node, validation component is used .This component is meant for validation of the user.

• The final node contains 2 components.

• The first component is meant for measuring the values and the second component is meant for displaying the values.

(13)

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)

private int Sex; private int Privilege; public void Specify () { }

public void Change () { }

}

Time and Date

public class Time and Date {

public void Unnamed () { }

}

Controller

Public class controller {

}

Conclusion

Thus, considering the weather monitoring system, analysis is made and design is obtained through various UML diagrams.

Figure

Updating...