private void ComputeAcceleration(TimeSeriesCollection tsc, CalibrationHelper calibrationHelper) { if (tsc.Length <= 2) { PadAccelerations(tsc); return; } for (int i = 1; i < tsc.Length - 1; i++) { float v1 = velocities[i - 1]; float v2 = velocities[i + 1]; float t = calibrationHelper.GetTime(2); float alpha = (v2 - v1) / t; tsc[Kinematics.AngularAcceleration][i] = (double)calibrationHelper.ConvertAngularAcceleration(alpha); float at = radii[i] * alpha; tsc[Kinematics.TangentialAcceleration][i] = (double)calibrationHelper.ConvertAcceleration(at); float ac = radii[i] * velocities[i] * velocities[i]; tsc[Kinematics.CentripetalAcceleration][i] = (double)calibrationHelper.ConvertAcceleration(ac); float a = (float)Math.Sqrt(at * at + ac * ac); tsc[Kinematics.ResultantLinearAcceleration][i] = (double)calibrationHelper.ConvertAcceleration(a); } PadAccelerations(tsc); }
private void ComputeRawAccelerations(TrajectoryKinematics kinematics, CalibrationHelper calibrationHelper) { if (kinematics.Length <= 4) { PadRawAccelerations(kinematics); return; } for (int i = 2; i < kinematics.Length - 2; i++) { PointF p0 = kinematics.RawCoordinates(i - 2); PointF p2 = kinematics.RawCoordinates(i); PointF p4 = kinematics.RawCoordinates(i + 2); float t02 = calibrationHelper.GetTime(2); float t24 = calibrationHelper.GetTime(2); float t13 = calibrationHelper.GetTime(2); kinematics.RawAcceleration[i] = calibrationHelper.ConvertAcceleration(GetAcceleration(p0, p2, p4, t02, t24, t13, Component.Magnitude)); kinematics.RawHorizontalAcceleration[i] = calibrationHelper.ConvertAcceleration(GetAcceleration(p0, p2, p4, t02, t24, t13, Component.Horizontal)); kinematics.RawVerticalAcceleration[i] = calibrationHelper.ConvertAcceleration(GetAcceleration(p0, p2, p4, t02, t24, t13, Component.Vertical)); } PadRawAccelerations(kinematics); }
private void ComputeAngularVelocities(TrajectoryKinematics kinematics, CalibrationHelper calibrationHelper) { if (kinematics.Length <= 2) { PadAngularVelocities(kinematics); return; } for (int i = 1; i < kinematics.Length - 1; i++) { double d1 = GetDisplacementAngle(kinematics, i, i - 1); double d2 = GetDisplacementAngle(kinematics, i + 1, i); float time = calibrationHelper.GetTime(2); float inRadPerSecond = (float)((d1 + d2) / time); kinematics.AngularVelocity[i] = calibrationHelper.ConvertAngularVelocity(inRadPerSecond); kinematics.TangentialVelocity[i] = calibrationHelper.ConvertSpeed((float)(inRadPerSecond * kinematics.RotationRadius)); kinematics.CentripetalAcceleration[i] = calibrationHelper.ConvertAcceleration((float)(inRadPerSecond * inRadPerSecond * kinematics.RotationRadius)); } PadAngularVelocities(kinematics); }