Skip to content

Commit

Permalink
fix #4600
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Sep 14, 2018
1 parent 6b61eac commit 7b50868
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/od/ODMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,16 @@ ODMatrix::writeFlows(const SUMOTime begin, const SUMOTime end,
for (std::vector<ODCell*>::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));
Expand Down

0 comments on commit 7b50868

Please sign in to comment.