Skip to content

Commit

Permalink
Revert to HP based AppliedTraction for SteamLocomotives
Browse files Browse the repository at this point in the history
Better wheel-slip guestimations
  • Loading branch information
cam72cam committed Oct 22, 2023
1 parent 3a663a1 commit ba58441
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public abstract class Locomotive extends FreightTank {
@TagField("cogging")
private boolean cogging = false;

private boolean slipping = false;

/*
*
* Stock Definitions
Expand Down Expand Up @@ -394,7 +396,7 @@ public void onTick() {
private double getStaticTractiveEffort(Speed speed) {
return (Config.ConfigBalance.FuelRequired ? this.getWeight() : this.getMaxWeight()) // KG
* 9.8 // M/S/S
* STEEL.staticFriction(STEEL)
* (slipping ? STEEL.kineticFriction(STEEL) : STEEL.staticFriction(STEEL))
* slipCoefficient(speed)
/ getDefinition().factorOfAdhesion()
* Config.ConfigBalance.tractionMultiplier;
Expand All @@ -407,8 +409,9 @@ protected double simulateWheelSlip() {

double adhesionFactor = Math.abs(getAppliedTractiveEffort(getCurrentSpeed())) /
getStaticTractiveEffort(getCurrentSpeed());
if (adhesionFactor > 1) {
return Math.copySign((adhesionFactor-1)/10, getReverser());
slipping = adhesionFactor > 1;
if (slipping) {
return Math.copySign((adhesionFactor-1)/5, getReverser());
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public double getAppliedTractiveEffort(Speed speed) {
return 0;
}

double traction_N = this.getDefinition().getStartingTractionNewtons(gauge);
//double traction_N = this.getDefinition().getStartingTractionNewtons(gauge);
double traction_N = this.getDefinition().getHorsePower(gauge) * 375 / Math.max(Math.abs(speed.imperial()), 1.0);
if (Config.isFuelRequired(gauge)) {
traction_N = traction_N / this.getDefinition().getMaxPSI(gauge) * this.getBoilerPressure();
}
Expand Down

0 comments on commit ba58441

Please sign in to comment.