Harshita Main Project (Autosaved)

103
A Permutation-based algorithm to optimally reschedule trains in railway traffic network CHAPTER - 1 INTRODUCTION 1 Department Of CSE GDMM , Nandigama

description

A Permutation-based Algorithm TRAIN

Transcript of Harshita Main Project (Autosaved)

A Permutation-based algorithm to optimally reschedule trains in railway traffic network

CHAPTER - 1INTRODUCTION

In this paper we discuss dynamic traffic management of railway traffic networks at an operational level. We design a model predictive controller based on measurements of the actual train positions. The core of the model predictive control approach is the railway traffic model, for which a switching max-plus linear system is proposed. If the model is affine in the controls, the optimisation problem can be recast as a mixed-integer linear programming problem. To this end we present a permutation-based algorithm to model the rescheduling of trains running on the same track. We apply the algorithm to a simple railway traffic network simulation model and show a significant reduction of delays compared to the uncontrolled case.1.1 MOTIVATIONThe motivation for the research is to provide signallers with better decision support

than is currently available in operational control systems. In this thesis, existing

algorithms for optimal train rescheduling are reviewed and a new algorithm is

developed. In which rescheduling approaches discussed in this thesis, only deal with

timetable disturbances and does not include rerouting of trains.In certain circumstances, if only one train is delayed, and only a small local area is

considered, train rescheduling can be a straightforward problem. However, as the

number of trains and the geographic area under consideration increase, the problem

becomes more complex. Furthermore, each of the trains may be of a different type

(high speed, commuter or freight). This means that each train will have different

accelerating and braking rates and a different top speed. The problem of deciding

upon an optimal solution then becomes even more complex, even for a simple

scenario.There are many different algorithms that can be used for optimisation; each has its

own strengths and weaknesses. For real-time train control, in practice, there is a trade

off between computation time and the identification of an optimal solution, i.e., the best possible solution. It is not straightforward to choose the most suitable algorithm to reduce the delay. The early chapters of this thesis therefore aim to compare and discuss a number of potential algorithms suitable for real-time railway control, in terms of required computation time and solution optimality. Eight optimization algorithms are selected for testing on four railway rescheduling benchmark scenarios.

Based on a comparison and discussion of the algorithms implementation, the

strengths and weaknesses of these algorithms are concluded with respect to the

railway rescheduling problem. The approach with the best performance is selected for

further study. In order to have a better resolution in a shorter computing time, further

research and analysis is carried out on the selected approach.

Finally, a new approach to optimal multi-junction rescheduling for a control region is

developed and tested, and then refined.

For all of the rescheduling approaches discussed in this thesis, it is very important to

estimate the running time as accurately as possible. Therefore, a multi train simulator

is designed and built is this thesis. Since a significant amount of work was conducted

on this simulator, the concepts and functions are introduced and the techniques and the equations are illustrated in detail in Appendix A. In addition, the rescheduling solutions are further examined by means of the Railway Traffic Controller (RTC) software which is the American standard software to plan and control railway traffic.

1.2 PROBLEM DEFINITIONRailway timetabling and rescheduling play a central role in day-to-day railway

operations. Trains on a railway network are scheduled and controlled according to a

timetable. Timetables are designed to be conflict free, that is, they should not contain

any situations where a train is restricted in its scheduled movement by another train.

However, in practice not all trains run according to the timetable due to delays such as

excessive dwell times at stations, infrastructure and/or train faults, and the late arrival

of crew. When trains do not operate according to the timetable, even by only a few

seconds, there is an increased likelihood that they will cause conflicts with other trains,

resulting in those trains also being delayed. Railway operators therefore attempt to run

trains to timetable, or, failing this, they try to minimise the cost of delays.

Generally, in todays railways, most train control is carried out by human operators

signallers. They are able to control the operation of signals to reschedule and prioritise

traffic flows. In simple scenarios, signallers are able to manage the flow of traffic

effectively. However, it has been shown that, as situations become more complex,

there is an increased likelihood of signallers making sub-optimal traffic management

decisions. This is particularly likely in significantly disturbed situations (Balfe et al.,

2007).

In the UK, 49% of trains arrive at their destination on time i.e., on or before their

scheduled timetable time (Best and Hyland, 2012). This means that 51% of trains are

late. Signallers need support in deciding upon the most appropriate train rescheduling

(train speed and sequences) to minimise the potential for further delays.

Figure 1-1: Statistics of train lateness in 2010/11by Network Rail (Best and Hyland, 2012)In recent years, railway operators have sought to find technology based solutions that

can help signallers make improved decisions. Such decision support or automatic

control systems have been deployed on many networks . In general they

rely on straightforward heuristic algorithms. These simple algorithms are able to

provide useful solutions in many cases, but, as situations become more complex, they

do not perform well .Therefore, many researchers throughout the

world have considered the use of more advanced algorithms as part of real-time

