Part Number: TMS320F28069
Other Parts Discussed in Thread: MOTORWARE
Tool/software: Code Composer Studio
Hi,
I am using InstaSPIN Motorware and I defined my motor in user.h with its parameters.
My motor is running correctly after setting gMotorVars.Flag_Run_Identify = true.
Now we have an EEPROM on our board, which stores different motorparameters for different motors. We get these parameters all with the motoridentification from lab02a. When I want to change the motor (motor is not running), I get new parameter from eeprom and store these parameter in gMotorVars and gUserParams and I call CTRL_setParams().
Starting the other motor by setting gMotorVars.Flag_Run_Identify = true doesn't works now and I don't know why. The motor is trying to start but it is not running.
When I change the motor parameters in user.h it works fine with the other motor.
What do I have to do, to change motor in runtime (motor is not running)?
This is my code running, when I change the motor parameters:
gMotorVars.Rs_Ohm = eeprom_structure.motor_params_arr[mot].Rs_Ohm;
gMotorVars.Rr_Ohm = eeprom_structure.motor_params_arr[mot].Rr_Ohm;
gMotorVars.Lsd_H = eeprom_structure.motor_params_arr[mot].Ls_q_d_H;
gMotorVars.Lsq_H = eeprom_structure.motor_params_arr[mot].Ls_q_d_H;
gMotorVars.MagnCurr_A = eeprom_structure.motor_params_arr[mot].magnetizing_current_A;
gMotorVars.SpeedRef_krpm = _IQ(eeprom_structure.motor_params_arr[mot].speed_run_rpm / 1000.0);
gMotorVars.MaxAccel_krpmps = _IQ(eeprom_structure.motor_params_arr[mot].speed_run_accel_rpmps / 1000.0);
gMotorVars.Kp_spd = _IQ(eeprom_structure.motor_params_arr[mot].Kp_spd);
gMotorVars.Ki_spd = _IQ(eeprom_structure.motor_params_arr[mot].Ki_spd);
gMotorVars.Kp_Idq = _IQ(eeprom_structure.motor_params_arr[mot].Kp_Idq);
gMotorVars.Ki_Idq = _IQ(eeprom_structure.motor_params_arr[mot].Ki_Idq);
// set the kp and ki speed values from the watch window
CTRL_setKp(ctrlHandle, CTRL_Type_PID_spd, gMotorVars.Kp_spd);
CTRL_setKi(ctrlHandle, CTRL_Type_PID_spd, gMotorVars.Ki_spd);
// set the kp and ki current values for Id and Iq from the watch window
CTRL_setKp(ctrlHandle, CTRL_Type_PID_Id, gMotorVars.Kp_Idq);
CTRL_setKi(ctrlHandle, CTRL_Type_PID_Id, gMotorVars.Ki_Idq);
CTRL_setKp(ctrlHandle, CTRL_Type_PID_Iq, gMotorVars.Kp_Idq);
CTRL_setKi(ctrlHandle, CTRL_Type_PID_Iq, gMotorVars.Ki_Idq);
gMotorVars.RsOnLineCurrent_A = (0.1 * eeprom_structure.motor_params_arr[mot].max_current_A);
gUserParams.maxCurrent = eeprom_structure.motor_params_arr[mot].max_current_A;
gUserParams.motor_numPolePairs = eeprom_structure.motor_params_arr[mot].motor_num_pole_pairs;
gUserParams.motor_ratedFlux = eeprom_structure.motor_params_arr[mot].motor_rated_flux_VpHz;
gUserParams.motor_Rr = gMotorVars.Rr_Ohm;
gUserParams.motor_Rs = gMotorVars.Rs_Ohm;
gUserParams.motor_Ls_d = gMotorVars.Lsd_H;
gUserParams.motor_Ls_q = gMotorVars.Lsq_H;
gUserParams.IdRated = eeprom_structure.motor_params_arr[mot].magnetizing_current_A;
gUserParams.fluxEstFreq_Hz = eeprom_structure.motor_params_arr[mot].flux_est_freq_Hz;
gUserParams.maxNegativeIdCurrent_a = (-0.5 * gUserParams.maxCurrent);
// set the default controller parameters
CTRL_setParams(ctrlHandle,&gUserParams);
Best regards,
Dani