You are here

Field Weakening

39 posts / 0 new
Last post
hexakopter
Offline
Last seen: 1 year 9 months ago
VESC Original
Joined: 2017-05-24 12:13
Posts: 94
Field Weakening

Already discussed in this thread: http://vedder.se/forums/viewtopic.php?t=639

Benjamin wrote in that thread that Field Weakenig is on his todo list, but I cant see it on the todo list available here http://vesc-project.com/node/110. Maybe that would be something to add to the list. smiley

ThierryGTLTS
Offline
Last seen: 6 years 3 months ago
Joined: 2017-09-06 14:18
Posts: 116

As far as I know it seems to be partly implemented, but I don't know how to use it.

Have a Nice Day.

Thierry

benjamin
Offline
Last seen: 1 week 6 days ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

Added to the todo list.

badger1666
Offline
Last seen: 1 year 3 months ago
Joined: 2017-11-11 13:08
Posts: 33

hi

any news on Field Weakening yet ?

thanks

C green

Maximilian Scherff
Offline
Last seen: 2 years 11 months ago
VESC Original
Joined: 2017-05-24 12:11
Posts: 3

Hi,

I'm also interested in field weakening. I build a dynastarter for a combustion engine.

In my application I need as much torque as possible from stand still (within restricted space available). This is why a higher number of windings is desirable. On the other hand, when the combustion engine is running at high revs the generated voltage can rise up too high, above supply voltage and the battery will be damaged.

I think field weakening could solve this problem. Or I'm wrong?

Max

Roger Wolff
Offline
Last seen: 2 years 6 months ago
VESC Original
Joined: 2017-05-24 12:27
Posts: 202

When the VESC encounters an error, it will stop driving all FETs and hope that this is a safe situation. When braking is required going down a hill, that may not be the best situation for the rider, but the electronics stays safe. 

 

This suddenly doesn't work when the motor can be driven at much higher speed than what the battery allows. The VESC uses 1.2 mOhm mosfets. At 50A the voltage drop will be about 60mV, so at 50A there will be about 3W of power dissipated. When the motor turns faster than the battery allows, the six mosfets will coincide with six diodes in a three fase bridge rectifier and start charging the battery. But now with a voltage drop of 0.6V, at 5A average you'll already hit the 3W power dissipation that the fets can handle without overheating..... 

When things go wrong, (you hit the reset on the CPU, hit reboot in the gui, a fault triggers anything) you blow up hardware..... 

 

field weakening is interesting when you have a low-inertia rotor that needs to go faster than the supply allows. 

hexakopter
Offline
Last seen: 1 year 9 months ago
VESC Original
Joined: 2017-05-24 12:13
Posts: 94

But why are a lot of ebike ESCs then use field weakening without blowing up? Just lucky that no faults happened in the period they are using a faster erpm then the normal battery max erpm or do they use special hardware preventing a blow up and dissipate the power in an other way? 

RSR
Offline
Last seen: 4 months 3 weeks ago
VESC Original
Joined: 2017-05-24 12:46
Posts: 38

The are at least 3 ways for fault handling during high speed field weakening

  1. disconnect the 3-phase -- so that the electronics will not be exposed to the high voltage -- sparks may occur (no good), cost $$$
  2. use components with higher voltage rating -- cost  $$$
  3. short circuit the 3-phase --  no extra costs -- often the preferred option

If a fault occurs at high speed, and the fault action is to output null vectors (all 3 phases to + or to Gnd), then the motor will do automatic field weakening.   High currents will occur when doing this, but it will not exceed Ichar=Lamda/Ld.  VESC firmware could easily calculate Ichar as a parameter during motor configuration, If Ichar is within safe range, then it could allow both high speed field weakening and null vectors as the default fault action.   

You can feel a high braking torque if you try to rotate by hand  a motor after connecting/shorting the 3 terminals.  It may feel like the braking torque will increase forever while trying to rotate it a higher speed, but it will not -- the torque will reach a peak, and the braking power (torque*rpm) will approach a constant value (P=R*Ichar^2) over a wide speed range -- constant power means that torque decreases as rpm increases. 

district9prawn
Offline
Last seen: 2 years 2 weeks ago
Joined: 2018-04-26 12:18
Posts: 123

I recently added a few lines of code to mcpwm_foc to implement field weakening. 

I set id_set_tmp based on the difference between iq_target and iq actual.

