Co-Simulation/Sumo/sumo-1.7.0/src/marouter/marouter_main.cpp
/**
 * Writes the travel times for a single interval
 */
Writes the travel times for a single interval
Writes the travel times for a single interval
void
writeInterval(OutputDevice& dev, const SUMOTime begin, const SUMOTime end, const RONet& net, const ROVehicle* const veh) {
    dev.openTag(SUMO_TAG_INTERVAL).writeAttr(SUMO_ATTR_BEGIN, time2string(begin)).writeAttr(SUMO_ATTR_END, time2string(end));
    for (std::map<std::string, ROEdge*>::const_iterator i = net.getEdgeMap().begin(); i != net.getEdgeMap().end(); ++i) {
        ROMAEdge* edge = static_cast<ROMAEdge*>(i->second);
        if (edge->getFunction() == SumoXMLEdgeFunc::NORMAL) {
            dev.openTag(SUMO_TAG_EDGE).writeAttr(SUMO_ATTR_ID, edge->getID());
            const double traveltime = edge->getTravelTime(veh, STEPS2TIME(begin));
            const double flow = edge->getFlow(STEPS2TIME(begin));
            dev.writeAttr("traveltime", traveltime);
            dev.writeAttr("speed", edge->getLength() / traveltime);
            dev.writeAttr("entered", flow);
            dev.writeAttr("flowCapacityRatio", 100. * flow / ROMAAssignments::getCapacity(edge));
            dev.closeTag();
        }
    }
    dev.closeTag();
}
void writeInterval ( OutputDevice & dev , const SUMOTime begin , const SUMOTime end , const RONet & net , const ROVehicle * const veh ) { dev . openTag ( SUMO_TAG_INTERVAL ) . writeAttr ( SUMO_ATTR_BEGIN , time2string ( begin ) ) . writeAttr ( SUMO_ATTR_END , time2string ( end ) ) ; for ( std :: map < std :: string , ROEdge * > :: const_iterator i = net . getEdgeMap ( ) . begin ( ) ; i != net . getEdgeMap ( ) . end ( ) ; ++ i ) { ROMAEdge * edge = static_cast < ROMAEdge * > ( i -> second ) ; if ( edge -> getFunction ( ) == SumoXMLEdgeFunc :: NORMAL ) { dev . openTag ( SUMO_TAG_EDGE ) . writeAttr ( SUMO_ATTR_ID , edge -> getID ( ) ) ; const double traveltime = edge -> getTravelTime ( veh , STEPS2TIME ( begin ) ) ; const double flow = edge -> getFlow ( STEPS2TIME ( begin ) ) ; dev . writeAttr ( " " , traveltime ) ; dev . writeAttr ( " " , edge -> getLength ( ) / traveltime ) ; dev . writeAttr ( " " , flow ) ; dev . writeAttr ( " " , 100. * flow / ROMAAssignments :: getCapacity ( edge ) ) ; dev . closeTag ( ) ; } } dev . closeTag ( ) ; }
Writes the travel times for a single interval
Writes the travel times for a single interval