[chronojump] gearedDown passed to getDynamics



commit 9dbfcd7e20046bd13933b2160221163a23761ed2
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 3 11:06:16 2016 +0100

    gearedDown passed to getDynamics

 encoder/graph.R            |    4 ++--
 encoder/graphSmoothingEC.R |   22 ++++++++++++----------
 encoder/util.R             |    4 ++--
 3 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 42705e7..be4ff69 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2384,7 +2384,7 @@ doProcess <- function(options)
        
                #find SmoothingsEC
                SmoothingsEC = findSmoothingsEC(singleFile, displacement, curves, op$Eccon, op$SmoothingOneC,
-                                               NULL, NULL, NULL) #needed for singleFile (signal)
+                                               NULL, NULL, NULL, NULL) #this row is only needed for 
singleFile (signal)
                print(c("SmoothingsEC:",SmoothingsEC))
        } else {        #singleFile == True. reads a signal file
                displacement=scan(file=op$File,sep=",")
@@ -2455,7 +2455,7 @@ doProcess <- function(options)
                #find SmoothingsEC
                SmoothingsEC = findSmoothingsEC(
                                                singleFile, displacement, curves, op$Eccon, op$SmoothingOneC,
-                                               op$EncoderConfigurationName, op$diameter, op$inertiaMomentum 
+                                               op$EncoderConfigurationName, op$diameter, op$inertiaMomentum, 
op$gearedDown 
                                                ) #second row is needed for singleFile (signal)
                print(c("SmoothingsEC:",SmoothingsEC))
                
diff --git a/encoder/graphSmoothingEC.R b/encoder/graphSmoothingEC.R
index 6112680..8baf6d8 100644
--- a/encoder/graphSmoothingEC.R
+++ b/encoder/graphSmoothingEC.R
@@ -27,9 +27,9 @@ findSmoothingsECGetPowerNI <- function(speed)
        power <- force * speed$y
        return(power)
 }
-findSmoothingsECGetPowerI <- function(displacement, encoderConfigurationName, diameter, massTotal, 
inertiaMomentum, smoothing)
+findSmoothingsECGetPowerI <- function(displacement, encoderConfigurationName, diameter, massTotal, 
inertiaMomentum, gearedDown, smoothing)
 {
-       dynamics = getDynamicsInertial(encoderConfigurationName, displacement, diameter, massTotal, 
inertiaMomentum, smoothing)
+       dynamics = getDynamicsInertial(encoderConfigurationName, displacement, diameter, massTotal, 
inertiaMomentum, gearedDown, smoothing)
        return(dynamics$power)
 }
 #splinesPredictGraph <- function(x,y)
@@ -44,7 +44,7 @@ findSmoothingsECGetPowerI <- function(displacement, encoderConfigurationName, di
 #
 #}
 findSmoothingsECYPoints <- function(eccentric.concentric, conStart, conEnd, x, maxPowerConAtCon, 
-                      encoderConfigurationName, diameter, massTotal, inertiaMomentum)
+                      encoderConfigurationName, diameter, massTotal, inertiaMomentum, gearedDown)
 {
        y <- NULL 
        count <- 1
@@ -58,7 +58,7 @@ findSmoothingsECYPoints <- function(eccentric.concentric, conStart, conEnd, x, m
                        powerTemp <- findSmoothingsECGetPowerNI(speed)
                else
                        powerTemp <- findSmoothingsECGetPowerI(eccentric.concentric, 
encoderConfigurationName, 
-                                                              diameter, massTotal, inertiaMomentum, 
smoothingOneEC)
+                                                              diameter, massTotal, inertiaMomentum, 
gearedDown, smoothingOneEC)
                
                #find the max power in concentric phase of this ecc-con movement
                maxPowerConAtFullrep <- max(powerTemp[conStart:conEnd])
@@ -81,7 +81,7 @@ findSmoothingsECYPoints <- function(eccentric.concentric, conStart, conEnd, x, m
 #called on "ec" and "ce" to have a smoothingOneEC for every curve
 #this smoothingOneEC has produce same speeds than smoothing "c"
 findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingOneC,
-                            singleFileEncoderConfigurationName, singleFileDiameter, 
singleFileInertiaMomentum)
+                            singleFileEncoderConfigurationName, singleFileDiameter, 
singleFileInertiaMomentum, singleFileGearedDown)
 {
        ptm <- as.vector(proc.time()[3])
        write("time start", stderr())
@@ -137,10 +137,12 @@ findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingO
                                myEncoderConfigurationName = singleFileEncoderConfigurationName;
                                myDiameter = singleFileDiameter;
                                myInertiaMomentum = singleFileInertiaMomentum;
+                               myGearedDown = singleFileGearedDown;
                                if(! singleFile) {
                                        myEncoderConfigurationName = curves[i,11];
                                        myDiameter = curves[i,12];
                                        myInertiaMomentum = curves[i,16];
+                                       myGearedDown = curves[i,17];
                                }
                        
                                powerTemp = NULL        
@@ -148,7 +150,7 @@ findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingO
                                        powerTemp <- findSmoothingsECGetPowerNI(speed)
                                else
                                        powerTemp <- findSmoothingsECGetPowerI(concentric, 
myEncoderConfigurationName,
-                                                                              myDiameter, 100, 
myInertiaMomentum, smoothingOneC)
+                                                                              myDiameter, 100, 
myInertiaMomentum, myGearedDown, smoothingOneC)
                                
                                maxPowerConAtCon <- max(powerTemp)
 