optimisation systems for railway traffic management.1.3 OBJECTIVE OF THE PROJECTWe have presented a control design method for a railway network. The control action consists in breaking certain connections or changing the order of departure to prevent delays from accumulating. These control moves can only be done at a certain cost. We have shown that the resulting optimization problem is a mixed integer linear programming (MILP) problem,that can be solved using existing commercial and free solvers for MILP problems, orby other integer optimization methods, for example genetic algorithms or tabu search.

Good initial values for the integer optimization are obtained by first solving a lowdimensionalreal-valued optimization problem using a structured input sequence. This structuredinput sequence is based on a decision mechanism, where we use thresholds on (expected)delays to decide whether a connection should be broken or the order of the trainsshould be switched.

Due to the use of a receding horizon this method can be used in on-line applications

and it can deal with (predicted) changes in the system parameters. So if we can predict thedelays that will occur due to an incident or to works, then we can include this information when determining the optimal control input for the next cycles of the operation of the network. The main objective of the project is we present a permutation-based algorithm to model the rescheduling of trains running on the same track.we design a predictive feedback controller that computes the most effective actions, based on measurements of the actual train positions. The control measures are restricted to changing the order of trains running on the same track.1.4 LIMITATION S OF PROJECT

The Limitation of the project is,When the trains running on the same track, there is a problem arised of conflicting of trains may be in two ways either in opposite direction or same direction.1.5 ORGANIZATION OF DOCUMENT

In this project documentation we have initially put the definition and objective of the project as well as the design of the project which is followed by the implementation and testing phases. Finally the project has been concluded successfully and also the future enhancements of the project were given in this documentation.

CHAPTER - 2

LITERATURE SURVEY2.1 INTRODUCTION

The operational-level management of railway traffic networks is mostly based on predefined rules and on the ability of traffic controllers and train dispatchers to detect and avoid conflicting situations. Delays caused by technical failures, fluctuation of passenger volumes, and/or weather conditions can be partly absorbed by a stable and robust timetable In the case of large delays, network managers might be forced to re-route or to change the order of trains, break connections, or even cancel a scheduled service to prevent the accumulation of delays in the network. In this paper we design a predictive feedback controller that computes the most effective actions, based on measurements of the actual train positions. The control measures are restricted to changing the order of trains running on the same track. A railway network with rigid connection constraints and a fixed routing schedule can be modeled using max-plus linear (MPL) models. An MPL odel is linear in the max-plus algebra, which has maximisation and addition as its basic operations.. In the railway context, synchronization means that some trains should give predefined connections to other trains, and a fixed routing schedule means that the order of departure is fixed. In this paper we model a controlled railway system using the switching max-plus-linear system description of. In this description we use a number of MPL models, each model corresponding to a specific mode, describing the network by a different set ofconnection and order constraints. We control the system by switching between different modes, allowing us to change the order of trains to minimise the delays of all trains in the network while considering the cost of the control actions.2.2 EXISTING SYSTEM:

Current practice in the operational-level management of railway traffic networks is mostly based on predefined rules and on the ability of traffic controllers and train dispatchers to detect and avoid conflicting situations. Delays caused by technical failures, fluctuation of passenger volumes, and/or weather conditions can be partly absorbed by a stable and robust timetable. In the case of large delays, network managers might beforced to re-route or to change the order of trains, break connections, or even cancel a scheduled service to prevent the accumulation of delays in the network.2.3 DISADVANTAGES OF EXISTING SYSTEM

1) In this we use traffic controllers ,train dispatchers , network managers .

2) Using of manual power more.

3) Time complexity is high.

4) Exactness of problem is difficult.

5) Problem solution is not sufficient in some cases including small delays and large delays

2.4 PROPOSED SYSTEM

In this paper we design a predictive feedback controller that computes the most effective actions, based on measurements of the actual train positions. The control measures are restricted to changing the order of trains running on the same track.2.5 ADVANTAGES OF PROPOSED SYSTE

1) Time complexity is reduced.2) Manual power is lowered.

3) Exact throughputs are obtained.

4) Problem identification is very easier and solution to the problem became very fast.2.6 CONCLUSIONWe have presented an approach to optimally reschedule trains on a railway network based on a permutation method.We have modeled the system based on the switching max-plus framework and showed how the control problem can be recast as a mixed-integer linear programming problem. Compared to previous results we have extended the control actions to change the departure and arrival order of non-subsequent trains. For a simple railway network we have shown that by optimally rescheduling trains using the proposed approach delays can be substantiallyreduced.CHAPTER-3

ANALYSIS

3.1 FEASIBILITY STUDYA feasibility study is a test of the system proposal regarding to its work ability, impact on the organization, ability to meet user needs, and effective use of resources. Thus when a new application is proposed, it normally goes through a feasibility study before its is approved for development.

An important outcome of the preliminary investigation is the determination that the system requested is feasible.

TECHNICAL FEASIBILITY:

Evaluating the technical feasibility is the trickiest part of a feasibility study. This is because , at this point in time, not too many detailed design of the system, making it difficult to access issues like performance, costs on ( account of the kind of technology to be deployed) etc. A number of issues have to be considered while doing a technical analysis.

