Computer-Controlled Railroad Simulator Adrian Anderson
-
Upload
reginald-armstrong -
Category
Documents
-
view
213 -
download
0
Transcript of Computer-Controlled Railroad Simulator Adrian Anderson
Computer-Controlled Railroad Simulator
Adrian Andersonhttp://compsci.snc.edu/cs460/andeaj/
Project Description Create a model railroad simulator Show graphic representation of trains, turnouts,
and sensors Allow for a custom track design Receive hardware commands from external
programs, and send response commands back Allow the user to recreate certain conditions Simulate hardware failure
Solution Computer-Controlled Railroad Simulator Written in Visual Basic 2005, using .NET
Simulator Internally stores the state of trains, turnouts,
and sensors Moves trains around a virtual track Interface for controlling the track and trains Simulation of ideal, controlled railroad
conditions Check for train collisions “Disasters” – see what happens when things go
wrong
Track Editor Track data stored in an XML file Loaded and stored in an internal database Fully customizable Allows for many different track arrangements
Communications Receives NMRA standard digital railroad
controller packets External programs can interface with the
simulator as if it were a real railroad Change train speed and direction Request state of all sensors Good for testing programs like the Train
Operating System
Methodology Problem: Represent track as computer data Solution:
Junctions Segments, which go from junction to junction Turnouts, which connect two segments at a junction Sensors, which are connected to segments
Methodology Problem: Save and store track data Solutions:
Internal Storage: DataSet Class Visual Basic class, relational database ReadXML command reads and interprets XML files
External Storage: XML Easy to read, interpret, and edit Standard format for miscellaneous data Easy to validate Easy to use in Visual Basic programs
Methodology Problem: Collision detection Solution:
Collision table Train’s movement leaves records in the collision table Compare a train’s potential destination with collision
table records on the same segment/junction If two records overlap, then the trains crash Sensor detection: Trains “collide” with sensors to
activate them
Methodology Problem: Collision detection Solution:
Collision table Train’s movement leaves records in the collision table Compare a train’s potential destination with collision
table records on the same segment/junction If two records overlap, then the trains crash Sensor detection: Trains “collide” with sensors to
activate them
Exceptions Saved state of trains and track Save status log to a file XML validation Preset train types More labels in simulator window
Demonstration
Learning & Development References
MSDN Library Win 32 System Services: The Heart of Windows 95
and Windows NT CS Concepts
Database – track representation, track editor Operating Systems – pipe communication, threading
Extensions Read more types of hardware packets Advanced collision detection More detailed graphical layout More detailed object information
Advice Start early Set concrete goals with deadlines Meet those deadlines Update journal often with small updates
Questions?