MSTLLogicControl::WAUTSwitchProcedure_JustSwitch Class Reference

#include <MSTLLogicControl.h>

Inheritance diagram for MSTLLogicControl::WAUTSwitchProcedure_JustSwitch:

MSTLLogicControl::WAUTSwitchProcedure

Detailed Description

This class simply switches to the next program.

Definition at line 523 of file MSTLLogicControl.h.


Public Member Functions

unsigned int getDiffToStartOfPhase (MSSimpleTrafficLightLogic *givenLogic, unsigned int pos)
 Returns the difference between an given position and the start of the phase.
bool isPosAtGSP (SUMOTime step, MSSimpleTrafficLightLogic *testLogic)
void switchToPos (SUMOTime simStep, MSSimpleTrafficLightLogic *givenLogic, unsigned int toPos)
bool trySwitch (SUMOTime step)
 Determines whether a switch is possible.
 WAUTSwitchProcedure_JustSwitch (MSTLLogicControl &control, WAUT &waut, MSTrafficLightLogic *from, MSTrafficLightLogic *to, bool synchron)
 Constructor.
 ~WAUTSwitchProcedure_JustSwitch ()
 Destructor.

Protected Member Functions

SUMOReal getGSPValue (MSTrafficLightLogic *from) const
 Returns the GSP-value which should be within the tls program definition.

Protected Attributes

MSTLLogicControlmyControl
 The control the logic belongs to.
MSTrafficLightLogicmyFrom
 The current program of the tls to switch.
bool mySwitchSynchron
 Information whether to switch synchron (?).
MSTrafficLightLogicmyTo
 The program to switch the tls to.
WAUTmyWAUT
 The WAUT responsible for switching.

Private Member Functions

WAUTSwitchProcedure_JustSwitchoperator= (const WAUTSwitchProcedure_JustSwitch &)
 Invalidated assignment operator.
 WAUTSwitchProcedure_JustSwitch (const WAUTSwitchProcedure_JustSwitch &)
 Invalidated copy constructor.

Constructor & Destructor Documentation

MSTLLogicControl::WAUTSwitchProcedure_JustSwitch::WAUTSwitchProcedure_JustSwitch ( MSTLLogicControl control,
WAUT waut,
MSTrafficLightLogic from,
MSTrafficLightLogic to,
bool  synchron 
)

Constructor.

Definition at line 281 of file MSTLLogicControl.cpp.

00284         : MSTLLogicControl::WAUTSwitchProcedure(control, waut, from, to, synchron) {}

MSTLLogicControl::WAUTSwitchProcedure_JustSwitch::~WAUTSwitchProcedure_JustSwitch (  ) 

Destructor.

Definition at line 287 of file MSTLLogicControl.cpp.

00287 {}

MSTLLogicControl::WAUTSwitchProcedure_JustSwitch::WAUTSwitchProcedure_JustSwitch ( const WAUTSwitchProcedure_JustSwitch  )  [private]

Invalidated copy constructor.


Member Function Documentation

unsigned int MSTLLogicControl::WAUTSwitchProcedure::getDiffToStartOfPhase ( MSSimpleTrafficLightLogic givenLogic,
unsigned int  pos 
) [inherited]

Returns the difference between an given position and the start of the phase.

Definition at line 253 of file MSTLLogicControl.cpp.

References MSPhaseDefinition::duration, MSSimpleTrafficLightLogic::getIndexFromOffset(), MSSimpleTrafficLightLogic::getOffsetFromIndex(), and MSSimpleTrafficLightLogic::getPhase().

Referenced by MSTLLogicControl::WAUTSwitchProcedure_GSP::adaptLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::cutLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::stretchLogic(), and MSTLLogicControl::WAUTSwitchProcedure::switchToPos().

00253                                                                                                                   {
00254     MSSimpleTrafficLightLogic *myLogic = givenLogic;
00255     unsigned int myPos = pos;
00256     unsigned int stepOfMyPos = myLogic->getIndexFromOffset(myPos);
00257     unsigned int startOfPhase = myLogic->getOffsetFromIndex(stepOfMyPos);
00258     MSPhaseDefinition myPhase = myLogic->getPhase(stepOfMyPos);
00259     unsigned int durOfPhase = (unsigned int)myPhase.duration;
00260 
00261     assert(myPos >= startOfPhase);
00262     unsigned int diff = myPos - startOfPhase;
00263     assert(diff <= durOfPhase);
00264     return diff;
00265 }

SUMOReal MSTLLogicControl::WAUTSwitchProcedure::getGSPValue ( MSTrafficLightLogic from  )  const [protected, inherited]

Returns the GSP-value which should be within the tls program definition.

Definition at line 223 of file MSTLLogicControl.cpp.

