I'm now working on single shunt FOC algorithm with S12ZVML31.
I found that sometime it failed to transmit from tracking to sensorless1(as the picture show)
I think, when it changes state from tracking to sensorless1(purple line)，the Speed Estamited error(red line), so my motor starts failed. But why it starts well in second chance?
So, why the speed estamite error or how can I solve this problem?
I'm afraid there is no simple answer to this. Since there are many motor types out there, we cannot have one universal fit for any motor type. It heavily depends on the inductances, backEMF, algorithm sampling, control loop settings, etc.
If you can manage to go from tracking to sensorless at least time-to-time, you are probably not far from a good settings. I usually start with the backEMF settings, getting some smooth waveforms of estimated backEMF. I usually try to adjust the merging speeds settings (Merge 1 and Merge 2), then the open-loop start-up current and closed loop current.
First of all, please make sure the current controllers are set correctly (all the motor parameters set correctly, current loop behaves smoothly in Current Control mode, backEMF observer set in order to get smooth estimated backEMF). Then you can switch to the Speed Control and start to play with the rest.
Merge 2 should be initially set to approx. 10% of the base (nominal) speed at least, usually even more.
Merge 1 is then set lower, with respect to the speed-up ramp and dynamic settings of the backEMF observer, tracking observer and speed filter (remember that the observer needs to settle between Merge 1 and Merge 2).
Some low-inertia motors (pumps) are better behaving with fast start-up, high-inertia motors behave better with slow start-up.
The open-loop current can be initially set to the nominal current of the motor, however, it should reflect the torque required during the start-up. If the current is set too high (exceeding the torque demands), there would probably be a control glitch right after the transition to the sensorless, which in turn can "trick-out" the backEMF observer and lead to a failed start-up. On the other hand, correctly set backEMF observer together with the speed and current loop settings can be used even with a very high start-up current.
I understand that this is a multi-criteria problem with many linkages between the parameters. There is no universal sensorless solution (if someone says there is, beware). Bright side is that if you play with it yourself, you will have enough experience to do it the next time faster and more robust.