## Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Show off your E-bike creation here.
Alan B   100 GW

Posts: 7728
Joined: Sep 11 2010 7:43am
Location: San Francisco Bay Area, USA
Contact:

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Timing advance is a different way of looking at id and iq.

If you consider the id and iq torque are at 90 degrees to each other, and you put a a constant current on one axis and rotate it to the other axis, it would be an advance (positive or negative). As with any vector quantity it can be looked at in polar (magnitude and angle) or projected onto the axes and looked at as two separate currents, one on each axis.

So they are just different ways of looking at the same current vector.

coleasterling   100 W

Posts: 229
Joined: Sep 21 2010 3:37am

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

fpvdude wrote:
Aug 16 2018 4:16pm
Heres a cool blog article on some stall testing a friend of mine did. http://build-its-inprogress.blogspot.co ... stand.html

Also, what IPMs have you driven sensorless, and with what controller? If I make some electric boat or something and don't want to make my own controller, I'd be OK with the loss of 20% stall torque and no field weakening. I was playing around with sensorless code on this controller, but didn't get that far.
Thanks for the info! I'm surprised it is so low, as well. I would take that to mean that driving it conventionally, is feasible.

I'll check that out!

This was only for testing motor function in a binary sense...Is it blown up, or not? Nothing fancy or high-power. I use an RC controller when I get a salvage transaxle in for that. It has never had an issue spinning them. I've done it with a couple HVH250's, Prius MG1 and MG2, and a couple smaller motors (AC compressor from the Tahoe Hybrid, was one, actually.)

fpvdude   1 mW

Posts: 19
Joined: May 29 2018 5:51pm

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Aug 17 2018 6:18am
Regarding the text of the testing the sum of the amps going into the motor stayed the same at 180A (is that right?, it looks a bit more?), but the torque increased from about 35Nm to 58Nm somewhere in the middle by just shifting the angle.
Yep, pretty much. I believe the test was done at 180A. One thing to note though is that it was not the sum of the currents, but the total magnitude, so sqrt(D^2 + Q^2). And yep magic torque increase just for doing this!
Aug 17 2018 6:18am
This means on IPM motors the speed AND torque can be gained when shifting the angle of the current supply , while on motors which have surface mounted magnets SMPM, only speed can be gained and no torque. No torque because a rotor with SMPM seems to not have any reluctance torque.
Sort of- you can use additional D current to both generate reluctance torque and do field weakening. However the laws of physics are never violated, its not magic torque that comes out of nowhere. Additionally, the relationship between PM torque, reluctance torque, and field weakening is a careful balance. Its not like "put a crapton of D axis current and everything gets better" lol.
Aug 17 2018 6:18am
I wonder what it needs to make a normal controller to apply current in the D-axis. Would a "timing advance" do the same, or is this something entirely different?
A timing advance would accomplish the same goal, I THINK. I'm not entirely sure, but I believe so. I've thought of making a hall sensor pass through thing that changes the timing, but its easier to just do it in software.

fpvdude   1 mW

Posts: 19
Joined: May 29 2018 5:51pm

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

coleasterling wrote:
Aug 17 2018 11:55am
This was only for testing motor function in a binary sense...Is it blown up, or not? Nothing fancy or high-power. I use an RC controller when I get a salvage transaxle in for that. It has never had an issue spinning them. I've done it with a couple HVH250's, Prius MG1 and MG2, and a couple smaller motors (AC compressor from the Tahoe Hybrid, was one, actually.)
I see, good to know that a standard RC controller can at least spin it.
Do you work at a junkyard or something? Do you still have the Tahoe compressor? Did you ever open it up? If not, you should, and post some pics!!

Posts: 2988
Joined: May 27 2013 2:02am
Location: Austria

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

fpvdude wrote:
Aug 19 2018 6:17pm
Yep, pretty much. I believe the test was done at 180A. One thing to note though is that it was not the sum of the currents, but the total magnitude, so sqrt(D^2 + Q^2). And yep magic torque increase just for doing this!
makes sense. Thanks for the explaination!
Sort of- you can use additional D current to both generate reluctance torque and do field weakening. However the laws of physics are never violated, its not magic torque that comes out of nowhere. Additionally, the relationship between PM torque, reluctance torque, and field weakening is a careful balance. Its not like "put a crapton of D axis current and everything gets better" lol.
Yes it seems that it will be hard to find out the optimal D-axis current (or phase shift) on a given IPM motor without putting the motor on a test bench or dyno.
- 10kW belt drive with Neumotor 8057: [url]viewtopic.php?
- KTM Hardtail Pedelec / eZee V2 6T / 27,5" / Kelly KBSX @ 1,5kW / Torque PAS / CA-V3 / 13s4p Sanyo GA in Shark case

