Forum

Setting motor direc...
 
Notifications
Clear all

[Solved] Setting motor direction in Torque Mode with negative parameters

4 Posts
2 Users
0 Likes
78 Views
Forum 1
(@guesttourist)
Active Member
Joined: 1 month ago
Posts: 4
Topic starter  

Hello,

I am planning to have a discrete PD controller implemented for my SOLO, and hence the input would be torque current that may vary between positive and negative. The hall sensor of the motor is hooked for closed-loop control on SOLO, and a rotational encoder will be used for the microcontroller.

I see that in the sample code,

// set the Direction on C.C.W.
SOLO_Obj1->SetMotorDirection(SOLOMotorControllers::Direction::COUNTERCLOCKWISE);
// set an arbitrary Positive torque reference
SOLO_Obj1->SetTorqueReferenceIq(1.2);

The direction was set before setting the torque.

 

I understand I can do a simple if-statement to change the motor direction based on the sign of my input.

How will this affect the timeliness of the control? Is inputting a negative number allowed since the parameter type is a float?

Additionally, is QuadratureCurrent different from Toeque Reference Current? I am seeing much smaller readings compared to my inputs. (I am assuming they are not the same)

 

Thanks in advance for any help!


   
Quote
SOLO Team
(@milad)
Illustrious Member Admin
Joined: 4 years ago
Posts: 581
 

Hello @guesttourist,

Posted by: @guesttourist

How will this affect the timeliness of the control? Is inputting a negative number allowed since the parameter type is a float?

 

Torque or Iq reference is a positive number, the Direction defines if that number means CW or CCW direction torque, You are right, to change the sign of the torque you need to send the Direction command plus the new Torque reference point, but these commadns can be sent through PDO messages, increasing the bandwidth to the maximum.

 

Posted by: @guesttourist

Additionally, is QuadratureCurrent different from Toeque Reference Current? I am seeing much smaller readings compared to my inputs. (I am assuming they are not the same)

 

Quadrature current as feedback, is the Iq or the current acting in torque generation sensed on the motor, the Torque reference, Iq reference or even Quadrature Current reference is your desired value, if you are in Torque mode, the Iq feedback makes sense only when the motor is loaded, to compare the Iq reference set by you and the feedback you read as Iq, you can lock the shaft of the Motor, in that case, Iq feedback will converge to Iq reference, so, in general, the value of Iq ( quadrature current) highly depends on the load on the shaft.

 

let me know if you have other questions.

 

Milad

 

 

If you found the answers helpful and you could solve your problems, please kindly verify here to help others in the future.


   
ReplyQuote
Forum 1
(@guesttourist)
Active Member
Joined: 1 month ago
Posts: 4
Topic starter  

Hello, thank you so much for the reply.

I was learning from a friend that the issue with the need to send two messages could result in accumulated errors over time. The board will receive the control signal at a delayed time. If the system is oscillating, this will introduce positive feedback and potentially make the system unstable. 

 

I realized that it is also possible to perform a hybrid control PWM using both digital and analog control to enhance torque control performance in my case.

Let's say that I write the program in the following structure

1. Create a motor driver object, and set the parameters in digital mode

2. Change the control mode to analog mode

3. Use the PWM functionality of the microcontroller to give PWM commands in analog mode

 

For example:

 // Initial Configuration of the device and the Motor
SOLO_Obj1->SetOutputPwmFrequencyKhz(pwmFrequency);
SOLO_Obj1->SetCurrentLimit(currentLimit);
SOLO_Obj1->SetMotorPolesCounts(numberOfPoles);
SOLO_Obj1->SetCommandMode(SOLOMotorControllers::CommandMode::DIGITAL);
SOLO_Obj1->SetMotorType(SOLOMotorControllers::MotorType::BLDC_PMSM);
SOLO_Obj1->SetFeedbackControlMode(SOLOMotorControllers::FeedbackControlMode::HALL_SENSORS);
SOLO_Obj1->SetControlMode(SOLOMotorControllers::ControlMode::TORQUE_MODE);
 
// Put the control in analog mode
SOLO_Obj1->SetCommandMode(SOLOMotorControllers::CommandMode::ANALOG);
 
 
 
 
 
As demonstrated in your example here:
 
Is it necessary to have a continuous PWM signal for the analog control as:
// Converted value to PWM duty cycle for desired current Limit on 8 bit PWM of Arduino
desiredDutyCycle_CurrentLimit = (int)(255 - (255 * (currentLimit / MaxMeasurableCurrent_SOLO_UNO)));
// Set the right Duty cycle on Pin ~9 for current Limit
analogWrite(9, desiredDutyCycle_CurrentLimit);
 
Can I just set it in digital mode and drive the motor with just the PWM for reference current and direction?
 
Thanks!
 
 
 
 

   
ReplyQuote
SOLO Team
(@milad)
Illustrious Member Admin
Joined: 4 years ago
Posts: 581
 

@guesttourist

Posted by: @guesttourist

Can I just set it in digital mode and drive the motor with just the PWM for reference current and direction?
 

if your reference is a constant value, then there is no need to change this duty cycle, so basically you change it whenever you are aiming to change the torque reference.

 

Milad

 

If you found the answers helpful and you could solve your problems, please kindly verify here to help others in the future.


   
ReplyQuote
Share: