ObjectType
Document
DocName Project Version FullName ShortDescription
TrackCtrl RailwayCrossing V2
 
Description
Each tracks tries to keep the signals in the 'halt' state whenever possible. However, this is only allowed to happen, when all trains past sensor ts1 have left the crossing area, i.e. have passed sensor ts2. Only then we can be sure that there are no more trains on the track (the only way to know is, if a train has passed ts2!). Further, if a new train enters a track, the track requests the signal to be changed to 'go'. If this is acknowledged by CrossingCtrl, the trains may pass. Otherwise, the signal stays in the 'halt' state.
 
Components
ModelName Number Type
ts 2 TrainSensCtrl
sig 1 SignalCtrl
 
Tasks
ModelName Description Strategy StrategyType Tasks Usage RealizedRequirement
TrackCtrlTask1 set signal to given value asap If setSignalState (go) is received, and curTrainNo is not 0, set the signal to go (setSignalState (go) to sig1).
If setSignalState (halt) is received, set the signal to halt (setSignalState (halt) to sig1), iff curTrainNo is 0.
f
TrackCtrlTask2 count no of trains If newTrain from ts1 is received, increment curTrainNo by 1, if it is received from ts2, decrement curTrainNo. f
TrackCtrlTask3 propagate a new signal state After sending setSignalState to sig1, propagate the new signal state (newSignalState). Change curMode to the appropiate value. f
TrackCtrlTask4 Initialziation After creation, switch curMode to init and ask for current signalState (getSignalState). After receiving newSignalState, switch curMode to the given value. f
 
Attributes
ModelName FullName Type Value Tasks Usage Description
curTrainNo Integer 0 TrackCtrlTask1 r
TrackCtrlTask2 w
curMode Enum (init, go, halt) init TrackCtrlTask3, TrackCtrlTask4 w
 
Signals
ModelName FullName Parameters Tasks Usage Description SignalPaths
setSignalState CharString, SignalStateType TrackCtrlTask1 p/c
newSignalState CharString, SignalStateType TrackCtrlTask3 p
TrackCtrlTask4 c SignalCtrlTask2:sig1:SignalCtrl/
(TrackCtrlTask4:*:TrackCtrl)=$2/
*=$1 > $2/$1
getSignalState CharString, SignalStateType TrackCtrlTask4 p (TrackCtrlTask4:*:TrackCtrl)=$2/
*=$1 > 
SignalCtrlTask2:sig1:SignalCtrl/$2/$1
newTrain CharString TrackCtrlTask2 c TrainSensCtrlTask1:ts[1,2]:TrainSensCtrl/
(TrackCtrlTask2:*:TrackCtrl)=$2/
*=$1 > $2/$1