1) Understand the different technologies involved in the proposed system :

Before commencing the project, we have to be very clear about what are the technologies that are to be required for the development of the new system.

2) Find out whether the organization currently possesses the required technologies:

1) Is the required technology available with the organization?

2) If so is the capacity sufficient?

ECONOMIC FEASIBILITY:Economic feasibility attempts 2 weigh the costs of developing and implementing a new system, against the benefits that would accrue from having the new system in place. This feasibility study gives the top management the economic justification for the new system.A simple economic analysis which gives the actual comparison of costs and benefits are much more meaningful in this case. In addition, this proves to be a useful point of reference to compare actual costs as the project progresses. There could be various types of intangible benefits on account of automation. These could include increased customer satisfaction, improvement in product quality better decision making timeliness of information, expediting activities, improved accuracy of operations, better documentation and record keeping, faster retrieval of information, better employee morale.

OPEARTIONAL FEASIBILITY:

Proposed projects are beneficial only if they can be turned into information systems that will meet the organizations operating requirements. Simply stated, this test of feasibility asks if the system will work when it is developed and installed. Are there major barriers to Implementation? Here are questions that will help test the operational feasibility of a project:

1) Is there sufficient support for the project from management from users? If the current system is well liked and used to the extent that persons will not be able to see reasons for change, there may be resistance.

2) Are the current business methods acceptable to the user? If they are not, Users may welcome a change that will bring about a more operational and useful systems.

3) Have the user been involved in the planning and development of the project?

4) Early involvement reduces the chances of resistance to the system and in

5) General and increases the likelihood of successful project.

Since the proposed system was to help reduce the hardships encountered. In the existing manual system, the new system was considered to be operational feasible. 3.2 SOFTWARE SYSTEM SPECIFICATION

3.2.1 PURPOSE OF THE PROJECT

In recent years a lot of research effort has been oriented towards the design of timetables that are robust against propagation of delays in the network, caused by technical failures, fluctuation of passenger volumes, measures of railway personnel and weather influence .

In this paper we concentrate on the operational-level management, and design a feedback controller that takes the most effective actions, based on measurements of the actual train positions. The measures we can take are changing the train speed, breaking train connections, or changing the order of trains.3.2.2 SCOPE OF THE PROJECT

Before estimating the train journey times one by one according to the order of passing

a junction area in the simulation when sequence is known, it is essential to introduce

the time superposition method first. This time superposition method is used when

more than one train could pass the junction area at the same time. By using this

method, the right of way signal time for each train can be given by the time one of the

front trains leaves the junction area, and the results of the superposition method will

show which train is the front train. Figure A-2 shows an example junction and Figure

A-3 presents the related right of way signal time of the sequence 1-2-3-4-5-6-7-8-9-

10-11-12; the white block is the right of way signal time for each train; the black

block is the train running time of passing the junction area. The outputs of using the superposition method are finding the exact front train that the current train should

follow.

3.3 SYSTEM CONFIGURATION3.3.1 Software SpecificationOperating System:Windows XP

Technology

:JAVA 1.6

Application Server : Tomcat5.0/6.X

Front End

: HTML, Java, Jsp

Scripts

: JavaScript.

Server side Script: Java Server Pages.

Database

: MysQl

Database Connectivity : JDBC.

3.3.2 Hardware Specification

Processor

:Pentium IV

RAM

:256 MB

Hard Disk

:80GB

Key Board

:Standard Windows Keyboard

Mouse

: Two or Three Button Mouse3.4 PROJECT SOFTWARE SPECIFICATION3.4.1 INTRODUCTION TO JAVA

CREATION OF JAVA:

Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank and Mike Sheridan at SUN Microsystems Incorporation in the year 1991.It took 18 months to develop the 1st working version. This language was initially called OAK, but was renamed JAVA in 1995, many more contributed to the design and evolution of the language.

JAVA OVERVIEW:

Java is a powerful but lean object-oriented programming language. It has generated a lot of excitement because it makes it possible to program for Internet by creating Applets. Programs that can be embedded in web page. The context of an applet can be an animation with sound, an interactive game or a ticker tape. With constantly updated stock prices. Applets can be just little decorations to liven up web page, or they can be serious applications like Word processor or Spreadsheet.

But Java is more than a programming language for writing Applets. It is being used more and more for writing standalone applications as well. It is becoming so popular that many people believe it will become standard language for both general purpose and Internet programming.

There are many buzzwords associated with Java, but because of its spectacular growth in popularity, a new buzzword has appeared ubiquitous. Indeed, all indications are that it will soon be everywhere.

Java builds on the strength of C++. It has taken the best features of C++ and discarded the more problematic and error prone parts. To this lean core, it has added garbage collection (automatic memory management), multithreading (the capacity for one program to do more than one thing at a time), security capabilities. This result is that Java is simple, elegant, and powerful and easy-to-use.

Java is actually a platform consisting of 3 components:

1) Java Programming Language.

