[chronojump] on inertial do not calculate on eccentric until no negative accel
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] on inertial do not calculate on eccentric until no negative accel
- Date: Thu, 25 Jun 2015 16:27:35 +0000 (UTC)
commit 168b28db8a18e45b0ef7258e6b50679e887c60c9
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Jun 25 18:26:58 2015 +0200
on inertial do not calculate on eccentric until no negative accel
encoder/graph.R | 12 +++++++++---
encoder/util.R | 34 +++++++++++++++++++++++++---------
2 files changed, 34 insertions(+), 12 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index c0c19b2..823dde8 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -970,11 +970,17 @@ paint <- function(displacement, eccon, xmin, xmax, yrange, knRanges, superpose,
inertialECstart = 1
if(length(eccentric) > 0)
inertialECstart = min(eccentric)
-
- if(inertiaMomentum > 0 && eccon == "ec" && accel$y[1] < 0) {
- inertialECstart <- min(which(accel$y > 0))
+
+ #as acceleration can oscillate, start at the eccentric part where there are not negative values
+ if(inertiaMomentum > 0 && eccon == "ec" &&
+ length(eccentric) > 0 && min(accel$y[eccentric]) < 0) #if there is eccentric data and there are
negative vlaues
+ {
+ inertialECstart = max(which(accel$y[eccentric] < 0)) +1
abline(v=inertialECstart,lty=3,col="black")
}
+ #print("------------ inercialECstart -----------")
+ #print(inertialECstart)
+
meanSpeedC = mean(speed$y[min(concentric):max(concentric)])
diff --git a/encoder/util.R b/encoder/util.R
index 0be5891..1712e0e 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -398,6 +398,7 @@ kinematicsF <- function(displacement, massBody, massExtra, exercisePercentBodyWe
accel$y <- accel$y * 1000
errorSearching = FALSE
+ eccentric = 0
concentric = 0
propulsiveEnd = 0
@@ -453,8 +454,22 @@ kinematicsF <- function(displacement, massBody, massExtra, exercisePercentBodyWe
if( isPropulsive && ( eccon== "c" || eccon == "ec" ) )
end <- propulsiveEnd
- if(inertiaMomentum > 0 && (eccon == "e" || eccon == "ec") && accel$y[1] < 0)
- start <- min(which(accel$y > 0))
+ #as acceleration can oscillate, start at the eccentric part where there are not negative values
+ #print(c(inertiaMomentum, eccon, length(eccentric), min(accel$y[eccentric])))
+ if(inertiaMomentum > 0 && (eccon == "e" || eccon == "ec"))
+ {
+ if(eccon=="e") {
+ eccentric=1:length(displacement)
+ }
+
+ #if there is eccentric data and there are negative vlaues
+ if(length(eccentric) > 0 && min(accel$y[eccentric]) < 0)
+ {
+ start = max(which(accel$y[eccentric] < 0)) +1
+ #print("------------ start -----------")
+ #print(start)
+ }
+ }
#print(c("kinematicsF start end",start,end))
@@ -749,16 +764,17 @@ getDynamicsInertial <- function(encoderConfigurationName, displacement, diameter
#TODO: WIP
forceDisc = inertiaMomentum * angleAccel * (2 / diameter.m)
forceBody = mass * accel
- print("PRINT FORCE")
- xmin=9815
- xmax=11727
- print(force[xmin:xmax])
+ #print("PRINT FORCE")
+ #xmin=9815
+ #xmax=11727
+ #print(force[xmin:xmax])
- print(max(speed[xmin:xmax]))
- print(max(accel[xmin:xmax]))
+ #print(max(speed[xmin:xmax]))
+ #print(max(accel[xmin:xmax]))
}
- return(list(displacement=displacement, mass=mass, force=force, power=power, forceDisc=forceDisc,
forceBody=forceBody, accelHere = accel))
+ #return(list(displacement=displacement, mass=mass, force=force, power=power, forceDisc=forceDisc,
forceBody=forceBody, accelHere = accel))
+ return(list(displacement=displacement, mass=mass, force=force, power=power))
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]