From 7b5086840616e427ac35e440d5d573125c10eee7 Mon Sep 17 00:00:00 2001 From: namdre Date: Fri, 14 Sep 2018 23:30:30 +0200 Subject: [PATCH] fix #4600 --- src/od/ODMatrix.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/od/ODMatrix.cpp b/src/od/ODMatrix.cpp index 60f6e1f28762..55ab35db5ca0 100644 --- a/src/od/ODMatrix.cpp +++ b/src/od/ODMatrix.cpp @@ -309,13 +309,16 @@ ODMatrix::writeFlows(const SUMOTime begin, const SUMOTime end, for (std::vector::const_iterator i = myContainer.begin(); i != myContainer.end(); ++i) { const ODCell* const c = *i; if (c->end > begin && c->begin < end) { + const double probability = asProbability ? float(c->vehicleNumber) / STEPS2TIME(c->end - c->begin) : 1; + if (probability <= 0) { + continue; + } dev.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, prefix + toString(flowName++)); dev.writeAttr(SUMO_ATTR_BEGIN, time2string(c->begin)); dev.writeAttr(SUMO_ATTR_END, time2string(c->end)); if (!asProbability) { dev.writeAttr(SUMO_ATTR_NUMBER, int(c->vehicleNumber)); } else { - const double probability = float(c->vehicleNumber) / STEPS2TIME(c->end - c->begin); if (probability > 1) { WRITE_WARNING("Flow density of " + toString(probability) + " vehicles per second, cannot be represented with a simple probability. Falling back to even spacing."); dev.writeAttr(SUMO_ATTR_NUMBER, int(c->vehicleNumber));