Bob, the formula gives the average TE produced over 1 rotation of the drive wheels. It is easier to derrive it by equating the total work produced by the cylinders in 1 complete revolution of the drive wheel to the work done in moving the loco a distance equal to the circumference of the drive wheel. Actually a sinusodial variation of torque is only applicable with infinitely long connecting rods. With normal connecting rod geometry the actual variation is a lot more complicated.
The steam pressure in the cylinder varies form boiler pressure due to a number of reasons not just cutoff. If you want to know the TE at any point in the cycle you need to construct an indicator diagram that gives the pressure acting on both sides of the piston at any point in the stroke and use that with the crank, connection rod and piston grometry to calculate it.
Work is simply force times the distance thru which it moves. Work produced in a cylinder per stroke is the piston area x the steam pressure x the stroke length. The cylinders are double acting so there are 2 power strokes per rotation. Most locos have 2 cylinders but we can indicate number of cylinders as n so the total work is W = n x 2 x PA x P x S. Piston area is pi x C^2 / 4 following your notation. So W = n x pi x C^2 x P x S / 2. (edit: I mention swept volume in a previous post. It is equal to the volume in the cylinder the piston moves thru during the stroke so it's equal to the PA x S and the work done is equal to the swept volume times the pressure.)
We set the average force produced at the rail in moving the loco to TE and the distance traveled is the circumference of drive wheels with diameter D which is pi x D. So the work done is W = TE x pi x D. equating the 2 works gives us:
TE x pi x D = n x pi x C^2 x P x S / 2
TE = n x C^2 x P x S / (2 x D)
If the loco has 2 cylinders then this gives TE = C^2 x P x S / D
P represent the average pressure acting on both sides (back pressure on the exhaust side) of the piston during the the full stroke. If the piston moved at an extreemely slow speed it would be close to boiler pressure. It is usually called the mean effective pressure (MEP) and is always less that the boiler presure. The formula can be used to calculate TE at any speed if the MEP at that speed is known. (Edit: For a given loco MEP is mostly a function of boiler pressure, cutoff setting and piston speed. Calculation of it for a specific loco and speed would require knowledge the valve and piping geometry and details of the valve setup. Not a rivial undertaking by any means. Since piston speed is directly related to loco speed due to direct coupling with the drive wheels, MEP is very dependent on loco speed.) So we end up with:
TE = C^2 x MEP x S / D
The MEP = 0.85 x P (with P representing boiler pressure) normally seen is just an historic standard value for starting/low speed conditions. Some steam locos towards the end of the steam era could in fact develop TE values equivalent to coefficents of 0.92 or a bit higher. It is based on pressure loss from boiler to cylinder and a further reduction due to pressure drop during expansion after cutoff and back pressure and compression effects when the exhaust value closes before the end of the stroke or if the admission valve opens before the start of the stroke. If the valve gear operated with a designed reduced cutoff then the standard coefficient would be reduced accordingly.
In the US maximum cutoff was assumed to be 90% for most locos even though the valve gear was set up to get 82-87% at maximum. The following table is from R. Johnson's book The Steam Locomotive and provides the values that were used by Baldwin in the 1940's. The 75% used as the default max in Trainz wasn't universally used particularly in the US. The max CO value in Trainz can be changed if it is desired to do it for some reason. I think it's better to keep it for now due to other problems like incorrect handling of steam expansion.
Code:
CO K
90% 0.85
80% 0.80
70% 0.74
60% 0.68
50% 0.60
Engines designed with reduced max CO often had auxilary ports to admit additional steam at low speeds when starting. Their rated TE would be calculated using an adjusted K value.
Bob Pearson