I also tried the lookup table method and manually recorded some data points of erpm and negative d axis current. I don't know much about programming so I just hard coded this table into mcpwm_foc and it also seems to work well enough. Some parts of the field weakening rpm curve are quite non linear, and I found it helpful to have a decent number of points defining the curve. 

Many ebike controllers have field weakening but I don't believe any of them use any proper method of fault handling. The manufacturers of most of these controllers simply recommend against running very high fw currents and speeds. Most users are on 20s or below, so there is a little headroom with 100v components. Also most of SPM motors don't field weaken that well anyway. The fw current needed to push way above the voltage limit probably prevents most users from killings things.

lux
Offline
Last seen: 1 month 1 week ago
VESC Free
Joined: 2019-01-15 13:48
Posts: 3

Hi

 

@benjamin:

Are there any plans to implement this feature? Do you need help with testing or could i do something else to speed up the process?

@district9prawn

could you describe more in detail what you did or could you even share code for testing?

 

I do have experience with STM32 software development but no idea of electronic engine control.

Best regards

Lux

paltatech
Offline
Last seen: 2 years 11 months ago
Joined: 2017-09-10 22:50
Posts: 33

lux, please take a look at this:

https://hackaday.io/project/164932-axiom-100kw-motor-controller/log/162931-field-weakening-support

Field Weakening support is getting closer!

sunsam8
Offline
Last seen: 1 year 3 months ago
Joined: 2018-04-02 13:27
Posts: 12

I like the plain notes on using field weakening.

I think a beefy diode paralell to the battery fuse is a must have to clamp the voltage in fault scenario.

bobfrank
Offline
Last seen: 5 years 1 month ago
Joined: 2019-04-23 09:43
Posts: 6

I think another option would be to be able to set a Max RPM/ERPM specific to field weakening, so that you can run your motor over speed, but not beyond the rating of the components used in the controller, eg, if you build a controller with 200v rated devices, but only run to a max pack voltage of 151.5v your field weakening would only let you get to an RPM that would result in your open circuit motor voltage being 199.9v (or less if you want). It should be reasonably safe provided you use avalanche rated switching devices, because your MOSFETs will only need to dissipate the 1/2 L I ^ 2 energy of the parasitic inductances, not the kinetic energy.

paltatech
Offline
Last seen: 2 years 11 months ago
Joined: 2017-09-10 22:50
Posts: 33

Yes, currently during FW we limit rpm to ( flux_linkage / Vinmax ).

lux
Offline
Last seen: 1 month 1 week ago
VESC Free
Joined: 2019-01-15 13:48
Posts: 3

Hello

thank all for they're work on this amazing project.

As I see it, the pull request hasn't been merged yet, right?

Could i do something to help? Maybe testing beta versions?

 

Best regards

gowrav
Offline
Last seen: 3 months 2 weeks ago
Joined: 2019-06-11 16:48
Posts: 17

Field Weakening blew the MOSFET on deceleration.
This is not a rant rather a way of sharing experience with FW/MPTA
> Following the discussion thread here https://github.com/vedderb/bldc/pull/91
I tried to implement the Field Weakening on my 6kw PMSM In runner on no load to achieve higher speeds.
The motor specs is as follows.

Poles : 8pole
Design Voltage : 60v
Operating Voltage : 48v
Design Current : 130Amps RMS
Operating Current : 100 Amps RMS
Nominal Speed : ~2300RPM @ 60v, ~1800kRPM @48v [Mechanical]
Nominal Speed : ~9kRPM @ 60v, ~7.0kRPM @48v [ERPM = Mechanical * Polepairs]

------------------

I was able to run the motor even upto 200Amps max current using the VESC75/300 board from TRAMPA
http://www.trampaboards.com/vesc--c-1434.html

After all the trials I decided to try the MTPA / Field Weakening to exploit the full motor power., with the known hazards and dangers of the Field Weakening I removed the load and kept the motor on noload condition to initially check the higher RPM and then put load as the suddent collapse of ID can fuel explosive energy of the MOSFETs.

I cloned the repos
https://github.com/powerdesigns/bldc/tree/FluxWeakening-MTPA-support
https://github.com/powerdesigns/vesc_tool/tree/FW_MTPA_support
modified the configuration and built the binaries to fit the board which in my case is