coleasterling   100 W

Posts: 229
Joined: Sep 21 2010 3:37am

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

fpvdude wrote:
Aug 19 2018 6:19pm
I see, good to know that a standard RC controller can at least spin it.

Do you work at a junkyard or something? Do you still have the Tahoe compressor? Did you ever open it up? If not, you should, and post some pics!!
Ha, no junkyard (unless you count my scrap pile!). I own a company that does turnkey product development and have an interest in re purposing salvage vehicle motors. My intent is to develop a line of motors and matched controllers for go karts, ebikes, e-motorcycles, etc...I have a few large CNC machines (50 Taper mill, 40 taper - 4 axis mill, 2 axis lathe) and do tons of prototyping, so this is just another prototyping job as far as the manufacturing side is concerned.

I wish I would have taken some pictures of it. It is a nice IPM package with integrated controller, meant for 300V operation. The controller is potted and impossible to interface with and very difficult to remove, unfortunately. I probably could have removed the stator, but decided against it. The rotor is fitted with counterweights for the scroll and not very friendly to work with, either. I ended up scrapping it and all I have left is the scroll, sadly.

coleasterling   100 W

Posts: 229
Joined: Sep 21 2010 3:37am

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

fpvdude wrote:
Aug 19 2018 6:17pm
Aug 17 2018 6:18am
Regarding the text of the testing the sum of the amps going into the motor stayed the same at 180A (is that right?, it looks a bit more?), but the torque increased from about 35Nm to 58Nm somewhere in the middle by just shifting the angle.
Yep, pretty much. I believe the test was done at 180A. One thing to note though is that it was not the sum of the currents, but the total magnitude, so sqrt(D^2 + Q^2). And yep magic torque increase just for doing this!
Aug 17 2018 6:18am
This means on IPM motors the speed AND torque can be gained when shifting the angle of the current supply , while on motors which have surface mounted magnets SMPM, only speed can be gained and no torque. No torque because a rotor with SMPM seems to not have any reluctance torque.
Sort of- you can use additional D current to both generate reluctance torque and do field weakening. However the laws of physics are never violated, its not magic torque that comes out of nowhere. Additionally, the relationship between PM torque, reluctance torque, and field weakening is a careful balance. Its not like "put a crapton of D axis current and everything gets better" lol.
Aug 17 2018 6:18am
I wonder what it needs to make a normal controller to apply current in the D-axis. Would a "timing advance" do the same, or is this something entirely different?
A timing advance would accomplish the same goal, I THINK. I'm not entirely sure, but I believe so. I've thought of making a hall sensor pass through thing that changes the timing, but its easier to just do it in software.

So looking through your stall testing, did you do it at different currents? I've read the optimal angle varies with both current and rpm. We (ES) have had discussion about how to best drive IPM's before, and one of the suggestions was to implement a lookup table, similar to injector pulse width if you're tuning a car Alpha-N. Any thoughts on that?

fpvdude   1 mW

Posts: 19
Joined: May 29 2018 5:51pm

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

I made a lookup table to drive this motor. Unfortunately at least some type of lookup table is more or less mandatory.
The current lookup table is not great, but yields acceptable performance with only a bit of voltage saturation. I'm still in the process of making a good lookup table, was working on that last night.

Not sure what of this information you know already, but I'll describe the complete procedure of what I've done so far:
IPM motors need a certain amount of Q and D current to operate properly. These currents depend on the phase resistance (same for D and Q), the phase inductances (different for D and Q, thats what generates reluctance torque), the flux linkage (effectively the Kv) and the battery voltage. Matters are complicated by the fact that the inductances can saturate, leaving you with reduced reluctance torque.

There are a lot of steps to making the lookup table.
The simplest test that was run first was the stall test. We mounted the motor to a friend's dyno and spun it at about 100RPM to get rid of any cogging effects. This test can also be done stationary as in the post on that same friends blog several posts ago, but should be repeated at several positions.

