[chronojump] networks jumps upload: Stiffness avg of some rows is corretcly calculated
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] networks jumps upload: Stiffness avg of some rows is corretcly calculated
- Date: Thu, 1 Sep 2022 09:11:08 +0000 (UTC)
commit 53174fa3c431016703050ed2dafd30bb2a437f92
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Sep 1 11:09:01 2022 +0200
networks jumps upload: Stiffness avg of some rows is corretcly calculated
src/json/compujumpJumps.cs | 11 +++++++++--
src/jump.cs | 26 ++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/src/json/compujumpJumps.cs b/src/json/compujumpJumps.cs
index 067e26099..2ceca42bc 100644
--- a/src/json/compujumpJumps.cs
+++ b/src/json/compujumpJumps.cs
@@ -152,6 +152,7 @@ public abstract class UploadJumpDataObject
protected int exerciseId;
+ protected double weightInKg;
protected double power;
protected double stiffness;
protected double initialSpeed;
@@ -167,6 +168,10 @@ public abstract class UploadJumpDataObject
{
get { return exerciseId.ToString(); }
}
+ public string WeightInKg
+ {
+ get { return Util.ConvertToPoint (weightInKg); }
+ }
public string PowerStr
{
get { return Util.ConvertToPoint (power); }
@@ -188,13 +193,14 @@ public class UploadJumpSimpleDataObject : UploadJumpDataObject
this.stationId = stationId;
this.jump = jump;
this.exerciseId = exerciseId;
+ this.weightInKg = jump.WeightInKg (personMassInKg);
if (jump.Tc > 0)
this.power = Jump.GetDjPower (jump.Tc, jump.Tv, personMassInKg + jump.Weight,
jump.Fall);
else
this.power = Jump.GetPower (jump.Tv, personMassInKg, jump.Weight);
- this.stiffness = jump.Stiffness (personMassInKg, jump.Weight);
+ this.stiffness = jump.Stiffness (personMassInKg, weightInKg);
this.initialSpeed = jump.GetInitialSpeedJumpSimple (metersSecondsPreferred);
}
}
@@ -206,9 +212,10 @@ public class UploadJumpReactiveDataObject : UploadJumpDataObject
this.stationId = stationId;
this.jumpRj = jumpRj;
this.exerciseId = exerciseId;
+ this.weightInKg = jumpRj.WeightInKg (personMassInKg);
this.power = jumpRj.PowerAverage (personMassInKg);
- this.stiffness = jumpRj.Stiffness (personMassInKg, jumpRj.Weight);
+ this.stiffness = jumpRj.StiffnessAverage (personMassInKg, weightInKg);
this.initialSpeed = Jump.GetInitialSpeed (jumpRj.TvAvg, metersSecondsPreferred);
}
}
diff --git a/src/jump.cs b/src/jump.cs
index 1e379f1df..744898c6d 100644
--- a/src/jump.cs
+++ b/src/jump.cs
@@ -189,6 +189,10 @@ public class Jump : Event
get { return weight; }
set { weight = value; }
}
+ public double WeightInKg (double personMassInKg)
+ {
+ return Util.WeightFromPercentToKg (weight, personMassInKg);
+ }
public double RSI {
get { return UtilAll.DivideSafe(Util.GetHeightInMeters(tv), tc); }
@@ -364,6 +368,28 @@ public class JumpRj : Jump
return UtilAll.DivideSafe (powerSum, tcList.Count);
}
+ // based on treeviewJump printAVG
+ public double StiffnessAverage (double personMassInKg, double weightInKg)
+ {
+ double stiffnessSum = 0;
+ int stiffnessCount = 0;
+
+ for (int i = 0; i < tcList.Count; i ++)
+ {
+ if(tcList[i] == -1) //startIn at first jump tc is 0, better check like this (string)
+ {
+ //do nothing
+ } else
+ {
+ stiffnessSum += Util.GetStiffness
+ (personMassInKg, weightInKg, tvList[i], tcList[i]);
+ stiffnessCount ++;
+ }
+ }
+
+ return UtilAll.DivideSafe (stiffnessSum, stiffnessCount);
+ }
+
public override double Stiffness(double personMassInKg, double extraMass)
{
return Util.GetStiffness(personMassInKg, extraMass, TvAvg, TcAvg);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]