//#define HW_SOURCE "hw_75_300.c"
//#define HW_HEADER "hw_75_300.h"


I got the proper parameters for the motor as shown below...although I am a bit skeptical why the Ld and Lq are 20 ...!

I have used sensored FOC till 4000 ERPM to have good starting torque

 

MTPA / FW was enabled with default parameters
 

Current was limited to 90Amps as that would be sufficent for field weakening with -10amps for regenerative breaking

 

Both forward and reverse ERPM was limited to 10k
 

Once I ran the motor this was the response

... I started at 5000 RPM and then used the VESC tool to increase the RPM to 7000 and then to 10000.,
as can be seen in the picture below the ID didn't actually deviate significantly but rather stayed with an average 0 Amps.

but the sound of the motor became sharper and sharper showing the speed increase with 95% duty cycle remaining constant on speed change.

after a minute of this I clicked on STOP to bring the motor to a halt., which on the click fried the MOSFET s

the driver, controller and the rest of MOSFETs seems to be okay on the glance but needs careful testing

 

The controller UART link with the VESC tools got disconnected when the MOSFET failed.,
So here is the dilemma since the 10000 ERPM brings the regenerated voltage to < 70v which is within the boards [MOSFET] safety limits., why did the MOSFET burn on stopping the motor.

can i replace all the MOSFETs on the board with IRF7769L1TRPbF which can withstand voltage fluctuations till 100v .
https://www.infineon.com/dgdl/Infineon-IRF7769L1-DS-v02_00-EN.pdf?fileId...
although package current is limited to 124Amps ., having 3 in parallel should be more than sufficient to achieve peak current of 200amps.

here is the RPM graph which also failed to show the higher RPM for some reason and shows the sharp declination of motor speed on stopping it .., before disconnecting completely

and the MOSFETs temperature...at this point it was hardly drawing any current from the battery... the Motor doesn't have any temp sensor so the plot can be ignored.

What should I do now to ensure safer ways to test and implement field weakening.??
I want to try the Field weakeing with VESC6plus until I could source and replace MOSFETs on the 300amps board.,  suggestions would be really helpful...
Would the virtual motor be of any importance in this test ?

 

GL

gowrav
Offline
Last seen: 3 months 2 weeks ago
Joined: 2019-06-11 16:48
Posts: 17

The variation of duty cycle can be seen below.

 

 

 

GL

Addy
Offline
Last seen: 6 months 2 weeks ago
Joined: 2017-09-06 01:53
Posts: 13

Thanks for sharing your experience. I don't know if it's just me, but I can't see any of the pictures you've posted. Can you check your sharing settings to make sure everyone can see the pictures? 

paltatech
Offline
Last seen: 2 years 11 months ago
Joined: 2017-09-10 22:50
Posts: 33

I can't see the images either...

gowrav
Offline
Last seen: 3 months 2 weeks ago
Joined: 2019-06-11 16:48
Posts: 17

Team thanks for the quick response and pointing out the issue with the pics...
I have updated the post ... hope its visible now...
https://vesc-project.com/comment/3801#comment-3801

GL

gowrav
Offline
Last seen: 3 months 2 weeks ago
Joined: 2019-06-11 16:48
Posts: 17

GL

maxicor88
Offline
Last seen: 1 year 10 months ago
Joined: 2019-08-01 01:15
Posts: 6

Hello gowrav, 

Thanks for reporting your experience sad. Its very helpful you have saved all those pictures, as I can try to replicate that configuration in virtual motor mode, and see what might happen and how to deal with that.

First of all, I did not try to add the motor configuration with the Wizard (as I think you did). I always load the configuration manually using the buttons available in the FOC window. So I programmed vesc-tool to make inductances Ld and Lq to match the L inductance (in a PMSM they are the same) when I pressed the "Apply" button. I did not realized that there was other place (using the Wizard config) where the L inductance was calculated, so that was why you saw that they were different. 

I don't think that can make a big issue, because that only makes the current regulator to try to act in advance (axis decoupling), but it is a detail to modify.

Besides, you say that you heard the motor spinning faster when duty was at 95%, but in the graph of RPM it did not show it was increasing. Are you sure it was actually spinning faster?

Thanks

Maxi

 

Maxi

artteth
artteth's picture
Offline
Last seen: 2 months 1 week ago
VESC FreeVESC Original
Joined: 2017-09-05 00:48
Posts: 12

