Speed Table

Short Definition 
A list of settings of how fast or slow the decoder should run at a given throttle speed. 
Most decoders have a builtin speed curve, (or Speed Table) that is a standard setting of how fast or slow the decoder should run at a given throttle speed. The speed curve between manufacturers can differ. Also, you will need to take into account different models and brands of locomotives. However, there are a few ways to alter that speed curve. Some decoder brands even allow you to program many different speed curves into the decoder, and allow you to select which one to use on the fly.
To handle the task for limiting speed, we use a speed table to tell the decoder the maximum speed. That is, you specify how fast (or slow) each speed step will be  hence a curve.
Even on identical models some tuning may be required, as slight differences between motors and gear sets will exist.
Speed curves are only available on decoders with 28 and 128 speed steps. Not all decoders include CVs 2, 5 and 6 required for trimming speeds either.
Contents
Why Change it?
Your throttle only has a limited number of 'notches', or speed steps. You can have 14, 28, or 128 different speed steps. At the lowest ones, the loco will probably not move at all. At the highest ones, your loco may move too quickly. The speed table allows you to adjust the 'notches' to include only the realistic range of speeds, allowing for finer control.
It also allows you to define how the locomotive will accelerate, and at what rate.
Types of Speed Tables
There are two ways to implement a speed table. The simplest is to set the starting speed, the mid point speed, and the fastest speed the locomotive can go. This is called VStart, VMid, and VMax. The second method is to specifiy 28 points along the speed curve  over nine times as more complex than the VStart method  but if you can't get your consist properly speed matched, you may be forced to go this route.
In most cases, the default or builtin speed curve work just fine. With mobile decoder features such as VStart, VMid, and VMax, it's generally possible to match speeds of dissimilar locomotives. But, if you can't attain the speed curve desired by modifying the builtin speed curve(s), you can always use the userloadable speed table to configure the exact curve you need.
VStart, VMid, VMax
These would be the equivalent of offidle, part throttle, and wide open throttle. These CVs set the minimum starting voltage, the midrange voltage, and the maximum voltage which will be applied to the motor. These are used to tailor throttle response. Much the same as when you move your car's shifter to Drive, it doesn't stall or surge when you press the accelerator, it runs efficiently at highway speed, and delivers maximum fuel when you floor it without surging or stalling.
 CV2: V_{START}, Required, works with CV65 Kick Start or the dithering or torque compensation, for smooth starts
 CV5: V_{HIGH}, Optional, controls the maximum power that will be applied to the motor
 CV6: V_{MID}, Optional, adjusts the power available in the midrange.
Additional Required CVs
 CV3: Acceleration Rate: Specified at 32mS delay between speed steps, useful values are from 5 to 10
 CV4: Deceleration Rate: Same, but works to slow the locomotive
