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.

Setting your user.h

Other Parts Discussed in Thread: MOTORWARE, BOOSTXL-DRV8301, DRV8301

Hello InstaSPIN users,

The scaling variables in user.h are critical and I don't think we have given enough proper guidance for how to choose these values the best. 

With that in mind I've put together a spreadsheet that should help you make the best choices.

This is an alpha version I just put together today.  It will change.  Hopefuly we get a version of this into the MotorWare _12 release at the end of this month.  That's IF we get good feedback.

So give it a try. Simply fill in all the cells in YELLOW and you should get guidance from the cells in GREEN.  I've also added a section on designing the filter pole for your own Hardware.

Please ask for clarity when required and give feedback for improvement.

 

Note that the latest spreadsheet will be towards the bottom of the thread. Removing older versions to avoid confusion.

 

  • Thank you for this very helpful spreadsheet, Chris! I definitely had some parameters set wrong.

    A quick question: near the bottom of the spreadsheet, it says "For Maximum Hz Motors > 730 Hz, pole  ~ 27.4Hz MIN". 

    Am I correct in understanding that if my motor no-load frequency is above 730 Hz, then I should follow this recommendation, and below 730 Hz, ignore completely? My motor no-load frequency is 100Hz, so this calculation would be invalid, right?

  • For setting the IDEAL HW FILTER POLE (note, you only do this when designing your own inverter hardware or if you are changing the values on the TI EVM by replacing capacitors)

    If your Maximum Frequency is > 730 Hz, then when you enter the pole + RPM information in B3 & B4 a maximum frequency will be generated in E4.

    This value in B4 will be used to set a minimum guideline for your hardware phase voltage Filter pole in B20 which will be > 200 Hz.  You can increase this value a bit, (it doesn't have to be so precise) with corresponding increase in your FULL_SCALE_FREQUENCY in I5. Note that the higher your pole frequency the more the capacitor tolerance should be tightened. 

    If your Maximum Frequency is < 730 Hz you will use the minimum hardware phase voltage filter pole of 200 Hz

     

  • Here is an update as we get closer to MotorWare _12 release.

    There are two main items that need to be clearly communicated.

    1. You must insure that USER_IQ_FULL_SCALE_FREQ_Hz  <  4 * USER_VOLTAGE_FILTER_POLE_Hz

    It does NOT have to = 4 * as I have been communicating in the _alpha version of this .xls and on my forum post.  Again, you can set USER_IQ_FULL_SCALE_FREQ_Hz to anything you like as long as it is < 4 * USER_VOLTAGE_FILTER_POLE_Hz

    This really only impacts you as a user when you are using a TI designed inverter with fixed HW filter poles.

    For example, if you are using an inverter with a pole of 364.682 Hz, this means you must keep USER_IQ_FULL_SCALE_FREQ_Hz < 1458.728 Hz.  If you have a 1500 Hz motor, following all of the other recommendations you may be inclined / directed to set USER_IQ_FULL_SCALE_FREQ_Hz = 1500 to 1800 range. This is incorrect. 

    In this example, use (1400.0)  and note that 1400 Hz is NOT a true upper limit for frequency commands in the system. There is a buffer built-in that allows frequency variables of 1.98 * USER_IQ_FULL_SCALE_FREQ_Hz, so you will have no issues with your 1500 Hz target or any reasonable overshoot.

    When you design your own HW you may choose to insure that your filter_pole *4 > Max Frequency + overhead so you can set USER_IQ_FULL_SCALE_FREQ_Hz to a value above your maximum.  OR, you may want to keep the filter_pole lower (hence IQ_FULL_SCALE lower) for other reasons (see #2 below)...

    An error check function has been added to all labs in _12 to help identify any potential issues.

     

    2. USER_VOLTAGE_FILTER_POLE_Hz accuracy to the actual HW Voltage Filter Poles will have an effect on estimation of the flux. 

    We are working on some calibration routines to "tune" the matching of the SW pole to the HW pole in system, similar to the OffsetRecalc functionality (where you store your HW specific values in user.h but can re-calculate before you start the drive). In the mean-time, you can do this yourself on your own HW by noting the value of gMotorVars.Flux_VpHz as you increase speeds.  At steady state speeds the flux value will be stable if the SW and HW poles are close to matching.  If your SW filter_pole setting is too low you will see the flux rise with speed increases.  If it's too high you will see the flux estimate decrease with speed increases.  Note, this is steady state speed, not during accelerations.

    For example, on my BOOSTXL-DRV8301 the default USER_VOLTAGE_FILTER_POLE_Hz (364.682) was too low. As I increase speed the flux estimation also rose.   I manually tuned this to (390.0) for steady flux estimations across full speed range.

     

    • At lower maximum frequencies (speeds) any error in the SW/HW pole mis-match has less effect
    • At higher maximum frequencies (speeds) and with a larger pole the accuracy of the pole filter becomes more important.
    • There is also a need in the algorithm for EST_FREQ > 8 * FILTER_POLE_Hz, so the higher the pole the more often you must run the estimator (using more MIPS), so in general lower pole would be preferred.

    Please use attached _beta.xls for user.h set-up and let me know if you have feedback.

     

     

  • Hi Chris,

    A couple of questions:

    1. Following your recommendation on how to find the real HW pole (see if flux is going up or down as speed increases and in steady state), does this experiment should be done under no-load or with load (with currents or without currents) ? If there exist a negative Id current, does it effect the flux estimation ?

    2. Does USER_IQ_FULL_SCALE_VOLTAGE_V  have any effect on the estimation (as long as it complies with the restrictions) ?

    3. While the motor is spinning, is it possible to change and update the Lsd,Lsq values for the estimator ?

    Thanks

  • Hi Mojo,

    1. The flux should be stable regardless of load, but it's obviously easier to do some testing at no-load. As mentioned we should be able to eventually come up with a sort of "CalibrateFilter" function that could do this off-line so you could calibrate in-system.

    2. YES. The IQ_VOLTAGE is very important in setting the minimum flux value that can be measured (H16 to J21 in the spreadsheet). It's basically the gear that lets you put your flux sensor into the best range/resolution.  But as long as you have enough resolution you aren't going to see a difference in performance from say using an IQ_VOLTAGE of 20V or 30V

    3. YES.  See C:\ti\motorware\motorware_1_01_00_11\sw\modules\est\src\32b\est.h   (or use MotorWare.exe and look at the EST module) starting at line 1487

     

  • Hi Chris,

    Thanks for the excel, it really puts all configuration issues together.

    A question regarding the voltage pole - since there are 3 sensors, hence three filters with different values probably, but only one parameter to tune... how do we handle this (except from using high precision R,C..) ? should it be handled for those of us using the DRV8301-69M kit ?

    Thanks

  • Very good question, Mojo!  (was kind of hoping noone would ask :) )

    For manual tuning using my process is good enough, find a SW pole which produces stable flux values. When we look at automating/calibrating this we will look at doing some compensation on a channel by channel basis just to make sure it is even better.

    In actuality though there is always going to be drift in the system, these are real-world components under real conditions.  The difference is going to be minor, but as engineers we want to get it operating as close to ideal as possible, even if that doesn't really bring us any benefit don't we?

     

  • That is a great answer :)

    There is this sentence - "The enemy of good is the best", which we always try to keep in mind...

    The other day I heard a complementary sentence - "The enemy of good is good enough" ...

    so we try to find the balance...

    By the way, did you ever thought about using these programmable filters, with switched capacitors ? you can actually get ICs that implement high order (4th,8th) butterworth etc filters..

    I think they could be interesting for wide speed range...

  • "By the way, did you ever thought about using these programmable filters, with switched capacitors ? you can actually get ICs that implement high order (4th,8th) butterworth etc filters.."

    Yes, we were actually discussing something like this a few days ago. However, programmable filters probably aren't cost effective for most applications, but we were considering having a filter network that could be controlled by a GPIO to change the pole on an EVM simply.  We have some ideas for tuning to the existing HW filter as well.

    _gamma version attached. Made some additional clarifications and noticed I had a gross error in the variable name used in H5!

     

  • Thank you a lot for all the support you provide. It is amazing and unique in my experience with an engineering company.

    I have one question though. When you mention "TI EVM defaults" do mean it is applicable to the BoostXL board as mentioned in an earlier post correct?

    My motor has a very low full scale frequency because it has many magnetic poles. Should I take any special care with your sheet?


    Thank you

    Paulo Neves

  • You are welcome. I want you all to be successful with InstaSPIN.

    by TI EVM defaults I was talking about the HW voltage filter pole for the phase voltage feedback.

    These are fixed in HW, so you need to just match in SW to the best you can.  You can update the EVM hardware yourself (we recommend doing this if the HW you are using is giving you poor resolution, like trying to run 12Vbus on the 66V scaled DRV8301 EVM; so while you are changing that voltage scaling you might as well update the filter pole if it should be updated per the spreadsheet).

    For your motor with very low full scale frequency, when you go design your own HW you can design the voltage flters for ~200.0 Hz and it will work well.

  • Delta version attached.

    Added a check for:

    USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz < USER_MOTOR_FLUX_EST_FREQ_Hz

     

    This is required so that when you hit the FLUX_EST_FREQ you are using FAST for feedback.

    With the default of (0.002)  and FLUX_EST >= 5 Hz, this is essentially always satisfied, but it's good to add it for a safety check.

  • Hello Chris,

    In the spreadsheet, there is cell for MInimum pole (B20).

    Could you explain me what I should put in this cell?

    Currently this cell is red, does it mean some error? I don't know whether this color is related to other cell or not, no explanation about this cell related to other.

    Thanks in advanced.

    Best regards,

    Maria

  • Maria,
    The section you are looking at is in regards to designing the voltage filter pole for NEW hardware (or if you want to update your TI EVM for use with your motor). 

    B20 = minimum filter pole value of 200 Hz.  There are some large, huge pole, ultra low speed motors where you could reduce this towards 100 Hz, but very rare. For vast majority of applications 200 Hz should be the default.

    B21 = filter pole design based on maximum frequency (with 10% buffer) divided by 4. If this number is lower than 200 Hz, just use 200 Hz.

    B22 = an option for high very high frequency motors.  If B21 has you creating a large filter pole, you may want to reduce it (larger poles will introduce more flux estimation error based on drift). This gives you an option to use a value 1/2 of B21, but you must still limit the IQ_FULL_SCALE_FREQUENCY variable to < pole value * 4.  This will set a full scale value < than your maximu frequency, but actual speed commands and speed estimates in InstaSPIN-FOC have an additiona 1.99 * FULL_SCALE_FREQUENCY buffer, so you can still hit your target speeds.

    Does that make sense?

  • Hello all,

    I would like to ask a question about the USER_IQ_FULL_SCALE_VOLTAGE_V parameter.

    In the user.h file it is commented (and i quote) that

    "//! \brief It is recommended to start with a value ~3x greater than the USER_ADC_FULL_SCALE_VOLTAGE_V and increase to 4-5x if scenarios where a Bemf calculation may exceed these limits"

    Which means that in a case like mine where i have the DRV8301_RevD and the USER_ADC_FULL_SCALE_VOLTAGE_V is at 66.32, the USER_IQ_FULL_SCALE_VOLTAGE_V should be like ~3*66.32=198.96.

    Inserting my specific data to the spreadsheet above, the proposed USER_IQ_FULL_SCALE_VOLTAGE_V is ~60 (like the maximum bus voltage). Have i misunderstood anything? If you wish i can attach the excel spreadsheet ChirsClearman created and i used 

    Which value shall i use and why?

    Thank you all in advance,

    Alexandros

     

  • Please use the spreadsheet.

    IQ_FULL_SCALE_VOLTAGE sets the minimum flux value that can be calculated. So for low flux machines this value will be smaller (typically Vbus value).  For very large flux machines that will need to run in field weakening, this IQ_FULL_SCALE_VOLTAGE value will need to be higher. It can be calculated by the Flux value (in V/Hz) multiplied by this highest frequency, with some additional buffer.

     

  • Hello Chris,

    Thanks for the reply.

    In my case, USER_VOLTAGE_FILTER_POLE_Hz calculated from my HW is 314, so it is bigger than 200 Hz.

    And my B21 is 16.5 that lower than 200 Hz. So which one is better to use, 314 Hz or 200 Hz?

    Thanks.

  • Maria,

    If B21 is 16.5 Hz, that means your I3 is 16.5 * 4 = 66 Hz, which means your B4 is 60 Hz, so a standard induction motor.

    If designing your own HW you should use the minimum pole suggested in B20 of 200 Hz.  In actuality you could design the HW pole for 100 Hz and it would be just fine.

    The 314 Hz is what is already on the HVKIT, so if using the HVKIT just make sure you set and tune your SW filter_pole and observe the Maximum IQ_FULL_SCALE_FREQUENCY of 4 * filter_pole, which won't be a problem with your 60 Hz motor.

     

  • I've added an additional check to the spreadsheet and changed the version from greek to standard number, this version being v2p0. 

    This scenario that is being checked should be very rare (you would have to set a very high estimation frequency or a very low full scale frequency) so it's more checking if you've made a gross error.

    cells H13-J13

    FLUX_EST_FREQ > ZEROSPEEDLIMIT * FULL_SCALE_FREQ TRUE If FALSE, lower ZEROSPEEDLIMIT

     This is important for Motor ID because:

    FLUX_EST_FREQ = the speed at which the motor should run to during RampUp state, so Flux can be identified.

    ZEROSPEEDLIMIT * FULL_SCALE_FREQ = the switchover speed from our force angle feedback to FAST feedback.  If during Motor ID the FLUX_EST_FREQ is at a speed where the force angle is still active, you will not be able to get a valid estimate because FAST will essentially be shut-off.  You must insure FAST is active at the speed you are running for the estimations.

     

    motorware_selecting_user_variables_v2p0.xlsx
  • Sorry, I actually added the FLUX_EST_FREQ check in the previous version.

    in v2p0 I simply added H11-JJ11

    EST > 8 * TARGET_Hz TRUE If FALSE, increase effective EST Frequency using TICKs

     Which insures that you are running the FAST estimator at least 8x the maximum motor frequency for good estimation.

    So for you 2KHz high speed motor guys...that means you need to run FAST at least 16 KHz, which uses up quite a bit of the MIPS.

     

     

  • Hi Chris,

    I have some problems to understand the design guide line:

    IQ_FULL_SCALE_FREQUENCY < 4 * USER_VOLTAGE_FILTER_POLE_Hz.

    So when my Motorfrequency is 800Hz and my HW Voltage Filter is "only" 200Hz the DSP can't measure the correct Voltage? Do you have any reason?

    Thank you

  • Lenz said:
    So when my Motorfrequency is 800Hz and my HW Voltage Filter is "only" 200Hz the DSP can't measure the correct Voltage?

    No.

    This is a variable relationship issue.There is an issue if the variable IQ_FULL_SCALE_FREQUENCY  is set to a value > 4 * the value of the variable  USER_VOLTAGE_FILTER_POLE_Hz

    Just make sure that in user.h you always keep IQ_FULL_SCALE_FREQUENCY  < 4 *  USER_VOLTAGE_FILTER_POLE_Hz

     

    And once you insure this, with InstaSPIN-FOC there is actually a variable "buffer" that allows actual frequency commands / feedback nearly 2 * IQ_FULL_SCALE_FREQUENCY.

     

    BTW - starting with MotorWare _13 this spreadsheet is now included in the release and referenced in the lab guide.

    C:\ti\motorware\motorware_1_01_00_13\docs\labs