signaling on the ccr tyler raulin. overview of signals rules: – red light there is a train in the...
DESCRIPTION
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 systemTRANSCRIPT
![Page 1: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/1.jpg)
Signaling on the CCRSignaling on the CCR
Tyler Raulin
![Page 2: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/2.jpg)
Overview of SignalsOverview of SignalsRules:
– 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
![Page 3: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/3.jpg)
RequirementsRequirements 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
![Page 4: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/4.jpg)
SolutionsSolutionsCreate 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
![Page 5: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/5.jpg)
Creating Data StructuresCreating Data StructuresNext Photocell
– Clockwise/Counterclockwise Direction– Straight/Curved Track
Next Turnout– Clockwise/Counterclockwise Direction
Light Status– Clockwise/Counterclockwise Direction– Straight/Curved Track
![Page 6: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/6.jpg)
Setting Lights for a trainSetting 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
![Page 7: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/7.jpg)
Setting Lights for TurnoutsSetting Lights for Turnouts
Scroll Through Next Photocell Data Structure– If value == NEEDSTURNOUT
Check the status of the turnoutIf we don’t have the turnout
– Set the Light to RED
![Page 8: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/8.jpg)
Setting Lights for Turnout in Setting Lights for Turnout in other Directionother 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
![Page 9: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/9.jpg)
Resource ManagerResource ManagerFunctions 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
![Page 10: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/10.jpg)
Train ControlTrain ControlGraphical interface that displays
information about each trainConnected to a train and its valuesDisplays the lights that the train sees as it’s
moving down the trackChange Direction Button Modified to
recover from deadlockToggle Turnout Button Added
![Page 11: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/11.jpg)
Train Control…cont.Train Control…cont.
![Page 12: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/12.jpg)
Change DirectionChange 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
![Page 13: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/13.jpg)
Toggle TurnoutToggle 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
![Page 14: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/14.jpg)
Toggle Turnout…cont.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
![Page 15: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/15.jpg)
ExceptionsExceptions
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
![Page 16: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/16.jpg)
MethodologyMethodologyDive right into the code, make adjustments
and see resultsDraw up ideas on paper before writing code
of my ownTest my results with as many scenarios as I
can think ofUse Log file to determine values at each
point in the process
![Page 17: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/17.jpg)
DemonstrationDemonstration
One TrainTwo Trains
![Page 18: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/18.jpg)
Questions?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
![Page 19: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/19.jpg)
StrategiesStrategies
LogicDiagramsPseudo-codeTesting
![Page 20: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/20.jpg)
KnowledgeKnowledge
Designing and coding data structuresCreation and Relation of classesAllocation of ResourcesDeadlocking and recovery from itEvent programming and the use of
interrupts and polling
![Page 21: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/21.jpg)
ExtensionsExtensions
Combine the Batch and Interactive file modes, implement record and playback
Work out issues with direction changes or toggling turnouts
![Page 22: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/22.jpg)
AdviceAdvice
Come up with a strategy and stick to itKeep the professor in the loop of your
projectTry to devote large chunks of time
![Page 23: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/23.jpg)
THANK YOU!!!THANK YOU!!!
![Page 24: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/24.jpg)
HASNOTURNOUTHASNOTURNOUT 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
![Page 25: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/25.jpg)
NEEDSTURNOUTNEEDSTURNOUT 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
![Page 26: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/26.jpg)
Next PhotocellNext 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
![Page 27: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/27.jpg)
back
![Page 28: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/28.jpg)
Next TurnoutNext Turnout
Initialize all memory locations to HASNOTURNOUT
Assign the turnout number to each locationOne 2-dimensional matrix 2 x
MAXPHOTOCELLSColumn 1 is for ClockwiseColumn 2 is for Counterclockwise
back
![Page 29: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/29.jpg)
back
![Page 30: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/30.jpg)
Photocell StatusPhotocell 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
![Page 31: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/31.jpg)
back
![Page 32: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/32.jpg)
Setting Lights with Two TrainsSetting Lights with Two Trains
back
![Page 33: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/33.jpg)
Deadlock IssueDeadlock 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 BLOCKEDSet the photocell you are blocked at to RED
back
![Page 34: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/34.jpg)
Deadlock Issue ResolvedDeadlock Issue Resolved
back
![Page 35: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/35.jpg)
Train Resources vs. PC Train Resources vs. PC ManagerManager
Train Resources were updated in AllocateResources
UpdateResources calls AllocateResources
AllocateResources is not always called if BLOCKED
back
![Page 36: Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly](https://reader035.vdocument.in/reader035/viewer/2022062905/5a4d1ad17f8b9ab0599718de/html5/thumbnails/36.jpg)
Toggle Turnout…cont.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