Permalink
Browse files

corrected typos

  • Loading branch information...
akegermany committed Dec 3, 2017
1 parent 4c1c315 commit 2a3d5354189e516d484dafd4da989d5ba002f168
@@ -23,7 +23,7 @@ static RouteAlternative selectMostProbableAlternative(Iterable<RouteAlternative>
return alternative;
}
}
Preconditions.checkState(false, "probabilities not sumed correctly: random=" + random + ", sumProb=" + sumProb);
Preconditions.checkState(false, "probabilities not summed correctly: random=" + random + ", sumProb=" + sumProb);
return null;
}
@@ -53,7 +53,6 @@ private static void calcProbabilityIfStochastic(Iterable<RouteAlternative> alter
if (hasTooLargeExponent(beta, alternative, alternatives)) {
// probability of 0 as trivial result
alternative.setProbability(0);
} else {
double probAlternative = calcProbability(beta, alternative, alternatives);
alternative.setProbability(probAlternative);
@@ -103,7 +103,7 @@ private void initialize(double simulationTimestep, List<VehiclePrototypeConfigur
@Nullable Consumption consumption) {
for (VehiclePrototypeConfiguration typeConfig : configurations) {
if (vehiclePrototypes.containsKey(typeConfig.getLabel())) {
throw new IllegalArgumentException("ambigous vehicle prototype definition: prototype with label=\""
throw new IllegalArgumentException("ambiguous vehicle prototype definition: prototype with label=\""
+ typeConfig.getLabel() + "\" already exists.");
}
VehiclePrototype vehiclePrototype = new VehiclePrototype(simulationTimestep, typeConfig);
@@ -40,19 +40,29 @@
private static final double TINY_VALUE = 0.0001;
/** The Constant LOG. */
/**
* The Constant LOG.
*/
private static final Logger LOG = LoggerFactory.getLogger(EquilibriumPropertiesImpl.class);
/** Discretization steps for tabulated function. Time-critical. */
/**
* Discretization steps for tabulated function. Time-critical.
*/
private static final int NRHO = 51;
/** The maximum density */
/**
* The maximum density
*/
private final double rhoMax;
/** The maximum equilibrium flow */
/**
* The maximum equilibrium flow
*/
double qMax = 0;
/** The density at maximum flow */
/**
* The density at maximum flow
*/
double rhoQMax = 0;
private final LinearInterpolatedFunction vEqFunction;
@@ -67,7 +77,7 @@ public EquilibriumPropertiesImpl(double vehicleLength, LongitudinalModelBase mod
vEqFunction = calcEquilibriumSpeedFunction(model);
calcRhoQMax();
} else {
double[] xDummy = new double[] { 0 };
double[] xDummy = new double[]{0};
vEqFunction = new LinearInterpolatedFunction(xDummy, xDummy);
}
}
@@ -110,11 +120,10 @@ public int getVEqCount() {
/**
* Calculates equilibrium velocity {@literal vEq} as a function of the density {@literal rho}.
*
* <p>
* <p>
* Finds equilibrium velocities with simple relaxation method: Model for homogeneous traffic solved for the velocity v_it of one
* arbitrary vehicle.
*
*/
private LinearInterpolatedFunction calcEquilibriumSpeedFunction(LongitudinalModelBase model) {
LOG.info("calc equilibrium speed as function of density for model={}", model.modelName());
@@ -145,14 +154,13 @@ private LinearInterpolatedFunction calcEquilibriumSpeedFunction(LongitudinalMode
vEqTab[0] = v0; // start with rho=0
rhoTab[0] = 0;
for (int ir = 1; ir < vEqTab.length; ir++) {
// final double rho = rhoMax * ir / vEqTab.length;
final double rho = getRho(ir);
final double s = getNetDistance(rho);
// start iteration with equilibrium velocity for the previous localDensity
vIteration = vEqTab[ir - 1];
for (int it = 1; it <= itMax; it++) {
final double acc = model.calcAccSimple(s, vIteration, 0.);
// interation step in [dtmin, dtmax]
// integration step in [dtmin, dtmax]
final double dtLocal = dtMax * vIteration / Math.max(v0, TINY_VALUE) + dtMin;
// actual relaxation
vIteration += dtLocal * acc;

0 comments on commit 2a3d535

Please sign in to comment.