This week is another short, fun snippet of code. We're going to calculate the tractive effort of a steam locomotive. Useless to most people, but I've got a large project where I'll be using it myself.
ASP
function TractiveEffort(cylinderDiameter, stroke, pressure, wheelDiameter)
TractiveEffort = cylinderDiameter ^ 2 * stroke * pressure * 0.85 / wheelDiameter
end function
PHP
function $tractiveEffort($cylinderDiameter, $stroke, $pressure, $wheelDiameter)
{
return $cylinderDiameter ^ 2 * $stroke * $pressure * 0.85 / $wheelDiameter;
}
It should be noted that the formula only applies to non-compound steam locomotives. Locomotives with multiple cylinders are more complex.
No comments:
Post a Comment