@@ -158,7 +160,7 @@ findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingO
                                                    to = as.numeric(smoothingOneC)/2, 
                                                    length.out = 5)
                                y <- findSmoothingsECYPoints(eccentric.concentric, conStart, conEnd, x, 
maxPowerConAtCon, 
-                                               myEncoderConfigurationName, myDiameter, 100, 
myInertiaMomentum)
+                                               myEncoderConfigurationName, myDiameter, 100, 
myInertiaMomentum, myGearedDown)
                                #write(paste("x, y", x, y), stderr())
 
 
@@ -174,7 +176,7 @@ findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingO
                                        powerTemp <- findSmoothingsECGetPowerNI(speed)
                                else
                                        powerTemp <- findSmoothingsECGetPowerI( eccentric.concentric, 
myEncoderConfigurationName,
-                                                                              myDiameter, 100, 
myInertiaMomentum, smoothingOneEC)
+                                                                              myDiameter, 100, 
myInertiaMomentum, myGearedDown, smoothingOneEC)
                                
                                #find the max power in concentric phase of this ecc-con movement
                                maxPowerConAtFullrep <- max(powerTemp[conStart:conEnd])
@@ -224,7 +226,7 @@ findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingO
                                         to = xLowerValue,
                                         length.out = 5)
                                y <- findSmoothingsECYPoints(eccentric.concentric, conStart, conEnd, x, 
maxPowerConAtCon, 
-                                               myEncoderConfigurationName, myDiameter, 100, 
myInertiaMomentum)
+                                               myEncoderConfigurationName, myDiameter, 100, 
myInertiaMomentum, myGearedDown)
                                
                                
                                smodel <- smooth.spline(y,x)
@@ -236,7 +238,7 @@ findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingO
                                        powerTemp <- findSmoothingsECGetPowerNI(speed)
                                else
                                        powerTemp <- findSmoothingsECGetPowerI( eccentric.concentric, 
myEncoderConfigurationName,
-                                                                              myDiameter, 100, 
myInertiaMomentum, smoothingOneEC)
+                                                                              myDiameter, 100, 
myInertiaMomentum, myGearedDown, smoothingOneEC)
                                
                                #find the max power in concentric phase of this ecc-con movement
                                maxPowerConAtFullrep <- max(powerTemp[conStart:conEnd])
diff --git a/encoder/util.R b/encoder/util.R
index 9484205..a6a8711 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -804,7 +804,7 @@ getDynamics <- function(encoderConfigurationName,
   massTotal = massBody + massExtra
   
   if(isInertial(encoderConfigurationName))
-    return (getDynamicsInertial(encoderConfigurationName, displacement, diameter, massTotal, 
inertiaMomentum, smoothing))
+    return (getDynamicsInertial(encoderConfigurationName, displacement, diameter, massTotal, 
inertiaMomentum, gearedDown, smoothing))
   else 
     return (getDynamicsNotInertial (encoderConfigurationName, speed, accel, 
                                     massBody, massExtra, massTotal, 
@@ -841,7 +841,7 @@ getDynamicsNotInertial <- function(encoderConfigurationName, speed, accel,
 #  ROTARYAXISINERTIAL Rotary axis encoder  connected to inertial machine on the axis
 #  ROTARYAXISINERTIALMOVPULLEY Rotari axis encoder connected to inertial machine on the axis and the subject 
pulling from a moving pulley
 
-getDynamicsInertial <- function(encoderConfigurationName, displacement, diameter, mass, inertiaMomentum, 
smoothing)
+getDynamicsInertial <- function(encoderConfigurationName, displacement, diameter, mass, inertiaMomentum, 
gearedDown, smoothing)
 {
        speed = getSpeed(displacement, smoothing) #mm/ms == m/s 
 


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