Eclipse SUMO - Simulation of Urban MObility
PhaseTransitionLogic Class Reference

This class handles the transition logic between two phases. More...

#include <NEMAController.h>

Collaboration diagram for PhaseTransitionLogic:
[legend]

Public Types

typedef NEMAPhasePhasePtr
 Typedef for commonly used phase pointer. More...
 

Public Member Functions

int getDistance (PhaseTransitionLogic *otherTrans)
 return the ring distance that this transition represents More...
 
PhasePtr getFromPhase (void) const
 get the from phase More...
 
PhasePtr getToPhase (void) const
 get the to phase More...
 
bool okay (NEMALogic *controller)
 This function is the main PhaseTransitionLogic function It is called by the fromPhase to check if a transition to the toPhase is acceptable. More...
 
 PhaseTransitionLogic (PhasePtr fromPhase, PhasePtr toPhase)
 Construct a new Phase Transition Logic object. More...
 
void setDistance (int d)
 set the transition distance More...
 
 ~PhaseTransitionLogic ()
 deconstructor More...
 

Data Fields

int distance
 

Private Member Functions

void buildLogic (void)
 build the transition logic based on the from and to phase More...
 
bool coordBase (NEMALogic *controller)
 represents the bare minimum coordinate mode logic. Requires that the toPhase can fit its minimum green time before the force off More...
 
bool freeBase (NEMALogic *controller)
 this represents the bare minimum logic, that the toPhase has an active detector and that the fromPhase is ready to switch More...
 
bool fromBarrier (NEMALogic *controller)
 If the fromPhase is at a barrier, then this function will be called to check whether the transition is valid. More...
 
bool fromCoord (NEMALogic *controller)
 if the fromPhase is a coordinated phase, then this logic will be checked More...
 

Private Attributes

PhasePtr fromPhase
 
PhasePtr toPhase
 

Detailed Description

This class handles the transition logic between two phases.

This is intended to be extensible in the future. Each phase stores some number of PhaseTransitionLogics, equal to the number of non-zero phases in a ring

Definition at line 888 of file NEMAController.h.

Member Typedef Documentation

◆ PhasePtr

Typedef for commonly used phase pointer.

Definition at line 891 of file NEMAController.h.

Constructor & Destructor Documentation

◆ PhaseTransitionLogic()

PhaseTransitionLogic::PhaseTransitionLogic ( PhasePtr  fromPhase,
PhasePtr  toPhase 
)

Construct a new Phase Transition Logic object.

Parameters
fromPhasethe phase who "owns" this transition
toPhasethe phase to which I represent a transition to

Definition at line 1673 of file NEMAController.cpp.

◆ ~PhaseTransitionLogic()

PhaseTransitionLogic::~PhaseTransitionLogic ( )
inline

deconstructor

Definition at line 928 of file NEMAController.h.

Member Function Documentation

◆ buildLogic()

void PhaseTransitionLogic::buildLogic ( void  )
private

build the transition logic based on the from and to phase

◆ coordBase()

bool PhaseTransitionLogic::coordBase ( NEMALogic controller)
private

represents the bare minimum coordinate mode logic. Requires that the toPhase can fit its minimum green time before the force off

Parameters
controller
Returns
true
false

Definition at line 1726 of file NEMAController.cpp.

References NEMAPhase::barrierNum, NEMAPhase::coordinatePhase, NEMAPhase::forceOffTime, freeBase(), fromPhase, NEMALogic::getCurrentCycleLength(), NEMALogic::getOtherPhase(), NEMALogic::getTimeInCycle(), NEMAPhase::getTransitionTime(), NEMAPhase::minDuration, NEMALogic::ModeCycle(), NEMAPhase::readyToSwitch, and toPhase.

Referenced by fromCoord(), and okay().

Here is the caller graph for this function:

◆ freeBase()

bool PhaseTransitionLogic::freeBase ( NEMALogic controller)
private

this represents the bare minimum logic, that the toPhase has an active detector and that the fromPhase is ready to switch

Parameters
controller
Returns
true
false

Definition at line 1704 of file NEMAController.cpp.

