Dear Jakob,
thanks for the hint, see patch attached to this mail.
Kind regards,
Dominik
On 2016-11-09 14:32, Jakob Erdmann wrote:
> Hello,
> this is not supported at the moment but should be easy to implement.
> Take a look at ODMatrix::writeFlows()
> And don't forget to send us a patch (-:
> regards,
> Jakob
>
> 2016-11-09 14:17 GMT+01:00 Dominik S. Buse <[email protected]
> <mailto:[email protected]>>:
>
> Hello everyone,
>
> when using od2trips with the --flow-output switch, the generated flows
> use the 'number' attribute.
> Is it also possible to have them generated using the 'probability'
> attribute to have the vehicles distributed in a binomial/poisson way?
>
> Thanks and kind regards,
> Dominik
>
>
> --
> Dominik Buse M.Sc.
> Distributed Embedded Systems (CCS Labs)
> Heinz Nixdorf Institut, Paderborn University, Germany
> http://www.ccs-labs.org/~buse/ <http://www.ccs-labs.org/%7Ebuse/>
>
>
>
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
> _______________________________________________
> sumo-user mailing list
> [email protected]
> <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/sumo-user
> <https://lists.sourceforge.net/lists/listinfo/sumo-user>
>
>
--
Dominik Buse M.Sc.
Distributed Embedded Systems (CCS Labs)
Heinz Nixdorf Institut, Paderborn University, Germany
http://www.ccs-labs.org/~buse/
Index: src/od/ODMatrix.cpp
===================================================================
--- src/od/ODMatrix.cpp (revision 21954)
+++ src/od/ODMatrix.cpp (working copy)
@@ -290,7 +290,8 @@
void
ODMatrix::writeFlows(const SUMOTime begin, const SUMOTime end,
OutputDevice& dev, bool noVtype,
- const std::string& prefix) {
+ const std::string& prefix,
+ bool asProbability) {
if (myContainer.size() == 0) {
return;
}
@@ -302,7 +303,16 @@
if (c->end > begin && c->begin < end) {
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)).writeAttr(SUMO_ATTR_NUMBER, int(c->vehicleNumber));
+ dev.writeAttr(SUMO_ATTR_END, time2string(c->end));
+ if(!asProbability) {
+ dev.writeAttr(SUMO_ATTR_NUMBER, int(c->vehicleNumber));
+ } else {
+ std::ostringstream oss;
+ oss.setf(oss.fixed);
+ oss.precision(6);
+ oss << float(c->vehicleNumber) / STEPS2TIME(c->end - c->begin);
+ dev.writeAttr(SUMO_ATTR_PROB, oss.str());
+ }
writeDefaultAttrs(dev, noVtype, *i);
dev.closeTag();
}
Index: src/od/ODMatrix.h
===================================================================
--- src/od/ODMatrix.h (revision 21954)
+++ src/od/ODMatrix.h (working copy)
@@ -175,10 +175,12 @@
* @param[in] dev The stream to write the generated vehicle trips to
* @param[in] noVtype Whether vtype information shall not be written
* @param[in] prefix A prefix for the flow names
+ * @param[in] asProbability Write probability to spawn per second instead of number of vehicles
*/
void writeFlows(const SUMOTime begin, const SUMOTime end,
OutputDevice& dev, const bool noVtype,
- const std::string& prefix);
+ const std::string& prefix,
+ bool asProbability=false);
/** @brief Returns the number of loaded vehicles
Index: src/od2trips_main.cpp
===================================================================
--- src/od2trips_main.cpp (revision 21954)
+++ src/od2trips_main.cpp (working copy)
@@ -113,6 +113,9 @@
oc.doRegister("flow-output", new Option_FileName());
oc.addDescription("flow-output", "Output", "Writes flow definitions into FILE");
+ oc.doRegister("flow-output.use-prob", new Option_Bool(false));
+ oc.addDescription("flow-output.use-prob", "Output", "Writes secondly spwan probability instead of number of vehicles per flow");
+
oc.doRegister("ignore-vehicle-type", new Option_Bool(false));
oc.addSynonyme("ignore-vehicle-type", "no-vtype", true);
oc.addDescription("ignore-vehicle-type", "Output", "Does not save vtype information");
@@ -292,7 +295,8 @@
if (OutputDevice::createDeviceByOption("flow-output", "routes", "routes_file.xsd")) {
matrix.writeFlows(string2time(oc.getString("begin")), string2time(oc.getString("end")),
OutputDevice::getDeviceByOption("flow-output"),
- oc.getBool("ignore-vehicle-type"), oc.getString("prefix"));
+ oc.getBool("ignore-vehicle-type"), oc.getString("prefix"),
+ oc.getBool("flow-output.use-prob"));
haveOutput = true;
}
if (!haveOutput) {
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
sumo-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-user