It doesn't have to relate to anything in the physical world as long as the values are consistently calculated and repeatable.
True, the calculations wouldn't have to relate to real calories. But if Peter wants to compare the energy used to eating a certain amount of candy or hamburgers, then it would be nice to at least be inside the ball park.
The front gear cluster has three different ring gears and the back cluster has nine ring gears, remembering that this is a mountain bike for hill climbing.
If I understand, then unlike most commercial cycle exercisers (that have only 1 gear but attempt to adjust and measure the work-resistance on the rolling wheel), you are using a real bicycle with gears, so that the rate of work done will change with the gear ratio.
In which case I don't think your method of calculating the gear ratio based on the relative speed of the pedals-versus-rear wheel will work very well. A rider can slack off on his pedaling speed (or not pedal at all) while still being in the same gear. When he coasts, it will cause your your gear-ratio calculation to be wrong.
What other method could be used to send the selected gear to the PLC? You could use a thumbwheel switch. Possibly the chain on the 3 front sprockets could be sensed with 2 or 3 prox switches. The rear 9 sprockets are probably too close for prox switches to be able to differentiate.
An alternative might be to just use the high gear, and then use some device as you said to apply resistance to the rear wheel, and calculate the calories needed to overcome the resistance at the one known gear ratio.
Actually doing some thinking here for once instead of just reacting, the work done at the rear wheel to overcome some force or resistance is going to be the same, regardless of the gear ratio. The gear ratio only controls how fast the work is done by the rider, not the amount of work. It is the same as climbing a hill. It takes the same amount of calories to get from the bottom to the top, whether you do it fast or slow. The only thing that changes is the rate of calorie burn, not the total amount.
Do you really need to know the gear ratio to calculate calories burned?