This is a minder to myself to add hill climb & hill descent feedforward to RailDriver's PIDF control loop.
How this will work is, it will take into account the track's gradient, the locomotive's current speed & direction of travel, & then feed this directly to the output of the control loop (to the traction motors) through a user-tunable gain.
This is to aid the control loop during transitions from level gradient to an incline & back again, where the proportional & integral terms don't react fast enough to correct from this. This feedforward component will be proportional to the incline & will remain constant for the entire time that the locomotive is either ascending or descending the hill that it is currently on.
What problems this will solve
Hill climb & descent feedforward reduces the likelihood of a phenomenon known as "bogging" occurring.
For those that are familiar with control theory, "bogging" is when the I-Term is completely saturated & the rest of the control loop is unable to correct for disturbances.
In layman's terms, this translates to the locomotive simply losing speed when you are going uphill & your locomotive gaining speed when you are going downhill. Hill climb & descent feedforward will reduce the chances of this happening by supplementing the control loop.
Currently, I have intentionally overtuned the control loop in order to make your locomotive climb & descend hills of up to 3.5 % gradient with the tradeoff of introducing an overshoot of up to 4 mph, when you accelerate or decelerate. In some cases, drastic changes in speed will cause your entire train to momentarily stop & then accelerate to your set speed again.
There is also an edge case where this drastic change in speed can cause a "rollback runaway" (particularly when you stop on a hill).
This same rollback runaway condition was addressed when I-Term Decay was introduced to RailDriver's control loop.
However, that doesn't kick in until your set speed is at 0 mph & your locomotive is traveling at or slower than 3 mph.
Additional
When I introduce hill climb & descent feedforward, I will spend some time with re-tuning the control loop (particularly with focus on the I-Term & P-Term gains) in such a way that the control loop is correctly being supplemented by this feedforward when your locomotive is climbing & descending hills. I will also address the overshoot problem while I am at it.
Overview
This is a minder to myself to add hill climb & hill descent feedforward to RailDriver's PIDF control loop.
How this will work is, it will take into account the track's gradient, the locomotive's current speed & direction of travel, & then feed this directly to the output of the control loop (to the traction motors) through a user-tunable gain.
This is to aid the control loop during transitions from level gradient to an incline & back again, where the proportional & integral terms don't react fast enough to correct from this. This feedforward component will be proportional to the incline & will remain constant for the entire time that the locomotive is either ascending or descending the hill that it is currently on.
What problems this will solve
Hill climb & descent feedforward reduces the likelihood of a phenomenon known as "bogging" occurring. For those that are familiar with control theory, "bogging" is when the I-Term is completely saturated & the rest of the control loop is unable to correct for disturbances. In layman's terms, this translates to the locomotive simply losing speed when you are going uphill & your locomotive gaining speed when you are going downhill. Hill climb & descent feedforward will reduce the chances of this happening by supplementing the control loop.
Currently, I have intentionally overtuned the control loop in order to make your locomotive climb & descend hills of up to 3.5 % gradient with the tradeoff of introducing an overshoot of up to 4 mph, when you accelerate or decelerate. In some cases, drastic changes in speed will cause your entire train to momentarily stop & then accelerate to your set speed again.
There is also an edge case where this drastic change in speed can cause a "rollback runaway" (particularly when you stop on a hill). This same rollback runaway condition was addressed when I-Term Decay was introduced to RailDriver's control loop. However, that doesn't kick in until your set speed is at 0 mph & your locomotive is traveling at or slower than 3 mph.
Additional
When I introduce hill climb & descent feedforward, I will spend some time with re-tuning the control loop (particularly with focus on the I-Term & P-Term gains) in such a way that the control loop is correctly being supplemented by this feedforward when your locomotive is climbing & descending hills. I will also address the overshoot problem while I am at it.