2) Java Library of Classes and Interfaces.

3) Java Virtual Machine3.4.2 FEATURES OF JAVADistributed

Java has an extensive library of routines for coping with TCP/IP protocols like HTTP and FTP Java applications can open and access across the Net via URLs with the same ease as when accessing local file system.

We have found the networking capabilities of Java to be both strong and easy to use. Anyone who has tries to do Internet programming using another language will revel. How simple Java makes onerous tasks will like opening a socket connection.

Robust

Java is intended for writing programs that must be readable in a Variety ways. Java puts a lot of emphasis on early checking for possible problems, later dynamic checking, and eliminating situations that are error prone. The single biggest difference between

The Java compiler detects many problems that in other languages would only show up at runtime. As for the second point, anyone who has spent hours chasing a memory leak cost by a printer bug will be very happy with this feature of Java.

Java gives you the best of both worlds. You need not pointers for everyday constructs like string and arrays. You have the power of pointers if you need it, for example, for like lists. And you have always-complete safety, since you can never access a bad pointer or make memory allocation errors. Secure

Java is intended to be used in networked/distributed environment toward that end; a lot of emphasis has been placed on security. Java enables the contraction of virus-free, temper-free systems.

Here is a sample of what Javas security features are supposed to keep a Java programming from doing:

1. Overrunning the runtime stack.

2. Corrupting memory outside its own process space.

3. Reading or writing local files when invoked through a security-

Conscious class loaders like Web browser.

Portable

Unlike C and C++, they are no "implementation dependent" aspects of the specifications. The sizes of the primitives data types are specified, as is the behavior of arithmetic on them.

For example, an int in Java is always a 32-bit integer. In C/C++, int can mean a 16-bit integer, a 32-bit integer, or any size the compiler vendor likes. The only restriction is that it must have at least as many bytes int and cannot have more bytes than a long int.

The libraries that are a part of the system define portable interfaces. For example, there is an abstract window class and implementations of it UNIX, Windows, and the Macintosh.

Interpreted

The Java interpreters can execute Java byte codes directly on any machine to which the interpreter has been ported. Since linking is a more incremental and lightweight process, the development process can be much more rapid and explanatory.

One problem is that the JDK is fairly slow at compiling your source code to the bytecode that will, ultimately, be interpreted in the current version MultithreadedIn a number of ways, Java is more dynamic language than C or C++. It was designed to adapt to an evolving environment. Libraries can freely add new methods and instance variables without any effect on their clients.... In Java, finding out run time type information is straightforward.This is an important feature in those situations where code needs to be added to a running program. A prime example is code that is downloaded from the Internet to run in browser.3.4.3 SERVLETS

Servlets provides a Java-Based solution used to address the problems currently associated with doing server side programming, including inextensible scripting solutions, platform specific APIs, and incomplete interfaces. Servlets are objects conform to a specific interface that can be plugged into a Java-based server. Servlets are to the server-side what applets are to the client-side-object byte codes that can be dynamically loaded off the net. They differ from applets in that they are faceless objects (without graphics or a GUI component). They serve as platform independent, dynamically loadable, plug gable helper byte code objects on the server side that can be used to dynamically extend server-side functionality.

THE ATTRACTIVE OF SERVLETS:

There are many features of servlets that make them easy and attractive to use. These include:

Easily configured using the GUI-based Admin Tool.

Can be loaded and invoked from a local disk or remotely across the network.

Can be linked together, or chained, so that one servlet can call another servlets, or several servlets in sequence.

Can be called dynamically from within HTML pages, using server-side include tags

INVOKING THE SERVLET:

To invoke a servlet you call it by creating a URL with /servlet/ pretended to the servlet name. Then enter this URL in your favorite browser to see the output of the Servlet.

Example:

After installing according to the directions above, access the HelloServlet by entering the following URL in your favorite browser:

http://server-host-name:8080/servlet/hellINTERNAL SERVLETS:

The Java Server servlet architecture is very flexible and the server takes advantage of this by dividing up its work among several internal servlets. These are

File Servlet

Invoker Servlet

Server side include servlet

Admin Servlet

CGI Servlet

Image map servlet3.4.4 INTRODUCTION TO JDBC

JDBC (Java Database connectivity) is a front-end tool for connecting to a server to ODBC in that respect, however JDBC can connect only java client and it uses ODBC for the connectivity. JDBC is essentially a low-level API since any data manipulation, storage and retrieval has to be done by the program itself. Some tools, which provide a higher-level abstraction, are expected shortly.

The next question that needs to be answered is why we need JDBC, once we have ODBC on hand. We can use the same ODBC to connect the entire database and ODBC is a proven technology.

Problem for doing this is ODBC gives a c language API, which uses pointers extensively. Since java does not have any pointes and is object-oriented sun Microsystems, inventor of java developed to suit its needs.

REQUIREMENTS TO USE JDBC:To use JDBC you need a basic knowledge of databases and SQL.A part from this you need the jdk1.1 (Java Development Kit1.1 available javasofts website) or a version of Java since jdk1.1 and above come bundled with JDBC software.

