cancel
Showing results for 
Search instead for 
Did you mean: 

By using MC_ProgramSpeedRampMotor1 api trying to change ramp in six step algorithm

soundarya_h_s
Associate III

The MC_ProgramSpeedRampMotor1 api is created in six steps to modify the ramp; however, ramp changes cannot be made with this api.It is possible to modify the ramp in FOC by using the MC_ProgramSpeedRampMotor1_F api.

Additionally, two produced APIs are supplied in FOC; however, in the Six Step, just MC_ProgramSpeedRampMotor1 generated.

I am unable to modify the ramp using the MC_ProgramSpeedRampMotor1 api in six step. Could you please assist me? Is there another method to modify the ramp in a six-step algorithm?

13 REPLIES 13
SRedd.5
Senior III


__weak bool MC_StopSpeedRampMotor1(void)
{
return (MCI_StopSpeedRamp(pMCI[M1]));
}

/**
* @brief Stops the execution of the on-going ramp for Motor 1, if any.
*
* If a ramp is currently being executed, it is immediately stopped, the torque or the speed
* of Motor 1 is maintained to its current value.
*/
__weak void MC_StopRampMotor1(void)
{
MCI_StopRamp(pMCI[M1]);
}

/**
* @brief Returns true if the last ramp submited for Motor 1 has completed, false otherwise
*/
__weak bool MC_HasRampCompletedMotor1(void)
{
return (MCI_RampCompleted(pMCI[M1]));
}

I have not used 6 step, but can you use the above functions to verify if the ramp is complete or not and then change the ramp or stop the ramp etc.

 

I used MC_HasRampCompletedMotor1 flag to check weather the ramp is completed or not and then i getting the message that rampl is completed but the speed is not reflecting in motor.

 

void MC_ProgramSpeedRampMotor1(int16_t hFinalSpeed, uint16_t hDurationms)

The ramp is with respect to the time that is you may want to achieve the speed in 5seconds, 10 seconds etc. To change the speed you have to update the  hFinalSpeed, provide different values as arguments to the function MC_ProgramSpeedRampMotor1 for example 100, 200 RPM (verify the units the function MC_ProgramSpeedRampMotor1 expects). Can you show how you are passing parameters to  the MC_ProgramSpeedRampMotor1 function?

 

soundarya_h_s_0-1702558238576.png

 

SRedd.5
Senior III

I find mistakes duration is unsigned but you are checking for less than 0

The targetspeed is a signed value but you are passing unsigned value. Please check those coding errors.

soundarya_h_s_0-1702618269134.png

I have changed to signed but still the ramp is not reflecting in the motor

 

SRedd.5
Senior III

You have to learn to debug the code use break points to verify if the expected the actual values are matching. You can also use the Cubemonitor to watch variables during the run time. 

You are checking the duration < 0, but that will never be True.

Both actual and expected values are matching.

Can you install CubeMonitor and try using it and post the images of the variables?