I'm making an app to put on my leg extension machine and to make it track my exercises (movements up and down) and store them in my sports tracker (Garmin Connect). I have all the data needed (every movement, kg/lbs weight I put on, my weight) but I don't know how to calculate what calories was burned? And how do I calculate watt (sports trackers like to store watt)? I would prefer to calculate it based on movements (1 movement = one up + one down)
I will tell you how to do it from the point of view of physics. But please take into account that this may or may not be useful, since your muscles are supposed to burn fuel based too on the time spent under tension, not only on the physical work you do. You can burn yourself to failure with one single rep, simply by doing it extremely slow, so that it can be nearly considered an isometric exercise. There is even a book that develops this idea called "Body by Science", or you can search in Wikipedia for Ultra Slow training.
Moreover, If you are trying to know how many calories you burn with resistance training, you will be deceived by the results of the calculations. It is very little, about ten times smaller than the total energy expenditure during 40 min of aerobic exercise. Resistance training has a great value in burning fat because it increases the amount of muscle you carry with you, which in turn burns more calories. But resistance training workouts don't burn much calories per se. You can see this by simply doing a rough estimation of the physical work done during a heavy squat: multiply the weight in kg (including not only the barbell but also ~70% of your body weight) by the distance travelled by the center of mass (about 0.65 m in an average adult, twice because of the down and up movement) and the value of gravity on the surface of the Earth (9.8). The result is in joules, which means you have to divide by 0.00418 in order to have the result in C (kcal).
Well, this is how you do it. We need to know how your leg extension machine is (please post a picture and I may be able to help better). It might be:
a) a simple model in which you attach a weight at a certain distance from the rotation axis
b) a model with a strap that transmits the weight so that the resistance is uniform along the movement,
c) a sophisticated Nautilus machine, designed so that the resistance is variable along the movement, being higher for those angles in which your leg is stronger.
Let's neglect the weight of the lower portion of the leg, since it weights only about 4.6% of your body weight (de Leva 1996). Let's call R the distance between the rotation axis and the point in which the machine exerts the opposing force. Then:
a) For the most simple machine, simply multiply the distance travelled by the weight W between the lower and upper position by the gravitational constant and the weight. If the shanks goes from vertical to horizontal, the work done in joules will be twice that (taking into account that every rep is made from an upwards and a downwards movement). That is, R*W*9.8. If you want your result in kcal, divide by 0.00418
b) For a machine with a strap & pulley mechanism, the radius of the pulley must be taken into account. If such radius is A, then the work is A*pi/2*W*9.8, again in joules.
c) If you are the proud owner of a legendary Nautilus machine from the 70s (let's begin with the downvotes, yeah!) then the resistance along the path is variable and I should have more specific details about the machine in order to give you a formula.
You will definitely find this link (EXRX) very useful in relation to your question.
These are only rough estimates. You may refine the calculations by adding the work done by moving your shanks (on EXRX you will find center of mass tables for different portions of the bogy and other useful information), by considering partial reps with different angles and so on.
As for the utility of this kind of physical work estimates, it is limited. Perhaps for tracking your relative progress, provided that you consistently do your reps at the same speed. But the calories burned by muscles don't only depend on the amount of physical work, but also on the time under tension. The energy needed to recover muscle tissue from microtrauma on the next few days after every workout is another component of the total energy expenditure for resistance training. All this make such calculations not very useful.
According to some interesting research (www.ncbi.nlm.nih.gov/pubmed/9292475) suggested by the OP in the comments, the calorie expenditure during muscle contraction is about four times the physical work done, therefore the results of the calculations should be multiplied by 4.
Nevertheless, during a few days following a strength workout tissue repair takes place and this is quite an energy demanding process. I have no idea on how to estimate that amount of extra calorie expenditure induced by exercise.