After that you need to have a back-end database engine for which a JDBC driver is available. When JDBC drivers are not available JDBC-ODBC bridge drivers are used to access the database through ODBC.Back-end is not needed when JDBC driver is capable of storing and retrieving the data itself, or if JDBC-ODBC Bridge and the ODBC driver can be used to store and retrieve the information.

3.4.6 DATA BASE MODELS

JDBC and accessing the database through applets and JDBC.API via an intermediate server resulted server resulted in a new type of database model which is different from the client-server model. Based on number of intermediate server through the request should go it is named as single tire, two tire and multi tire architecture

SINGLE TIER:

In a single tier the server and client are the same in the sense that a client program that needs information (client) and the source of this type of architecture is also possible in java, in case flat files are used to store the data. However this is useful only in case of small applications. The advantage with this is the simplicity and portability of the application developed.

TWO TIER (CLIENT-SERVER): In two architecture the database resides in one machine the network. In this type of architecture a database management takes control of the database and provides access to clients in a network. This software bundle is also called as the server. Software in different machines, requesting for information are called as the clients.

THREE TIER AND N-TIER:

In the three-tier architecture, any number servers can access the database that resides on server. Which in turn serve clients in a network. For example, you want to access the database using java applets, the applet running in some other machine, can send request only to the server from which it is down loaded. For this reason we will need to have a intermediate server which will accept the requests from applets and them to the actual database server. This intermediate server acts as a two-way communication channel also. This is the information or data from the database is passed on to the applet that is requesting it. This can be extended to make n tiers of servers, each server carrying to specific type of request from clients, however in practice only 3 tiers architecture is popular.

3.5 CONCLUSION

In this phase, we understand the software requirements specifications for the project. We arrange all the required components to develop the project in this phase itself so that we will have a clear idea regarding the requirements before designing the project. Thus we will proceed to the design phase followed by the implementation phase of the project.CHAPTER 4

DESIGN4.1 INTRODUCTION

4.1.1 INPUT DESIGN

The input design is the link between the information system and the user. It comprises the developing specification and procedures for data preparation and those steps are necessary to put transaction data in to a usable form for processing can be achieved by inspecting the computer to read data from a written or printed document or it can occur by having people keying the data directly into the system. The design of input focuses on controlling the amount of input required, controlling the errors, avoiding delay, avoiding extra steps and keeping the process simple. The input is designed in such a way so that it provides security and ease of use with retaining the privacy. Input Design considered the following things:

1) What data should be given as input?

2) How the data should be arranged or coded?

3) The dialog to guide the operating personnel in providing input.

4) Methods for preparing input validations and steps to follow when error occur.

4.1.2 OBJECTIVES

Input Design is the process of converting a user-oriented description of the input into a computer-based system. This design is important to avoid errors in the data input process and show the correct direction to the management for getting correct information from the computerized system.

It is achieved by creating user-friendly screens for the data entry to handle large volume of data. The goal of designing input is to make data entry easier and to be free from errors. The data entry screen is designed in such a way that all the data manipulates can be performed. It also provides record viewing facilities

When the data is entered it will check for its validity. Data can be entered with the help of screens. Appropriate messages are provided as when needed so that the user will not be in maize of instant. Thus the objective of input design is to create an input layout that is easy to follow

4.1.3 OUTPUT DESIGN

A quality output is one, which meets the requirements of the end user and presents the information clearly. In any system results of processing are communicated to the users and to other system through outputs. In output design it is determined how the information is to be displaced for immediate need and also the hard copy output. It is the most important and direct source information to the user. Efficient and intelligent output design improves the systems relationship to help user decision-making.

1. Designing computer output should proceed in an organized, well thought out manner; the right output must be developed while ensuring that each output element is designed so that people will find the system can use easily and effectively. When analysis design computer output, they should Identify the specific output that is needed to meet the requirements.

2. Select methods for presenting information.

3. Create document, report, or other formats that contain information produced by the system.

The output form of an information system should accomplish one or more of the following objectives.

1) Convey information about past activities, current status or projections of the

2) Future.

3) Signal important events, opportunities, problems, or warnings.

4) Trigger an action.

5) Confirm an action

4.2 UML DIAGRAMS

4.2.1 INTRODUCTION

UML is a method for describing the system architecture in detail using the blueprint.UML represents a collection of best engineering practices that have proven successful in the modeling of large and complex systems.

UML is a very important part of developing objects oriented software and the software development process.

UML uses mostly graphical notations to express the design of software projects. Using the UML helps project teams communicate, explore potential designs, and validate the architectural design of the software.DefinitionUML is a general-purpose visual modeling language that is used to specify, visualize, construct, and document the artifacts of the software system.UML is a languageIt will provide vocabulary and rules for communications and function on conceptual and physical representation. So it is modeling language.

UML Specifying

