File |
Line |
org\opentrafficsim\road\gtu\lane\tactical\following\IDMOld.java |
160 |
org\opentrafficsim\road\gtu\lane\tactical\following\IDMPlusOld.java |
177 |
}
/** {@inheritDoc} */
@Override
public final String getLongName()
{
return String.format("%s (a=%.1fm/s\u00b2, b=%.1fm/s\u00b2, s0=%.1fm, tSafe=%.1fs, delta=%.2f)", getName(),
this.a.getSI(), this.b.getSI(), this.s0.getSI(), this.tSafe.getSI(), this.delta);
}
/** {@inheritDoc} */
@Override
public final void setA(final Acceleration a)
{
this.a = a;
}
/** {@inheritDoc} */
@Override
public final void setT(final Duration t)
{
this.tSafe = t;
}
/** {@inheritDoc} */
@Override
public final void setFspeed(final double fSpeed)
{
this.delta = fSpeed;
}
// The following is inherited from CarFollowingModel
/** {@inheritDoc} */
@Override
public final Speed desiredSpeed(final Parameters parameters, final SpeedLimitInfo speedInfo) throws ParameterException
{
throw new UnsupportedOperationException("Old car-following model does not support desired speed.");
}
/** {@inheritDoc} */
@Override
public final Length desiredHeadway(final Parameters parameters, final Speed speed) throws ParameterException
{
throw new UnsupportedOperationException("Old car-following model does not support desired headway.");
}
/** {@inheritDoc} */
@Override
public final Acceleration followingAcceleration(final Parameters parameters, final Speed speed,
final SpeedLimitInfo speedInfo, final PerceptionIterable<? extends Headway> leaders) throws ParameterException
{
Length headway;
Speed leaderSpeed;
if (leaders.isEmpty())
{
headway = new Length(Double.MAX_VALUE, LengthUnit.SI);
leaderSpeed = speed;
}
else
{
Headway leader = leaders.first();
headway = leader.getDistance();
leaderSpeed = leader.getSpeed();
}
return this.computeAcceleration(speed, speedInfo.getSpeedInfo(SpeedLimitTypes.MAX_VEHICLE_SPEED), leaderSpeed, headway,
speedInfo.getSpeedInfo(SpeedLimitTypes.FIXED_SIGN));
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return "IDMOld [s0=" + this.s0 + ", a=" + this.a + ", b=" + this.b + ", tSafe=" + this.tSafe + ", stepSize=" |
File |
Line |
org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java |
70 |
org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java |
113 |
Cooperation PASSIVE_MOVING = new Cooperation()
{
@Override
public Acceleration cooperate(final LanePerception perception, final Parameters params, final SpeedLimitInfo sli,
final CarFollowingModel cfm, final LateralDirectionality lat, final Desire ownDesire)
throws ParameterException, OperationalPlanException
{
if ((lat.isLeft() && !perception.getLaneStructure().getExtendedCrossSection().contains(RelativeLane.LEFT))
|| (lat.isRight() && !perception.getLaneStructure().getExtendedCrossSection().contains(RelativeLane.RIGHT)))
{
return new Acceleration(Double.MAX_VALUE, AccelerationUnit.SI);
}
// Acceleration b = params.getParameter(ParameterTypes.B);
Acceleration a = new Acceleration(Double.MAX_VALUE, AccelerationUnit.SI);
double dCoop = params.getParameter(DCOOP);
Speed ownSpeed = perception.getPerceptionCategory(EgoPerception.class).getSpeed();
RelativeLane relativeLane = new RelativeLane(lat, 1);
for (HeadwayGTU leader : Synchronization.removeAllUpstreamOfConflicts(Synchronization.removeAllUpstreamOfConflicts(
perception.getPerceptionCategory(NeighborsPerception.class).getLeaders(relativeLane), perception,
relativeLane), perception, RelativeLane.CURRENT))
{
Parameters params2 = leader.getParameters();
double desire = lat.equals(LateralDirectionality.LEFT) ? params2.getParameter(DRIGHT)
: lat.equals(LateralDirectionality.RIGHT) ? params2.getParameter(DLEFT) : 0;
if (desire >= dCoop && (leader.getSpeed().gt0() || leader.getDistance().gt0())) |
File |
Line |
org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java |
47 |
org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java |
83 |
Acceleration a = new Acceleration(Double.MAX_VALUE, AccelerationUnit.SI);
double dCoop = params.getParameter(DCOOP);
Speed ownSpeed = perception.getPerceptionCategory(EgoPerception.class).getSpeed();
RelativeLane relativeLane = new RelativeLane(lat, 1);
for (HeadwayGTU leader : Synchronization.removeAllUpstreamOfConflicts(Synchronization.removeAllUpstreamOfConflicts(
perception.getPerceptionCategory(NeighborsPerception.class).getLeaders(relativeLane), perception,
relativeLane), perception, RelativeLane.CURRENT))
{
Parameters params2 = leader.getParameters();
double desire = lat.equals(LateralDirectionality.LEFT) ? params2.getParameter(DRIGHT)
: lat.equals(LateralDirectionality.RIGHT) ? params2.getParameter(DLEFT) : 0;
if (desire >= dCoop && (leader.getSpeed().gt0() || leader.getDistance().gt0()))
{
Acceleration aSingle = LmrsUtil.singleAcceleration(leader.getDistance(), ownSpeed, leader.getSpeed(),
desire, params, sli, cfm);
a = Acceleration.min(a, aSingle); |
File |
Line |
org\opentrafficsim\road\gtu\lane\tactical\following\IDMOld.java |
80 |
org\opentrafficsim\road\gtu\lane\tactical\following\IDMPlusOld.java |
86 |
public IDMOld(final Acceleration a, final Acceleration b, final Length s0, final Duration tSafe, final double delta)
{
this.a = a;
this.b = b;
this.s0 = s0;
this.tSafe = tSafe;
this.delta = delta;
}
/**
* Desired speed (taking into account the urge to drive a little faster or slower than the posted speed limit).
* @param speedLimit Speed; the speed limit
* @param followerMaximumSpeed Speed; the maximum speed that the follower can drive
* @return DoubleScalarRel<SpeedUnit>; the desired speed
*/
private Speed vDes(final Speed speedLimit, final Speed followerMaximumSpeed)
{
return new Speed(Math.min(this.delta * speedLimit.getSI(), followerMaximumSpeed.getSI()), SpeedUnit.SI);
}
/** {@inheritDoc} */
@Override
public final Acceleration computeAcceleration(final Speed followerSpeed, final Speed followerMaximumSpeed,
final Speed leaderSpeed, final Length headway, final Speed speedLimit)
{
return computeAcceleration(followerSpeed, followerMaximumSpeed, leaderSpeed, headway, speedLimit, DEFAULT_STEP_SIZE);
}
/** {@inheritDoc} */
@Override
public final Acceleration computeAcceleration(final Speed followerSpeed, final Speed followerMaximumSpeed,
final Speed leaderSpeed, final Length headway, final Speed speedLimit, final Duration stepSize)
{ |
File |
Line |
org\opentrafficsim\road\network\lane\conflict\ConflictBuilder.java |
419 |
org\opentrafficsim\road\network\lane\conflict\ConflictBuilder.java |
532 |
Length longitudinalPosition2 = lane2.getLength().multiplyBy(f2start);
Length length1 = lane1.getLength().multiplyBy(Math.abs(f1end - f1start));
Length length2 = lane2.getLength().multiplyBy(Math.abs(f2end - f2start));
// Get geometries
OTSLine3D geometry1 = getGeometry(lane1, f1start, f1end, widthGenerator);
OTSLine3D geometry2 = getGeometry(lane2, f2start, f2end, widthGenerator);
// Determine conflict rule
ConflictRule conflictRule;
if (lane1.getParentLink().getPriority().isBusStop() || lane2.getParentLink().getPriority().isBusStop())
{
Throw.when(lane1.getParentLink().getPriority().isBusStop() && lane2.getParentLink().getPriority().isBusStop(),
IllegalArgumentException.class, "Merge conflict between two links with bus stop priority not supported.");
conflictRule = new BusStopConflictRule(simulator);
}
else
{
conflictRule = new DefaultConflictRule();
}
// Make conflict
Conflict.generateConflictPair(ConflictType.MERGE, conflictRule, permitted, lane1, longitudinalPosition1, length1, dir1, |
File |
Line |
org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java |
47 |
org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java |
126 |
Acceleration a = new Acceleration(Double.MAX_VALUE, AccelerationUnit.SI);
double dCoop = params.getParameter(DCOOP);
Speed ownSpeed = perception.getPerceptionCategory(EgoPerception.class).getSpeed();
RelativeLane relativeLane = new RelativeLane(lat, 1);
for (HeadwayGTU leader : Synchronization.removeAllUpstreamOfConflicts(Synchronization.removeAllUpstreamOfConflicts(
perception.getPerceptionCategory(NeighborsPerception.class).getLeaders(relativeLane), perception,
relativeLane), perception, RelativeLane.CURRENT))
{
Parameters params2 = leader.getParameters();
double desire = lat.equals(LateralDirectionality.LEFT) ? params2.getParameter(DRIGHT)
: lat.equals(LateralDirectionality.RIGHT) ? params2.getParameter(DLEFT) : 0;
if (desire >= dCoop && (leader.getSpeed().gt0() || leader.getDistance().gt0())) |
File |
Line |
org\opentrafficsim\road\network\factory\LaneFactory.java |
417 |
org\opentrafficsim\road\network\factory\LaneFactory.java |
486 |
final CrossSectionLink link = makeLink(network, name, from, to, intermediatePoints, simulator);
Lane[] result = new Lane[laneCount];
Length width = new Length(4.0, LengthUnit.METER);
for (int laneIndex = 0; laneIndex < laneCount; laneIndex++)
{
// Be ware! LEFT is lateral positive, RIGHT is lateral negative.
Length latPosAtStart = new Length((-0.5 - laneIndex - laneOffsetAtStart) * width.getSI(), LengthUnit.SI);
Length latPosAtEnd = new Length((-0.5 - laneIndex - laneOffsetAtEnd) * width.getSI(), LengthUnit.SI);
result[laneIndex] =
makeLane(link, "lane." + laneIndex, laneType, latPosAtStart, latPosAtEnd, width, speedLimit, simulator);
}
return result;
} |
File |
Line |
org\opentrafficsim\road\gtu\lane\tactical\following\FixedAccelerationModel.java |
119 |
org\opentrafficsim\road\gtu\lane\tactical\following\SequentialFixedAccelerationModel.java |
187 |
}
/** {@inheritDoc} */
@Override
public final void setA(final Acceleration a)
{
//
}
/** {@inheritDoc} */
@Override
public final void setT(final Duration t)
{
//
}
/** {@inheritDoc} */
@Override
public final void setFspeed(final double fSpeed)
{
//
}
// The following is inherited from CarFollowingModel
/** {@inheritDoc} */
@Override
public final Speed desiredSpeed(final Parameters parameters, final SpeedLimitInfo speedInfo) throws ParameterException
{
return null;
}
/** {@inheritDoc} */
@Override
public final Length desiredHeadway(final Parameters parameters, final Speed speed) throws ParameterException
{
return null;
}
/** {@inheritDoc} */
@Override
public final Acceleration followingAcceleration(final Parameters parameters, final Speed speed,
final SpeedLimitInfo speedInfo, final PerceptionIterable<? extends Headway> leaders) throws ParameterException
{
return null;
} |
File |
Line |
org\opentrafficsim\road\gtu\lane\tactical\LaneBasedGTUFollowingDirectedChangeTacticalPlanner.java |
294 |
org\opentrafficsim\road\gtu\lane\tactical\LaneBasedGTUFollowingDirectedChangeTacticalPlanner.java |
341 |
if (simplePerception.getParallelHeadwaysLeft().isEmpty())
{
Collection<Headway> sameLaneTraffic = new HashSet<>();
// TODO should it be getObjectType().isGtu() or !getObjectType().isDistanceOnly() ?
// XXX Object & GTU
if (simplePerception.getForwardHeadwayGTU() != null
&& simplePerception.getForwardHeadwayGTU().getObjectType().isGtu())
{
sameLaneTraffic.add(simplePerception.getForwardHeadwayGTU());
}
if (simplePerception.getBackwardHeadway() != null
&& simplePerception.getBackwardHeadway().getObjectType().isGtu())
{
sameLaneTraffic.add(simplePerception.getBackwardHeadway());
}
DirectedLaneChangeModel dlcm = new DirectedAltruistic(getPerception());
DirectedLaneMovementStep dlms = dlcm.computeLaneChangeAndAcceleration(laneBasedGTU,
LateralDirectionality.LEFT, sameLaneTraffic, simplePerception.getNeighboringHeadwaysLeft(), |
File |
Line |
org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java |
34 |
org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java |
70 |
org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java |
113 |
Cooperation PASSIVE = new Cooperation()
{
@Override
public Acceleration cooperate(final LanePerception perception, final Parameters params, final SpeedLimitInfo sli,
final CarFollowingModel cfm, final LateralDirectionality lat, final Desire ownDesire)
throws ParameterException, OperationalPlanException
{
if ((lat.isLeft() && !perception.getLaneStructure().getExtendedCrossSection().contains(RelativeLane.LEFT))
|| (lat.isRight() && !perception.getLaneStructure().getExtendedCrossSection().contains(RelativeLane.RIGHT)))
{
return new Acceleration(Double.MAX_VALUE, AccelerationUnit.SI);
}
Acceleration b = params.getParameter(ParameterTypes.B); |
File |
Line |
org\opentrafficsim\road\gtu\generator\AbstractGTUGenerator.java |
343 |
org\opentrafficsim\road\gtu\generator\AbstractGTUGenerator.java |
403 |
double distanceM = cumDistanceSI + otherGTU.position(theLane, otherGTU.getRear(), when).getSI() - lanePositionSI;
if (distanceM > 0 && distanceM <= maxDistanceSI)
{
return new HeadwayGTUSimple(otherGTU.getId(), otherGTU.getGTUType(), new Length(distanceM, LengthUnit.SI),
otherGTU.getLength(), otherGTU.getWidth(), otherGTU.getSpeed(), otherGTU.getAcceleration(), null);
}
return new HeadwayDistance(Double.MAX_VALUE);
}
// Continue search on successor lanes.
if (cumDistanceSI + theLane.getLength().getSI() - lanePositionSI < maxDistanceSI)
{
// is there a successor link?
if (theLane.nextLanes(this.gtuType).size() > 0) |