Motor/generators have a k1*V/f transfer function when coasting and when accelerating or braking have a force transfer function of k2*V/DCR.
Since motors are designed to do work they may be >90% efficient but carry a lot on stored energy from the inertial load which can be far greater than the Joules stored in the motor itself.
So the duty cycle of dumping Watts or plugging power with even more Watts, must be regulated with the winding thermal resistance Rwa ['C/W] in order to prevent overtemp on the windings and armature which causes accelerated aging.
Since a contant acceleration and braking force is often ideal at some level, how does one control this effectively and efficiently?
There's no simple solution but let me try this idea.
If one knows the DCR of the motor and uses efficient MOSFET switches that are <2% of the DCR then most of the heat I^2*DCR (neglecting other losses) will be in the motor windings.
We know that for PWM that the effective series resistance (ESR) is a ratio between RdsOn (of bridge pair) divided by the duty cycle. But the back EMF V/f reduces with RPM so the effective braking current reduces in an uncontrolled decay in rotational g's.
There when you input PID loop parameters for some machine with certain transfer functions and mass and choose setpoints for acceleration and velocity profiles it is better to compare the error in each parameter separately for a nice 2nd order stable response with critical dampening. That means choose a start or stop time according to current conditions including winding temp, start conditions and end conditions and compare acceleration feedback with current feedback and rotary encoder rate of changes and velocity feedback with encoder frequency and then set an g level that can be maintained to complete the task in the desired time as often as needed without overheating.
Now there are a lot of variables to compute here, which I won't begin to define.
here comes the Carl Jung moment (aha)
The way to set controlled braking profiles is now obvious to some to use current sensing with average current compared to target current profile in a servo loop using PWM to the required negative plug voltage using a 50mV current shunt rated at maximum short circuit currents. The PWM duty cycle can be varied perhaps from 10% to 100% to minimize the harmonics of the PWM rate and the thermal sensor can reduce the duty cycle as needed if there is a repetitive cycling of motors up and down.
Before locking the rotor with 0 OHm bridge shunts across all coils (no current) we need to modify the PID loop to go from constant velocity mode to braking mode to locked position mode using just before the 0 velocity error reaches 0 so that we don't start going backwards from the plugged negative voltage. But then as the OP stated doing this from a low velocity is a bit of overkill with dynamic losses increased and the software guy's not getting it right. But by regulating the current shunt drop, this servo control method ought to give a smooth transition using predicted PWM levels from "-Vr plug voltage and 0V by knowing the desired barking rate and expected current with inertial load. Some adaptive braking cycles may need to be periodically done to check the transfer functions are correct, to compare expected stop times with actual.
so what is the aha? Servo design with vel, accel, inertial mass , low RdsOn/DCR ratios with RPM feedback and current loop regulation for smooth stops. (something really need for bus drivers) Then compensating loop gain for variable inertia and load current using RPM feedback to track user foot controlled brake g levels.
The tradeoff is you can't have shortest stop time with variable back MF V/RPM or an uncontrolled resistance, you need a back driving voltage that increases as speed reduces to keep current constant. OR you must compromise on shortest stop time with a fixed back-driving voltage and controlled braking current.
S&H can be used on peak currents and compared with avg currents to get cycle to cycle PWM feedback on duty cycle.
This is how we did it in the 70's with a 2Hp linear motor seeking to any track in 50 ms with a large mass head arm assembly on 14" HDD's with zero overshoot on 5 disks to within 0.1 thou position error using embedded servo pulses. ...those were elephants.
Best Answer
Why do you feel the need to tune D and Q separately? D-component is non-torque producing current which manifests itself in the ABC reference frame as a phase shift. Why is this important? well it depends on whether you intentionally require D-component or not...
If for instance you wanted field weakening then yes you would want to control the D-component however this isn't the case here as you have a fixed D-current demand of 0, the standard method. In doing so the displacement power factor is minimized.
Why state this... well the four listed steps is implying independent tuning steps for D and Q which opens the possibility of different frequency response between the D control and the Q control. Think for a minute what this will result in? if the D-control had a bandwidth a 10th of the Q-control, there would be a lag in controlling the D-component to zero resulting in unwanted D voltage/current for a longer period of time during and after acceleration resulting in a sluggish performance, inefficiency and possibly stability considerations.
Traditionally the Q and the D share the same control parameters ( note: not always the case as there are benefits in limiting the D-demand).
So if it can be accepted that \$K_{pq} \equiv K_{pd}\$ and \$K_{iq} \equiv K_{id}\$ how to tune? there are a couple of empirical methods (Ziegle-Nichols, Cohen-Coon) and these are useful if you do not know the plant, but you should. in this instance the plant is the line-line resistance and inductance of your machine (at rated current)
The plant transfer function is thus
\$\frac{I(s)}{V(s)} = \frac{1}{Ls + R} \$ which is of the form: \$ \frac{K_{dc}}{\tau s + 1}\$
\$K_{dc} = \frac{1}{R}\$
\$ \tau = \frac{L}{R}\$
Consider the classic close loop block diagram
where in this instance H = -1 and G = P*G (plant time Gain)
The canonical form of a feedback control system is thus: \$ \frac{G}{1+G}\$
A PI controller has a transfer function equal to
\$C(s) = K_p + \frac{K_i}{s} = \frac{K_p\cdot s + K_i}{s}\$
\$P(s) = \frac{K_{dc}}{\tau s + 1}\$
Thus: \$G(s) = C(s)\cdot P(s) = \frac{K_p\cdot s + K_i}{s} \cdot \frac{K_{dc}}{\tau s + 1}\$
The the feedback control system is:
\$\frac{Y(s)}{X(s)} = \frac{G(s)}{1 + G(s)} = \frac{K_{dc}\cdot K_p\cdot s + K_{dc}\cdot K_i}{\tau \cdot s (1+K_{dc}\cdot K_p)\cdot s + K_{dc}\cdot K_i}\$
This can be rearranged into one of the many standard forms:
\$ \frac{ \frac{K_p}{K_i}\cdot s + 1} { \frac{\tau}{K_{dc} \cdot K_i}\cdot s^2 + \frac{1 + K_{dc}\cdot K_p}{K_{dc}\cdot K_i} \cdot s + 1} \$
With a desired damping factor and a target resonance frequency, Ki and Kp can be determined to match your known plant.