From b5ac1b7d3d6056f7d40ea27cc3c0bb9b289953c9 Mon Sep 17 00:00:00 2001 From: timmmooney Date: Thu, 1 May 2014 19:48:13 +0000 Subject: [PATCH] write max v/a to PVs. Acceleration to final position determined from desired speed (0),, not position. --- motorApp/OmsSrc/MAX_trajectoryScan.st | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/motorApp/OmsSrc/MAX_trajectoryScan.st b/motorApp/OmsSrc/MAX_trajectoryScan.st index f38cd2b4..94076cf3 100644 --- a/motorApp/OmsSrc/MAX_trajectoryScan.st +++ b/motorApp/OmsSrc/MAX_trajectoryScan.st @@ -400,6 +400,10 @@ ss maxTrajectoryScan { vmax = epicsMotorVMAX[j]; if (fabs(vmax) < .001) vmax = epicsMotorVELO[j]; amax = vmax/epicsMotorACCL[j]; + motorMVA[j] = 0.; + motorMAA[j] = 0.; + motorMVE[j] = 0; + motorMAE[j] = 0; for (k=0; k motorMVA[j]) { + motorMVA[j] = velocity[j][k]; + motorMVE[j] = k; + } + if (fabs(acceleration[j][k]) > motorMAA[j]) { + motorMAA[j] = acceleration[j][k]; + motorMAE[j] = k; + } } + motorMVA[j] *= epicsMotorMres[j]; + motorMAA[j] *= epicsMotorMres[j]; + pvPut(motorMVA[j]); + pvPut(motorMAA[j]); + pvPut(motorMVE[j]); + pvPut(motorMAE[j]); } } @@ -1060,7 +1078,7 @@ static int buildTrajectory(SS_ID ssId, struct UserVar *pVar, double *realTimeTra } else { v_ideal = 0.; accel_v = (v_ideal - v_out[i-1])/dt; - a_out[i-1] = accel_p; + a_out[i-1] = accel_v; } if (pVar->debugLevel >= 7) { printf("%3d:%8.2f %8.2f %7.2f %8.3f %8.3f %8.3f %8.3f %8.3f\n", @@ -1086,7 +1104,7 @@ static int buildTrajectory(SS_ID ssId, struct UserVar *pVar, double *realTimeTra calcMotorTrajectory[i] = calcMotorTrajectory[i-1] + v_out[i-1]*dt + .5 * a_out[i-1]*dt*dt; } a_out[npoints-1] = a_out[npoints-2]; - + if (pVar->debugLevel >= 7) { printf("buildTrajectory:\n"); printf("%10s %10s %10s %10s %10s\n", "realTime", "motorTraj", "calcTraj", "v_out", "a_out");