Testing FOC for synchronous motor
- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
I corrected one bug in FOC code: the frequency dependent offset was not limited to the controllers maximum output, typically [-37813, 37813]. So once the offset surpassed that limit the integrator would wind up to counteract. Offset is now limited. Haven't drafted a new release yet.
There is also a new test mode for FOC that allows you to manually specify and id and iq set point, e.g. for finding syncofs. It's still a bit dangerous as the speed limiting code is not in effect. Given enough field weakening current I'm not sure where the physical limit for the motor speed will be, so careful, keep your hand on the ignition key!
There is also a new test mode for FOC that allows you to manually specify and id and iq set point, e.g. for finding syncofs. It's still a bit dangerous as the speed limiting code is not in effect. Given enough field weakening current I'm not sure where the physical limit for the motor speed will be, so careful, keep your hand on the ignition key!
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
PoloLbricolo
- Posts: 106
- Joined: Wed Apr 10, 2019 2:32 pm
- Location: France
- Has thanked: 3 times
- Been thanked: 12 times
Re: Testing FOC for synchronous motor
Attempted to build (under Windows) Can't seem to find timer_get_ic_value from inc_encoder.cpp (searched all files)
Used your copy of custom libopencm3 and libopeninv
EDIT: Changed line 587 ...compiled OK.
Used your copy of custom libopencm3 and libopeninv
EDIT: Changed line 587 ...compiled OK.
Code: Select all
int measTm = timer_get_counter(REV_CNT_TIMER);-
doobedoobedo
- Posts: 264
- Joined: Sat Jan 12, 2019 12:39 am
- Location: UK
- Been thanked: 1 time
Re: Testing FOC for synchronous motor
Builds fine for me (linux)
did you run:
I wrote a little script:
did you run:
Code: Select all
make get-depsCode: Select all
$ cat build.sh
#!/bin/bash
make get-deps
CONTROL=FOC make clean
CONTROL=FOC make- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
Of course thats not the same but then this code won't be used in FOC mode most likely.dima wrote: ↑Mon Jan 20, 2020 10:55 pm EDIT: Changed line 587 ...compiled OK.
Code: Select all
int measTm = timer_get_counter(REV_CNT_TIMER);
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
Just studied another paper on anti-windup and came across a chapter where he calculates some ideal Kp and Ki values for the id and iq controllers. Surprisingly he ends up at K p = 16.06, K i = 20200. So really high Ki. Hmm, maybe I should try that too.
Paper here: http://www.jcee.upc.edu/JCEE2008/pdf_po ... windup.pdf
Paper here: http://www.jcee.upc.edu/JCEE2008/pdf_po ... windup.pdf
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
Alright everyone, this is crazy! I just drove with curki cranked up to 20000 and all the various kludges that I added in the last months disabled. Result: awesome!
No unwanted regen, smooth acceleration to 9000rpm (didn't dare spin faster with my vibrato coupler), no over current trips on wheel spin. It just drives.
All that pain because I didn't have da ballz to crank up the integral controller gain
Did a quick measurement and reported a power peak at 110kW, 20 kW regen. I never sniffed cocain, but I'm sure this is better
By disabled kludge I mean the frqfac parameter, the separate regen controller and the ramp between the two. All unnecessary.
Parameter attached, will release the cleaned up firmware in a minute.
No unwanted regen, smooth acceleration to 9000rpm (didn't dare spin faster with my vibrato coupler), no over current trips on wheel spin. It just drives.
All that pain because I didn't have da ballz to crank up the integral controller gain
Did a quick measurement and reported a power peak at 110kW, 20 kW regen. I never sniffed cocain, but I'm sure this is better
By disabled kludge I mean the frqfac parameter, the separate regen controller and the ramp between the two. All unnecessary.
Parameter attached, will release the cleaned up firmware in a minute.
- Attachments
-
- Leaf 2020-01-31.json
- (1.15 KiB) Downloaded 378 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
doobedoobedo
- Posts: 264
- Joined: Sat Jan 12, 2019 12:39 am
- Location: UK
- Been thanked: 1 time
-
Alexstarex
- Posts: 28
- Joined: Mon Jan 13, 2020 1:53 pm
- Location: Russia
-
kiwifiat
- Posts: 101
- Joined: Sat Dec 22, 2018 9:39 pm
- Location: Vancouver, Canada
- Been thanked: 12 times
Re: Testing FOC for synchronous motor
That is really great news, persistance and research pays dividends. Thank youjohu wrote: ↑Fri Jan 31, 2020 4:34 pm Alright everyone, this is crazy! I just drove with curki cranked up to 20000 and all the various kludges that I added in the last months disabled. Result: awesome!
No unwanted regen, smooth acceleration to 9000rpm (didn't dare spin faster with my vibrato coupler), no over current trips on wheel spin. It just drives.
- Kevin Sharpe
- Posts: 1339
- Joined: Fri Dec 14, 2018 9:24 pm
- Location: Ireland and US
- Been thanked: 10 times
Re: Testing FOC for synchronous motor
Congratulations Johannes
This is a personal post and I disclaim all responsibility for any loss or damage which any person may suffer from reliance on the information and material in this post or any opinion, conclusion or recommendation in the information and material.
- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
More testing today. There are still some occasional trips in the high rev range when changing from full throttle to full regen.
I have removed the bus voltage based field weakening controller and only left the "crossover-controller" in. That is if iq can't be reached, id will be increased (well, decreased, as it's negative).
I also added a frequency dependent factor to curki. So with increasing motor speed it will increase integral controller gain for better response in that region while maintaining the car calm in the lower rev range.
I tried a filmed test drive but acceleration is so hard now that the camera topples over. Plus two cop cars came the other way which, well, is a bit problematic right now. So maybe not a good idea to publish the video
I have removed the bus voltage based field weakening controller and only left the "crossover-controller" in. That is if iq can't be reached, id will be increased (well, decreased, as it's negative).
I also added a frequency dependent factor to curki. So with increasing motor speed it will increase integral controller gain for better response in that region while maintaining the car calm in the lower rev range.
I tried a filmed test drive but acceleration is so hard now that the camera topples over. Plus two cop cars came the other way which, well, is a bit problematic right now. So maybe not a good idea to publish the video
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
arber333
- Posts: 3795
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 166 times
- Been thanked: 411 times
- Contact:
Re: Testing FOC for synchronous motor
Nice! Maybe you could go to some abandoned airfield and try there...johu wrote: ↑Thu Feb 06, 2020 11:10 am More testing today. There are still some occasional trips in the high rev range when changing from full throttle to full regen.
I have removed the bus voltage based field weakening controller and only left the "crossover-controller" in. That is if iq can't be reached, id will be increased (well, decreased, as it's negative).
I also added a frequency dependent factor to curki. So with increasing motor speed it will increase integral controller gain for better response in that region while maintaining the car calm in the lower rev range.
I tried a filmed test drive but acceleration is so hard now that the camera topples over. Plus two cop cars came the other way which, well, is a bit problematic right now. So maybe not a good idea to publish the video![]()
So do you think i can use FOC brain with TWO power sections now? I would be driving IGBTs from the same pwm channels but i would parallel current sensors up to 3K3 pulldown resistor. My theory is any difference in IGBT output would be shown in sensor readout leaving centerline. Would be interesting to try. Is the current reading fast enough to sense this?
- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
Hmm, can you spawn an abandoned airfield in my neighborhood, please 
Paralleling the PWM channels shouldn't be much of a problem. Your current sensor paralleling strategy sounds interesting. Not sure what exactly is going to happen. It won't be able to detect imbalance so you have to make sure there is none. Otherwise you can just connect one pair of current sensors and double (half) the gain factor.
Current reading happens at control frequency - independent of PWM frequency fixed to 8.8kHz nowadays
Paralleling the PWM channels shouldn't be much of a problem. Your current sensor paralleling strategy sounds interesting. Not sure what exactly is going to happen. It won't be able to detect imbalance so you have to make sure there is none. Otherwise you can just connect one pair of current sensors and double (half) the gain factor.
Current reading happens at control frequency - independent of PWM frequency fixed to 8.8kHz nowadays
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
arber333
- Posts: 3795
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 166 times
- Been thanked: 411 times
- Contact:
Re: Testing FOC for synchronous motor
Hmm... I am thinking of using longer phase wires and parallel connect them much closer to motor. I expect this will dampen induction surges and flyback diodes will not be too stressed inside IGBTs.johu wrote: ↑Thu Feb 06, 2020 11:33 am Hmm, can you spawn an abandoned airfield in my neighborhood, please
Paralleling the PWM channels shouldn't be much of a problem. Your current sensor paralleling strategy sounds interesting. Not sure what exactly is going to happen. It won't be able to detect imbalance so you have to make sure there is none. Otherwise you can just connect one pair of current sensors and double (half) the gain factor.
Current reading happens at control frequency - independent of PWM frequency fixed to 8.8kHz nowadays
You can try to find an empty parking lot in a mall on Sunday? But idea is somewhere that you may not expect any traffic... or cops...
-
arber333
- Posts: 3795
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 166 times
- Been thanked: 411 times
- Contact:
Re: Testing FOC for synchronous motor
One more question J.
Can we use latest FOC code for Leaf motor with encoder ABZ interface? I have installed one ABZ encoder onto motor rear shaft since my resolver is damaged. If its possible to run motor without mechanical changes i would be very happy.
tnx
Can we use latest FOC code for Leaf motor with encoder ABZ interface? I have installed one ABZ encoder onto motor rear shaft since my resolver is damaged. If its possible to run motor without mechanical changes i would be very happy.
tnx
- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
The first startup could be rough, but theoretically it should work.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
arber333
- Posts: 3795
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 166 times
- Been thanked: 411 times
- Contact:
Re: Testing FOC for synchronous motor
What do you mean for first setup rough? Why? Isnt ABZ signal pretty much the same as resolver only digital?
Do yopu mean every first start will be rough or just at setup?
Hm... should i then rather try to reinstall resolver?
A
- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
Resolver instantly returns the current, absolute rotor angle. ABZ only returns incremental angle increase and once per rotation the index pulse. Only then do you have an absolute angle. So you're blind on the first turn and can just dump some random sine wave until you see the index pulse. Most of all I haven't tested ABZ mode for ages.
So I'd recommend you try to get the resolver running or use a sin/cos like this: https://www.melexis.com/-/media/files/d ... elexis.pdf with a small magnet as you already know. Of course I don't know if there will be any disturbance by motor stray field.
So I'd recommend you try to get the resolver running or use a sin/cos like this: https://www.melexis.com/-/media/files/d ... elexis.pdf with a small magnet as you already know. Of course I don't know if there will be any disturbance by motor stray field.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
arber333
- Posts: 3795
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 166 times
- Been thanked: 411 times
- Contact:
Re: Testing FOC for synchronous motor
What a good idea. I will try to implement it ASAP. I think RLS has just the chip for my form factor.johu wrote: ↑Sat Feb 08, 2020 10:14 am So I'd recommend you try to get the resolver running or use a sin/cos like this: https://www.melexis.com/-/media/files/d ... elexis.pdf with a small magnet as you already know. Of course I don't know if there will be any disturbance by motor stray field.
https://www.rls.si/en/products/rotary-m ... tal-flange
EDIT: So if i would do this with your rev. 2 board i would need the resolver circuit too yes?
I would connect it by Sin and Cos lines and i would leave Ex lines unconnected yes? Also Sin/Cos lines are single ended. That means probably that other side is connected to GNDfor reference. How does that apply to your circuit?
BUT this chip sends ONE sine/cos weave only at single FULL shaft revolution. What does that mean for 8 pole motor like Leaf? Would that be enough?
- johu
- Site Admin
- Posts: 7182
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 552 times
- Been thanked: 1914 times
- Contact:
Re: Testing FOC for synchronous motor
Yes, no excitation needed, so rev2 board will work. Remove encoder pull-up resistors!
You mean model RMF44AC? That is centered at Vcc/2. Would be perfect if it runs on 3V3. Otherwise you have to divide 2.5->1.65 accurately because there is no offset-calibration in that mode.
One sin/cos per turn is ok, just set respolepairs=1
You mean model RMF44AC? That is centered at Vcc/2. Would be perfect if it runs on 3V3. Otherwise you have to divide 2.5->1.65 accurately because there is no offset-calibration in that mode.
One sin/cos per turn is ok, just set respolepairs=1
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
arber333
- Posts: 3795
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 166 times
- Been thanked: 411 times
- Contact:
Re: Testing FOC for synchronous motor
It says signal is 1.1V each across reference so 2.2V in all. Can you tell me how to connect Sin and Cos signal wires? Do i just connect Sin to encA and Cos to encB? Minus pullups of course...
tnx
tnx
-
PoloLbricolo
- Posts: 106
- Joined: Wed Apr 10, 2019 2:32 pm
- Location: France
- Has thanked: 3 times
- Been thanked: 12 times
Re: Testing FOC for synchronous motor
Hi,
I'm back with the smart for the week-end, i did the firmware upgrade 4.73,i have a lot more power now
but it's too much for the liking of my battery (limited to 350 DC Amps).
Also i now have a HICUROFS2 wich occurs either a high speeds and high load. freezed data shows 294A on il1 an ~195A on il2.
As well as going from positive torque to regen.
I have basically the parameters from the release adapted to my car.
I'm thinking of switching back to 4.54FOC
Paul
I'm back with the smart for the week-end, i did the firmware upgrade 4.73,i have a lot more power now
Also i now have a HICUROFS2 wich occurs either a high speeds and high load. freezed data shows 294A on il1 an ~195A on il2.
As well as going from positive torque to regen.
I have basically the parameters from the release adapted to my car.
I'm thinking of switching back to 4.54FOC
Paul