[chronojump] ForceSensor analyze general show PSAP on elastic



commit c767d1ef3ca73ec3c694feafb21f04abcc2c6f08
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Nov 12 17:08:06 2019 +0100

    ForceSensor analyze general show PSAP on elastic

 src/forceSensor.cs            | 17 ++++++++++++++
 src/gui/forceSensorAnalyze.cs | 54 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 70 insertions(+), 1 deletion(-)
---
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index 04e13a48..09e0ea21 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -1301,6 +1301,13 @@ public class ForceSensorAnalyzeInstant
        public double ForceAVG;
        public double ForceMAX;
 
+       //for elastic
+       public bool CalculedElasticPSAP;
+       public List<double> Position_l;
+       public List<double> Speed_l;
+       public List<double> Accel_l;
+       public List<double> Power_l;
+
        private ForceSensorCapturePoints fscAIPoints; //Analyze Instant
        private ForceSensorValues forceSensorValues;
        private int graphWidth;
@@ -1386,6 +1393,16 @@ public class ForceSensorAnalyzeInstant
 
                forces = fsd.GetForces();
 
+               CalculedElasticPSAP = false;
+               if(fsd.CalculedElasticPSAP)
+               {
+                       Position_l = fsd.GetPositions();
+                       Speed_l = fsd.GetSpeeds();
+                       Accel_l = fsd.GetAccels();
+                       Power_l = fsd.GetPowers();
+                       CalculedElasticPSAP = true;
+               }
+
                int i = 0;
                foreach(int time in times)
                {
diff --git a/src/gui/forceSensorAnalyze.cs b/src/gui/forceSensorAnalyze.cs
index 69384ba2..698eed62 100644
--- a/src/gui/forceSensorAnalyze.cs
+++ b/src/gui/forceSensorAnalyze.cs
@@ -908,14 +908,66 @@ public partial class ChronoJumpWindow
                        int instant = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
                        if(instant > 0 && instant < fsAI.GetLength() -1)
                        {
+                               int verticalPos = -20;
+                               if(fsAI.CalculedElasticPSAP)
+                                       verticalPos = -60;
+
                                layout_force_ai_text.SetMarkup(string.Format("RFD: {0:0.#} N/s",
                                                        Math.Round(fsAI.CalculateRFD(instant -1, instant +1), 
1) ));
                                textWidth = 1;
                                textHeight = 1;
                                layout_force_ai_text.GetPixelSize(out textWidth, out textHeight);
                                force_sensor_ai_pixmap.DrawLayout (pen_blue_force_ai,
-                                               allocation.Width -textWidth -10, allocation.Height/2 -20,
+                                               allocation.Width -textWidth -10, allocation.Height/2 + 
verticalPos,
                                                layout_force_ai_text);
+
+                               //showing on elastic: position, speed, accel, power
+                               if(fsAI.CalculedElasticPSAP)
+                               {
+                                       //position
+                                       layout_force_ai_text.SetMarkup(string.Format("Position: {0:0.###} m",
+                                                               Math.Round(fsAI.Position_l[instant], 3)));
+                                       textWidth = 1;
+                                       textHeight = 1;
+                                       layout_force_ai_text.GetPixelSize(out textWidth, out textHeight);
+                                       verticalPos += 40;
+                                       force_sensor_ai_pixmap.DrawLayout (pen_blue_force_ai,
+                                                       allocation.Width -textWidth -10, allocation.Height/2 
+ verticalPos,
+                                                       layout_force_ai_text);
+
+                                       //speed
+                                       layout_force_ai_text.SetMarkup(string.Format("Speed: {0:0.###} m/s",
+                                                               Math.Round(fsAI.Speed_l[instant], 3)));
+                                       textWidth = 1;
+                                       textHeight = 1;
+                                       layout_force_ai_text.GetPixelSize(out textWidth, out textHeight);
+                                       verticalPos += 20;
+                                       force_sensor_ai_pixmap.DrawLayout (pen_blue_force_ai,
+                                                       allocation.Width -textWidth -10, allocation.Height/2 
+ verticalPos,
+                                                       layout_force_ai_text);
+
+                                       //accel
+                                       layout_force_ai_text.SetMarkup(string.Format("Accel: {0:0.###} m/s^2",
+                                                               Math.Round(fsAI.Accel_l[instant], 3)));
+                                       textWidth = 1;
+                                       textHeight = 1;
+                                       verticalPos += 20;
+                                       layout_force_ai_text.GetPixelSize(out textWidth, out textHeight);
+                                       force_sensor_ai_pixmap.DrawLayout (pen_blue_force_ai,
+                                                       allocation.Width -textWidth -10, allocation.Height/2 
+ verticalPos,
+                                                       layout_force_ai_text);
+
+                                       //power
+                                       layout_force_ai_text.SetMarkup(string.Format("Power: {0:0.###} W",
+                                                               Math.Round(fsAI.Power_l[instant], 3)));
+                                       textWidth = 1;
+                                       textHeight = 1;
+                                       verticalPos += 20;
+                                       layout_force_ai_text.GetPixelSize(out textWidth, out textHeight);
+                                       force_sensor_ai_pixmap.DrawLayout (pen_blue_force_ai,
+                                                       allocation.Width -textWidth -10, allocation.Height/2 
+ verticalPos,
+                                                       layout_force_ai_text);
+                               }
                        }
                        return;
                }


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