can you help me and compile this vesc tool to work on mac?
i want to test Field Weakening and i will write my results
thanks

gowrav
Offline
Last seen: 3 months 2 weeks ago
Joined: 2019-06-11 16:48
Posts: 17

Hey Maxi,

Thanks for the followup,
Your assumption and comment on the Inductance is valid, I needed the confirmation on the same.
The Inductance values from our simulation is supposed to be around 135uH..

This used to be properly identified by TI Instaspin using Wizard mode. [Identified Motor Parameters are in the green box]

 

Since the VESC Tool identifies the Inductance as 70uH is there a calculation that I am missing here or should I manually set this to the design values ?

I too decided to try with virtual motor but the ERPM mismatch compared to the real thing has stalled me there...https://github.com/vedderb/bldc/pull/82#issuecomment-515680414

I am very confident about the higher speeds as the pitch of the motor hum while spinning kept on increasing with newly set ERPM steps.., I am yet to receive new set of components for replacement however I can try the same with the VESC6+ within a reasonable ERPM change and measure the same using a handheld tachometer.

I believe a manually controlled ramp down will do the job for now..

BR,
Gowrav

 

GL

gowrav
Offline
Last seen: 3 months 2 weeks ago
Joined: 2019-06-11 16:48
Posts: 17

As of today there is an official build for MACOS from Vedder
https://github.com/vedderb/vesc_tool/blob/master/build_macos
you should be able to use the same Makefile to build it against the Field Weakening version
https://github.com/powerdesigns/vesc_tool/tree/FW_MTPA_support

just ensure you have the right branch [FW_MTPA_support] and not the MASTER checked out from the repo.

GL

slomobile
Offline
Last seen: 3 months 3 weeks ago
Joined: 2019-12-14 04:22
Posts: 1

Field Weakening is a feature I plan to use heavily.  My use case is described here.  The short version is overspeeding e-bike wheels to 90mph, abuse plain and simple.  I doubt Field Weakening will be enough to protect my batteries, so I also want Dynamic Resistor Braking.  I cannot think of any use case for dynamic braking that would not also benefit from field weakening so I propose it here as a potential TODO.

I am brand new here so there are many things I am not up to speed on.  My naive vision for dynamic braking seems like it could possibly be implemented completely outside VESC but would benefit from integration, or at least communication. 

A program in an add on module physically close to battery, monitors battery voltage.  If rate of rise suggests overvolt is immenent, short B+ to B- through nichrome wire until Bat voltage falls below hysteresis cut out voltage.  If voltage fails to fall by short timeout, or continues rise, switch in additional resistive loads.  Perhaps a few resisters switched by mosfet for high speed and one or more switched by relay for lowspeed redundancy.

If Dynamic Braking module is able to communicate w/VESC, and VESC is aware module is present and active, Field Weakening routines could trigger the OvervoltImminent signal and VESC could forestall some undesirable protection behavior.

Would such a dynamic braking module damage VESC?  Would it even work?

district9prawn
Offline
Last seen: 2 years 2 weeks ago
Joined: 2018-04-26 12:18
Posts: 123

When you are field weakening heavily, I'd be concerned about the controllers but not the battery. On the battery you have the fuse as well as current and voltage limits.

dk-odense
Offline
Last seen: 1 year 9 months ago
Joined: 2017-09-06 08:01
Posts: 8

I personally think Benjamin needs to prioritize field Weakening. My buddy's ESC is a cheap China ESC, which greatly outperforms my vesc75/300 in top speed big time, because his ESC supports field weakening.

He has about 40% higher top speed with the same motor, gear ratio and battery voltage as me. That's massive, and I am considering to skip the vesc for a China ESC 😩

It has been on vedders to-do since 2017 so maybe this needs some priority?

TheFallen
Offline
Last seen: 1 month 3 days ago
VESC FreeVESC Original
Joined: 2017-09-11 11:46
Posts: 222

Hey Benjamin/Frank, quick bump, I'm extremely interested in field weakening, any news?

Also @dk-odense what Chinese ESC was this?

district9prawn
Offline
Last seen: 2 years 2 weeks ago
Joined: 2018-04-26 12:18
Posts: 123

I have been playing around with field weakening on the vesc on my ebike for a few weeks now. D current is calculated from motor parameters and speed.

