本文整理汇总了C++中MESegment::getMeanSpeed方法的典型用法代码示例。如果您正苦于以下问题:C++ MESegment::getMeanSpeed方法的具体用法?C++ MESegment::getMeanSpeed怎么用?C++ MESegment::getMeanSpeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MESegment
的用法示例。
在下文中一共展示了MESegment::getMeanSpeed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getLength
SUMOReal
MSEdge::getMeanSpeed() const {
SUMOReal v = 0;
SUMOReal no = 0;
if (MSGlobals::gUseMesoSim) {
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
const SUMOReal vehNo = (SUMOReal) segment->getCarNumber();
v += vehNo * segment->getMeanSpeed();
no += vehNo;
}
if (no == 0) {
return getLength() / myEmptyTraveltime; // may include tls-penalty
}
} else {
for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
const SUMOReal vehNo = (SUMOReal)(*i)->getVehicleNumber();
v += vehNo * (*i)->getMeanSpeed();
no += vehNo;
}
if (no == 0) {
return getSpeedLimit();
}
}
return v / no;
}
示例2: getLength
SUMOReal
MSEdge::getCurrentTravelTime(SUMOReal minSpeed) const {
assert(minSpeed > 0);
if (!myAmDelayed) {
return myEmptyTraveltime;
}
SUMOReal v = 0;
#ifdef HAVE_INTERNAL
if (MSGlobals::gUseMesoSim) {
MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(*this);
unsigned segments = 0;
do {
v += first->getMeanSpeed();
first = first->getNextSegment();
segments++;
} while (first != 0);
v /= (SUMOReal) segments;
} else {
#endif
for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
v += (*i)->getMeanSpeed();
}
v /= (SUMOReal) myLanes->size();
#ifdef HAVE_INTERNAL
}
#endif
return getLength() / MAX2(minSpeed, v);
}
示例3:
SUMOReal
GUIEdge::getFlow() const {
SUMOReal flow = 0;
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
flow += (SUMOReal) segment->getCarNumber() * segment->getMeanSpeed();
}
return 3600 * flow / (*myLanes)[0]->getLength();
}
示例4: switch
bool
GUIEdge::setMultiColor(const GUIColorer& c) const {
const int activeScheme = c.getActive();
mySegmentColors.clear();
switch (activeScheme) {
case 10: // alternating segments
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
}
//std::cout << getID() << " scheme=" << c.getScheme().getName() << " schemeCols=" << c.getScheme().getColors().size() << " thresh=" << toString(c.getScheme().getThresholds()) << " segmentColors=" << mySegmentColors.size() << " [0]=" << mySegmentColors[0] << " [1]=" << mySegmentColors[1] << "\n";
return true;
case 11: // by segment jammed state
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->free() ? 0 : 1));
}
return true;
case 12: // by segment occupancy
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
}
return true;
case 13: // by segment speed
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
}
return true;
case 14: // by segment flow
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
}
return true;
case 15: // by segment relative speed
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
segment != 0; segment = segment->getNextSegment()) {
mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
}
return true;
default:
return false;
}
}
示例5: getSpeedLimit
SUMOReal
GUIEdge::getMeanSpeed() const {
SUMOReal v = 0;
SUMOReal no = 0;
for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
SUMOReal vehNo = (SUMOReal) segment->getCarNumber();
v += vehNo * segment->getMeanSpeed();
no += vehNo;
}
if (no == 0) {
return getSpeedLimit();
}
return v / no;
}