I want to convert the notched throttle from linear to exponential action, but have to use a formula.
A formula applicable to an enginescript.lua that converts multiples of 0,12 into an exponential range starting with at 0, first "notch" about 0.06 and ending with the eighth "notch" at 1.
I have already succesfully disconnected the throttle handle from the Regulator control value, just like the dynamic brake handle.
The throttle is thus far linear with:
- Code: Select all
Call( "*:SetControlValue", "Regulator", 0, gThrottleHandlePosition )
The dynamic brake now has a setup position with warning buzzer if you move it forwards too early and is mapped to the dynamic brake control value by means of this code:
- Code: Select all
Call( "*:SetControlValue", "DynamicBrake", 0, (gDynamicBrakeHandlePosition - 0.28 ) * 1.38888 )
The 0.28 corresponds with the "zero" point of the remaining range on the dynamic brake handle when I set the Set Up position at around 17%.
The remaining range of dynamic braking is linear, I suppose it would be exponential in prototype as well.
The prime mover revs up and down according to resistor grid current, but unlike the throttle the resistor grid isn't damped and the prime mover responds instantaneously to changes of RPM while in dynamic braking.
- Code: Select all
Call( "*:SetControlValue", "RPM", 0, 315 + (gResistorGridCurrent * 0.6125 ) )
Where can I find a damping formula to act on RPM?
Of course all three blue handles should be mechanically interlocked and since I have "disconnected" them from the simulation engine, I'll have to achieve that in lua as well.
Any ideas?
Note: this is all for the old Kuju ES44, the new RSC one has its enginescripts in encoded lua. First I have to come up with a plaintext lua version and perhaps RSC has changed the inner workings of the control stand as well. I seems more controllers are propagated along a consist.
A thought occured to me: lua is an official programming language, so documentation should be available on line. Im a noob in programming however, but enginescripts aren't too difficult.
While thinking this over, another thought occured to me: Open Rails is open source. Perhaps its source code reveals how the developers deal with locomotive control issues like these. With Open Rails v0.8 now upon us, I checked their website, it is open source, but the source code is only disclosed upon request.
Finally, one could doubt if it is really worth all the trouble, 99% of the players don't give a dern about the number of notches and TS2013 US train physics are still way off.