Ejemplo n.º 1
0
void
ROLoader::openRoutes(RONet& net) {
    // build loader
    // load relevant elements from additinal file
    bool ok = openTypedRoutes("additional-files", net);
    // load sumo-routes when wished
    ok &= openTypedRoutes("route-files", net);
    // load the XML-trip definitions when wished
    ok &= openTypedRoutes("trip-files", net);
    // load the sumo-alternative file when wished
    ok &= openTypedRoutes("alternative-files", net);
    // load the amount definitions if wished
    ok &= openTypedRoutes("flow-files", net);
    // check
    if (ok) {
        myLoaders.loadNext(string2time(myOptions.getString("begin")));
        if (!MsgHandler::getErrorInstance()->wasInformed() && !net.furtherStored()) {
            throw ProcessError("No route input specified or all routes were invalid.");
        }
        // skip routes prior to the begin time
        if (!myOptions.getBool("unsorted-input")) {
            WRITE_MESSAGE("Skipped until: " + time2string(myLoaders.getFirstLoadTime()));
        }
    }
}
Ejemplo n.º 2
0
void
ROLoader::processRoutes(SUMOTime start, SUMOTime end,
                        RONet& net, SUMOAbstractRouter<ROEdge, ROVehicle>& router) {
    SUMOTime absNo = end - start;
    // skip routes that begin before the simulation's begin
    // loop till the end
    bool endReached = false;
    bool errorOccured = false;
    const SUMOTime firstStep = myLoaders.getFirstLoadTime();
    SUMOTime lastStep = firstStep;
    for (SUMOTime time = firstStep; time < end && !errorOccured && !endReached; time += DELTA_T) {
        writeStats(time, start, absNo);
        myLoaders.loadNext(time);
        net.saveAndRemoveRoutesUntil(myOptions, router, time);
        endReached = !net.furtherStored();
        lastStep = time;
        errorOccured = MsgHandler::getErrorInstance()->wasInformed() && !myOptions.getBool("ignore-errors");
    }
    if (myLogSteps) {
        WRITE_MESSAGE("Routes found between time steps " + time2string(firstStep) + " and " + time2string(lastStep) + ".");
    }
}