Skip to main content
Graduate
January 10, 2026
Solved

MCSDK: behavior of sequential ramps

  • January 10, 2026
  • 1 reply
  • 461 views

Hi,

I wonder how the motor control unit should behave if a speed ramp is programmed right after a torque ramp?

Following code snippet shows this setup:

// Set Torque/Iq limit
MC_ProgramTorqueRampMotor1(iqLimit, 0);
// Programm speed ramp
MC_ProgramSpeedRampMotor1(speed, 500);
// Start motor
MC_StartMotor1();

Do I understand correctly that this code should lead to the following behavior?

  • the motor starts in speed mode

  • if the load driven by the motor increases the speed will decrease

  • if the load increases further the motor will run with decreasing speed until it reaches the torque/iq limit set by  the MC_ProgramTorqueRampMotor1() function

  • the motor will stop and deliver a constant torque - the torque programmed with MC_ProgramTorqueRampMotor1()

 

Best regards

B0bbyR4y

Best answer by STuser2

If one command execution is in progress it will not execute the next command. Refer the below documentation in the code 

/**
 * @brief Returns information about the state of the last buffered command.
 * @PAram pHandle Pointer on the component instance to work on.
 * @retval The state of the last buffered command
 *
 * The state returned by this function can be one of the following codes:
 * - #MCI_BUFFER_EMPTY if no buffered command has been called.
 * - #MCI_COMMAND_NOT_ALREADY_EXECUTED if the buffered command
 * condition has not already occurred.
 * - #MCI_COMMAND_EXECUTED_SUCCESSFULLY if the buffered command has
 * been executed successfully. In this case calling this function resets
 * the command state to #MCI_BUFFER_EMPTY.
 * - #MCI_COMMAND_EXECUTED_UNSUCCESSFULLY if the buffered command has
 * been executed unsuccessfully. In this case calling this function
 * resets the command state to #MCI_BUFFER_EMPTY.
 */
__weak MCI_CommandState_t MCI_IsCommandAcknowledged(MCI_Handle_t *pHandle)

 This function is in the mc_interface.c file

and also refer

/**
 * @brief Programs a torque ramp for Motor 1 for later or immediate execution.
 *
 * A torque ramp is a linear change from the current torque reference to the @p hFinalTorque
 * target torque reference in the given @p hDurationms time.
 *
 * Invoking the MC_ProgramTorqueRampMotor1() function programs a new torque ramp
 * with the provided parameters. The programmed ramp is executed immediately if
 * Motor 1's state machine is in the #RUN states. Otherwise, the ramp is buffered
 * and will be executed when the state machine reaches any of the aforementioned state.
 *
 * The Application can check the status of the command with the MC_GetCommandStateMotor1()
 * to know whether the last command was executed immediately or not.
 *
 * Only one command can be buffered at any given time. If another ramp - whether a
 * torque or a speed one - or if another buffered command is programmed before the
 * current one has completed, the latter replaces the former.

in mc_api.c file.

1 reply

STuser2Best answer
Senior III
January 10, 2026

If one command execution is in progress it will not execute the next command. Refer the below documentation in the code 

/**
 * @brief Returns information about the state of the last buffered command.
 * @PAram pHandle Pointer on the component instance to work on.
 * @retval The state of the last buffered command
 *
 * The state returned by this function can be one of the following codes:
 * - #MCI_BUFFER_EMPTY if no buffered command has been called.
 * - #MCI_COMMAND_NOT_ALREADY_EXECUTED if the buffered command
 * condition has not already occurred.
 * - #MCI_COMMAND_EXECUTED_SUCCESSFULLY if the buffered command has
 * been executed successfully. In this case calling this function resets
 * the command state to #MCI_BUFFER_EMPTY.
 * - #MCI_COMMAND_EXECUTED_UNSUCCESSFULLY if the buffered command has
 * been executed unsuccessfully. In this case calling this function
 * resets the command state to #MCI_BUFFER_EMPTY.
 */
__weak MCI_CommandState_t MCI_IsCommandAcknowledged(MCI_Handle_t *pHandle)

 This function is in the mc_interface.c file

and also refer

/**
 * @brief Programs a torque ramp for Motor 1 for later or immediate execution.
 *
 * A torque ramp is a linear change from the current torque reference to the @p hFinalTorque
 * target torque reference in the given @p hDurationms time.
 *
 * Invoking the MC_ProgramTorqueRampMotor1() function programs a new torque ramp
 * with the provided parameters. The programmed ramp is executed immediately if
 * Motor 1's state machine is in the #RUN states. Otherwise, the ramp is buffered
 * and will be executed when the state machine reaches any of the aforementioned state.
 *
 * The Application can check the status of the command with the MC_GetCommandStateMotor1()
 * to know whether the last command was executed immediately or not.
 *
 * Only one command can be buffered at any given time. If another ramp - whether a
 * torque or a speed one - or if another buffered command is programmed before the
 * current one has completed, the latter replaces the former.

in mc_api.c file.