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.

TMS320F28026F: Controlling multiple motors with different parameters

Part Number: TMS320F28026F

I've seen on the forum where multiple motors can be controlled, but I was wondering if there is a limitation regarding the differences between the motors.  I'd like to control 2 different BLDC motors but one at a time.  I'd use a dip switch setting on my board to identify which board is connected.  Differences between the motors would be in the main ID parameters (e.g. Rs_Ohms, Max voltage/current, inductance, etc.) but they would both be 2 pole pair PMSMs.  How would I go about changing these parameters at runtime versus having them compiled into the code?

  • With InstaSPIN, it supports parameter identification and measurement at start so you dont have to feed any value. Hope it helps.

  • Each motor will be assembled in a water pump and down in a well under load at start up.  I don't think the identification process will give reliable results under load..  At least that's what I've experienced so far.

    From a little digging it looks like I would need to read the dip switch at the beginning of main() to determine which motor is connected before parameter INIT routines are run.  My question is do I create two INIT routines, one for each motor or send it a parameter.  Also, only one motor definition is defined at a time in user.h so I'd need a second one at least.  Maybe I could create an array of motor parameters then send the setParams routine the motor number for it to initialize from.

    Any recommendations or thoughts would be appreciated.

    Thanks

  • Reset the motor parameters in gUserParams structure variable and call CTRL_setParams(handle,&gUserParams) to the motor parameters for the using motor.

  • To reset the motor parameters in gUserParams that looks like a USER_setParams call.  This moves the motor parameter constants in user.h into gUserParams.  I guess I would need to setup a second USER_setParams routine for the 2nd motor using a different set of constants.  Then call CTR_setParams after that call.

    What about the USER_checkForErrors function?  It looks hard coded to use the motor parameter constants.  I guess that would need a duplicate one as well for the second motor.

    I assume for this to work correctly I'll need to go through the rest of the code and make sure references to motor parameters are not using the user.h parameter constants directly but referencing the gUserParams variables.  For example, in Proj_lab11a.c when setting up the PID loops and trajectory the code refers directly to the user.h motor parameter constants.

  • You  don't need to call the USER_setParams(), just need to set the motor parameters to the related variables in the gUserParams object as below.

      gUserParams.motor_type = USER_MOTOR_TYPE;
      gUserParams.motor_numPolePairs = USER_MOTOR_NUM_POLE_PAIRS;
      gUserParams.motor_ratedFlux = USER_MOTOR_RATED_FLUX;
      gUserParams.motor_Rr = USER_MOTOR_Rr;
      gUserParams.motor_Rs = USER_MOTOR_Rs;
      gUserParams.motor_Ls_d = USER_MOTOR_Ls_d;
      gUserParams.motor_Ls_q = USER_MOTOR_Ls_q;

    USER_checkForErrors is only for debugging and checking the hardware parameters. You just need to call it once for a motor if you make sure that the other parameters are correct.

    If you want to use the lab11a, you should the motor parameters to gUserParams object, and then call

      CTRL_setParams(ctrlHandle,&gUserParams);

        EST_setEstParams(estHandle,&gUserParams);
        EST_setupEstIdleState(estHandle);

  • What about this concern

    "I assume for this to work correctly I'll need to go through the rest of the code and make sure references to motor parameters are not using the user.h parameter constants directly but referencing the gUserParams variables.  For example, in Proj_lab11a.c when setting up the PID loops and trajectory the code refers directly to the user.h motor parameter constants."

  • All of initial functions related to the motor parameters are better to be re-called for update the control parameters.