We are doing that one!!
We are doing that one!!
Sorry, didn't understand what you mean by clamp on this subject. What is the "usual clamping"? why do we need to do that clamp??
Ah ok, now I understand. Our firmware is already doing that, that is why it controls regen current well -- here the max current and max regen current control:
It is a Renesas UPD78F9202MA. I had a discussion about it on mikrocontroller.net, as the µC is defective on my sensor. I now use the signal from the hallsensor pin directly.
Good idea and in fact I already tried that but there are some issues:
So you are taking to outside the signal of each hall sensor??
to be honest, I don't understand your problem.
I wish it would be so simplestancecoke wrote: ↑Nov 26, 2017 2:55 pmto be honest, I don't understand your problem.
The control loop keeps the current at zero automatically if the throttle is closed, so the right duty cycle is applyed at every time with a direct drive. If you have a geared motor, you start at zero erps every time, that's no problem, too.
Why do you let the motor coast at braking? Just set the current target to zero and let the control loop do it's job!!!
No, I just use one hall sensor and have no direction detection implemented, as in torquesensor-mode it is not necessary. In torque-simulation mode the motor starts turning forewards when pushing the bike backwards and the pedals are turning backwards. That is not good and has to be improved. (or a PAS with internal direction detection has to be used)
Did you ride like that? Do you think it will work? the test ride you did today was like that?
Of course this works, as you can see in the video and in the plot. There's no difference in sound between accelerating (positive current) and regenerating (negative current).
Code: Select all
// make sure current is not negative, we are here not to control negative/regen current
I have 2 current controllers, one that is fast on PWM cycle code and other slow with PI controller.
The slow loop controller just sets duty_cycle_target while the fast one controls duty_cycle. duty_cycle have the higher priority and so I am actuating on it for the regen controller.
Yes, I was in a hurry -- just did now
I really don't like that idea because:
I remember to see a case that when failing, the angle would run off to a max or min value, like getting out of sync. Since I remember, the FOC can adjust the angle of +-30º or something like that, other higher/lower values don't make sense. So maybe I need to check if the angle of FOC is withing that range... if not, stop the motor and consider a "motor in short circuit".
The watchdog in the fast loop is important of course. Having one central PI-controller that makes sure, that there are no sudden jumps in the dutycycle value is much more reliable, I think. The fast loop should concentrate on keeping track of the rotor position/sine table index and FOC control, that's the really time critical task...