This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Diffrence between bandwith of software code & bandwith of bode plot

Hello Sir,

I have bit doubt regarding term bandwidth used with Compensator & software Motor control algorithm code.

In Frequency response, definition of Bandwidth :--
The bandwidth frequency is defined as the frequency at which the closed-loop magnitude response is equal to -3 dB.

From transient response to unit step function we can derive the Bandwidth of the system using this formula, see the attached picture :--

One thing i know is as per time shift property of Laplase transform, delay in software loop will cause pase lag.
Time delay of T seconds generates a phase shift of -wT radians (w is frequency in rad/sec., T is in sec.).
This link also explain best the math behind phase lag & time delay in LTI systems.

http://lpsa.swarthmore.edu/BackGround/TimeDelay/TimeDelay.html

Following blog from Dave Wilson says :---
https://e2e.ti.com/blogs_/b/motordrivecontrol/archive/2013/04/04/teaching-your-pi-controller-to-behave-part-vi
But in reality, as long as the current controller’s bandwidth is at least 10x higher than the velocity loop unity gain frequency, our tuning procedure is still pretty good at predicting the system response.

What exactly Mr Dave Wilson mean by bandwidth here ?

What is the definition of Bandwidth when using software ?
Suppose i am calling current loop algorithm written in c language every T = 0.1 sec (i.e 10 times faster than velocity loop) then, bandwidth of software current loop = 1/T = 1/0.1 = 10 ?
Suppose i am calling Velocity loop algorithm written in c language every T = 1 sec then, bandwidth of software Velocity loop = 1/T = 1/1 = 1 ?
Have i got it right ?

What is difference or relation between bandwidth of software algorithm code & bandwidth of bode plot ?


Please suggest.

Regards,
Dinesh

  • Dinesh,

    "In Frequency response, definition of Bandwidth :--

    The bandwidth frequency is defined as the frequency at which the closed-loop magnitude response is equal to -3 dB."

    Often, yes. However people use bandwidth to mean a variety of different things. Some refer to the -3 dB point of the open loop response as its' bandwidth. It is also used in connection with control sensitivity, and (below) software. There are other definitions too, so we need to take care with terms like "bandwidth" which can be applied in many different ways.

    "From transient response to unit step function we can derive the Bandwidth of the system using this formula, see the attached picture :--"

    Where do these equations come from? Ts & Tp are un-defined, and there is clearly an assumed link between damping ratio and un-damped natural frequency, which is not generally true.

    "One thing i know is as per time shift property of Laplase transform, delay in software loop will cause pase lag.
    Time delay of T seconds generates a phase shift of -wT radians (w is frequency in rad/sec., T is in sec.)."

    Correct, and thanks for the link.

    "But in reality, as long as the current controller’s bandwidth is at least 10x higher than the velocity loop unity gain frequency, our tuning procedure is still pretty good at predicting the system response. What exactly Mr Dave Wilson mean by bandwidth here ?"

    I do not know exactly what Dave had in mind, but my assumption is he was referring to the open loop bandwidth of the current control loop. In the sentence following the one you quoted, he talks about the current controller pole influencing the outer velocity loop phase, which makes sense. His point is the inner current loop should be much faster (i.e. have higher "bandwidth") than the outer velocity loop.

    "What is the definition of Bandwidth when using software ?"

    In terms of software, people often use the term "bandwidth" to indicate the percentage of time available for the CPU to do useful work. Often this is taken 100% minus the percentage of time spent servicing interrupts. I hope the attached diagram with make this clear.  This is a quite different use of the word from that of control theory. It's safest always to explicitly state how the term "bandwidth" is being applied.

    "What is difference or relation between bandwidth of software algorithm code & bandwidth of bode plot ?"

    See above.

    I hope this helps to clarify an ambiguous use of words.  Post back if anything's still unclear.

    Regards,

    Richard

    CPU Bandwidth.pdf

  • Hello Sir,

    Thanks for your reply.

    >> Where do these equations come from? Ts & Tp are un-defined, and there is clearly an assumed link between damping ratio and un-damped natural frequency, which is not generally true.

    Tp & Ts are peak & setting time. I took these equation from abut.sdsu.edu/.../Chap8.pdf.

    >>  I hope the attached diagram with make this clear. 

    Thanks for sharing this useful diagram

    >> Post back if anything's still unclear.

    Process which Mr Dave is using to create PI controller (Teaching your PI controller to behave) for motor(plant) is diffrent from how we use to make lag lead compensator for plant control.
    See Digital control lecture 20 & 21 here in below link :--
    nptel.ac.in/.../

    Also in BLDC motor for FOC control we use 3 PI compensators for velocity, current Iq & Id. See below image :--
    e2e.ti.com/.../8623.Picture1.gif
    This image is used by dave in below link :--
    e2e.ti.com/.../teaching-your-pi-controller-to-behave-part-ix

    As variable of interrest is input velocity command & output velocity as per this we can design our single compensator to meet our design requirement of settling & rise time etc.

    Its easy to plot frequency & time response for simple compensator. But now how to distribute Kp & KI parameter of single PI compensator to three compensator for velocity, current Iq & Id.

    Now If instead of adding single PI compensator if i add 3 PI compensator. Then at the time of stability analysis 3 more transfer function will be cascadded to change the actual transfer function of plant in cloose loop.

    So my overall calculation of transient response to unit step function which i have done for single compensator will fail after adding 2 more PI compensator for Id & iQ.

    Or i have to calculate the Kp & Ki of all the three PI compensator in such a way that when three transfer function of 3 PI compensator are cascaded & combine they produce effect of single PI compensator transfer function as used in Cascaded PID tunning.

    Please suggest on this .

    Regards,
    Dinesh

  • OK got its about tuning the cascaded PID controllers. But setting Kp & Ki of the 3 compensator is bit challenging maths.
    Matlab can make task easier but manually need complete knowledge of cascaded PID controllers & DSP for which i am still lagging

    One thing is SVM module can be replaced by ZERO order hold ? I am asking this question because "pi controller tuning blog by Dave Wilson" never mentioned about this term.

    Regards,
    Dinesh

  • Dinesh,

    In my understanding, the inner loop PI controllers are typically tuned such that the motor pole is cancelled by the controller zero.  This turns the inner open loop TF into an integrator with gain, so the inner closed loop TF will be first order.  The outer loop PI (or PID) controller could be tuned manually to optimize a transient, or a more analytical approach taken to cancel the inner loop pole, or force a closed loop damping ratio or some other parameter.  This is my understanding; the references Ramesh recommended in your other post may help you here.

    I would not expect the SVM module to contribute any significant dynamics because it's simply a method of generating the required PWM patterns. The contribution will come from the PWM module which I have seen modeled as a ZOH.  i.e. with phase contribution of -wT/2 where T is the switching frequency.

    Regards,

    Richard

  • Hello Sir,

    >>In my understanding, the inner loop PI controllers are typically tuned such that the motor pole is cancelled by the controller zero.
    Thanks for clearing this point it have given me enough hint to how to proceed. I will go through all this process again will get back to you on this.

    As you have been control engineer and as we know that being a control engineer first we take the transfer function of PLANT (Motor + load in this case).
    THen subject it to unit step input & get the step response & frequency response of the PLANT. The as per our requirement of settling, rise, peak time & bandwith, P.M & G.M we use to decide we need Lag or Lead or LAG-Lead compensator to meed our design requirement. But the blog from Mr Dave Wilson is suggesting us direclty to use PI controller for Velocity & current loop both. Without going through the control design process of Z-Plane  he is suggesting to use PI controller for bot velocity & current. Is he saying from his experience with motor control that in "motor control application PI controllers will be the right compensator to use" ?

    Also do both the Iq & Id PI-controller will have effect on the overall openloop transfer function of the system ?
    Or only the Iq Pi-controller which is cascaded with the output of the Velocity PI-controller will have effect on the overall openloop transfer function of the system ?

    Also In below figure i have pointed the modules in RED arrow, which will have effect on overall open loop transfer function of the system.
    Please correct me on this.


    Also when Vu,Vv,Vw & commanded speed are measured from using ADC. Then will these Sample-hold & ADC & Digital FIlter have effect on the overall Z-Transform of the system ?

    Regards,
    Dinesh

  • Dinesh,

    I am saying that the inner current loop PIs are typically designed such that the motor pole is cancelled by the controller zero. Dave Wilson explains this in part 2 of his blog. He uses Ka & Kb as notation for the proportional and integral gains, but he is just exploiting the fact that the transfer function of an ideal PI controller is a real zero and a pure integrator. This is done separately for both Id and Iq loops and, as far as I know, in motor control is very widespread.

    The outer speed loop controller is dealt with in part 3 of Dave's blog and again, he has used a PI controller.

    You have correctly identified those elements which affect the control loop, however the block diagram is incorrect in that the (FAST) estimator does not provide Id & Iq: those come from the Park transform which needs sampled phase currents as inputs. Assuming commanded speed is also a sampled input your statements at the foot of your last post are correct.

    One final point: in his blog Dave's uses an s-domain model of plant and controller. Most of the descriptions I have seen discretize the plant model and then use the z-domain to compute the controller.

    I hope this helps.

    Regards,

    Richard

  • Hello Richard,

    One question you missed to answer.

    1> Also when Vu,Vv,Vw & commanded speed are measured from using ADC. Then will these Sample-hold  & Digital FIlter have effect on the overall Z-Transform of the system ?

    2> Sample & hold circuit inside the ADC of micro-controller will have same transfer function as Z.O.H of PWM module ?

    Please suggest on this.

    Regards,

    Dinesh

  • Hello Dinesh,

    Richard is currently out of office, I will have him reply back on this thread when he has returned.

    Sean
  • Hello Dinesh,

    Sorry I missed that in my earlier reply.

    The principal effect of sampling is to impose an upper limit on the frequencies which can be uniquely represented in the digital system. You use a z transform to represent discrete time signals coming from the ADC.  The ZOH sample & hold occurs at the discrete-to-continuous time conversion boundary (the PWM in this case).  I use a ZOH model there to capture the S&H.  I don't use a ZOH to model the ADC.

    You will also need to include the z-transform of the low-pass filter in your simulation.

    I hope it's clear but please post back if you still have questions on this.

    Regards,

    Richard

  • Hello Richard,

    Thanks for your reply.

    >> You will also need to include the z-transform of the low-pass filter in your simulation.
    Which type of digital filter will you prefer for motor control application ? kalman filter iir filter code is mentioned in your website.
    sites.google.com/.../downloads

    Please suggest.


    Regards,
    Dinesh

  • Hello Dinesh,

    We do not use a filter on the ADC inputs for motor control, at least not with InstaSPIN.  The phase currents are sampled and passed directly to the estimator.

    The Kalman filter code on my website illustrates a state estimator example in one of the seminars.  If you wanted to filter ADC data you would likely use a low-pass FIR filter.  This was the z-transform I meant in my previous post.

    Regards,

    Richard

  • Hello Richard,

    Thanks for your reply.

    >>  If you wanted to filter ADC data you would likely use a low-pass FIR filter.  This was the z-transform I meant in my previous post.

    But as per Dave Wilson blog FIR filter add phase lag, he suggested to use IIR filter. What do you say ?

    Regards,

    Dinesh

  • Hello Richard,

    As per your suggestion i will use low-pass FIR filter to filter the ADC data or velocity data comming from Rotatory incoder.
    What should be the time constant for this low-pass FIR filter ?

    Will it be the number of clock tics required to execute "low-pass FIR filter" code ?

    Please suggest.

    Regards,
    Dinesh

  • Sorry Dinesh, I don't know.

    I did not suggest using a low-pass filter. Looking back through this thread I think that came from your post on 10/21/2016.

    I have not been through Dave Wilson's blog, but I recall from his seminars that he described a tracking filter estimator which he showed to be a second order IIR.

    Regards,

    Richard