Servo Motor Positioning Simulator — Cascaded Position & Velocity PI Loops with Load Disturbance

Interactive servo positioning simulator — a cascaded position and velocity PI loop with torque limit aligns a camera cradle; add a load disturbance, sweeping target or reversed encoder polarity.

← Mechatronics Labs
About this tool — how it works & FAQOpen ▾Close ▴

About the Servo Motor Positioning Simulator

A direct-drive rotary positioning rig aligns a camera cradle. The encoder measures actual shaft position, an outer position loop requests speed, and an inner velocity PI loop requests limited motor torque. You can add a load disturbance or reverse sensor polarity to investigate tracking.

What the simulator shows

• A direct-drive servo with cooling fins, a camera cradle and shaft pointer, a feedback encoder, a position and velocity loop controller, and a target arc with command pointer. • Controls for target angle (-90 to 90°), reference motion (fixed or sweeping target), position-loop gain, velocity proportional and integral gains, an opposing torque after 4 s (0-1 N·m) and reversed encoder polarity. • Readouts of actual shaft angle, target angle, true positioning error, applied motor torque, shaft speed and the velocity integral contribution. • Experiments: disturbance rejection, no velocity integral, and an incorrect feedback sign.

The model behind it

ωref = clamp[Kpos(r − θmeasured), ±π] rad/s and τ = clamp[Kvel(ωref − ωmeasured) + I, ±1.5] N·m, with İ = Ki(ωref − ωmeasured) and conditional anti-windup. The rig obeys Jω̇ = τ − 0.08ω − load(t) with J = 0.08 kg·m², and the sweeping target is target × sin(2π × 0.12t).

Model boundaries

The model assumes an ideal inner current loop with no electrical winding transients, gearing, backlash or encoder quantization. Angles are unwrapped with no mechanical stop, so reversed feedback may cause continuous rotation. This is a teaching model, not a tuned commercial drive.

Frequently asked questions

Does the target pointer prove actual positioning?

No. The encoder and actual cradle angle reveal tracking error.

Does torque saturation mean position must stay correct?

No. Limited torque constrains how the system can correct disturbances.

What happens with no velocity integral gain?

A sustained load produces a position offset in this cascade; velocity integral action increases torque after the load step and helps restore position.

What happens if the encoder polarity is reversed?

The measured motion reinforces the error, so position runs away until torque and speed dynamics limit it, and with no mechanical stop the rig can rotate continuously.

Related tools & guides