Specifying means building models that are precise, unambiguous and complete. In particular, the UML address the specification of all the important analysis, design and implementation decisions that must be made in developing and displaying a software intensive system.UML Visualization

The UML includes both graphical and textual representation. It makes easy to visualize the system and for better understanding.

UML Constructing

UML models can be directly connected to a variety of programming languages and it is sufficiently expressive and free from any ambiguity to permit the direct execution of models.

UML Documenting

UML provides variety of documents in addition raw executable codes.

Fig 4.1: Modeling a System Architecture using views of UML

The use case view of a system encompasses the use cases that describe the behavior of the system as seen by its end users, analysts, and testers. The design view of a system encompasses the classes, interfaces, and collaborations that form the vocabulary of the problem and its solution. The process view of a system encompasses the threads and processes that form the system's concurrency and synchronization mechanisms. The implementation view of a system encompasses the components and files that are used to assemble and release the physical system. The deployment view of a system encompasses the nodes that form the system's hardware topology on which the system executes.

Uses of UML

The UML is intended primarily for software intensive systems. It has been used effectively for such domain as

Enterprise Information System

Banking and Financial Services

Telecommunications

Transportation

Defense/Aerospace

Retails

Medical Electronics

Scientific Fields

Distributed Web

Building blocks of UML

The vocabulary of the UML encompasses 3 kinds of building blocks

Things

Relationships

Diagrams

Things

Things are the data abstractions that are first class citizens in a model. Things are of 4 types

Structural Things, Behavioral Things , Grouping Things, An notational Things

RelationshipsRelationships tie the things together. Relationships in the UML are

Dependency, Association, Generalization, Specialization

UML Diagrams

A diagram is the graphical presentation of a set of elements, most often rendered as a connected graph of vertices (things) and arcs (relationships).

There are two types of diagrams, they are

Structural and Behavioral Diagrams

Structural Diagrams

The UMLs four structural diagrams exist to visualize, specify, construct and document the static aspects of a system. View the static parts of a system using one of the following diagrams. Structural diagrams consist of Class Diagram, Object Diagram, Component Diagram, and Deployment Diagram.

Behavioral Diagrams

The UMLs five behavioral diagrams are used to visualize, specify, construct, and document the dynamic aspects of a system. The UMLs behavioral diagrams are roughly organized around the major ways which can model the dynamics of a system.

Behavioral diagrams consists of

Use case Diagram, Sequence Diagram, Collaboration Diagram, State chart Diagram, Activity Diagram

4.2.2 CLASS DIAGRAM

Class diagrams are widely used to describe the types of objects in a system and their relationships. Class diagrams model class structure and contents using design elements such as classes, packages and objects. Class diagrams describe three different perspectives when designing a system, conceptual, specification, and implementation. These perspectives become evident as the diagram is created and help solidify the design. Class diagrams are arguably the most used UML diagram type. It is the main building block of any object oriented solution. It shows the classes in a system, attributes and operations of each class and the relationship between each class. In most modeling tools a class has three parts, name at the top, attributes in the middle and operations or methods at the bottom..

Fig 4.2 : Example Class Diagram

Fig 4.3 : Class Diagram4.2.3 USE-CASE DIAGRAM

A use case is a set of scenarios that describing an interaction between a user and a system. A use case diagram displays the relationship among actors and use cases. The two main components of a use case diagram are use cases and actors.

Fig 4.4: Elements of use-case DiagramAn actor is represents a user or another system that will interact with the system you are modeling. A use case is an external view of the system that represents some action the user might perform in order to complete a task.

Contents:

Use cases

Actors

Dependency, Generalization, and association relationships

System boundary

Fig 4.5 : Use-Case Diagram(1)

Fig 4.6 : Use Case diagram(2)4.2.4 SEQUENCE DIAGRAM

Sequence diagrams in UML shows how object interact with each other and the order those interactions occur. Its important to note that they show the interactions for a particular scenario. The processes are represented vertically and interactions are show as arrows1) Show the dynamic collaboration between objects for a sequence of messages sent between them in a sequence of time

2) Time sequence is easier to see in the sequence diagram, read from top to bottom

3) Choose sequence diagram when only the sequence of operations needs to be shown

Fig 4.7 : Example Sequence Diagram

Fig 4.8 : Sequence Diagram(1)

Fig 4.9 : Sequence Diagram(2)

4.2.5 COLLABORATION DIAGRAM

Communication diagram was called collaboration diagram in UML. It is similar to sequence diagrams but the focus is on messages passed between objects. The same information can be represented using a sequence diagram and different objects.

Fig 4.10 : Collaboration Diagram(1)

Fig 4.11 : Collaboration Diagram(2)

4.2.6 ACTIVITY DIAGRAM

Activity diagrams describe the workflow behavior of a system. Activity diagrams are similar tostate diagramsbecause activities are the state of doing something. The diagrams describe the state of activities by showing the sequence of activities performed. Activity diagrams can show activities that are conditional or parallel