References TplConvert< E >::_2SUMOReal(), and MSTrafficLightLogic::getParameterValue().

Referenced by MSTLLogicControl::WAUTSwitchProcedure_GSP::adaptLogic(), MSTLLogicControl::WAUTSwitchProcedure::isPosAtGSP(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::trySwitch(), and MSTLLogicControl::WAUTSwitchProcedure_GSP::trySwitch().

00223                                                                                 {
00224     std::string val = from->getParameterValue("GSP");
00225     if (val.length()==0) {
00226         return -1;
00227     }
00228     return TplConvert<char>::_2SUMOReal(val.c_str());
00229 }

bool MSTLLogicControl::WAUTSwitchProcedure::isPosAtGSP ( SUMOTime  step,
MSSimpleTrafficLightLogic testLogic 
) [inherited]

get the position of the given signalprogramm at the actual simulationsecond

compare the position of the given programm with the GSP (GSP = "GuenstigerSchaltPunkt")

Definition at line 233 of file MSTLLogicControl.cpp.

References MSTrafficLightLogic::getDefaultCycleTime(), MSTLLogicControl::WAUTSwitchProcedure::getGSPValue(), and SUMOReal.

Referenced by MSTLLogicControl::WAUTSwitchProcedure_Stretch::trySwitch(), and MSTLLogicControl::WAUTSwitchProcedure_GSP::trySwitch().

00233                                                                                                    {
00234     MSSimpleTrafficLightLogic *givenLogic = (MSSimpleTrafficLightLogic*) testLogic;
00235     size_t CycleTime = givenLogic->getDefaultCycleTime();
00236     SUMOReal gspFrom = getGSPValue(givenLogic);
00238     size_t posFrom = givenLogic -> getPhaseIndexAtTime(step);
00239 
00240     if (gspFrom == CycleTime)   {
00241         gspFrom = 0;
00242     }
00244     if (gspFrom == posFrom) {
00245         return true;
00246     } else {
00247         return false;
00248     }
00249 }

WAUTSwitchProcedure_JustSwitch& MSTLLogicControl::WAUTSwitchProcedure_JustSwitch::operator= ( const WAUTSwitchProcedure_JustSwitch  )  [private]

Invalidated assignment operator.

void MSTLLogicControl::WAUTSwitchProcedure::switchToPos ( SUMOTime  simStep,
MSSimpleTrafficLightLogic givenLogic,
unsigned int  toPos 
) [inherited]

Definition at line 269 of file MSTLLogicControl.cpp.

References MSSimpleTrafficLightLogic::changeStepAndDuration(), MSPhaseDefinition::duration, MSTLLogicControl::WAUTSwitchProcedure::getDiffToStartOfPhase(), MSSimpleTrafficLightLogic::getIndexFromOffset(), MSSimpleTrafficLightLogic::getPhase(), and MSTLLogicControl::WAUTSwitchProcedure::myControl.

Referenced by MSTLLogicControl::WAUTSwitchProcedure_Stretch::trySwitch(), and MSTLLogicControl::WAUTSwitchProcedure_GSP::trySwitch().

00269                                                                                                                           {
00270     MSSimpleTrafficLightLogic *myLogic = givenLogic;
00271     unsigned int posTo = pos;
00272     unsigned int stepTo = myLogic->getIndexFromOffset(posTo);
00273     unsigned int diff = getDiffToStartOfPhase(myLogic, posTo);
00274     MSPhaseDefinition myPhase = myLogic->getPhase(stepTo);
00275     unsigned int dur = (unsigned int)myPhase.duration - diff;
00276     myLogic->changeStepAndDuration(myControl ,simStep, stepTo, dur);
00277 }

bool MSTLLogicControl::WAUTSwitchProcedure_JustSwitch::trySwitch ( SUMOTime  step  )  [virtual]

Determines whether a switch is possible.

This implementation alsways returns true

Implements MSTLLogicControl::WAUTSwitchProcedure.

Definition at line 291 of file MSTLLogicControl.cpp.

00291                                                                            {
00292     return true;
00293 }


Field Documentation

The current program of the tls to switch.

Definition at line 492 of file MSTLLogicControl.h.

Referenced by MSTLLogicControl::WAUTSwitchProcedure_Stretch::trySwitch(), and MSTLLogicControl::WAUTSwitchProcedure_GSP::trySwitch().

Information whether to switch synchron (?).

Definition at line 498 of file MSTLLogicControl.h.

Referenced by MSTLLogicControl::WAUTSwitchProcedure_Stretch::trySwitch(), and MSTLLogicControl::WAUTSwitchProcedure_GSP::trySwitch().

The WAUT responsible for switching.

Definition at line 501 of file MSTLLogicControl.h.


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

Generated on Wed May 5 00:06:49 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6