Skip to content

Commit

Permalink
Allow rolling resistance modification in way context
Browse files Browse the repository at this point in the history
  • Loading branch information
quaelnix authored May 30, 2024
1 parent be0aa77 commit 7ba2f14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion brouter-core/src/main/java/btools/router/StdPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ protected void computeKinematic(RoutingContext rc, double dist, double delta_h,
}

double speed = maxSpeed; // Travel speed
double f_roll = rc.totalMass * GRAVITY * (rc.defaultC_r + incline);
double crf = Math.max(1, rc.expctxWay.getRollingResistanceFactor());
double f_roll = rc.totalMass * GRAVITY * (rc.defaultC_r * crf + incline);
if (rc.footMode) {
// Use Tobler's hiking function for walking sections
speed = rc.maxSpeed * Math.exp(-3.5 * Math.abs(incline + 0.05));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class BExpressionContextWay extends BExpressionContext implements T
private boolean decodeForbidden = true;

private static String[] buildInVariables =
{"costfactor", "turncost", "uphillcostfactor", "downhillcostfactor", "initialcost", "nodeaccessgranted", "initialclassifier", "trafficsourcedensity", "istrafficbackbone", "priorityclassifier", "classifiermask", "maxspeed", "uphillcost", "downhillcost", "uphillcutoff", "downhillcutoff", "uphillmaxslope", "downhillmaxslope", "uphillmaxslopecost", "downhillmaxslopecost"};
{"costfactor", "turncost", "uphillcostfactor", "downhillcostfactor", "initialcost", "nodeaccessgranted", "initialclassifier", "trafficsourcedensity", "istrafficbackbone", "priorityclassifier", "classifiermask", "maxspeed", "uphillcost", "downhillcost", "uphillcutoff", "downhillcutoff", "uphillmaxslope", "downhillmaxslope", "uphillmaxslopecost", "downhillmaxslopecost", "crfactor"};

protected String[] getBuildInVariableNames() {
return buildInVariables;
Expand Down Expand Up @@ -98,6 +98,10 @@ public float getDownhillmaxslopecost() {
return getBuildInVariable(19);
}

public float getRollingResistanceFactor() {
return getBuildInVariable(20);
}

public BExpressionContextWay(BExpressionMetaData meta) {
super("way", meta);
}
Expand Down

0 comments on commit 7ba2f14

Please sign in to comment.