rcarlyle / StepperSim

Simulates stepper motor driver systems
MIT License
100 stars 11 forks source link

Speeds between current-limited and voltage-limited range may not converge goal seek due to multiple current peaks #32

Open rcarlyle opened 8 years ago

rcarlyle commented 8 years ago

With some configurations, it's possible for intermediate speeds to fail to converge the goal seek function even though higher speeds will converge.

This occurs because the current waveform can develop two current peaks around RPMs in the transition between constant-current operation and constant-voltage operation, confusing the inductor phase lag estimation technique used here. When the highest peak changes due to different goal seek input, the estimated phase lag jumps over the convergence value. So the goal seek fails.

In a perfect world, the current waveform would be decomposed into an ideal sine curve fit so there is only one peak per cycle and that peak's phase would be continuous for all input values, but that's very hard to do in Excel.

Repro config: https://groups.google.com/d/msg/deltabot/Lu7k8U9gYpc/AEXfznDPCAAJ