This data was used to generate a lookup table for stall and low speeds.

So, stall table for low speeds, down. Unfortunately the higher speed tests are much, much harder....
That dyno couldn't do the high speeds which we needed, so we tried more analytical methods to make the lookup table. The most basic test is to just put the motor on your bike and ride it around while logging currents and voltages. From the logged data, the inductances can be solved for in MATLAB with just a least-squares regression. The inductances are the real hard thing to get right, as the "d axis inductance" is only kind of measureable, and only sort of exists in real life. The best way to observe the inductances is to use your setup to measure itself, that way any measurement biases are inherently compensated for.

This lookup table generator takes in the resistance, phase inductances, battery voltage, and flux linkage, and spits out these lookup tables. I'm now about 80% sure these lookup tables are wrong unfortunately due to wrong inductances

Last night I was doing some inductance measurement on the Q axis. Unfortunately it looks like the Q axis saturates pretty heavily at high currents. Turn up the volume on this video!!

The Q axis saturates a lot harder than expected. I am doing this testing because I realized that I should be getting a lot more reluctance torque than I actually am- 20% is quite low. I realized that this might be because the Q axis is saturating, meaning it would have an inductance closer to that of the D axis. This seems to be the case, but more testing is necessary to confirm these findings.

coleasterling   100 W

Posts: 229
Joined: Sep 21 2010 3:37am

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Very interesting! My somewhat uninformed thoughts on the lookup table were much more simple. Instead of commanding D & Q currents directly, the table would consist of load (throttle),rpm, and timing advance, with the assumption that timing advance is the real-world manifestation of D-axis current. Similar again to Alpha-n tuning, you'd put the motor on a dyno capable of running through the entire rev range and tune timing at each load and RPM point you specify for peak torque.

fpvdude   1 mW

Posts: 19
Joined: May 29 2018 5:51pm

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Unfortunately just a phase advance is not enough information to fully define the system. For example think what happens at high speed at zero throttle- even though you are commanding zero throttle, some amount of D axis current is necessary to keep the motor from regen braking ultra hard. I solved this problem with a separate D and Q axis lookup table, but I guess an equally viable solution would be phase advance table as well as extra D current lookup table.

I wish just a phase advance was all it took, unfortunately not
At least its a good project where you really have to build a detailed model that takes into account a TON of different factors. Its pretty cool IMHO.

coleasterling   100 W

Posts: 229
Joined: Sep 21 2010 3:37am

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Is that assuming you've entered the field weakening region? I wouldn't think it would be an issue until then?

fpvdude   1 mW

Posts: 19
Joined: May 29 2018 5:51pm

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

coleasterling wrote:
Aug 21 2018 4:34pm
Is that assuming you've entered the field weakening region? I wouldn't think it would be an issue until then?
Yep. However, the reason an IPM is good is because it can do field weakening very effieciently. Without field weakening, my bike's top speed would be limited to only about 17mph, pretty lame for an electric bike.

Usually, an SPM (surface permanent magnet) motor is operated without field weakening, with the field weakening reserved for short high-speed bursts. Field weakening will buy you 50% extra speed, maybe double, but very inefficiently on an SPM. This is not the case in an IPM. A good general target for an IPM is to have your base speed (the speed you could reach without any field weakening) at about 1/2 to 1/3 of your top speed. Then, you field weaken to get more top speed when you want it, and the IPM will do so with good efficiency. If you gear your motor for one half of top speed, you effectively double your low-end torque, but with the great field weakening you can still get to high speeds.

I will be doing a lot of modeling over the next couple weeks to try and extract even more performance out of this motor. We'll see how it goes!

StuRat   100 W

Posts: 121
Joined: Mar 15 2018 7:18pm

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Fpvdude, you are cool and I only understand every second word you say.

How is the bike going? Any plans to sell... the bike... the motors?

district9prawn   100 W

Posts: 272
Joined: Jul 20 2013 10:46pm
Location: Sydney

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

fpvdude wrote:
Aug 22 2018 11:50am

