[chronojump] CairoGraphRaceAnalyzer prints RunEncoderSegmentCalcs accel, force



commit 612e9a9f1542e4e6b443445ffcc162bc6440ae6c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon May 9 12:46:32 2022 +0200

    CairoGraphRaceAnalyzer prints RunEncoderSegmentCalcs accel, force

 src/gui/cairo/raceAnalyzer.cs |  6 ++++--
 src/runEncoder.cs             | 18 ++++++++++++++----
 2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/cairo/raceAnalyzer.cs b/src/gui/cairo/raceAnalyzer.cs
index 4204278f5..aa00ff3d6 100644
--- a/src/gui/cairo/raceAnalyzer.cs
+++ b/src/gui/cairo/raceAnalyzer.cs
@@ -136,7 +136,7 @@ public class CairoGraphRaceAnalyzer : CairoXY
                                //vertical
                                if(segmentCalcs.Count > 0)
                                {
-                                       LogB.Information("accels: ");
+                                       LogB.Information("accels ; forces");
                                        g.Save();
                                        g.SetDash(new double[]{1, 2}, 0);
                                        for(int i = 0 ; i < segmentCalcs.Count ; i ++)
@@ -146,7 +146,9 @@ public class CairoGraphRaceAnalyzer : CairoXY
                                                //seconds
                                                string xTextBottom = 
Util.TrimDecimals(segmentCalcs.Time_l[i]/1000000.0, 1).ToString();
                                                double xGraph = 
calculatePaintX(segmentCalcs.Time_l[i]/1000000.0);
-                                               LogB.Information(segmentCalcs.Accel_l[i].ToString());
+                                               LogB.Information(string.Format("{0} ; {1}",
+                                                                       segmentCalcs.Accel_l[i].ToString(),
+                                                                       segmentCalcs.Force_l[i].ToString() ));
 
                                                if(useListOfDoublesOnY)
                                                        paintVerticalGridLine(g, Convert.ToInt32(xGraph), 
xTextBottom, textHeight-3);
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index 5d18f5df5..86e548ae0 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -417,7 +417,7 @@ public class RunEncoderSegmentCalcs
        private List<double> time_l;
        private List<double> speedCont_l;
        private List<double> accel_l;
-
+       private List<double> force_l;
        /*
        //TODO: a, F, P
        accel = (V2 - V1)/(T2 - T1)
@@ -439,6 +439,7 @@ public class RunEncoderSegmentCalcs
                time_l = new List<double> ();
                speedCont_l = new List<double> ();
                accel_l = new List<double> ();
+               force_l = new List<double> ();
                //TODO: a, F, P
        }
 
@@ -453,7 +454,11 @@ public class RunEncoderSegmentCalcs
                speedCont_l.Add(speedCont);
 
                if(isFirstOne)
-                       accel_l.Add(UtilAll.DivideSafe(speedCont, time/1000000.0));
+               {
+                       double accel = UtilAll.DivideSafe(speedCont, time/1000000.0);
+                       accel_l.Add (accel);
+                       force_l.Add ( massKg * (accel + g * Math.Sin(angle)) );
+               }
                else
                {
                        /*
@@ -463,8 +468,10 @@ public class RunEncoderSegmentCalcs
                                                UtilAll.DivideSafe( (speedCont - speedCont_l[Count -2]), 
(time/1000000.0 - time_l[Count -2]/1000000.0) ) ));
                                                */
 
-                       accel_l.Add(UtilAll.DivideSafe(
-                                               (speedCont - speedCont_l[Count -2]), (time/1000000.0 - 
time_l[Count -2]/1000000.0) ));
+                       double accel = UtilAll.DivideSafe(
+                                       (speedCont - speedCont_l[Count -2]), (time/1000000.0 - time_l[Count 
-2]/1000000.0) );
+                       accel_l.Add (accel);
+                       force_l.Add ( massKg * (accel + g * Math.Sin(angle)) );
                }
        }
 
@@ -482,6 +489,9 @@ public class RunEncoderSegmentCalcs
        public List<double> Accel_l {
                get { return accel_l; }
        }
+       public List<double> Force_l {
+               get { return force_l; }
+       }
 }
 
 public class RunEncoderExercise


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