[chronojump] missed to upload changes on util.cs for workJ fix on last commits



commit 0e18b0c952a362f2fcecc31e83c8051643585582
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jan 16 16:40:11 2020 +0100

    missed to upload changes on util.cs for workJ fix on last commits

 encoder/util.R | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/encoder/util.R b/encoder/util.R
index 0ba27b69..f2331ac1 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -796,10 +796,20 @@ pafGenerate <- function(eccon, kinematics, massBody, massExtra, laterality, iner
        #vi, vf: speed initial/final
        #wi, wf: angular speed initial/final
        lastValue = length(kinematics$displ)
-       workJ <- kinematics$mass * ( g * (kinematics$displ[lastValue] - kinematics$displ[1]) + 
.5*((kinematics$speedy[lastValue])^2 - (kinematics$speedy[1])^2) )
+       workJ <- kinematics$mass * ( g * (
+                                         abs(cumsum(kinematics$displ))[length(cumsum(kinematics$displ))] / 
1000 #position displaced in m
+                                         ) + .5*((kinematics$speedy[lastValue])^2 - 
(kinematics$speedy[1])^2) )
        if(inertiaMomentum > 0) #if is not inertial Roptions has a -1
                workJ = workJ + .5 * inertiaMomentum * ( (kinematics$speedyangular[lastValue])^2 - 
(kinematics$speedyangular[1]^2) )
 
+       #print ("workJ decomposed:")
+       #print (workJ)
+       #print (kinematics$mass)
+       #print (g)
+       #print (abs(cumsum(kinematics$displ))[length(cumsum(kinematics$displ))] / 1000 ) #position displaced 
in m
+       #print ((kinematics$speedy[lastValue])^2)
+       #print ((kinematics$speedy[1])^2)
+
        #impulse
        impulse <- meanForce * length(kinematics$displ)/1000    #F * time in s
 


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