2021-10-13 01:30 AM
Setting the current reference is describes as:
void MC_SetCurrentReferenceMotor1(Curr_Components Iqdref);
What should I type to replace Curr_Components and Iqdref?
I want to manually set current reference to increase torque when the motor is in low rotation speed. Is it possible?
2021-10-13 11:53 PM
Hi @CHuan.8 and welcome to the ST Community.
Since your question is about STM32 MCSDK, I removed the topic Motor Control Hardware and left only "STM32 Motor Control".
2021-11-29 04:28 AM
Any information available on the question above? I'm very interested in a solution for high torque at low rpm as well.
I'd really love to see an ST Employee to answer questions and not only moving customer questions from one forum to the other or just correcting topics....
2021-12-01 05:00 AM
Hello @CHuan.8 ,
"I want to manually set current reference to increase torque when the motor is in low rotation speed. Is it possible?"
What do you want to achieve ?
The FOC algorithm embeds a PID speed control that should keep the speed constant whatever the break applied to your motor.
This PID speed will increase or decrease the torque if the speed is to slow or to fast compared to the target.
Now, if the speed is under a certain limit, the observer will not be able to reconstruct the angle and will not be able drive your motor.
So basically, yes you can apply a torque manually, but if your target is to keep a speed constant, I would rather check PID speed parameters.
If you have a speed feedback error, because the speed is to slow, then using a sensor (Encoder or Hall sensor) can be helpful.
Regards
Cedric
2022-12-25 11:37 PM
Dear @cedric H , you still did not explain how to use the function MC_SetCurrentReferenceMotor1 and how to pass the parameter of type qd_t to it. Please do that right away. Let us answer the question and not divert the topic to something else.
Regards
2023-01-03 09:28 AM
Dear @Community member ,
The MC_SetCurrentReferenceMotor1 is documented in the MCSDK 6.1 release as following:
MC_SetCurrentReferenceMotor1()
Programs the current reference to Motor 1 for later or immediate execution.
The current reference to consider is made of the Id and Iq current components.
Invoking the MC_SetCurrentReferenceMotor1() function programs a current reference with the provided parameters. The programmed reference is executed immediately if Motor 1's state machine is in the #START_RUN or RUN states. Otherwise, the command 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 buffered command is programmed before the current one has completed, the latter replaces the former.
Parameters
Iqdrefcurrent reference in the Direct-Quadratic reference frame. Expressed in the qd_t format.
if you look at the qd_t format, you will see this:
typedef struct
{
int16_t q;
int16_t d;
} qd_t;
In order to call this function in your application, you need to:
include the file mc_api.h
declare a variable of type qd_t :
qd_t myqdValue;
set the value you want:
myqdValue.d=0;
myqdValue.q=15000;
as qd_t represents a current, the format is in S16A. S16A is described in Documentation/html/md_docs_measurement_units.html
and call the c function :
MC_SetCurrentReferenceMotor1(myqdValue);
Does this answer match your expectations?
Regards
Cedric
2023-01-03 09:50 PM
Hey @cedric H . Hope you are in good health. Thank you for your answer. This is what I did but it looks like there is another underlying problem in the motor control middleware that is not allowing me to do so.
I used MC_SetCurrentReferenceMotor1 with the expectation that it will help me align the motor and I was wrong.
I'm using a 24V 15P-P 730RPMmax Motor with B-G431B-ESC1 with hall sensors. I have configured it accordingly both in the Motor Tab and Speed Sensing tab of the MC WB. The pins assigned in the Digital I/O tab are also correct. I am driving the motor with speed control. This motor has been profiled using ST Motor Profiler.
Yet, I'm not able to run the motor. I've observed that MX_MotorControl_Init only initializes the motor and programs speed ramp with the target value assigned in the MC WB. Hence, I called the MC_StartMotor1(); function in order to start the programed ramp. This is not working for me. I'm having a speed feedback error and i do not know what might be causing this. What is the process of starting the motor with hall sensors otherwise?
PS: Although the motor needs big time tuning of the PI values, I'm able to move the motor to desired target speed (RPM) in the sensorless speed control mode. I wish to run the motor with sensored speed control mode since I also need to achieve position control. Need your assistance in controlling it with sensors.
Regards
2023-01-03 11:15 PM
I found the following information in the MC Docs.My question is, if I use Hall Sensors as speed sensing, which of the above (torque ramp, speed ramp or current ref) do I set in order to start motor successfully?
2023-01-04 01:31 AM
Hello @Community member ,
Your issue seems coming from the Hall sensors configuration. Hall sensors send to the control algorithm a mechanical angle information. The control algo uses an electrical angle. You must configure the shift between the electrical angle and the mechanical one. One other point, the way you connected the 3 phases, and the 3 Hall sensors are important.
From the SDK 6.1 we introduced a really nice feature in order to help you to achieve the hall sensor configuration.
If you open the Pilot and select the profiler, you will be able now to also profile your hall sensors. The tool will guide you through all the different steps to determine your all sensors configuration.
Please give it a try and provide feedback about your profiling results.
Cedric
2023-01-04 04:48 AM
Hey @cedric H ,
I have profiled previously mentioned motor using both MC prof 6.0 and 6.1.
6.1 seems to have voltage issues since there is no max voltage parameter that we can input. I either get undervoltage or overvoltage faults. Let me share the pictures:
MC profiler 6.0:
MC profiler 6.1:
6.1 has voltage calculation issues. The profiling fails every time. Please note that I'm not even giving extra RPM (730RPM) in 6.1, while I have actually provided 1500RPM in 6.0 and it still profiled fine for 730RPM.
Also, I'm not able to profile Hall Sensors.
I have disassembled my motor so I can see the order of Hall Sensors placed in the Motor. I might be going wrong in the "Placement Electrical Angle". I've provided it has 60 degree right now.