Having looked at a few coast down calculators I am generally unsatisfied with them so I am going to create my own. I will make two versions: one that assumes a level surface, and the other that assumes a constant grade. Please feel free to sanity check me.
First, I'll derive the one for a level surface.
I'm going to start with the road load power formula, which I snagged a description of:
A*v + B*v^2 + C*v^3
The A component comes mostly from the rolling resistance of the tires, and friction in the car's components, like drag from the brake pads, or friction in the wheel bearings.
The B component also comes from friction in components, and from the rolling resistance in the tires. But it also comes from the power used by the various pumps in the car.
The C component comes mostly from things that affect aerodynamic drag like the frontal area, drag coefficient and density of the air.
Instantaneous power equals force times the velocity, or:
P(t) = F(t)*v(t)
-(A*v + B*v^2 + C*v^3) = F*v
-(A + B*v + C*v^2) = F
Since F=m*a, we get:
-(A + B*v + C*v^2) = m*a
a = -(A + B*v + C*v^2)/m
since a = dv/dt we get a differential equation, but the integrals involved are very messy so a numeric solution is easier (I'll spare you the differential equation formulas).
Now I'll account for a constant grade.
Potential energy = m*g*h, where h is the height
Defining a constant s such that s*(distance traveled along the hill) = (vertical distance change), we can show the rate of PE change as:
m*g*s*v
Note that s is unitless, being distance / distance.
Now adding this to the road load power and reusing our previous reasoning:
-(A*v + B*v^2 + C*v^3) + m*g*s*v = F*v
-(A + B*v + C*v^2) + m*g*s = F
F = m*a
-(A + B*v + C*v^2) + m*g*s = m*a
a = -(A + B*v + C*v^2)/m + g*s
Since the hill's effect would be lumped in with the A parameter, we need to perform coast down runs both uphill and downhill on the same stretch. The difference can tell us what value s has.
Uphill:
a = -(A + B*v + C*v^2)/m - g*s
Downhill:
a = -(A + B*v + C*v^2)/m + g*s
Assuming nobody finds any errors in this derivation, I'll produce the formulas needed to numerically solve for A, B, C, and s. Once those are calculated, they can be used to estimate other desired parameters.