public double getSpeed(double time) { if (flowFunction == null) { return CONSTANT_INIT_SPEED; } return speedFunction.value(time); }
@Override public double getVEq(double rho) { // return Tables.intp(vEqTab, Math.min(rho, rhoMax), 0, rhoMax); return vEqFunction.value(rho); }
public double getFlowPerLane(double time) { if (flowFunction == null) { return CONSTANT_FLOW_PER_LANE; } return flowFunction.value(time); }
public double rho(double x) { return rhoFct.value(x); } }
public double vInit(double x) { Preconditions .checkNotNull(speedFct, "expected usage of equilibrium speeds, check with hasUserDefinedSpeeds"); return speedFct.value(x); }
private void calcRhoQMax() { Preconditions.checkNotNull(vEqFunction, "first calc equlibrium funcion vEq"); final double incr = rhoMax / (vEqFunction.getNumberOfDataPoints() - 1); qMax = -1.; double rho = 0; while (vEqFunction.value(rho) * rho > qMax) { qMax = vEqFunction.value(rho) * rho; rho += incr; } rhoQMax = rho - incr; LOG.info("rhoQMax = {}/km, qMax={}/h", rhoQMax * 1000, qMax * 3600); }
/** * sets the speeds of externally controlled vehicles in whole road network */ public void setSpeeds(double simulationTime) { for (Entry<Vehicle, LinearInterpolatedFunction> entry : controlledVehicles.entrySet()) { double currentSpeed = entry.getValue().value(simulationTime); Vehicle vehicle = entry.getKey(); vehicle.setSpeed(currentSpeed); } }
private void interpolateGridData(TreeSet<SpatialTemporal> dataPoints) { final int size = dataPoints.size(); final double[] xMicro = new double[size]; final double[] vMicro = new double[size]; final double[] aMicro = new double[size]; int j = 0; for (SpatialTemporal dp : dataPoints) { LOG.debug("data point for interpolation={}", dp); vMicro[j] = dp.speed; xMicro[j] = dp.position; aMicro[j] = dp.acceleration; ++j; } LinearInterpolatedFunction speeds = new LinearInterpolatedFunction(xMicro, vMicro); LinearInterpolatedFunction accelerations = new LinearInterpolatedFunction(xMicro, aMicro); for (int i = 0; i < macroSpeed.length; ++i) { final double x = i * dxOutput; macroSpeed[i] = speeds.value(x); macroAcceleration[i] = accelerations.value(x); } }
private double get_uPTa(double a) { double wm = param.getWeightMinus(); double bMax = param.getBMax(); double uPT = Math.min(bMax, Math.max(-bMax, uPTaFunction.value(a))); return (a <= -bMax) ? wm * (1 - 2 * delta) * Math.pow(a / param.getA0(), -2 * delta) : (a < bMax) ? uPT : (wm + dw) * (1 - 2 * delta) * Math.pow(a / param.getA0(), -2 * delta); }
private double get_uPTaa(double a) { double bmax = param.getBMax(); double aPT = Math.min(bmax, Math.max(-bmax, uPaaFunction.value(a))); return (a <= -bmax) ? -param.getWeightMinus() * 2 * delta * (1 - 2 * delta) * Math.pow(a / param.getA0(), -2 * delta - 1) : (a < bmax) ? aPT : -(param.getWeightMinus() + dw) * 2 * delta * (1 - 2 * delta) * Math.pow(a / param.getA0(), -2 * delta - 1); }