References NEMAPhase::barrierNum, NEMAPhase::callActive(), fromPhase, NEMALogic::getOtherPhase(), okay(), NEMAPhase::readyToSwitch, and toPhase.

Referenced by coordBase(), fromBarrier(), and okay().

Here is the caller graph for this function:

◆ fromBarrier()

bool PhaseTransitionLogic::fromBarrier ( NEMALogic controller)
private

If the fromPhase is at a barrier, then this function will be called to check whether the transition is valid.

Parameters
controllera reference to the controller
Returns
true
false

Definition at line 1746 of file NEMAController.cpp.

References NEMAPhase::barrierNum, freeBase(), fromPhase, NEMAPhase::getCurrentState(), NEMALogic::getOtherPhase(), NEMALogic::getPhasesByRing(), Green, NEMAPhase::readyToSwitch, NEMAPhase::ringNum, and toPhase.

Referenced by okay().

Here is the caller graph for this function:

◆ fromCoord()

bool PhaseTransitionLogic::fromCoord ( NEMALogic controller)
private

if the fromPhase is a coordinated phase, then this logic will be checked

Parameters
controller
Returns
true
false

Definition at line 1771 of file NEMAController.cpp.

References coordBase(), NEMAPhase::forceOffTime, fromPhase, NEMALogic::getCurrentCycleLength(), NEMALogic::getOtherPhase(), NEMAPhase::getSequentialPriorPhase(), NEMALogic::getTimeInCycle(), NEMAPhase::getTransitionTime(), NEMAPhase::isTransitionActive(), NEMALogic::isType170(), NEMAPhase::minDuration, NEMALogic::ModeCycle(), NEMAPhase::readyToSwitch, and toPhase.

Referenced by okay().

Here is the caller graph for this function:

◆ getDistance()

int PhaseTransitionLogic::getDistance ( PhaseTransitionLogic otherTrans)

return the ring distance that this transition represents

Parameters
otherTransthe other PhaseTransitionLogic
Returns
int

Definition at line 1798 of file NEMAController.cpp.

References NEMAPhase::barrierNum, distance, fromPhase, NEMAPhase::getCurrentState(), Green, GreenXfer, and toPhase.

Referenced by NEMALogic::getNextPhases().

Here is the caller graph for this function:

◆ getFromPhase()

PhasePtr PhaseTransitionLogic::getFromPhase ( void  ) const
inline

get the from phase

Definition at line 936 of file NEMAController.h.

References fromPhase.

Referenced by NEMALogic::getDefaultTransition().

Here is the caller graph for this function:

◆ getToPhase()

PhasePtr PhaseTransitionLogic::getToPhase ( void  ) const
inline

get the to phase

Definition at line 931 of file NEMAController.h.

References toPhase.

Referenced by NEMALogic::getDefaultTransition(), NEMALogic::getNextPhases(), NEMAPhase::handleGreenRestOrTransfer(), NEMAPhase::handleRedXferOrNextPhase(), and NEMAPhase::trySwitch().

Here is the caller graph for this function:

◆ okay()

bool PhaseTransitionLogic::okay ( NEMALogic controller)

This function is the main PhaseTransitionLogic function It is called by the fromPhase to check if a transition to the toPhase is acceptable.

Parameters
controllera reference to the controller
Returns
true
false

Definition at line 1681 of file NEMAController.cpp.

References coordBase(), NEMALogic::coordinateMode, NEMAPhase::coordinatePhase, freeBase(), fromBarrier(), fromCoord(), fromPhase, NEMAPhase::getCurrentState(), Green, NEMAPhase::isAtBarrier, and toPhase.

Referenced by freeBase().

Here is the caller graph for this function:

◆ setDistance()

void PhaseTransitionLogic::setDistance ( int  d)
inline

set the transition distance

Definition at line 922 of file NEMAController.h.

References distance.

Field Documentation

◆ distance

int PhaseTransitionLogic::distance

Definition at line 925 of file NEMAController.h.

Referenced by getDistance(), and setDistance().

◆ fromPhase

PhasePtr PhaseTransitionLogic::fromPhase
private

◆ toPhase

PhasePtr PhaseTransitionLogic::toPhase
private

The documentation for this class was generated from the following files: