Page 2 of 3

Re: Fast Current control with reverse

Posted: 07 Apr 2017, 06:58
by benjamin
It sounds like the current controller could be a bit too fast. Try setting the time constant for calculating kp and ki to 2000 µS and try with those values.

Re: Fast Current control with reverse

Posted: 07 Apr 2017, 16:17
by blezalex
benjamin wrote:It sounds like the current controller could be a bit too fast. Try setting the time constant for calculating kp and ki to 2000 µS and try with those values.


What is the name of the parameter for that constant? Is that DTc ?

Re: Fast Current control with reverse

Posted: 09 Apr 2017, 01:54
by blezalex
Found the time constant.

With TC=2000 it works better, but still losses sync under load.
I also noticed that if i sent 0->30A current request motor clicks a few times (though it goes to top speed rather quick).

With TC=4000 I don't get those clicks and seems like motor runs much smoother, but it also seems like it becomes too slow for balancing application board falls to the other side before controller gives enough torque to counter than.

With TC=500 i can still ride the bord. Sync seems to go worse - torque is much lower.

I also played with observer gain, but that does not seem to have much effect (I tested at low speeds)

Is there anything else I can do? I'd really like to use your firmware in my balancing application..

Re: Fast Current control with reverse

Posted: 11 Apr 2017, 07:47
by benjamin
Which voltage version of the motor do you have? 30A sounds like a lot of current for it, and it probably saturates from that making it difficult for the observer to track it. You could try lowering the current and see if you get the same problem.

In the new firmware I have implemented some saturation compensation to make it possible to push motors a bit harder. I will probably work more on it, but if you want to give it a try you can add this to the observer_update function in mcpwm_foc.c:

Code: Select all

const float comp = 0.1; // Try values between 0.0 and 0.25
const float sign = (m_motor_state.iq * m_motor_state.vq) >= 0.0 ? 1.0 : -1.0;
R -= R * sign * comp * (m_motor_state.i_abs_filter / m_conf->l_current_max);


don't forget to remove const from R.

Re: Fast Current control with reverse

Posted: 12 Apr 2017, 07:49
by blezalex
I asked for 36V 500W version (not sure if they shipped what I asked for :) )

It seems to survive short busts of 40A current just fine..

I lowered current limit from 60 to 40A and got a big improvement, still not 100% stable though.

Then I tried the code modification - with 0.1 I seems to work significantly better than without the change. With 0.2 it seems to loose power and sync issues are back again. (I need to re-tests this).

The two issues I observe with 0.1 setting are:
1. Very short sync issues 1-2 clicks per deceleration. For very rapid deceleration it may loose sync completely but that happens very rarely now.
2. Seems like controller has a noticeable lag, board feels very soft, a lot like surfing (As if i'm standing on the water, not solid floor)

Do you have a quick way to re-flash the controller but keep EEPROM? I'm afraid I can forget to restore something after a flash.

Is there an easy way to produce a log file to see what is going on with the motor?

Here is the data I collected with my primitive ESC firmware (it runs as BLDC, DUTY control with reverse)

Battery 10s
10 seconds of ride time (sampled each 5ms)
Duty: range [-510, 510]
Image
html image uploader

Current:
Image
html image uploader

Data in CSV: https://www.dropbox.com/s/12gdm3nvdz6q00o/data.csv?dl=0

Re: Fast Current control with reverse

Posted: 12 Apr 2017, 09:45
by e-biker
Hi blezalex,

You can save all your settings to XML file, then load it back. To log data you can simply create array in the code to store data witch you need, then read it via terminal.

There may be two reasons why your's board feels soft (only my opinion):

1. To big TC constant. I've noticed that "lag" on my ebike then i increased it to 4us.
2. There could be an isue with to low current. Maybe there is not enough power to correct it instantly.

Re: Fast Current control with reverse

Posted: 13 Apr 2017, 07:34
by rew
blezalex wrote:It seems to survive short busts of 40A current just fine..
Benjamin said something about saturation. If that is the case, you are pushing current through the motor that is not causing the expected magnetic fields to develop. This can cause an extra heating up of the motor as well as throwing off measurements that the VESC needs to properly run your motor. It is not only about the motor surviving the "ordeal".... :-)

Re: Fast Current control with reverse

Posted: 26 Apr 2017, 01:21
by blezalex
Here is the source code for controller if you interested https://github.com/blezalex/WheelBoardMain. I just finished porting it from Arduino, still needs a lot of cleanup.


I still have those issues with FOC. I wonder if raising battery voltage and reducing max current can help with saturation..

Re: Fast Current control with reverse

Posted: 13 Sep 2017, 21:30
by blezalex
It turns out my problem was setting sensorless ERPM too low. motor max rmp is 4200, I assumed 1000 would be a good value, turns out 2000 is a good value :)

Re: Fast Current control with reverse

Posted: 14 Sep 2017, 17:17
by rew
My guess is that the FOC-parameters (R, L , lambda etc) are not correctly set. Then once the "sensorless" kicks in, you get into trouble. Postponing it for a speed where it somehow doesn't matter is ignoring the problem. Might be a good workaround for you, but it isn't the best solution.

Sensorless should be possible from about 10% of MAX RPM. About 420RPM in your case.