I've got it working so that if I brake or release the throttle at high speed, the field weakening is also active as necessary.

See the branch on my github fork. https://github.com/district9prawn/bldc/tree/field_weakening

 

SVM
Offline
Last seen: 4 years 2 months ago
Joined: 2020-09-23 21:35
Posts: 2

Hello everyone, I'm new in this forum but not to the topic. I noticed something that may be missing in the field weakening function.

In mcpwm_foc.c in the function correct_hall(), the angle offset due to i_d and i_q (or position misalignment between rotor field and air-gap field) is not taken into consideration. It may explain why field weakening with Hall sensors leads to a higher speed than in sensorless mode as reported by one beta tester.

This must be considered in particular if you use MPTA. Otherwise a high q-current generates an offset in the calculated angle from Hall signals. It results in field-weakening operation even if the control sets i_d = 0. The Halls measure the resulting air-gap field but FOC needs rotor field only!

The best way to investigate the problem is to drive a motor which has both Hall-sensors and an external encoder and check the angle difference at high q-current. The correction required looks like atan2( Lq*iq, phi_PM + Ld*id) but the Ld and Lq are not the ones for air-gap fields since the Hall are closer to the stator than the rotor. It is however a good starting point for proper tuning.

For the angle extrapolation from Halls, I also used to implement these kinds of first-order extrapolators until I found a paper decribing a PLL with PI control for low resolution Encoder. Unfortunately I can't find the paper anymore. It was from Robert Lorentz I think. It is way more elegant to implement and has not the low speed "if then else" required by the first order extrapolator. If interested, I can share my software.

Regards and thank you for your amazing open source software, Gael

eptv
Offline
Last seen: 1 month 3 weeks ago
VESC Original
Joined: 2018-10-21 21:20
Posts: 35

I am extremely interested in the feature released in the spring. Ready to sponsor development. Benjamin, please inform me how it's possible to help speed up to implement FW.

Ba1tuks
Offline
Last seen: 2 years 7 months ago
VESC Original
Joined: 2019-08-12 19:21
Posts: 3

Benjamin, your controllers are really good. Biggest flaws are lack of proper input protection(don't even ask how many time I've been "burned" because UART and ADC pins are directly connected to MCU), and Field Weakening. I hope new ones (100V) have input protection and will have FW in near future. For now - sticking to nucular drives for my builds, despite your firmware and PC/Bluetooth applications kicking butt and being leaps and bound better than nuculars(don't have any, just the dash/computer :-DD) . Just love Vesc Bluetooth app and miss it every time!

I hope this VESC project won't fail and you are making decent money from this. The versatility of open-source(at least firmware) and ability to make your own controller add-ons(made custom lighting controller and dashboard interfacing with VESC via UART and custom app) is really cool. 

Kick ASS e-scooter builder :-)

benjamin
Offline
Last seen: 1 week 6 days ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

I will have a look and try to get something into the current dev branch.

benjamin
Offline
Last seen: 1 week 6 days ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

First attempt is now in the dev-branch and some builds are available here:

https://vesc-project.com/node/2859

Here is a discussion about it:

https://github.com/vedderb/bldc/pull/91

Be _very_ careful when testing, as it is easy to get hurt and to damage hardware. Let me know how it works!

 

TechAUmNu
Offline
Last seen: 3 months 1 week ago
Joined: 2017-09-22 01:27
Posts: 575

I can't get this do any anything. Changing the settings doesn't make any difference and always goes to the same erpm. Is there some condition or limitation here?
Running with my a50s which is dual low side with current and phase filters. 

 

 

config here: https://drive.google.com/file/d/1WSUOCd36cYzi0YsUei0XepNvslT954cj/view?u...

TechAUmNu
Offline
Last seen: 3 months 1 week ago
Joined: 2017-09-22 01:27
Posts: 575

Actually I just got it to work, not entirely sure why it wasn't working before!

district9prawn
Offline
Last seen: 2 years 2 weeks ago
Joined: 2018-04-26 12:18
Posts: 123

It worked well for me with a 6374 on the bench. I can see that when letting off the throttle suddenly or braking while in field weakening, the d axis current is maintained and the winding voltage stays at safe levels.

DeuceDos
Offline
Last seen: 5 months 1 week ago
VESC Free
Joined: 2021-05-15 13:09
Posts: 2

What does your buddy have? Did you ever get to run FW?

DD