Project for the grading of TCP/IP Networking course Course Code: E2 232
This is a train collision avoidance system. This project deals with very specific situation with following constrains/assumptions:-
- Two Trains are moving on the same track with a maximum speed of 100 Km/hr or 27.77 m/s.
- RFID tags are kept every 1 km.
- Every train need approx 400m to stop (for deceleration of 0.1*g)
- To prevent head-on collision train must apply break when they are 800m apart which is 1km roughly.
- Both the trains have RFID tag readers with a range of 40m approx.
- RFID tags can store two things (in user data section): position ID and Track ID.
- Track ID inform on which track the tag is present.
- Position ID infrom about the posion of the train on the given track. ( tags are placed in increasing order of Position ID in one direction of the track)
- Hosts are Rpi4.
- TLS connection for secure communication
- Only valid host( who have valid certificate) can connect with the server.
- Data is encrypetd.
- Authentication of user for further communication: Valid host must also know the user-name and password.
- Keepalive feature included: Clients will be informed if server is down.
- Threading for simultaneous client handling.
- SHA256 hashing: Password protection on both server and client side. This provides more security for stored passwords.
- Latency:
- Authentication: 300 - 350 ms
- Receiving STOP signal (RTT+processing): 5 ms
- Reliability
- TLS performs retransmission in case of a packet loss
- Latency is low, therefore we have enough time for retransmission.
- Trains receive stop signal way before breaking distance (minimum distance before which trains need to apply breaks to avoide head on collision). If a train misses a tag it will still have another chance.
Brief info about the files:-
- server.py: It contains the python code for running the server.
- client.py: It contains the python code for running the client.
- auth_data.csv: It contains the list of valid usernames and passwords in SHA256 hashed format.
- certificates/CA_cert.sh: It creates the necessary certificates and keys using OpenSSL.
Command to run server at IPv4 10.0.0.1 with port 3000
python3 server.py -sIP 10.0.0.1 -p 3000
Command to run client with port 3000 to connect to server at IPv4 10.0.0.1
python3 client.py -sIP 10.0.0.1 -p 3000
We can simulate four scenarios, and every scenario has its own simulation number.
Simulation Number | Scenario |
---|---|
0 | Train A and Train B are on different tracks |
1 | Train A and Train B are moving towards each other on same track |
2 | Train A and Train B are moving away from each other on same track |
3 | Train A and Train B are moving in same direction on same track |
In this example we are running simulation 1 where server IP is 10.114.240.240
Train A
python3 client.py -sIP 10.114.240.240 -p 3000 -train A -sim 1
Train B
python3 client.py -sIP 10.114.240.240 -p 3000 -train B -sim 1
Server
python3 server.py -p 3000
For more information about the option run
python3 client.py -h
python3 server.py -h
Dummy username and password
username,password
user1,password1
user2,password2