viewof totalStepsMove = Inputs.range([1000, 100000], {value: 80000, step: 1000, label: "Total Steps to Move"})
viewof maxSpeedMove = Inputs.range([100, 3000], {value: 1000, step: 100, label: "Max Speed (steps/s)"})
viewof acceleration = Inputs.range([100, 2000], {value: 500, step: 50, label: "Acceleration (steps/s²)"})
accelTime = maxSpeedMove / acceleration
accelDistance = 0.5 * acceleration * accelTime * accelTime
decelDistance = accelDistance
constDistance = Math.max(0, totalStepsMove - accelDistance - decelDistance)
// If can't reach max speed (triangular profile)
canReachMaxSpeed = (accelDistance + decelDistance) <= totalStepsMove
actualMaxSpeed = canReachMaxSpeed ? maxSpeedMove : Math.sqrt(acceleration * totalStepsMove)
actualAccelTime = actualMaxSpeed / acceleration
actualAccelDistance = 0.5 * acceleration * actualAccelTime * actualAccelTime
actualDecelTime = actualAccelTime
actualConstDistance = Math.max(0, totalStepsMove - 2 * actualAccelDistance)
actualConstTime = actualConstDistance > 0 ? actualConstDistance / actualMaxSpeed : 0
totalTime = 2 * actualAccelTime + actualConstTime
profileType = canReachMaxSpeed ? "Trapezoidal" : "Triangular"
html`<div style="background: #f8f9fa; padding: 15px; border-radius: 8px; margin-top: 15px;">
<h4 style="margin-top: 0; color: #2c3e50;">Acceleration Profile Calculator</h4>
<table style="width: 100%; border-collapse: collapse;">
<tr><th scope="row" style="padding: 8px; border-bottom: 1px solid #ddd;"><strong>Profile Type:</strong></th>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${profileType}</td></tr>
<tr><th scope="row" style="padding: 8px; border-bottom: 1px solid #ddd;"><strong>Actual Max Speed:</strong></th>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${actualMaxSpeed.toFixed(0)} steps/s</td></tr>
<tr><th scope="row" style="padding: 8px; border-bottom: 1px solid #ddd;"><strong>Accel Time:</strong></th>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${actualAccelTime.toFixed(2)} s</td></tr>
<tr><th scope="row" style="padding: 8px; border-bottom: 1px solid #ddd;"><strong>Accel Distance:</strong></th>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${actualAccelDistance.toFixed(0)} steps</td></tr>
<tr><th scope="row" style="padding: 8px; border-bottom: 1px solid #ddd;"><strong>Const Speed Time:</strong></th>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${actualConstTime.toFixed(2)} s</td></tr>
<tr><th scope="row" style="padding: 8px; border-bottom: 1px solid #ddd;"><strong>Const Speed Distance:</strong></th>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${actualConstDistance.toFixed(0)} steps</td></tr>
<tr><th scope="row" style="padding: 8px; border-bottom: 1px solid #ddd;"><strong>Decel Time:</strong></th>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${actualAccelTime.toFixed(2)} s</td></tr>
<tr><th scope="row" style="padding: 8px;"><strong>Total Time:</strong></th>
<td style="padding: 8px;"><strong>${totalTime.toFixed(2)} seconds</strong></td></tr>
</table>
<p style="margin-top: 10px; font-size: 0.9em; color: #555;">
${canReachMaxSpeed ?
"Trapezoidal profile: motor reaches commanded max speed." :
"Triangular profile: distance too short to reach max speed, motor accelerates then immediately decelerates."}
</p>
</div>`Acceleration Profile Calculator
Acceleration Profile Calculator
animation
actuators
stepper
Try Start with Total Steps to Move at 80000, Max Speed (steps/s) at 1000, and Acceleration (steps/s²) at 500.
Observe The default move is Trapezoidal: acceleration takes 2.00 s and Total Time is 82.00 seconds.
Explain Acceleration (steps/s²) sets the ramp time by dividing the target speed by acceleration; equal acceleration and braking ramps surround any constant-speed section.
Technical boundaries. The calculation assumes constant acceleration and equal braking strength. If the distance is too short, peak speed becomes the square root of acceleration times total steps; torque limits and missed steps are not modelled.