From 56c313198a9bb57a9702e42fef2ed8cc57bba74a Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 27 Jan 2025 14:24:27 +0100 Subject: [PATCH] tweaking debug code --- .../traffic_lights/MSActuatedTrafficLightLogic.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp b/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp index ef21fbebf692..5fe8b4318d0f 100644 --- a/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp +++ b/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp @@ -41,6 +41,7 @@ //#define DEBUG_DETECTORS //#define DEBUG_PHASE_SELECTION +//#define DEBUG_PHASE_SELECTION_CUSTOM #define DEBUG_COND (getID()=="C") // =========================================================================== @@ -1173,7 +1174,12 @@ MSActuatedTrafficLightLogic::decideNextPhaseCustom(bool mustSwitch) { for (int next : getCurrentPhaseDef().nextPhases) { const MSPhaseDefinition* phase = myPhases[next]; const std::string& condition = mustSwitch ? phase->finalTarget : phase->earlyTarget; - //std::cout << SIMTIME << " mustSwitch=" << mustSwitch << " condition=" << condition << "\n"; +#ifdef DEBUG_PHASE_SELECTION_CUSTOM + if (DEBUG_COND) { + std::cout << SIMTIME << " mustSwitch=" << mustSwitch << " cur=" << myStep << " next=" << next << " condition=" << condition + << " eval=" << (condition == "" ? NAN : evalExpression(condition)) << "\n"; + } +#endif if (condition != "") { // backward compatibility if a user redefined DEFAULT_CONDITION if (condition == DEFAULT_CONDITION && myConditions.count(DEFAULT_CONDITION) == 0) {