Activity diagrams should be used in conjunction with other modeling techniques such asinteraction diagramsand state diagrams. The main reason to use activity diagrams is to model the workflow behind the system being designed. Activity Diagrams are also useful for: analyzing a use case by describing what actions need to take place and when they should occur;describing a complicated sequential algorithm;and modeling applications with parallel processes.

1) Show the sequential flow of activities

2) Typically in an operation

3) Also in a use case or event trace

4) Complement the class diagram by showing the workflow of the business (aka Flowchart)

5) Encourage discovery of parallel processes which helps eliminate unnecessary sequences in business processes

Elements Symbols

Initial state

Final state

Action state

Control flow

Fig 4.12 : Activity Diagram

4.2.7 STATE CHART DIAGRAMS

State chart diagrams are similar to activity diagrams although notations and usage changes a bit. They are sometime known as state diagrams or start chart diagrams as well.. Below State machine diagram show the basic states and actions.

Fig 4.13 : State Chart Diagram4.2.8 COMPONENT DIAGRAM

A component diagram displays the structural relationship of components of a software system. These are mostly used when working with complex systems that have many components.. Below images shows a component diagram.

Fig 4.14 : Component Diagram4.2.9 DEPLOYMENT DIAGRAM

A deployment diagrams shows the hardware of your system and the software in those hardware. Deployment diagrams are useful when your software solution is deployed across multiple machines with each having a unique configuration

Fig 4.15 : Deployment Diagram

4.3 LOGICAL DESIGN

Logical design is a process through which requirements are translated into a representation of software. Initially the representation depicts a holistic view of software. Subsequent refinement leads to a design representation that is very close to source code.

The conceptual structure of a database is called a schema. Schema shows the kinds of data that exists in a database and how the kinds of data are logically related to each other. A schema can be regarded as a blueprint that portrays both kind of data used in building a database and logical relationship that exist among various kinds of data. At the minimum, the schema must represent all needed data items, must correctly represent their interrelationships, and must be able to support all reports. Schema is frequently depicted pictorially using Data Flow Diagrams (DFD).

4.3.1 DATA FLOW DIAGRAMS

Data Flow Diagrams (DFD) depicts information flow and transforms that are applied as data move from input to output. The DFD is also known as Data Flow Graph or Bubble Chart. It is the starting point of the design phase that functionality decomposes the requirement specification down to the lowest level of details. Thus, a DFD describes what data flows (logical) rather than how they are processed. Data Flow Diagrams are made up of number of symbols which represent system components. Data Flow modeling methods used for kinds of symbols. These symbols are used to represent four kinds of system components. Processes, Data Stores, External Entities, Data Flows.

Processes

Processes show what system does. Each process has one or more data inputs and produces one or more data outputs. Processes are represented by round rectangles in DFD.

Data Stores

A file or data stores is repository of data. Processes can enter data into a store or retrieve data from data store. The line in the DFD and each store represents each data store as a unique name.

External Entities

External entities are outside the system but they supply either input data into the system or used for the system output. They are entities on which the designer has no control. There may be an organization or other bodies with which system interacts.

Data Flows

Data Flows model the passage of data on the system and represented by the lines joining the system components. An arrow indicates the direction of flow and line is labeled by the name of data flow. Flow of data in the system can take place

1) Between two processes

2) From a data store to a process

3) From a process to a process

4) From source to a processData flow diagrams are used to describe how the system transforms information. They define how information is processed and stored and identify how the information flows through the process.

When building a data flow diagram, the following items should be considered:1) Where does the data that passes through the system come from and where does it go.2) What happens to the data once it enters into the system (i.e., the inputs) and before it leaves the system (i.e., the outputs).3) What delays occur between the inputs and outputs (i.e. identifying the needs for data stores).

Steps to Draw a Data Flow Diagram:

1) Start from the context diagram Identify the parent process and external entities with their net inputs and outputs.2) Place the external entities on the diagram. Draw the boundary.3) Identify the data flows needed to generate the net inputs and outputs to the external entities.4) Identify the business processes to perform the work needed to generate the input and output data flows.5) Connect the data flows from the external entities to the processes.6) Identify the data stores.7) Connect the processes and data stores with data flows.8) Apply the processes Model Paradigm to verify that the diagram addresses the processing needs of all external entites.9) Apply the processes Model Paradigm to further validate that the flows to the external entites are correct.10) Connect the data flows from the external entites to the process.11) Identify the data stores.12) Connect the data stores and processes with data flows.13) Apply the processes Model Paradigm to verify that the diagram addresses the processing needs of all external entites.14) Apply the External Control Paradigm to further validate that the flows to the external entites are correct.15) Continue to decompose to the nth level DFD. Draw all DFDs at one level before moving to the next level of decomposing detail. You should decompose horizontally first to a sufficient nth level to ensure that the processes are partitioned correctly; then you can begin to decompose vertically.

DFD SYMBOLS:

In the DFD, there are four symbols

1) A square defines a source(originator) or destination of system data

2) An arrow identifies data flow. It is the pipeline through which the information flows

