SUMOTime MSTLLogicControl::WAUTSwitchProcedure::getDiffToStartOfPhase(MSTrafficLightLogic& logic, SUMOTime toTime) { unsigned int stepOfMyPos = logic.getIndexFromOffset(toTime); SUMOTime startOfPhase = logic.getOffsetFromIndex(stepOfMyPos); assert(toTime >= startOfPhase); return toTime - startOfPhase; }
bool MSTLLogicControl::WAUTSwitchProcedure::isPosAtGSP(SUMOTime currentTime, const MSTrafficLightLogic& logic) { SUMOTime gspTime = TIME2STEPS(getGSPValue(logic)) % logic.getDefaultCycleTime(); SUMOTime programTime = logic.getOffsetFromIndex(logic.getCurrentPhaseIndex()) + (logic.getCurrentPhaseDef().duration - (logic.getNextSwitchTime() - currentTime)); return gspTime == programTime; }