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.

MATH_vec2 data structure and Motorware variables and access functions in ctrl.c ctrl.h park.h

Other Parts Discussed in Thread: MOTORWARE

Hi, I have some questions concerning the data structures and and access functions used in some of the Motorware files

Using the MATH_vec2 data structure (in math.h) to obtain various motor measurement parameters using the access functions in files such as ctrl.c and park.h:

(in ctrl.c ctrl.h)
CTRL_getIab_in_pu(CTRL_Handle handle,MATH_vec2 *pIab_in_pu)
CTRL_getIdq_in_pu(CTRL_Handle handle,MATH_vec2 *pIdq_in_pu)

(in park.h)
void PARK_getPhasor(PARK_Handle handle,MATH_vec2 *pPhasor)

In the above code snip bit, what are the units of the values being put int he MATH_vec2 data structure? How do I convert them into engineering units such as amperes for current? Is there a document that explain what the access functions mean and their units?

Thanks in advance.

  • Hi Tom,

    Good question.  

    Note that the next major update to InstaSPIN-FOC will be in floating-point and all variables will be in engineering units.  For now we are working in fixed-point so values are shown as per-unit and you need to refer to the fixed-point scaling for the variable.

    Converting from PU to engineering units are shown in the InstaSPIN-FOC user's guide, below is a good example from this document:

    Jeff

  • _pu = per unit. It turns a value into a % of the full scale value. for example, for current, any real measurement is turned into a per unit measurement

    this concept is discussed in SPRUHJ1 section 5.1

    in proj_lab10 you can see an example of converting a pu to Amps by simply multiplying the full scale current.
    // read Id and Iq vectors in amps
    gMotorVars.Id_A = _IQmpy(CTRL_getId_in_pu(ctrlHandle), _IQ(USER_IQ_FULL_SCALE_CURRENT_A));
    gMotorVars.Iq_A = _IQmpy(CTRL_getIq_in_pu(ctrlHandle), _IQ(USER_IQ_FULL_SCALE_CURRENT_A));
  • I wanted to ask a few more questions on this topic if I may:

    1). In the CTRL_Obj data structure (chapter 3.3.1.1 of InstaSPIN user guide), all the member variables that are of type MATH_vec2 (for example MATH_vec2 Iab_in;) . Is _iq MATH_vec2 Iab_in[0] the least significant value and _iq MATH_vec2 Iab_in[1] the most significant value?

    2). I'm still having problems converting into engineering units. Are there any example code that converts a MATH_vec2 type to engineering unit value?

    3). I also tried
    gMotorVars.Id_A = _IQmpy(CTRL_getId_in_pu(ctrlHandle), _IQ(USER_IQ_FULL_SCALE_CURRENT_A));
    in proj_lab02b example project of the Piccolo F2806xF boostxl_dr8301_revB , but the value I get doesn't look like it's in amperes.

    Any further pointers would be much appreciated. Thank you.
  • 1. correct
    2. in proj_lab10 look at the updateGlobalVariables_motor function. there are a few that are done to display in volts and amps
    3. your code is correct. note that Id is being controlled to 0 A, so under proper control it should be pretty close.
    gMotorVars.Id_A = _IQmpy(CTRL_getId_in_pu(ctrlHandle), _IQ(USER_IQ_FULL_SCALE_CURRENT_A));