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.

how can I add another ctrl handler in to my code.

Other Parts Discussed in Thread: MOTORWARE

Hi:

I want to add two ctrl handles to my code. so I write the code like this.

#ifdef FAST_ROM_V1p6
ctrlHandle = CTRL_initCtrl(ctrlNumber, estNumber); //v1p6 format (06xF and 06xM devices)
ctrlHandle1 = CTRL_initCtrl(ctrlNumber+1, estNumber+1);
// controller_obj = (CTRL_Obj *)ctrlHandle;
#else

is there any problem such as the two handle will share some things (such as est handle), or we can use these two handle independently.

by the way, In rom version FAST_ROM_V1p6, the ctrl handle is allocated by the rom(through CTRL_initCtrl), does it mean we cannot 

add other member to the control struct pointed by the control handler ? 

 

  • HI,

    I  am assuming you are talking about F28069 .

    It is exactly like what you did:CTRL_initCtrl(ctrlNumber+1, estNumber+1);

    they don't share estimator handle, which means they are independent.

    Unfortunately, you cannot add more member. Even further, you cannot use several members defined in CTRL_OBJ listed below:

    You have to somehow transfer those parameter to runpionly function. This is because the second ctrl starts at the Idq_offset_pu address. TI engineers did only one CTRL in this version motorware, so they use the second CTRL space in ROM.

    // NOTE: APPENDING ONLY WORKS BECAUSE WE HAVE ALLOCATED TWO CONTROLLERS IN PROTECTED RAM AND WE ARE ONLY USING THE FIRST ONE

      MATH_vec2          Idq_offset_pu;                //!< the Idq offset values, pu
      MATH_vec2          Vdq_offset_pu;                //!< the Vdq offset values, pu
      _iq                angle_pu;                     //!< the angle value, pu
      _iq                speed_ref_pu;                 //!< the speed reference, pu
      _iq                speed_fb_pu;                  //!< the feedback speed value, pu
      _iq                speed_outMax_pu;              //!< the maximum output of the speed PI control, pu
      bool               flag_enableCurrentCtrl;       //!< a flag to enable the current controllers





  • thanks for your reply. so that mean I have to remove the code that accesses these members in motorware.
    do you know whether the code in rom will access these members? if the code can access these members, how can we use two ctrl idenpently.

    thanks for your help.
  • Chen,

    Please post this on the InstaSPIN forum.

    For the next generation of InstaSPIN, CTRL instances are defined as an array to help with this. Not sure how to handle with current version, but someone else will have an answer for you.
  • code in rom may not access these members. code in their code elsewhere can access these members. I think they are inside  ctrl.c. you need to search the members and see which function (or method) is using them, and then replace the functions

  • thanks.
    how do you control two motor use motorware? create two ctrl and remove thoese member access from ctrl.c?
  • chen,
    it looks like you found this thread
    e2e.ti.com/.../439315
  • thanks for your help.