[chronojump] Jumps Dj power calculated by X.Padulles method



commit 8c2cbaad9a2f57661808dc88b51aea9e963bc2f0
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Jul 14 14:00:04 2014 +0200

    Jumps Dj power calculated by X.Padulles method

 src/exportSession.cs |    5 +++--
 src/treeViewJump.cs  |    2 +-
 src/util.cs          |   16 ++++++++++++++--
 3 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/exportSession.cs b/src/exportSession.cs
index 404c4b5..3b11156 100644
--- a/src/exportSession.cs
+++ b/src/exportSession.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- *  Copyright (C) 2004-2011   Xavier de Blas <xaviblas gmail com> 
+ *  Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -299,6 +299,7 @@ public class ExportSession
                                else
                                        myWeight = weightInKg.ToString();
                
+                               double fall = Convert.ToDouble(myStr[7]);
                                double tc = Convert.ToDouble(myStr[6]);
                                double tf = Convert.ToDouble(myStr[5]);
 
@@ -306,7 +307,7 @@ public class ExportSession
                                string power = "-";
                                if(tf > 0) {    
                                        if(tc > 0)              //dj
-                                               power = Util.TrimDecimals(Util.GetDjPower(tc, tf).ToString(), 
dec);
+                                               power = Util.TrimDecimals(Util.GetDjPower(tc, tf, 
personWeight, fall).ToString(), dec);
                                        else                    //it's a normal jump without tc
                                                power = Util.TrimDecimals(Util.GetPower(tf, personWeight, 
weightInKg).ToString(), dec);
                                }
diff --git a/src/treeViewJump.cs b/src/treeViewJump.cs
index 786684f..2daa539 100644
--- a/src/treeViewJump.cs
+++ b/src/treeViewJump.cs
@@ -217,7 +217,7 @@ public class TreeViewJumps : TreeViewEvent
                        //calculate jumps with tf
                        if(newJump.Tv > 0) {    
                                if(newJump.Tc > 0)      //if it's Dj (has tf, and tc)
-                                       myData[count++] = Util.TrimDecimals(Util.GetDjPower(newJump.Tc, 
newJump.Tv).ToString(), pDN);
+                                       myData[count++] = Util.TrimDecimals(Util.GetDjPower(newJump.Tc, 
newJump.Tv, personWeight, newJump.Fall).ToString(), pDN);
                                else {                  //it's a normal jump without tc
                                        //we calculate weightInKg again because can be changed in edit jump, 
and then treeview is no re-done
                                        //but we do not calculate again person weight, because if it changes 
treeview is created again
diff --git a/src/util.cs b/src/util.cs
index 883d81d..d821626 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -205,7 +205,7 @@ public class Util
                        string [] valuesListFull = valuesList.Split(new char[] {':'});
                        
                        for(int i=0; i<count; i++) {
-                               summatory += System.Math.Pow ( (Convert.ToDouble(valuesListFull[i]) - avg), 
2);
+                               summatory += Math.Pow ( (Convert.ToDouble(valuesListFull[i]) - avg), 2);
                        }
 
                        /*
@@ -586,8 +586,10 @@ public class Util
                return initialSpeed.ToString();
        }
        
-       public static double GetDjPower (double tc, double tf) 
+       public static double GetDjPower (double tc, double tf, double mass, double fallHeight) 
        {
+               /*
+                * old method
                //relative potency in Watts/Kg
                //Bosco. Pendent to find if published
 
@@ -596,6 +598,16 @@ public class Util
                double tt = tc + tf; //totalTime
 
                return 24.6 * ( tt + tf ) / (Double)tc;
+               */
+
+               //new method (proposal by Xavier Padullés)
+               //Calcule the potential energies before (mass * g * fallHeight) and after the jump (mass * g 
* tv^2 * 1.226)
+               //and divide by the time during force is produced
+               double g = 9.81;
+               double tt = tc + tf; //totalTime
+               fallHeight = fallHeight / 100.0; //cm -> m
+               
+               return mass * g * ( fallHeight + 1.226 * Math.Pow(tf,2) ) / (Double)tt;
        }
                                
        //only Lewis now


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]