[chronojump] Detection of not sustanined force



commit d8afde8d2f410bd91639a88c70d3ccf941ed44f2
Author: Xavier Padullés <x padulles gmail com>
Date:   Fri Jun 2 14:07:02 2017 +0200

    Detection of not sustanined force

 r-scripts/maximumIsometricForce.R |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/r-scripts/maximumIsometricForce.R b/r-scripts/maximumIsometricForce.R
index 383eae5..7511b97 100644
--- a/r-scripts/maximumIsometricForce.R
+++ b/r-scripts/maximumIsometricForce.R
@@ -200,8 +200,15 @@ drawDynamicsFromLoadCell <- function(
         }
         par(mar = c(6, 4, 6, 4))
         
+        if(dynamics$fmax.fitted > dynamics$fmax.raw*1.5){
+                sustainedForce = F
+                yHeight = dynamics$fmax.raw
+        } else if(dynamics$fmax.fitted <= dynamics$fmax.raw*1.5){
+                sustainedForce = T
+                yHeight = max(dynamics$fmax.raw, dynamics$fmax.fitted) * 1.1
+        }
+                
         #Plotting raw data from startTime to endTime (Only the analysed data)
-        yHeight = max(dynamics$fmax.raw, dynamics$fmax.fitted) * 1.1
         if (!is.na(xlimits[1])){
                 xWidth = xlimits[2] - xlimits[1]
                 plot(dynamics$time[dynamics$startSample:dynamics$endSample] , 
dynamics$f.raw[dynamics$startSample:dynamics$endSample],
@@ -222,6 +229,11 @@ drawDynamicsFromLoadCell <- function(
                      main = dynamics$nameOfFile, yaxs= "i", xaxs = "i")
         }
         
+        if(!sustainedForce){
+                text("Bad execution. Probably not sustained force", adj = c(0.5, 0.5))
+                return()
+        }
+        
         #Plotting Impulse
         
         print("--------Impulse-----------")


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