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.

Query related USER_setParams() function

Dear all,

I am using lab3a as reference in my custom board for my code.

I make a one function like below for interface my display board, so user can modify some motor parameter and also other parameter after initialization of void USER_setParams(USER_Params *pUserParams) function.

void USER_setParams_amt(USER_Params *pUserParams)

{

pUserParams->motor_numPolePairs = (float)act.mtr_poles * 0.5 ;//

pUserParams->motor_ratedFlux = (0.8165 * (float)x24.mtr_vlt)/((float)x24.mtr_frq*0.1);//

pUserParams->motor_Rs = foc.Rs;

pUserParams->motor_Rr = foc.Rr;

pUserParams->motor_Ls_d = foc.Ls_d;

pUserParams->motor_Ls_q = foc.Ls_d;

// assign the motor type

CTRL_setMotorParams(ctrlHandle,pUserParams->motor_type,

pUserParams->motor_numPolePairs,

pUserParams->motor_ratedFlux,

pUserParams->motor_Ls_d,

pUserParams->motor_Ls_q,

pUserParams->motor_Rr,

pUserParams->motor_Rs);

}

now I set pUserParams.motor_Ls_d and pUserParams.motor_Ls_d = 0.00651 value but when I debug the code I see in gUserParams.motor_Ls_d and gUserParams.motor_Ls_d = 0.00651 but in gMotorVars.Lsd_H and gMotorVars.Lsq_H = 0.01379426.

Why it is differ from user define value? Or still I miss any function to set after pUserParams modified parameters.

  • Simply i want to change some parameter of gUserparams' s variable in motor running condition, than what type of take care or function call for these?

  • What do you mean "motor running condition" ?

    Anyway, you can change the gUserparam before calling CTRL_setParams(ctrlHandle,&gUserParams) to tell the CTRL to use you parameters.

    The user.h file, to me, has three main sections : about the CPU(control cards) , about the driver board, and about the motor.

    We only have ifdef around the motor-specific parameters in the file user.h but not for the other sections. I wish TI also have had user.h ifdef for the other sections too.

    If you run lab2c or the GUI you would see that only 4 or 5 motor-specific defines are used to identify the motor.

  • Thanks Tinhtan,

    What do you mean "motor running condition" ?

    means Ctrlstate = online and Eststate = online.

    but when i call  CTRL_setParams(ctrlHandle,&gUserParams) function,  my Eststate gone to the EST_State_RoverL → EST_State_Rs → EST_State_RampUp and so on.....

    I want to change gUserParams value in Ctrlstate = online and Eststate = online stage.

  • Amtech said:

    now I set pUserParams.motor_Ls_d and pUserParams.motor_Ls_d = 0.00651 value but when I debug the code I see in gUserParams.motor_Ls_d and gUserParams.motor_Ls_d = 0.00651 but in gMotorVars.Lsd_H and gMotorVars.Lsq_H = 0.01379426.

    Why it is differ from user define value? Or still I miss any function to set after pUserParams modified parameters.

    UserParams is used from very beginning to check the configuration you have with USER_checkForErrors().

    This check is almost equivalent with Chris's excel program.

    Your Rs and Ls_d are also used to configure the motor to the CTRL; but later on the EST would update them and that's why you would see different values in the gMotorVars. There is no guarantee that the EST would retain your original values passed in from the CTRL to the EST.

    If both CTRL and EST is on line that means your motor is running fine.  So I still don't know what you try to do here.