180 likes | 431 Views
Real-time Railway Simulation in Java. Senior Design Presentation by Dominic Ancheta. Real-time Railway Simulation Presentation Outline. Project background and description Technologies involved Application architecture Application operation and details Demonstration of working application
E N D
Real-time Railway Simulation in Java Senior Design Presentation by Dominic Ancheta
Real-time Railway Simulation Presentation Outline • Project background and description • Technologies involved • Application architecture • Application operation and details • Demonstration of working application • Problems encountered • Field Questions
Project Description • Railway simulation for information and recreation. • Modeled after BART simulation applet. • Application can run different railways (Not constrained to BART like above- mentioned applet). • Simulates trains in a railway moving in real time or accelerated time.
Project Description (cont’d) • Trains are animated over maps like this • Users will be able to choose from a selection of railways and schedules • Time compression is user controlled • Railway simulation runs for one railway day
Major technologies used • Object-oriented programming • Java with AWT 1.1 • Relational Database and JDBC • Internet/Intranet distributed application, however distributed DB unavailable
Application Architecture The following diagrams show: • Network Distribution Architecture • Java Modules
Railway Simulator HTTP Server GIF or Bitmap Image Server Client Railway Database Browser Browser executes app in standalone window Intranet or Internet
Application operation and details • Database storage method • Simulation operation overview The following slides cover these topics:
Database Storage Method • Three programs created to construct database tables and insert railway data into them • Text files, which are created to user specifications, are parsed and inserted into the railway database
Sample Schedules from BART Railway Richmond to Colma/Daly City (Weekday) RICH DEL-N PLAZA N-BRK BRK ASHBY MACAR 19ST 12ST W-OAK EMBAR MONTG POWEL CIVIC 16ST 24ST GLNPK BALPK DALY COLMA 4:56a 4:59a 5:02a 5:06a 5:08a 5:11a 5:14a 5:18a 5:19a 5:24a 5:31a 5:32a 5:34a 5:35a 5:37a 5:39a 5:42a 5:44a 5:48a 5:52a 5:11a 5:14a 5:17a 5:21a 5:23a 5:26a 5:29a 5:33a 5:34a 5:39a 5:46a 5:47a 5:49a 5:50a 5:52a 5:54a 5:57a 5:59a 6:03a 6:07a 5:26a 5:29a 5:32a 5:36a 5:38a 5:41a 5:44a 5:48a 5:49a 5:54a 6:01a 6:02a 6:04a 6:05a 6:07a 6:09a 6:12a 6:14a 6:18a 6:22a 5:41a 5:44a 5:47a 5:51a 5:53a 5:56a 5:59a 6:03a 6:04a 6:09a 6:16a 6:17a 6:19a 6:20a 6:22a 6:24a 6:27a 6:29a 6:33a 6:37a 5:56a 5:59a 6:02a 6:06a 6:08a 6:11a 6:14a 6:18a 6:19a 6:24a 6:31a 6:32a 6:34a 6:35a 6:37a 6:39a 6:42a 6:44a 6:48a 6:52a 6:10a 6:13a 6:16a 6:20a 6:22a 6:25a 6:28a 6:32a 6:33a 6:38a 6:45a 6:46a 6:48a 6:49a 6:51a 6:53a 6:56a 6:58a 7:02a 7:06a 6:25a 6:28a 6:31a 6:35a 6:37a 6:40a 6:43a 6:47a 6:48a 6:53a 7:00a 7:01a 7:03a 7:04a 7:06a 7:08a 7:11a 7:13a 7:17a 7:21a 6:40a 6:43a 6:46a 6:50a 6:52a 6:55a 6:58a 7:02a 7:03a 7:08a 7:15a 7:16a 7:18a 7:19a 7:21a 7:23a 7:26a 7:28a 7:32a 7:36a 6:56a 6:59a 7:02a 7:06a 7:08a 7:11a 7:14a 7:18a 7:19a 7:24a 7:31a 7:32a 7:34a 7:35a 7:37a 7:39a 7:42a 7:44a 7:48a 7:52a 7:11a 7:14a 7:17a 7:21a 7:23a 7:26a 7:29a 7:33a 7:34a 7:39a 7:46a 7:47a 7:49a 7:50a 7:52a 7:54a 7:57a 7:59a 8:03a 8:07a 7:26a 7:29a 7:32a 7:36a 7:38a 7:41a 7:44a 7:48a 7:49a 7:54a 8:01a 8:02a 8:04a 8:05a 8:07a 8:09a 8:12a 8:14a 8:18a 8:22a 7:41a 7:44a 7:47a 7:51a 7:53a 7:56a 7:59a 8:03a 8:04a 8:09a 8:16a 8:17a 8:19a 8:20a 8:22a 8:24a 8:27a 8:29a 8:33a 8:37a 7:56a 7:59a 8:02a 8:06a 8:08a 8:11a 8:14a 8:18a 8:19a 8:24a 8:31a 8:32a 8:34a 8:35a 8:37a 8:39a 8:42a 8:44a 8:48a 8:52a ... Daly City - Dublin/Pleasanton (Weekday) DALY BALPK GLNPK 24ST 16ST CIVIC POWEL MONTG EMBAR W-OAK LAKEM FRTVL COLIS SLEAN BFAIR C-VLY DUBPL 4:21a 4:25a 4:27a 4:30a 4:32a 4:34a 4:35a 4:37a 4:38a 4:45a 4:50a 4:54a 4:57a 5:01a 5:05a 5:09a 5:20a 4:53a 4:56a 4:59a 5:01a 5:03a 5:05a 5:07a 5:09a 5:10a 5:17a 5:22a 5:25a 5:29a 5:32a 5:36a 5:40a 5:51a 5:08a 5:12a 5:14a 5:17a 5:19a 5:21a 5:23a 5:25a 5:26a 5:33a 5:38a 5:42a 5:45a 5:49a 5:53a 5:57a 6:08a 5:22a 5:26a 5:28a 5:31a 5:33a 5:35a 5:37a 5:39a 5:40a 5:47a 5:52a 5:56a 5:59a 6:03a 6:07a 6:11a 6:22a 5:37a 5:41a 5:43a 5:46a 5:48a 5:50a 5:52a 5:54a 5:55a 6:02a 6:07a 6:11a 6:14a 6:18a 6:22a 6:26a 6:37a 5:52a 5:56a 5:58a 6:01a 6:03a 6:05a 6:07a 6:09a 6:10a 6:17a 6:22a 6:26a 6:29a 6:33a 6:37a 6:41a 6:52a 6:06a 6:10a 6:13a 6:16a 6:18a 6:20a 6:22a 6:24a 6:25a 6:32a 6:37a 6:41a 6:44a 6:48a 6:52a 6:56a 7:07a 6:21a 6:25a 6:28a 6:31a 6:33a 6:35a 6:37a 6:39a 6:40a 6:47a 6:52a 6:56a 6:59a 7:03a 7:07a 7:11a 7:22a 6:36a 6:40a 6:43a 6:46a 6:48a 6:50a 6:52a 6:54a 6:55a 7:02a 7:07a 7:11a 7:14a 7:18a 7:22a 7:26a 7:37a 6:51a 6:55a 6:58a 7:01a 7:03a 7:05a 7:07a 7:09a 7:10a 7:17a 7:22a 7:26a 7:29a 7:33a 7:37a 7:41a 7:52a 7:06a 7:10a 7:13a 7:16a 7:18a 7:20a 7:22a 7:24a 7:25a 7:32a 7:37a 7:41a 7:44a 7:48a 7:52a 7:56a 8:07a 7:21a 7:25a 7:28a 7:31a 7:33a 7:35a 7:37a 7:39a 7:40a 7:47a 7:52a 7:56a 7:59a 8:03a 8:07a 8:11a 8:22a 7:36a 7:40a 7:43a 7:46a 7:48a 7:50a 7:52a 7:54a 7:55a 8:02a 8:07a 8:11a 8:14a 8:18a 8:22a 8:26a 8:37a 7:51a 7:55a 7:58a 8:01a 8:03a 8:05a 8:07a 8:09a 8:10a 8:17a 8:22a 8:26a 8:29a 8:33a 8:37a 8:41a 8:52a 8:06a 8:10a 8:13a 8:16a 8:18a 8:20a 8:22a 8:24a 8:25a 8:32a 8:37a 8:41a 8:44a 8:48a 8:52a 8:56a 9:07a 8:21a 8:25a 8:28a 8:31a 8:33a 8:35a 8:37a 8:39a 8:40a 8:47a 8:52a 8:56a 8:59a 9:03a 9:07a 9:11a 9:22a 8:36a 8:40a 8:43a 8:46a 8:48a 8:50a 8:52a 8:54a 8:55a 9:02a 9:07a 9:11a 9:14a 9:18a 9:22a 9:26a 9:37a 8:51a 8:55a 8:58a 9:01a 9:03a 9:05a 9:07a 9:09a 9:10a 9:17a 9:22a 9:26a 9:29a 9:33a 9:36a 9:40a 9:52a ...
Railway database design Train Railway Line rail_id rail_name bmp_name wait_time line_id line_name schedule rail_id (FK) color train_id line_id (FK) train_order 1 N 1 N 1 1 N N Rail_Location Arrival arrival_id train_id (FK) arrival_order line_loc_id (FK) arrival_time wait_time delay_time line_loc_id name x-coord y-coord rail_id (FK) 1 N
Simulation operation overview To run real-time railway simulation: • User clicks on browser link which runs the application class. • GUI window opens with control buttons and simulation area. • User selects railway to run and presses start button • Retrieval of data for selected railway is begun over a JDBC connection
Simulation operation overview (cont’d) • Trains run and animate over screen until whole day schedule is run or user ends the application. • User has controls to stop, pause, resume, quit or change time compression while simulation runs. • Time compression used to slow down or speed up simulation.
Train curr_x curr_y state Arrivals time wait_time move_delay RailwayTime compression ... Railway Simulation Classes Line name color Railway Simulator main ( ) Railway Data Railway Database SQL Queries via JDBC:ODBC bridge N Railway GUI RailwayCanvas railway_select schedule_select compression_select control buttons time display N Rail location x_coord y_coord N N
Project Design and Implementation Issues • Much of the technologies used, such as OO design, relational database design, JDBC and Java AWT were new to me. • Much time spent learning to design and implement the technologies. • Problems creating SQL statements for data storage and data retrieval • Taking time to design a good database with integrity
Project Issues (cont’d) • Creation of well-contained objects and messaging objects required much thought • Maintenance and improvement of objects • Animation algorithm gave not too many problems due to good planning
Java Modules Railway Simulator Train Railway Time java.sql Package Railway GUI java.sql.Time java.awt Package