It isn't
that complicated.
Engine efficiency, advance speed, and vacuum don't matter, at least from the perspective of the calculator. All we need is a set of data for the torque curve to get power from the engine versus speed. I suppose you can change the torque curve by changing timing, fueling, and so on, but all that's needed is a torque curve. Tire pressure is incorporated in rolling resistance (Crr), which can be experimentally determined by the owner. Terrain can be accounted for the same way power can.