Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • O opSimulation
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 29
    • Issues 29
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Eclipse ProjectsEclipse Projects
  • Eclipse openpass
  • opSimulation
  • Issues
  • #47

Delay in TrafficLightController::UpdateStates accelerates phases but does not delay

currently merged in branch servant : sim/src/core/slave/modules/World_OSI/TrafficLightNetwork.cpp the delay parameter of a TrafficSignalController is handled in such a way that the controller accelerates through the phases, not delays:

In TrafficLightController::UpdateStates (...)
{
   double deltaTime = time - lastTime;       //0 - (-delay) = +delay
   lastTime = time;
   timeRemainingInCurrentPhase -= deltaTime;  // tRiCP -= +delay
   while (timeRemainingInCurrentPhase <= 0)
   {
       currentPhase++;
       if (currentPhase == phases.cend())
       {
           currentPhase = phases.begin();
       }
       timeRemainingInCurrentPhase += currentPhase->duration;
       for (auto [trafficLight, newState] : currentPhase->states)
       {
           trafficLight->SetState(newState);
       }
   }
}

lastTime is initialized via the constructor by -delay this results in the deltaTime being positive for the delay, causing the whole controller to speed up towards the next phase. It might be that this implementation opposes the wording of delay.

The constructor is here:

TrafficLightController::TrafficLightController(std::vector<TrafficLightController::Phase> &&phases, double delay) :
    phases(phases),
    currentPhase(this->phases.begin()),
    timeRemainingInCurrentPhase(currentPhase->duration),
    lastTime(-delay)
{
    for (auto [trafficLight, newState] : currentPhase->states)
    {
        trafficLight->SetState(newState);
    }
    UpdateStates(0);
}
Assignee
Assign to
Time tracking

Copyright © Eclipse Foundation, Inc. All Rights Reserved.     Privacy Policy | Terms of Use | Copyright Agent