diff --git a/src/Traffic/TrafficMovement.cpp b/src/Traffic/TrafficMovement.cpp index 47f046157792216770bb89b06d92707ee302243a..c47970898d41db0be56f0c91f3466841352e308f 100644 --- a/src/Traffic/TrafficMovement.cpp +++ b/src/Traffic/TrafficMovement.cpp @@ -131,17 +131,14 @@ void TrafficMovement::calculateTimestep(uint step) VectorHelper::fillVector(*pnext, -1); if (concWriter != nullptr) concWriter->resetConcentrations(); - //apply rules on all cars + //apply rules on all cars for (uint i = 0; i < road->roadLength; i++) { if ((*pcurrent)[i] > -1) { applyRules(i); } } - for (auto &junction : road->junctions) { - junction->updateJunction(); - junction->calculateTimeStep(*this); - } + calculateJunctionStep(); calculateSourceStep(); @@ -168,6 +165,13 @@ void TrafficMovement::calculateSourceStep() } } +void TrafficMovement::calculateJunctionStep() +{ + for (auto &junction : road->junctions) { + junction->updateJunction(); + junction->calculateTimeStep(*this); + } +} void TrafficMovement::switchCurrentNext() { diff --git a/src/Traffic/TrafficMovement.h b/src/Traffic/TrafficMovement.h index f3f9a354d5c8902e3ade4c5e908905789b5c9172..b02d2ee39ef497e8f636728e64dd1475a463f467 100644 --- a/src/Traffic/TrafficMovement.h +++ b/src/Traffic/TrafficMovement.h @@ -52,6 +52,7 @@ private: //calculate timestep void calculateSourceStep(); + void calculateJunctionStep(); void switchCurrentNext(); //gap