[chronojump] Encoder inertial show diameter on analyze treeview
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder inertial show diameter on analyze treeview
- Date: Fri, 13 Nov 2020 15:41:58 +0000 (UTC)
commit 0fc5f1d85c9ab571c84a95871e3e9266078b12c0
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Nov 13 16:41:36 2020 +0100
Encoder inertial show diameter on analyze treeview
encoder/capture.R | 2 +-
encoder/graph.R | 10 ++++----
encoder/util.R | 4 ++--
src/encoder.cs | 8 ++++---
src/gui/encoderTreeviews.cs | 57 ++++++++++++++++++++++++++++-----------------
5 files changed, 49 insertions(+), 32 deletions(-)
---
diff --git a/encoder/capture.R b/encoder/capture.R
index 3b1ca027..71f7f9f1 100644
--- a/encoder/capture.R
+++ b/encoder/capture.R
@@ -84,7 +84,7 @@ calcule <- function(displacement, op, curveNum, startInSet)
paf = data.frame()
myLaterality = "" #TODO
- paf = pafGenerate(op$Eccon, kinematicsResult, op$MassBody, op$MassExtra, myLaterality,
op$inertiaMomentum)
+ paf = pafGenerate(op$Eccon, kinematicsResult, op$MassBody, op$MassExtra, myLaterality,
op$inertiaMomentum, op$diameter)
position = cumsum(displacement)
diff --git a/encoder/graph.R b/encoder/graph.R
index df5b6ab8..36a9825d 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -3676,7 +3676,7 @@ doProcess <- function(options)
repOpSeparated,
SmoothingsEC[i],op$SmoothingOneC,
g, isPropulsive, TRUE),
- repOp$massBody, repOp$massExtra, repOp$laterality, repOp$inertiaM
+ repOp$massBody, repOp$massExtra, repOp$laterality, repOp$inertiaM,
repOp$diameter
)))
}
@@ -3910,7 +3910,7 @@ doProcess <- function(options)
"meanForce", "maxForce", "maxForceT",
"maxForce_maxForceT",
"workJ", "impulse",
- "laterality", "inertiaM"
+ "laterality", "inertiaM", "diameter"
)
#Add "Max", "AVG" and "SD" when analyzing, not on "curves", not on "curvesAC", not
on "curvesProcessMultiDB"
@@ -3930,7 +3930,7 @@ doProcess <- function(options)
max(pafCurves$meanForce), max(pafCurves$maxForce),
max(pafCurves$maxForceT),
max(pafCurves$maxForce_maxForceT),
max(pafCurves$workJ), max(pafCurves$impulse),
- "", max(pafCurves$inertiaM)
+ "", max(pafCurves$inertiaM), max(pafCurves$diameter)
)
#2) AVG
@@ -3942,7 +3942,7 @@ doProcess <- function(options)
mean(pafCurves$meanForce),
mean(pafCurves$maxForce), mean(pafCurves$maxForceT),
mean(pafCurves$maxForce_maxForceT),
mean(pafCurves$workJ), mean(pafCurves$impulse),
- "", mean(pafCurves$inertiaM)
+ "", mean(pafCurves$inertiaM),
mean(pafCurves$diameter)
)
#3) Add SD if there's more than one data row.
@@ -3955,7 +3955,7 @@ doProcess <- function(options)
sd(pafCurves$meanForce),
sd(pafCurves$maxForce), sd(pafCurves$maxForceT),
sd(pafCurves$maxForce_maxForceT),
sd(pafCurves$workJ), sd(pafCurves$impulse),
- "", sd(pafCurves$inertiaM)
+ "", sd(pafCurves$inertiaM),
sd(pafCurves$diameter)
)
diff --git a/encoder/util.R b/encoder/util.R
index 26aed2dc..27e02808 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -760,7 +760,7 @@ findPropulsiveEnd <- function(accel, concentric, maxSpeedTInConcentric,
return (propulsiveEnd)
}
-pafGenerate <- function(eccon, kinematics, massBody, massExtra, laterality, inertiaMomentum)
+pafGenerate <- function(eccon, kinematics, massBody, massExtra, laterality, inertiaMomentum, diameter)
{
meanSpeed <- mean(kinematics$speedy)
@@ -829,7 +829,7 @@ pafGenerate <- function(eccon, kinematics, massBody, massExtra, laterality, iner
meanForce, maxForce, maxForceT, maxForce_maxForceT,
mass, massBody, massExtra, #kinematics$mass is Load
workJ, impulse,
- laterality, inertiaMomentum
+ laterality, inertiaMomentum, diameter
))
}
diff --git a/src/encoder.cs b/src/encoder.cs
index 5e85abcb..baa221eb 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -233,7 +233,8 @@ public class EncoderCurve
public string Laterality; //only on analyze
public double ExtraWeight;
public double DisplacedWeight;
- public int Inertia;
+ public int Inertia; //analyze inertial
+ public double Diameter; //analyze inertial
public string Start;
public string Duration;
public string Height;
@@ -289,7 +290,7 @@ public class EncoderCurve
public EncoderCurve (string n, string series, string exercise,
string laterality,
double extraWeight, double displacedWeight,
- int inertia,
+ int inertia, double diameter,
string start, string duration, string height,
string meanSpeed, string maxSpeed, string maxSpeedT,
string meanPower, string peakPower, string peakPowerT,
@@ -304,7 +305,8 @@ public class EncoderCurve
this.Laterality = laterality;
this.ExtraWeight = extraWeight;
this.DisplacedWeight = displacedWeight;
- this.Inertia = inertia;
+ this.Inertia = inertia; //inertial
+ this.Diameter = diameter; //inertial
this.Start = start;
this.Duration = duration;
this.Height = height;
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index 06e201f3..f528d16f 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -612,7 +612,8 @@ public partial class ChronoJumpWindow
Catalog.GetString("Laterality") + "\n",
Catalog.GetString("Extra weight") + "\n(Kg)",
Catalog.GetString("Total weight") + "\n(Kg)",
- Catalog.GetString("Inertia M.") + "\n(Kg*cm^2)",
+ Catalog.GetString("Inertia M.") + "\n(Kg*cm^2)", //inertial
+ Catalog.GetString("Diameter") + "\n(cm)", //inertial
Catalog.GetString("Start") + "\n" + timeUnits,
Catalog.GetString("Duration") + "\n" + timeUnits,
Catalog.GetString("Distance") + "\n" + distanceUnits,
@@ -709,7 +710,8 @@ public partial class ChronoJumpWindow
cells[21], //laterality
Convert.ToDouble(Util.ChangeDecimalSeparator(cells[4])), //extraWeight
totalMass,
//displaceWeight
- Convert.ToInt32(cells[22]),
//inertia
+ Convert.ToInt32(cells[22]),
//inertia M. (inertial)
+ Convert.ToDouble(cells[23]),
//diameter (inertial)
cells[5], cells[6], cells[7],
cells[8], cells[9], cells[10],
cells[11], cells[12], cells[13],
@@ -748,8 +750,8 @@ public partial class ChronoJumpWindow
int i=0;
foreach(string myCol in columnsString)
{
- //do not show inertia moment on powergravitatory
- if(encoderMode == Constants.Menuitem_modes.POWERGRAVITATORY && i == 6)
+ //do not show inertia moment and diameter on powergravitatory
+ if(encoderMode == Constants.Menuitem_modes.POWERGRAVITATORY && (i == 6 || i == 7))
{
i ++;
continue;
@@ -783,54 +785,57 @@ public partial class ChronoJumpWindow
aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderDisplacedWeight));
break;
case 6:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderInertia));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderInertia)); //inertial
break;
case 7:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderStart));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderDiameter)); //inertial
break;
case 8:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderDuration));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderStart));
break;
case 9:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderHeight));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderDuration));
break;
case 10:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanSpeed));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderHeight));
break;
case 11:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxSpeed));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanSpeed));
break;
case 12:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxSpeedT));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxSpeed));
break;
case 13:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanPower));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxSpeedT));
break;
case 14:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPeakPower));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanPower));
break;
case 15:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPeakPowerT));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPeakPower));
break;
case 16:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPP_PPT));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPeakPowerT));
break;
case 17:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanForce));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPP_PPT));
break;
case 18:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxForce));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanForce));
break;
case 19:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxForceT));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxForce));
break;
case 20:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxForce_maxForceT));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxForceT));
break;
case 21:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderWork));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxForce_maxForceT));
break;
case 22:
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderWork));
+ break;
+ case 23:
aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderImpulse));
break;
}
@@ -1166,6 +1171,14 @@ public partial class ChronoJumpWindow
renderBoldIfNeeded(cell, curve, str);
}
+ private void RenderDiameter (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model,
Gtk.TreeIter iter)
+ {
+ EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
+
+ string str =
String.Format(UtilGtk.TVNumPrint(curve.Diameter.ToString(),1,0),Convert.ToDouble(curve.Diameter));
+
+ renderBoldIfNeeded(cell, curve, str);
+ }
private void RenderStart (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model,
Gtk.TreeIter iter)
{
@@ -1590,7 +1603,7 @@ public partial class ChronoJumpWindow
//LogB.Information(string.Format("cellsString: {0}", Util.StringArrayToString(cells, ";")));
if(captureOrAnalyze && cells.Length < 21) //from 0 to 20
return false;
- else if(! captureOrAnalyze && cells.Length < 23) //from 0 to 22
+ else if(! captureOrAnalyze && cells.Length < 24) //from 0 to 23
return false;
return true;
@@ -1630,9 +1643,11 @@ public partial class ChronoJumpWindow
//capture does not return inerta
//analyze returns inertia (can be different on "saved curves") comes as Kg*m^2, convert it to
Kg*cm^2
+ //analyze returns also diameter (used on inertial)
if(! captureOrAnalyze) {
double inertiaInM = Convert.ToDouble(Util.ChangeDecimalSeparator(cells[22]));
cells[22] = (Convert.ToInt32(inertiaInM * 10000)).ToString();
+ cells[23] = Util.ChangeDecimalSeparator(cells[23]);
}
return cells;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]