Yep. However, the reason an IPM is good is because it can do field weakening very effieciently. Without field weakening, my bike's top speed would be limited to only about 17mph, pretty lame for an electric bike.
So if you were to coast at 30mph with no field weakening currents, does this mean you could blow your controller or expose it to high voltages?
Neu 8057 6kW left hand drive hardtail with 18 fet Vesc: viewtopic.php?f=6&t=96754

redline2097   100 W

Posts: 165
Joined: Jun 18 2015 1:43am

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

We are making E-Kart prototype with IPM motor. We need the best available acceleration from 40 to 60kmh, top speed would be 80kmh. Is it better to gear it to 80kmh without Flux weakening or gear it to 40-50kmh and apply field weakening to go up to 80kmh. Which scenario has the best acceleration in needed acceleration range. Standstill acceleration is not very important.

billvon   100 MW

Posts: 2980
Joined: Sep 16 2007 9:53pm
Location: san diego

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

district9prawn wrote:
Oct 24 2018 7:05pm
So if you were to coast at 30mph with no field weakening currents, does this mean you could blow your controller or expose it to high voltages?
That is possible but unlikely. You would not see overvoltage because the diodes would freewheel and direct the current to the battery. However, it is possible to overcurrent the diodes and damage the inverter that way if the current went on for too long.
--bill von

Posts: 2988
Joined: May 27 2013 2:02am
Location: Austria

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

billvon wrote:
Nov 13 2018 3:38pm
district9prawn wrote:
Oct 24 2018 7:05pm
So if you were to coast at 30mph with no field weakening currents, does this mean you could blow your controller or expose it to high voltages?
That is possible but unlikely. You would not see overvoltage because the diodes would freewheel and direct the current to the battery. However, it is possible to overcurrent the diodes and damage the inverter that way if the current went on for too long.
Tank you for bringing this up.
If i look on the circuit diagram of a power stage, if BEMF is going up above battery voltage it should work like a bridge rectifier and would charge your battery. This would stress the diodes but it should not hurt the Mosfet's itself (in terms of max voltage rating).

Would this also be the case if the controller is using synchronuous rectification? I think it would be but i am not sure..

billvon   100 MW

Posts: 2980
Joined: Sep 16 2007 9:53pm
Location: san diego

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Nov 14 2018 6:13am
If i look on the circuit diagram of a power stage, if BEMF is going up above battery voltage it should work like a bridge rectifier and would charge your battery. This would stress the diodes but it should not hurt the Mosfet's itself (in terms of max voltage rating).
Yes, with a minor caveat - in most cases the diodes ARE the MOSFETs.
Would this also be the case if the controller is using synchronuous rectification? I think it would be but i am not sure..
The current stress would be the same. The thermal stress would be lower due to lower heating loads.
--bill von

liveforphysics   100 GW

Posts: 14134
Joined: Oct 29 2008 1:48am
Location: Santa Cruz, CA, USA

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

I don't know how I missed this thread until now. Wow!

You are a rockstar Fpvdude!

Lowest effort and lowest performance way to build your IPM tables at higher RPMs may be a woodworking router motor. They should run fine on DC for speed control, and some achieve 18krpm+

More effort, but a second of the same AC pump motor used as a dyno load/drive also should work.

Thank you for this tremendous project and congratulations on your controller design and skills to run that motor so hard. It would be a dog turd of a motor without your clever controller work.
fpvdude wrote:
Aug 20 2018 4:57pm
I made a lookup table to drive this motor. Unfortunately at least some type of lookup table is more or less mandatory.
The current lookup table is not great, but yields acceptable performance with only a bit of voltage saturation. I'm still in the process of making a good lookup table, was working on that last night.

Not sure what of this information you know already, but I'll describe the complete procedure of what I've done so far:
IPM motors need a certain amount of Q and D current to operate properly. These currents depend on the phase resistance (same for D and Q), the phase inductances (different for D and Q, thats what generates reluctance torque), the flux linkage (effectively the Kv) and the battery voltage. Matters are complicated by the fact that the inductances can saturate, leaving you with reduced reluctance torque.

There are a lot of steps to making the lookup table.
The simplest test that was run first was the stall test. We mounted the motor to a friend's dyno and spun it at about 100RPM to get rid of any cogging effects. This test can also be done stationary as in the post on that same friends blog several posts ago, but should be repeated at several positions.

This data was used to generate a lookup table for stall and low speeds.

