#include <MSTLLogicControl.h>

Definition at line 464 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) |
| virtual bool | trySwitch (SUMOTime step)=0 |
| Determines whether a switch is possible. | |
| WAUTSwitchProcedure (MSTLLogicControl &control, WAUT &waut, MSTrafficLightLogic *from, MSTrafficLightLogic *to, bool synchron) | |
| Constructor. | |
| virtual | ~WAUTSwitchProcedure () |
| Destructor. | |
Protected Member Functions | |
| SUMOReal | getGSPValue (MSTrafficLightLogic *from) const |
| Returns the GSP-value which should be within the tls program definition. | |
Protected Attributes | |
| MSTLLogicControl & | myControl |
| The control the logic belongs to. | |
| MSTrafficLightLogic * | myFrom |
| The current program of the tls to switch. | |
| bool | mySwitchSynchron |
| Information whether to switch synchron (?). | |
| MSTrafficLightLogic * | myTo |
| The program to switch the tls to. | |
| WAUT & | myWAUT |
| The WAUT responsible for switching. | |
Private Member Functions | |
| WAUTSwitchProcedure & | operator= (const WAUTSwitchProcedure &) |
| Invalidated assignment operator. | |
| WAUTSwitchProcedure (const WAUTSwitchProcedure &) | |
| Invalidated copy constructor. | |
| MSTLLogicControl::WAUTSwitchProcedure::WAUTSwitchProcedure | ( | MSTLLogicControl & | control, | |
| WAUT & | waut, | |||
| MSTrafficLightLogic * | from, | |||
| MSTrafficLightLogic * | to, | |||
| bool | synchron | |||
| ) | [inline] |
Constructor.
Definition at line 467 of file MSTLLogicControl.h.
00470 : myFrom(from), myTo(to), mySwitchSynchron(synchron), myWAUT(waut), myControl(control) { }
| virtual MSTLLogicControl::WAUTSwitchProcedure::~WAUTSwitchProcedure | ( | ) | [inline, virtual] |
| MSTLLogicControl::WAUTSwitchProcedure::WAUTSwitchProcedure | ( | const WAUTSwitchProcedure & | ) | [private] |
Invalidated copy constructor.
| unsigned int MSTLLogicControl::WAUTSwitchProcedure::getDiffToStartOfPhase | ( | MSSimpleTrafficLightLogic * | givenLogic, | |
| unsigned int | pos | |||
| ) |
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 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] |
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(), 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 | |||
| ) |
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(), 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& MSTLLogicControl::WAUTSwitchProcedure::operator= | ( | const WAUTSwitchProcedure & | ) | [private] |
Invalidated assignment operator.
| void MSTLLogicControl::WAUTSwitchProcedure::switchToPos | ( | SUMOTime | simStep, | |
| MSSimpleTrafficLightLogic * | givenLogic, | |||
| unsigned int | toPos | |||
| ) |
Definition at line 269 of file MSTLLogicControl.cpp.
References MSSimpleTrafficLightLogic::changeStepAndDuration(), MSPhaseDefinition::duration, getDiffToStartOfPhase(), MSSimpleTrafficLightLogic::getIndexFromOffset(), MSSimpleTrafficLightLogic::getPhase(), and 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 }
Determines whether a switch is possible.
If a switch shall be done, this method should return true.
Implemented in MSTLLogicControl::WAUTSwitchProcedure_JustSwitch, MSTLLogicControl::WAUTSwitchProcedure_GSP, and MSTLLogicControl::WAUTSwitchProcedure_Stretch.
Referenced by MSTLLogicControl::check2Switch().
The control the logic belongs to.
Definition at line 504 of file MSTLLogicControl.h.
Referenced by MSTLLogicControl::WAUTSwitchProcedure_GSP::adaptLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::cutLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::stretchLogic(), and switchToPos().
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 program to switch the tls to.
Definition at line 495 of file MSTLLogicControl.h.
Referenced by MSTLLogicControl::WAUTSwitchProcedure_Stretch::adaptLogic(), MSTLLogicControl::WAUTSwitchProcedure_GSP::adaptLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::cutLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::stretchLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::trySwitch(), and MSTLLogicControl::WAUTSwitchProcedure_GSP::trySwitch().
WAUT& MSTLLogicControl::WAUTSwitchProcedure::myWAUT [protected] |
1.5.6