I've tried to keep this question as non-programmer-friendly as possible, but please let me know if you don't understand something.
I'm a software developer and I'm looking over some old code and I have come across a formula for working out calories burned.
METs = (1.5245 * milesPerHour) + 0.1128;
caloriesBurned = (durationMinutes * ((METs * 3.5 * kilograms) / 200.0f));
I can't figure out for definite what the unnamed arbitrary numbers are supposed to represent.
I did some research and found that the "normal" formula for working out calories burned is:
Energy (kcal) = METs * weight (kg) * time (hours)
I speculate that the numbers in the first equation have come about because someone just plugged some values into Excel and used the formula displayed on the trendline as an estimate.
The numbers in the second equation elude me completely. I thought it might be converting kJ to kcal, but the equation already outputs calories.
Then I noticed that the duration in the code is in minutes, but the formula I expect wants hours. However, (3.5/200)
makes no sense converting from minutes to hours. (Coincidentally, it is a close approximation 0.016 ≈ 0.0175)
I think I've found the resource the original developer must have used:
Work Unit Conversions
1 MET = 3.5 ml/kg/min
1 MET = 1 kcal/kg/hr
...
METS to Kcal/min = multiply METS x 3.5 x body weight in kg then divide by 200
I still have no idea where that 200 comes from and I think the resource might be erroneous anyway as it seems to equate calories to mlO2
NB: I'm not looking for a new / "correct" formula, unfortunately I can't change this. However I'd like to be able to add comments to the code so that I can understand if / why it's wrong if I look at it again in the future.
TL;DR:
What do the arbitrary numbers mean in the above formulas?
assume
is the word I'm worried about. It seems to have just been pulled out of nowhere. There is a equivalence of calories to ml of oxygen, but that factor is 3.5 * 60 = 210 (possibly just an error in the resource?). This can be seen by the equivalence of1 MET = 3.5ml/kg/min ≣ 1 kcal/kg/hr ≣ 60 kcal/kg/min