So, stall table for low speeds, down. Unfortunately the higher speed tests are much, much harder....
That dyno couldn't do the high speeds which we needed, so we tried more analytical methods to make the lookup table. The most basic test is to just put the motor on your bike and ride it around while logging currents and voltages. From the logged data, the inductances can be solved for in MATLAB with just a least-squares regression. The inductances are the real hard thing to get right, as the "d axis inductance" is only kind of measureable, and only sort of exists in real life. The best way to observe the inductances is to use your setup to measure itself, that way any measurement biases are inherently compensated for.

This lookup table generator takes in the resistance, phase inductances, battery voltage, and flux linkage, and spits out these lookup tables. I'm now about 80% sure these lookup tables are wrong unfortunately due to wrong inductances

Last night I was doing some inductance measurement on the Q axis. Unfortunately it looks like the Q axis saturates pretty heavily at high currents. Turn up the volume on this video!!

The Q axis saturates a lot harder than expected. I am doing this testing because I realized that I should be getting a lot more reluctance torque than I actually am- 20% is quite low. I realized that this might be because the Q axis is saturating, meaning it would have an inductance closer to that of the D axis. This seems to be the case, but more testing is necessary to confirm these findings.
Each carcinogen vapor exposure includes a dice roll for cancer.

Each mutagen vapor exposure includes a dice roll for reproductive genetic defects in your children.

Each engine start sprays them into a shared atmosphere which includes beings not offered an opportunity to consent accepting these cancer experiences and defective genetics life experiences.

Every post is a free gift to the collective of minds composing the living bleeding edge of LEV development on our spaceship.

fpvdude   1 mW

Posts: 19
Joined: May 29 2018 5:51pm

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Hey all,
Its time to get back into this project... got a few upgrades in the works. The plan is to first make the bike more aesthetically pleasing and then further push performance.

First step is to fix the current trashpile electronics stack. Currently the motor controller is weatherproofed with just a "healthy" load of electrical tape, and the data logger is just taped on top of that as well with a paper towel in between.

Here is the current stack:

The plan is to condense the motor controller and data logger into one small "electronics module" which is packaged nicely.

Here is the old controller (left) and new controller (right). The new controller uses a smaller IGBT brick and 2x 10uf capacitors instead of 4 4.7uf capacitors.

New controller has nice little standoffs to mount the data logger on. This board had a few issues though so I am sending out for a new one.

Also, two days ago I finally put "odometer mode" firmware on it. I took the bike out for a 17-ish mile test ride and then a 0.76 mile calibration ride (measured on google earth between two manhole covers). Apparently the motor spun a total of 354,275 revolutions, which corresponds to 17.86 miles of riding. Pretty insane that the motor turns so many times.

The bike has now been running for just over a year, and I think I've put somewhere between 300 and 500 miles on it. Despite its incredible sketchyness, somehow it has never failed during a ride even once. It is still a joy to ride, and hopefully will get even better as I continue to make upgrades.

thundercamel   1 kW

Posts: 318
Joined: Jul 23 2018 2:58pm
Location: Round Lake, Illinois

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Glad to hear you've gotten a lot of usage out of it!
My Ebike builds - Existing bikes, affordable motor kits, self built 14s6p batteries - Now with more recumbent!

kiwifiat   100 W

Posts: 159
Joined: Mar 16 2013 5:49pm

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

blog_security.PNG (32.61 KiB) Viewed 916 times
Do you have any plans to open source your controller? Keep up the great work.
“You never know if quotes on the internet are genuine.” - Abraham Lincoln

amberwolf   100 GW

Posts: 28299
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

That particular message I've seen before on sites that have been suspended by the provider for whatever reason.

fpvdude   1 mW

Posts: 19
Joined: May 29 2018 5:51pm

### Re: Toyota Prius A/C Compressor Motorbike: The Bike of IPM Motor Science

Google and bing were for some reason very aggressively crawling the site- I'm currently trying to get it back, should be back online in a few days.

Regarding open sourcing this stuff, I'm not sure. I'll be graduating from grad school in about a year, and was thinking of turning this all into a company as a few people have expressed interest in purchasing this power system. The hard part though is that these motors only really work well at high voltages, which is a bit scary. Not sure what to do about that. Any thoughts?

kiwifiat   100 W

Posts: 159
Joined: Mar 16 2013 5:49pm