3) A circle or a bubble represents a process that transforms incoming data flow into outgoing data flows.

4) An open rectangle is a data store, data at rest or a temporary repository of data

Process that transform data flow

Source or Destination of data

Data flow

Data Store

CONSTRUCTING A DFD:

Several rules of thumb are used in drawing DFDS:

1) Process should be named and numbered for an easy reference. Each name should be representative of the process.

2) The direction of flow is from top to bottom and from left to right. Data traditionally flow from source to the destination although they may flow back to the source. One way to indicate this is to draw long flow line back to a source. An alternative way is to repeat the source symbol as a destination. Since it is used more than once in the DFD it is marked with a short diagonal.

3) When a process is exploded into lower level details, they are numbered.

4) The names of data stores and destinations are written in capital letters. Process and dataflow names have the first letter of each work capitalized

A DFD typically shows the minimum contents of data store. Each data store should contain all the data elements that flow in and out.

Questionnaires should contain all the data elements that flow in and out. Missing interfaces redundancies and like is then accounted for often through interviews.SAILENT FEATURES OF DFDS:

1) The DFD shows flow of data, not of control loops and decision are controlled considerations do not appear on a DFD.

2) The DFD does not indicate the time factor involved in any process whether the dataflow take place daily, weekly, monthly or yearly.

3) The sequence of events is not brought out on the DFD.

4.3.2 LEVEL 0:

CONTEXT LEVEL DIAGRAM:

Fig 4.16 : Context Level Diagram

4.3.3 LEVEL 1:

TOP LEVEL 0:

Fig 4.17 : Top Level 0 Diagram4.3.4 LEVEL 2:

DETAIL LEVEL 0:

Fig 4.18 : Detail Level 0 Diagram

DETAIL LEVEL 1:

Fig 4.19 : Detail Level 1 Diagram

4.4 CODING

CTS.JAVA

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

public class CTS { //implements ActionListener, MouseListener

// variables

private CTSParameters ctsp;

private CTSScreen ctsScreen;

private CTSEngine ctsEngine;

private CTSStats stats;

/**

* Constructor of this class.

*/

public CTS() {

ctsp = new CTSParameters();

stats = new CTSStats(ctsp);

ctsScreen = new CTSScreen(ctsp,this,stats);

ctsEngine = new CTSEngine(ctsp,ctsScreen,stats);

}

/**

* Starts the simulation.

**/

public void start() {

ctsEngine.start();

ctsEngine.setTimer('s');

}

/**

* Restarts the simulation.

**/

public void restart() {

ctsEngine.setTimer('s');

}

/**

* Pause the simulation.

**/

public void pause() {

ctsEngine.setTimer('p');

}

/**

* Sets the station status to be true or false.

*

* @param st: The station number.

* @param status: The status.

**/

public void setStationStatus(int st,boolean status) {

ctsEngine.setStationStatus(st,status);

}

/**

* The main method of this class.

*

* @param: The arguments.

**/

public static void main(String args[]){

try {

CTS Obj = new CTS();

} catch(Exception e) {

System.out.println(e);

}

} // end of main method.

} // end of class CTS.

CTSENGINE.JAVA

import java.util.*;

import java.lang.Thread.*;

import java.awt.event.*;

import javax.swing.Timer;

public class CTSEngine implements ActionListener {

private int simSecs, prevSecs, countTrains, nextTrIns, totalTrains;

private long startTime;

private boolean trIns;

private Timer timer;

private ArrayList trains;

privateRandom rnd;

private Date date;

private CTSStation[] stations;

private int[][] pathLocks;

private int[][][] platLocks;

private int[][][] waitingQueue;

private int[][][] exitStatPos;

private CTSTrain[][][] map;

private ThreadGroup thrGroup;

private CTSScreen ctsScreen;

private CTSStats ctsStats;

private CTSParameters ctsp;

/**

* Constructor

*

* @param ctsP: An object of class CTSParameters

* @param ctsScr: An object of class CTSScreen.It will be used for updating info on screens.

* @param sts: An object of class CTSStats. It will be used for updating stats.

**/

public CTSEngine(CTSParameters ctsP,CTSScreen ctsScr, CTSStats sts) {

ctsp=ctsP;

date = new Date();

rnd = new Random();

trains = new ArrayList();

ctsStats = sts;

ctsScreen = ctsScr;

trIns = false;

prevSecs=0;

startTime = System.currentTimeMillis();

thrGroup = new ThreadGroup("Stations");

timer = new Timer(ctsp.DELAY,this);

stations = new CTSStation[4];

pathLocks = new int[2][6];

platLocks = new int[2][4][2];

waitingQueue = new int[2][4][2];

exitStatPos = new int[2][4][2];

map = new CTSTrain[2][3][370];

setArrays();

}

/**

* Sets some extra action when we start the simulation.

* e.g : updates the correct parameters in stats and screen objects.

**/

public void start() {

// update arrays in stats obj according to parameters.

ctsStats.setStartup();

ctsScreen.setStartup();

for(int i=0; i