Download presentation
Presentation is loading. Please wait.
Published byAshlie Banks Modified over 8 years ago
1
Signaling on the CCR Tyler Raulin
2
Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly for the train to continue – Yellow Light There is a train two sections away from the train – Green Light The next two sections of track are clear There are no turnouts blocking us from continuing
3
Requirements Implement virtual signals in each cab to reflect what each train would see Redesign the CAB’s human interface so that it is useful Implement existing deadlock avoidance, detection, and removal algorithms for trains controlled interactively Allow User to toggle turnouts instead of controlled by the operating system
4
Solutions Create Data Structures to store the values of the Next Photocell, Next Turnout, and Light Status Create a Light Manager Class which checks and updates these data structures Tie the Light Manager Class into the existing Resource Manager Class and Train Control Class
5
Creating Data Structures Next Photocell – Clockwise/Counterclockwise Direction – Straight/Curved Track Next Turnout – Clockwise/Counterclockwise Direction Light Status – Clockwise/Counterclockwise Direction – Straight/Curved Track
6
Setting Lights for a train All Lights are initialized to Green Red Lights are placed outside the section for trains that wish to enter Yellow Lights are placed in the next section after the Red Lights
7
Setting Lights for Turnouts Scroll Through Next Photocell Data Structure – If value == NEEDSTURNOUT Check the status of the turnout If we don’t have the turnout –Set the Light to RED
8
Setting Lights for Turnout in other Direction Scroll Through Next Turnout Data Structure – If value != HASNOTURNOUT (there is a turnout) If Turnout is Straight –Set Curved Light to RED Else –Set Straight Light to RED
9
Resource Manager Functions used or adjusted: – OnTimer Calls the UpdateLights function – HandleArrival Called when direction is changed in the Train Control – UpdateResources changes the values for each train instead of AllocateResources
10
Train Control Graphical interface that displays information about each train Connected to a train and its values Displays the lights that the train sees as it’s moving down the track Change Direction Button Modified to recover from deadlock Toggle Turnout Button Added
11
Train Control…cont.
12
Change Direction When Button is clicked – The train becomes active – The direction and the next and previous photocells are switched – We handle an arrival with the new previous photocell
13
Toggle Turnout Giving the user control over the turnouts causes many issues: – When can the turnout be adjusted – Who can adjust the turnout – When do we no longer have possession of the Turnout
14
Toggle Turnout…cont. Use an array of semaphors to not allow a turnout to be toggled while a train is in that section of track This is a critical section of code that must not be interrupted
15
Exceptions Change direction will cause issues if reversed out of deadlock, then reversed again If train1 is blocked at a turnout and train2 goes through the turnout the other way, we are unable to toggle it back once train2 has left
16
Methodology Dive right into the code, make adjustments and see results Draw up ideas on paper before writing code of my own Test my results with as many scenarios as I can think of Use Log file to determine values at each point in the process
17
Demonstration One Train Two Trains
18
Questions? HASNOTURNOUT NEEDSTURNOUT NextPhotocell NextPC Data Structure NextTurnout NextTO Data Structure Photocell Status PC Status Data Structure Light with Two Trains Deadlock Issue Deadlock Issue Resolution PC Manager Issue Semaphors
19
Strategies Logic Diagrams Pseudo-code Testing
20
Knowledge Designing and coding data structures Creation and Relation of classes Allocation of Resources Deadlocking and recovery from it Event programming and the use of interrupts and polling
21
Extensions Combine the Batch and Interactive file modes, implement record and playback Work out issues with direction changes or toggling turnouts
22
Advice Come up with a strategy and stick to it Keep the professor in the loop of your project Try to devote large chunks of time
23
THANK YOU!!!
24
HASNOTURNOUT In this case (in the clockwise matrix): – Photocell 2 would have value of 7 in the straight column – Photocell 2 would have a value of HASNOTURNOUT in the curved column back
25
NEEDSTURNOUT In this case (in the counterclockwise matrix) – Photocell 13 would have a value of 15 in the straight column – Photocell 13 would have a value of NEEDSTURNOUT in the curved column – Photocell 14 would have a value of NEEDSTURNOUT in the straight column – Photocell 14 would have a value of 15 in the curved column back
26
Next Photocell Initialize all memory locations to HASNOTURNOUT Individually assign values for whichever is the next photocell Two 2-dimensional matrices 2 x MAXPHOTOCELLS – One for Clockwise, one for Counterclockwise – Column one is straight, column two is curved Never adjusted after values are first assigned back
28
Next Turnout Initialize all memory locations to HASNOTURNOUT Assign the turnout number to each location One 2-dimensional matrix 2 x MAXPHOTOCELLS Column 1 is for Clockwise Column 2 is for Counterclockwise back
30
Photocell Status Initialize all memory locations to HASNOTURNOUT Initialize all lights to be GREEN Two 2-dimensional matrices 2 x MAXPHOTOCELLS – One for Clockwise, one for Counterclockwise – Column one is straight, column two is curved UpdateTrackLights( ) changes the values on a timer in the Resource Manager back
32
Setting Lights with Two Trains back
33
Deadlock Issue These two trains are technically seen as being in the same section They look to the next light and see GREEN We need to check if blocked during UpdateLights() – If BLOCKED Set the photocell you are blocked at to RED back
34
Deadlock Issue Resolved back
35
Train Resources vs. PC Manager Train Resources were updated in AllocateResources UpdateResources calls AllocateResources AllocateResources is not always called if BLOCKED back
36
Toggle Turnout…cont. When Train Arrives at photocell and is BLOCKED by a turnout – It will toggle the turnout if able – Then Set the semaphor to 0 to prevent toggling – Semaphor is 1 when train leaves back
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.