Computing Horsepower - for TI-83 or higher calculators


<Insert Creative Title>
Okay, some of you I know have programing and math skills. Here is a programing script for a Texas Instruments TI-83 graphing calcultor. The script show also work in higher-model TI calculators (-83plus, -89, -90, -96).

This script askes for train tonnage, ruling grade and perferred average speed. Once the variables are input (I set the script up to ask in a clear, consise manner), it caluculates the necessary horsepower needed to pull the train up a hill, taking friction and mechanical resistance into account. The owner's manual for the TI-83 explains how to enter a program, its clear enough that if you can add a fuel script to a loco than you can do this...

The program uses enlish units (mph, lbs) for calcultions, my apalogies to the majority of the world. I know its a bit advanced, but I hope someone can get something out of it...

Program: TRAINHP
:Fix 0
:Disp "_What_is_train"
:Disp "_ _Tonnage?"
:prompt T
:Disp "_What_is_ruling"
:Disp "Grage?_(percent)"
:prompt G
:Disp "What_is_average"
:Disp "_ _Speed?_(mph)"
:prompt S
:W x Cos(A)U + W x Sin(A) = R
:S x 1609.3/3600=V
:Disp "_Actual_Horse-"
:Disp "Power_required:"
:Disp H
:Disp "_Raw_locomotive"
:Disp "_ _ _Horsepower:"
:Disp 1.2 x H

That's far more useful than the program I wrot on my calc, which jst repeats a one-line phrase over and over for all eternity (until you press "on"! :p )

I'm off to program it now, thanks Greg! :D
Whew! I'm glad somebody understood it! :Y:

It gives two answers, the first 'actual horsepower' is the horsepower needed at the rails.

The second answer, 'Raw locomotive horsepower', is the total horsepower of the primemover(s). According to "The Railroad - What it is, what it does" by John Armstrong, approximatly 20% of the prime mover's horsepower is lost to heat and mechanical/electrical resistance before it gets to the rails. I don't know if this figure holds true for steam engines, but the horsepower requirement is independant of the locomotive.
Couple of comments. I don't have my old TI programmable - well I do but it would take a lot of digging to get it as I haven't used it for about 20 years now. Most of the time nowadays I just use a spread sheet program. The resistance calc you do assumes 0.0025 N per N of force exerted normal to the rail. I perfer to use a value based on the old Davis formulas which is by the way what Trainz appears to use for cab mode physics. This includes 3 terms representing axle (journal) resistance, rolling (flange) resistance and air drag. The formulas assume the resistance is a function of train speed with a constant, linear and quadratic term. But you'd require more input if you used something like this.

Just to clarify tonnage is the total weight of the train including the locomotive(s) in units of tons (2000 lbs). Some people forget that the locomotive has to pull it's own weight!

It would be simplier if you didn't convert to metric units to calculate the power and then convert back to mechanical HP units. HP = RS/375 where R is resistance in lbs (your R is in Newtons) and S is speed in mph.

The 20% loss is rule of thumb and can vary - I have no better limits on its range. It also includes power required to run auxiliaries that doesn't get to the traction motors. I would say the raw power as you named it should be 1.25 x H as 80% of that gives you the 1.0 value at the rail.

Steam locomotives are a bit different in rating their power. The power required at the rail is calculated in the same way though.

Enjoyed looking thru the program. If you decided to program the Davis formulas and used the resistance coefficients from the engine spec configs as they vary for locos and railcars (and in TRS2004 used a value of ~1.2G for grade resistance) you'd be able to predict fairly closely what Trainz calcs for resistance.

Thanks for posting it.

Bob Pearson
Last edited:
Tonnage = number of tons in consist (including locos; multiply this figure by 2000 to get lbs)

0.0025, the coefficient of rolling friction for steel-on-steel comes from a variety of sources. The actaull value ranges from 0.006 to 0.001, the later being the theoritical minimum. 0.0025 is the average for dry rails best I can find.

The program does have it's weaknesses. It assumes that train tonnage includes the weight of the locomotives. Futhermore it negates air resistance and static friction if the train needs to start from a stop. The program can only calculate the horsepower necessary to keep the train from stalling. And yes, I assumed frictionless bearings in the bogeys. :eek:

Unit Conversions: the program does do more than an extreme number of conversions. I only know equations which deal with Newtons, Joules and Watts, so the enlish inputs are converted to metric, calculated, than converted back.

I orginally designed the program because I like to model helper operations, or other equivalent mountain-division SNAFU's (like "doubling the hill"), and needed a quick calculation for adding in additional locomotives. :cool:

Great ideas. I am already modifying the script to adjust for air resistance, an "average" mechanical resistance, and the other various shortcomings (I'm changing to the Davis formulas you mentioned). :Y:
Yes, like that. Only I did it backwards... :p

SNAFU = Sitituation Normal, All [censored] Up. Its just a polite way of saying it.
Last edited:
That seems kinda oxymoronic, but it's far from the strangest thing I've heard (do NOT sit down to lunch with Robert V.). Thanks, Greg! :wave: