FOC configuration help

Discussions regarding the Field Oriented Control (FOC) implementation on the VESC.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
jamesshuang
Posts: 9
Joined: 07 Apr 2016, 05:14
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

FOC configuration help

Postby jamesshuang » 16 Apr 2016, 06:45

Hi everyone,
I'm having difficulty getting FOC mode to behave. The startup performance is very poor -- the motor consistently seems to lag for a moment before spinning up. I've also noticed while riding my board that the controller seems to get "out of sync" with the motor on about 20% of rolling starts, causing a very brief but severe deceleration and nasty crunching noise. Frequently this is accompanied by the system entering into some sort of fault mode where controls are ignored for about 5-10s. Unfortunately I can't seem to catch these happening with my laptop out, so I can't figure out exactly what the fault message says.

I've tried watching the realtime data on faulty startups. What I've noticed is the motor current shoots up to 30A or higher before dropping down as the duty cycle catches up. On smooth startups, that initial peak on the motor current doesn't occur, and duty cycle rises concurrently with the motor current. I'm running VESC hardware vs. 4.10 with the GVDD 4.7uF cap mod, firmware 2.16. I've attached my FOC settings here. Any idea what the problem could be?
Screenshot from 2016-04-15 23-11-34.png
Screenshot from 2016-04-15 23-11-34.png (401.71 KiB) Viewed 5318 times

rew
Posts: 943
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: FOC configuration help

Postby rew » 16 Apr 2016, 08:45

Make sure you get the R&L& Labda measurements right.

I somehow "lost" my measurements yesterday and didn't have the hardware around to remeasure them. So I just put in the numbers I had noted before, and then fiddled a bit with them. At some points it would show the behaviour you describe. So try reducing and increasing R&L by 20% and see if things get better.

jamesshuang
Posts: 9
Joined: 07 Apr 2016, 05:14
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: FOC configuration help

Postby jamesshuang » 16 Apr 2016, 17:21

Hmm.... I tried tweaking the R and L measurements as you mentioned, but it didn't seem to affect the operation. Measuring the R and L values repeatedly seems to return very consistent values. The measured lambda never changes by more than 5% even over many measurements.

I've also managed to catch a ton of FAULT_CODE_DRV8302 messages. The VESC shuts down for about 10 seconds after these faults, but resumes working afterwards. I managed to get the same fault code in BLDC mode while braking relatively quickly.

I've captured some phase current plots from the BLDC tool. In this plot, the motor "catches" and manages to spin correctly during the plotted window. You can see the massive change in the current envelope right where it "catches". On startups where the motor doesn't catch correctly, you see massive phase current deflections that look like the first 0.03 seconds very consistently for the entire plotted window.
phase_current_bad.png
phase_current_bad.png (343.31 KiB) Viewed 5302 times


This is the realtime current / duty cycle plot for two startup attempts. The first one didn't work at all, so you can see motor amps shoot up to 60A. The second attempt, the motor "catches" about a second or two in, and you can see motor amps falls while duty cycle jumps.
current_duty.png
current_duty.png (274.22 KiB) Viewed 5302 times


Since this VESC was hand soldered, could something be wrong with my assembly? The board is pretty terrifying to ride already, and the intermittent DRV8302 faults are scary since I never know when I'll have braking available!

benjamin
Site Admin
Posts: 280
Joined: 15 Dec 2015, 08:38
Location: Sweden
Contact:

Re: FOC configuration help

Postby benjamin » 19 Apr 2016, 12:19

What kind of motor are you using?

jamesshuang
Posts: 9
Joined: 07 Apr 2016, 05:14
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: FOC configuration help

Postby jamesshuang » 19 Apr 2016, 17:27

I'm using a Turnigy SK3 5065, 236kv motor.

Also, I seem to be blowing DRV8302 chips relatively frequently with FOC mode. It will work ok for a few miles, but slowly start accumulating FAULT_CODE_DRV8302 messages. After a while, the chip stops operating altogether. However, swapping in a new chip immediately fixes the issue. Looking over the schematic, I can't see anything that could be causing these issues...

benjamin
Site Admin
Posts: 280
Joined: 15 Dec 2015, 08:38
Location: Sweden
Contact:

Re: FOC configuration help

Postby benjamin » 19 Apr 2016, 20:35

I haven't tested that motor, but there are a few things you can try:

* For better startup, set the openloop rpm to something like 700. Decreasing the measured resistance by 5 to 10 % can also help a bit.

* Regarding getting out of sync and getting drv faults in combination with that, this is a problem likely to damage the hardware. One thing you can try is to change the observer gain (I have to work on calculating the gain better). Double it and try carefully, then halve it and try carefully again. Does this make any difference?

* If you have killed DRVs, make sure that the 100 ohm resistors from the shunts aren't dead and show a few kohm. This has happened to me a few times.

* Other things you can try are increasing the switching frequency to something like 25 KHz and decreasing the time constant to something like 500 µS when calculating Kp and Ki.

jamesshuang
Posts: 9
Joined: 07 Apr 2016, 05:14
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: FOC configuration help

Postby jamesshuang » 21 Apr 2016, 01:55

Thanks for the advice! I've made the adjustments and it does seem to behave slightly more consistently. However, I have a suspicion either I soldered the last three DRV's at too high a temperature (300C on my air gun), or they were from a bad batch. This one which I got straight from TI (as opposed to mouser) seems to be behaving much better, no issues going out of sync after ~10km today, mostly flat terrain. I still managed to get two FAULT_CODE_DRV8302 errors with the terrifying lack of brakes, here's one of them:

Fault : FAULT_CODE_DRV8302
Current : -187.4
Current filtered : -28.6
Voltage : 45.95
Duty : 0.53
RPM : 29545.7
Tacho : 894345
Cycles running : 9
TIM duty : 4422
TIM val samp : 5
TIM current samp : 8398
TIM top : 8400
Comm step : 0
Temperature : 50.44


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Return to “FOC”

Who is online

Users browsing this forum: No registered users and 2 guests