I haven't posted here in while. Several people have used my Scale/Speed/Chuff Factor calculator but with mixed results. It worked on a couple of engines but I've never gotten it to work on my engines. By "not working", I mean that I calculated a new value, loaded it into the engine but it had no effect that I could see.
So I'm throwing out the equations to the world hoping to gather some insight about what these factors do.
With help from others, we identified what I call "Speed Factor" (in RAM 0x04 and 0x05) and "Chuff Factor" (in RAM 0x18 and 0x19). With the Scale Factor in RAM 0x08 and 0x09. The Chuff Factor controls how often a steam engine chuffs (always zero for diesel and electric engines). The Speed Factor **seems** to affect the speed the engine moves along the track.
I had said that I would post the actual equations that I worked out so here they are. The Scale Factor, Speed Factor & Chuff Factor calculator/updater is available in my ADPCM web page in version 5.4.
http://www.silogic.com/trains/ADPCM.html
Inputs to the equation are:
- WD - The wheel diameter in mm
- GR - The gear ratio (typically 10.50 for diesels and 18.00 for steam engines - but might be different)
- NS - The number of stripes on the tach wheel (typically 24 - but might be different)
It uses these fixed parameters:
- 5280 feet/mile
- 12 inches/foot
- 48 (O Scale)
- 25.4 mm/inch
- M_PI = 3.14159265358979323846264338327950288
- "Smile" is a scale mile - 110 feet in O Scale.
Here is my code directly from my C program:
K = (12 * 5280/48); // 1320 inches/Smile
// multiplier of 2 in the next equation seems to be because both the
// leading edge and the trailing edge of each stripe generates a count
TS = 2 * ((K)/((WD / 25.4) * M_PI)) * NS * GR;
// The meaning of the divisor of 11 in the next equation is not known. Test runs over
// measured distance show that it is exactly needed to generate
// correct distance reporting by the engine.
SF = TS / 11;
This SF value is converted to hexadecimal and loaded into RAM at addresses 0x08 and 0x09 (big endian).
Chuff Factor:
// Number of stripes for 1 rev of driving wheel * 2 = Number of DTO counts for 1 rev of driving wheel
// Number of stripes for 1 rev of driving wheel = gear_ratio * Number of stripes on tach wheel
// divided by 4 to set 4 chuffs per revolution (use value depending on how many chuffs per rev you want)
CF = NS * GR * 2 / 4;
This CF value is converted to hexadecimal and loaded into RAM at addresses 0x18 and 0x19 (big endian).
Speed Factor:
K = (12 * 5280/48); // 1320 inches/Smile
// multiplier of 2 seems to be because both the
// leading edge and the trailing edge of each stripe generates a count
TS = 2 * ((K)/((WD / 25.4) * M_PI)) * NS * GR;
// the meaning of the divisor of 11 is not known. Test runs over
// measured distance show that it is exactly needed to generate
// correct distance reporting by the engine.
// Calculate Scale Factor
SF = TS / 11;
//
// Calculate Speed Factor
// Constant was calculated by Gear Ratio Spreadsheet (if anyone wants this, let me know)
// 31.9288 ms/tick_of_DCH
SpdF = (4973087 * 31.9288) / (SF * 11);
This SpdF value is converted to hexadecimal and loaded into RAM at addresses 0x04 and 0x05 (big endian). Again, we don't know what this value is used for but we know how to calculate. My equations match the actual value to within 0.05 percent.