If the momentum values are set the formula used by the decoder is CV value X 0.896/Speed Steps
UserLoadable Speed Table
The userloadable table provides 28 CVs (6794) for the speed table, plus three others (65, 66, and 95) for finetuning. CV67 is for speed step 1 in the 28 speedstep mode. CV68 is for speed step #2, CV69 is for speed step 3, and so on all the way up to CV94 for speed step #28.
For fine tuning, you can use CVs 66 and 95 for forward and reverse trims. CV65 is for Kick Start, to help the loco get started on speed step 1  used to get around stiction.
With some decoders, the userloadable speed table can only be used in the 14 or 28speedstep modes. More advanced decoders can expand the speed table for use with the 128speedstep. It does this by by stretching the 28 CVs, or interpolating, into 128 virtual CVs and automatically computing the inbetween points.
You don't have to use the userloadable speed table. The default decoder setting will typical function good enough to get you started and allow you to run your trains.
Equipment Requirements for UserLoadable Speed Table
The userloadable speed table is provided solely by the decoder. It only requires a DCC system capable of programming CVs 6794. To use the userloadable speed table, you will need to set bit 4 of CV29 and to return to the builtin speed curve you will need to unset it.
Due to the complexity of programming userloadable speed tables, we highly recommend using DCC software to assist in this task. Some software applications allow the use of a graph or some other graphical tool to represent the speed for each step. Software programs will also help you to reconfigure or fine tune the speed table. Also, some software applications allow you to save and restore speed tables so that you can have multiple tables for the same decoder; all you have to do is load the speed table to the decoder to change it.
Decoder Pro allows access to the speed tables, and any options the decoder may offer.
There are a number of videos and tutorials on the web demonstrating speed matching using the speed tables in the decoder.
Notes on Various Manufacturers
Digitrax
Digitrax decoders provide the userloadable speed table in the 28 and 128speedstep modes. They are supposed to support kick start and forward/reverse loco trim, but these features may not work on some of their current decoders.
SoundTraxx
SoundTraxx sound decoders provide the userloadable speed table in the 28 and 128speedstep modes. They also support kick start and forward/reverse loco trims with the userloadable speed table as well as with their optional builtin speed tables.
Train Control Systems (TCS)
Train Control Systems decoders provide the userloadable speed table in the 28 and 128speedstep modes. They also support kick start in the userloadable speed table as well as the builtin speed curve, but do not support forward/reverse loco trims.
Designing a Speed Table
This procedure is intended to create a speed table for a 28step throttle where each throttle step is approximately equal to the locomotive’s scale speed in mph. This type of speed table is useful for a switching prototype and was specifically created for a model of the Alco S2 locomotives used by the State Belt Railroad of California, a switching railroad that operated on the San Francisco waterfront between 1898 and 1993. In that service the prototype locomotive was typically operated between about 4 and 15 MPH for switching and urban street operation. The basic process used to create this speed table can be adapted to other applications.
Tune the Locomotive
The creation of a speed table is very specific to a particular locomotive and decoder and is therefore affected by various tuning parameters that can affect motor operation. Before attempting to create the speed table, do all necessary tuning both mechanically and with CV’s relating to motor operation. This is particularly important with respect to back EMF related CV’s. Once the locomotive is running to your satisfaction proceed with the creation of the speed table. This specific speed table was created for a Arnold/Rapido N scale S2 model. The model was modified with North West Short Line 26796 geared wheelset. A Lenz Silver Mini DCC Decoder was installed.
Gather Performance Data
It is useful to know what the minimum scale speed the locomotive is capable of starting at during DC operation. In the case of the above locomotive it was capable of maintaining a minimum speed DC of about 6 scale MPH. It later turned out that with DCC and the back EMF parameters tuned, it could maintain a scale speed of 1.5 MPH. It was later found that the linearvoltage performance followed a different curve below 6 MPH than it did above 6 MPH, presumably related to the DC capability and the operation of back emf. It will be explained later how to deal with that behavior.
The first step is to gather data on how the locomotive runs with a linear voltage curve. Select the standard speed table with the CV 5 Maximum Speed parameter set at 255 and the CV 6 Mid Speed Vmid parameter set at 128. These settings establish a linear voltage curve. Set momentum to 0. Set the throttle steps to 128.
Take speed data at throttle settings over the range of operation of interest. In this case data was taken at throttle settings of 16, 9, 14, 18, and 24. The data taken was the time in seconds required to travel 12” both in forward and reverse with the two figures added together to average the speeds. Typically speed will be slightly different between the two directions. These throttle settings produced a ranges of speeds from 1.5 MPH to 31.2 MPH. Because the operating speed range was intended to be from 028 MPH, this is all the data that was required.
The throttle settings must be translated into internal digital values (ranging from 0255) that are used by the decoder to set to the voltage steps. Experimentation indicated that the very first throttle step corresponded to a digital value of 1 and thereafter each digital value was equal to 2X the throttle step. A table of digital values and scale speeds was thereby established
Analyzing the Data
The digital values were plotted against the scale speed and a least squares fit established. It was observed that there is a kink in the data at about 6 MPH. This was dealt with by using two different linear data fits, one for below 6 MPH and one for above 6 MPH. Microsoft Excel was used for the plotting and least squares data fits.
The formulas for the two lines are used to establish the appropriate CV values for the speed table as follows:
The equation for a line takes the form: Y = MX + B
In this case X is the digital voltage step value and Y is the scale speed in MPH. To create the speed table we need to be able to calculate voltage step digital values from desired speeds for each throttle step.
Simple algebra gives the following formula: X = (Y – B)/M
The least squares fits gave the following for the parameters slop and yintercept.
Below 6 MPH: M = 0.4232, B = 1.0613
Above 6 MPH: M = 0.6794, B = 0.4288
These values are used to calculate the speed table.
Calculate the Speed Table
Before proceeding though consider how the speed table is defined. It consists of 28 values that define voltage output at 28 equally spaced throttle settings from minimum to maximum. If you use a 28step throttle, then each speed table value exactly corresponds to a throttle setting. However if you use a 128step throttle then each speed table entry corresponds to 128/28 = 4.6 throttle steps, which means the decoder will interpolate the intermediate throttle values. This complicates calculating a speed table and introduces greater inaccuracy due to rounding errors  specifically errors in speed vs throttle setting. Since this application only required a narrow range of speeds it was decided to use a 28step throttle.
It was desired that each throttle setting would correspond as exactly as possible to the actual scale speed in MPH (i. e. that a throttle setting of 9 would correspond to a speed of 9 MPH). In this case then each respective speed table CV value should produce as exactly as possible the corresponding scale speed. The calculation is performed as follows:
(Y – B ) / M = CV setting, where Y = Speed MPH, and M and B are selected from the appropriate speed ranges as noted earlier. Note that this formula will calculate a value that must be rounded to the nearest whole number. The formula calculates 0 for the first table CV value so the first value was set as 1. Neither formula calculates a sensible value for 6 MPH because of the kink, so an intermediate value was chosen. A set of values were calculated and entered into CV 6794 creating the speed table.
Resulting Speed Table Accuracy
The speed table was tested using the intended 28 step throttle and delivered acceptable performance for the application of +16%/10%. These errors were less than 1 MPH in most cases.
Some improvement may be possible by manually adjusting the speed table or by recalculating CV values taking into account an error function. However, it should be kept in mind that because of the use of relatively course digital values there is a practical limit of accuracy of any speed table that is on the order of a 5% average error. The error limit at low speeds is even greater due to limitations of the motor.