DIY Electric Car Forums banner
1 - 20 of 145 Posts

·
Registered
Joined
·
482 Posts
Discussion Starter · #1 ·
This is a spin off thread from this thread.
http://www.diyelectriccar.com/forums/showthread.php/highlander-hybrid-and-prius-motors-86829.html

It seems that there are several of us exploring using salvaged Toyota internal permanent magnet motors and Power inverters in our EV conversions but the motors and power electronics only have value if we can get a working controller.

There is a lot of information out there. Hopefully this thread will help some of us towards getting a working controller.

The current discussion is in regards to hacking the built in resolver for the needed rotor position feedback but feel free to add any information that you have regarding the control of these types of motors.

General theory is ok but more specific examples or experiments is preferred.

Here is a quote from one of the later posts
I will explore multiple methods. You got me thinking about what would be needed to drive the resolver directly and decode it right along with my motor current regulation attempts.

I don't know what you mean by "truly open" but I love to have somewhere that I can bounce my ideas. I am not sure what the outcome so I do not make claims or predictions of what fruits it will bare. My signature states that my project requires a custom ECU for the Prius Inverter so yes we may have a common goal. There are others trying to use these motors but are not as vocal. I am sure they will be lurking.

After I asked you about the resolver drive signals, I did some searching and came to this site
http://www.tamagawa-seiki.com/english/lvdt/post.html

I think Toyota uses one of these "Singlsyn" models. This gave me a rough idea of the input impedance, frequency, and transfer ratio.

Here is a sketch of my resolver excitation driver circuit. I am planning to drive the two opposing sine wave inputs (D_EXEC, D_nEXC) from the two DACs on my uP board. Resolution TBD.
View attachment 16654

My uP board is 3.3V so I centered my DAC sin outputs at 1.65V +/- 1V. The opamps shift, amplify (4x), and smooth. This results in a differential output of 16Vp-p. I am only using positive voltage supplies. See my simulation: (click on image to expand)
View attachment 16655

I am going to measure the SIN and COS returns using a AD7609 which I am also using to measure the motor phase currents. It can simultaneously sample and converter 8 differential measurements. Once I get this hardware spun up I can start hacking on some code.

Is that open source enough for you? I would post this in the "Toyota IPM Motor Control Design Details Thread" if you had one:)
Jeff

Jeff
 

·
Registered
Joined
·
482 Posts
Discussion Starter · #2 ·
I have gotten several private messages lately from people that are installing these motors or considering installing them.

Prius, Camry, Highlander, Lexus, etc. All pretty much the same from a control point of view.

We all seem to be in the same boat not having a robust control solution at the moment.

Please introduce yourself in this thread so we can all get an idea of how many(or few) of us are working to the same goal.

This may take several skill sets to make this thing a reality.

Best Regards
Jeff
 

·
Registered
Joined
·
4,458 Posts
I can't contribute anything meaningful to the controller development, unless you need CAD for the housing, but I am considering using a Highlander motor on my e-bike. I think my needs (180-250kW) are going to be outside those of the average DIY'er, so I'm not so sure what's developed here will work for me. I am subscribed and taking notes though... ;)
 

·
Registered
Joined
·
482 Posts
Discussion Starter · #4 ·
I just did this video of one my current regulation experiments using the Prius inverter.


I am in the process of laying out a PCB for the Arduino Due. This new shield will have the ADC chip on board so I won't need the plug in board you see in the video. I add provisions for using the built in resolver in the Prius motor for getting rotor position. I also added a CAN bus transceiver and some connectors for my BMS design. You can notice I left the 96pin connector for plugging in some of the Analog Devices EVAL boards as a fall back plan and for testing purposes. I already have a Resolver to Digital board that can plug into that 96pin connector so I can compare my angle calculations with it.
Electronic engineering Electronics Electronic component Circuit component Electrical network



Thanks
Jeff
 

·
Registered
Joined
·
482 Posts
Discussion Starter · #6 ·
In my previous video the current sensor output was very noisy. Here is the same signal with respect to the analog reference coming from the inverter.

The red trace is the differential signal representing the phase current.
Electronic device Electronics Technology Oscilloscope Multimedia
 

·
Registered
Joined
·
482 Posts
Discussion Starter · #7 ·
I enjoyed reading this guys Thesis on the 2004 Toyota Prius drive systems


I took some notes:

- motor to wheel gear ratio 4.113
- motor torque of 400Nm up to 1200 rpm but will overheat in short amount of time at this current
- motor speed of 1000 rpm with a 200V bus voltage and no flux weakening
- motor speed of 2500 rpm with a 500V bus voltage and no flux weakening
- 500V bus is made using a switching boost converter limited to 20kW or 100 battery amps in the Prius

- he presented a field oriented control method with V and I constraints to manage flux weakening and reluctance torque
- negative Id to counter flux generating bemf and to increase the reluctance torque
- bemf aligns with q-axis
- he mentions the pesky EMI problem with the current sensors
- i don't know what he means by over modulation region
- he estimates the continuous rating of the 50kw motor to be around 17 or 20kw with 55 degC coolant
- continuous torque to be approximately 150Nm but with additional cooling who knows


This is going to be easy:D

I have some ideas on how to work around some of these limitations but for now I will be happy if I can get it to work at this level first.
 

Attachments

·
Registered
Joined
·
482 Posts
Discussion Starter · #8 ·
I just finished the PCB layout of my Arduino Due Prius Inverter Control shield and placed the order with ExpressPCB.

I didn't put anything on it to measure the temperature of the inverter nor the motor. I wasn't sure what type of sensors they were and I have enough to work on for now. I guess I will have to add them later.

In the meantime I will be researching some more on the control theory and programming side.

Regards
Jeff
 

·
Registered
Joined
·
1,151 Posts
Great resource, JDD; thanks.

- i don't know what he means by over modulation region
I think it just means using square voltage waves, or trapezoid voltage waves, to drive the motors.

If you apply say 110% modulation (where 100% modulation uses all your available DC bus voltage, i.e. you are using everything from 0% to 100% PWM ratio), then the peaks of your generated sine waves will be clipped. In other words, your PWM ratio will go to 100% and 0% for a significant part of the sine wave; you'd like to go to 105% and -5%, but of course you can't.

As you increase the modulation past 100%. you "go further into the over modulation region", and the clipping gets worse and worse. Your sine waves go from correctly rounded to a little clipped to trapezoidal to (eventually) practically square waves.

Of course, IPM motors are typically designed to be driven like this. I think I read somewhere that the Prius switches from PWM modulation to actual direct square waves (in the latter, you don't bother chopping up the signal at a PWM frequency, you just switch hard on and hard off at the electrical frequency of the motor). This switch is based on motor speed; PWM below that speed, square waves above that speed.

I don't know what the shape is below that speed (it would presumably be sine waves or trapezoid waves, or maybe something that better matches the back-EMF shape.)
 

·
Registered
Joined
·
91 Posts
Hi Jeff!

Great to see this thread is going. :) Now I can post that boring :rolleyes: stuff that pertains mostly to motor controllers for the Toyota IPM synchronous motors here. :D

Just to start, here are some BEMF measurements at different speeds:
(Taken from the Highlander Hybrid thread)
Quote:
Originally Posted by PStechPaul
It should be possible to add three equal resistors from each of the three phases to a common point, which can be used as a neutral reference.

It should also be possible to do the conversion mathematically, by using vector sums and differences, or trigonometry.

Here is explanation of the "phantom neutral" and ways to derive an effective neutral from three phase delta, or a third phase from two legs of a three phase wye source.
http://www.marcspages.co.uk/pq/4510.htm

Other possibly helpful references:
http://elect.mrt.ac.lk/EE201_3phase_sym_comp.pdf (for math whizzes)


The information above is extremely interesting. The paper for math whizzes (I'm definitely NOT one :rolleyes:) did a great job of explaining the wye vs delta thing. One thing I found VERY interesting is that industrial 3 phase systems will often have a 4th connection for the neutral. If the system is working properly, it should be balanced, and there should be no current in the neutral line. It did go into whether the SOURCE was wye or delta connected. I wonder.... Is the standard 6 switch inverter considered a wye or delta source??

So, I connected a "phantom neutral" using some BIG wirewound 1K resistors I have sitting around. I then replicated my back-EMF test.

Here is the data from the phantom neutral back emf test. The numbers are all out of my 'scopes "waveform parameters" display, except for the motor rpm column. One thing I found interesting and cannot explain are the AC RMS and AC+DC RMS numbers. Note that the phase difference was the expected 120 degrees, except the first number, I don't know why. The last set of numbers, at 41.9Hz were taken by moving the probe from phaseC to phaseB.

I also included a couple of waveform examples. They have similar "bumps" within the waveform as the previous test. It may be worsened by my lousy phantom neutral connections.
Attached Thumbnails
 

·
Registered
Joined
·
91 Posts
More interesting stuff! Well, I think it is....:rolleyes:

(Stolen from the Highlander Hybrid thread)
Please note that an error in this post has been edited (bold) to the give the right information. Don't want to appear stupid 2X. :rolleyes:

Now that I had a phantom neutral working for the motor, I was curious how the resolver timing worked with this. It took a bunch of messing with resolver drive frequencies, etc. The tests were run with resolver frequencies that were much lower than I would run for a real motor control, But I got some cool graphs illustrating the resolver working along with the back EMF. I triggered the scope with the BEMF signal.

VERY cool: There is a definite point where the resolver's sine output zero crossing and the phase A zero crossing happen at the same time! :cool:

The first pic is phaseA and the resolver cos output. Resolver frequency:1.5 kHz.
The second pic is phaseA and the resolver sin output. Resolver frequency: 1.5 kHz.
The third pic is phaseB and the resolver cos output. Resolver frequency: 1.5 kHz.
The last pis is zoomed up on phaseA and the resolver cos output. Resolver frequency: 5 kHz.
Attached Thumbnails
 

·
Registered
Joined
·
91 Posts
Here are the resolver tests I did in the other thread:

Here's what I found while testing the resolver:
1) If there is DC offset in the drive signal, it doesn't seem to affect the output.
I tested this at 5kHz with a p-p amplitude of 5V. I varied the DC offset from -0.84V > 0V > 1.03V. The output was always centered around -0.14V with an amplitude of 1.08V p-p.

Of course that could change at higher offsets - I would be cautious about saturation. Saturation is what limited my tests because of my signal generator's limitations. When the offset was above the values shown above, the peaks of the output signals were clipped.

Because the input signal's DC offset doesn't seem to affect the output, it may be possible to build a driver that uses only positive power. That should make things easier. :cool:
2) The driver frequency did not affect the input/output amplitude ratio significantly between 5kHz and 20kHz. In this frequency range, the input/output ratio was ~4.825:1 (requires higher input > output )
3) The driver input/output amplitude ratio decreased (higher output/input) between 20kHz and 125kHz, where this behavior peaked. At 125kHz input frequency, the ratio was 1.09:1. A 2:1 ratio happens somewhere between 50kHz and 75kHz.

I guess one could say there is an optimum at 125kHz. If an envelope filter is used and one doesn't have to catch precise peaks at such a high frequency, this could be valuable. :cool: OTOH, the stability of the input/output amplitude ratio between 5kHz and 20kHz may prove valuable because changes in driver frequency would not affect the output amplitude.

I keep mentioning an "envelope filter" - in reality, it's just a low pass filter. ;) The problem is what to do about the signal reversing sign. If a lowpass filter only looks for peaks, then one would end up with a "rectified" filtered signal. Therefore, the filter must look for peaks before a zero crossing and low points after, ect.

Even if the signal is offset 2.5V for a 5V p-p signal, the problem doesn't change. :( It must be "intelligent" enough to see the real output of the resolver. One possibility may be to perfectly trigger an "undersample" every peak (or low point) resolver cycle. Ideas, anyone?
 

·
Registered
Joined
·
1,151 Posts
One thing I found interesting and cannot explain are the AC RMS and AC+DC RMS numbers.
Well, you expect no DC component, so that's why the AC RMS and the DC RMS values are the same.

You know of course that RMS = Root Mean Square; it's like the DC equivalent of AC. If you put a 120 ohm resistor across 120 VDC, you get 1 A of current and 120 W of power. If you put the same 120 ohm resistor across 120 V AC (a sine wave with an RMS value of 120 V, but varies instantaneously from zero to +170 V back to zero, down to -170 V, and back to zero again), you also get 1 A RMS of current (varies from zero to +1.41 A to zero, down to -1.41 A and back to zero again), and importantly, you get the same 120 W of power. (Well, average power; the instantaneous power varies from zero to 240 W to zero, back up to 240 W and down to zero; you don't get "negative power" because when the current is negative, the voltage is negative too, so the product is positive).

For a square wave, the DC and the peak to zero value (half the peak to peak value) are the same. So the ratio of peak to peak voltage and RMS voltage is 2.0. For a sine wave, the ratio turns out to be twice the square root of 2, or about 2.828. For signals with narrow peaks, the ratio can be higher.

For your numbers, I see about 2.9 ratio between the peak to peak values and the RMS values. That implies that your signals are nearly sine waves, but just a little bit "peakier" than a pure sine wave. And indeed, they do look like that.

Note that the phase difference was the expected 120 degrees, except the first number, I don't know why.
I think that's just because the amplitude is so low, and the signals are somewhat distorted, so you are seeing some jitter in where the instrument is deciding that the zero crossing is. So it gets the phase a bit wrong on the first measurement where the amplitude is less than 4 volts RMS.
 

·
Registered
Joined
·
482 Posts
Discussion Starter · #14 ·
the stability of the input/output amplitude ratio between 5kHz and 20kHz may prove valuable because changes in driver frequency would not affect the output amplitude.
I think this freq range is the way to go.


I keep mentioning an "envelope filter" - in reality, it's just a low pass filter. ;) The problem is what to do about the signal reversing sign. If a lowpass filter only looks for peaks, then one would end up with a "rectified" filtered signal. Therefore, the filter must look for peaks before a zero crossing and low points after, ect.
I am a little confused with what you are trying to do exactly but it sounds like you are trying to demodulate the sine and cosine wave forms from the carrier.

What happens if you subtract the carrier and one of the returns? Try this on your scope and see if it gives you a signal that will be more compatible with your peak detector.

I am not sure of the best way to demodulate. In my approach I am going to sample the sin and cos voltages in sync with the carrier so hopefully I can catch them at their peaks.

Jeff
 

·
Registered
Joined
·
482 Posts
Discussion Starter · #15 ·
As you increase the modulation past 100%. you "go further into the over modulation region", and the clipping gets worse and worse. Your sine waves go from correctly rounded to a little clipped to trapezoidal to (eventually) practically square waves.

Of course, IPM motors are typically designed to be driven like this. I think I read somewhere that the Prius switches from PWM modulation to actual direct square waves (in the latter, you don't bother chopping up the signal at a PWM frequency, you just switch hard on and hard off at the electrical frequency of the motor). This switch is based on motor speed; PWM below that speed, square waves above that speed.

I don't know what the shape is below that speed (it would presumably be sine waves or trapezoid waves, or maybe something that better matches the back-EMF shape.)
This is exactly the kind of stuff we will need to consider as the IPM control algorithm is evolves. I just hope we can get to that point.

Thank you very much
Jeff
 

·
Registered
Joined
·
482 Posts
Discussion Starter · #16 · (Edited)
IPM motor regen question:

I think I am getting a handle on this max torque per amp concept of an IPM motor and using Iq>0 and Id<0 for drive.

However I am not so sure about optimal regen for these types of motors.
Since there is a max torque per min amp in the drive, I would assume you would want a max amp per min torque for the regen. This way you would get the most back out of the motor for the minimum amount of speed reduction.

Perhaps in regen the reluctance torque is not helpful for putting energy back into the battery. It will most likely slow you down but will not produce energy. If this is the case then the regen alorithm will use a Iq<0 and Id=0 much like a surface mounted magnet motor in regen.

Another thing to consider may be that Id<0 may still need to be enforced even during regen if the motor is operating at very high speeds to avoid excessively high Iq as the result of very high bemf.

If very fast slow down is commanded then producing negative torque using the reluctance torque can be used but will simply consume energy to do so which is not regen. This is probably only done at low speeds when there is not enough bemf to pull from.

As I type this I am wondering if the Prius generator (MG1) has the same rotor design. Perhaps it is closer to BLDC since it's primary function is different. There is not much on this motor but it is a 30kw resource that I am planning on using.

Regards
Jeff
 

·
Registered
Joined
·
1,151 Posts
Since there is a max torque per min amp in the drive, I would assume you would want a max amp per min torque for the regen. This way you would get the most back out of the motor for the minimum amount of speed reduction.
I don't think you can buy much with this. At a particular speed, so much torque represents so much power, so at a particular battery voltage, so much torque represents exactly so much current; getting more current than that would be violating the conservation of power (energy per interval of time). Maybe at low speeds you can do something to tweak the efficiency so that you can still get moderate current where you otherwise might have gotten very little, but it will still "cost" the same amount of torque for each ampere of regen current.

Perhaps in regen the reluctance torque is not helpful for putting energy back into the battery.
My understanding (but I could well be wrong) is that reluctance motors have just as good regen as other AC motor types. If it wasn't for the slight additional improvement in efficiency that a permanent magnet provides, most commercial EVs would be using SR motors. In fact, if the rare earth materials for the magnets become scarce and/or expensive, EVs could switch to reluctance motors rather than induction motors. What I'm trying to say is that their performance is pretty close to PM and induction motors.

Another thing to consider may be that Id<0 may still need to be enforced even during regen if the motor is operating at very high speeds to avoid excessively high Iq as the result of very high bemf.
If the paper I'm still reading through is correct, then flux weakening is needed for all speeds above a fairly low figure, 2500 RPM comes to mind. In that case, you would need flux weakening (Id < 0) for regen at all speeds above this threshold, because otherwise the back EMF would result in the DC bus going higher than 500 VDC (on the high side of the booster), and that would be dangerous for the electronics. I note that you would have to provide Id < 0 at *all times* that the motor is spinning above 2500 RPM, or the electronics that the motors would be connected to would cause the diodes across the IGBTs to rectify the motor output into DC bus, which may cause a dangerous overvoltage. In the Prius, with MG2 connected to the wheels (so to speak), you can't stop it spinning above 2500 RPM above a rather modest speed (around 30 MPH perhaps).

It's a little scary to think that if the processor driving the motors ever crashed at a speed above this, it would likely fry the electronics and put a short circuit across the motor, giving you way more regen than you would want (I think it would almost lock the wheels). I've never heard of this happening, although I have seen it discussed in papers defending the use of PM motors. They seemed to claim that rectifying the motor output into the battery would be a serious event (with quite strong braking and quite high currents), but the electronics and the battery are likely to survive it. I wonder though about the Prius and its boost converter; the IGBT diodes would not connect directly to the battery, and the limited power of the DC-DC converter would mean it could not all get to the battery. Without the battery to absorb the power, I think it would fry a most of the power section of the inverter.

So the cost of a software bug could be high :eek:! Be careful guys. Start small and work up only when you are confident of the software.

As I type this I am wondering if the Prius generator (MG1) has the same rotor design. Perhaps it is closer to BLDC since it's primary function is different. There is not much on this motor but it is a 30kw resource that I am planning on using.
Yes, it's weird that MG1, which on the 2004 Prius has about 60% of the peak power of MG2, is so neglected, and there is so little information on it. My feeling is that it's made much the same as MG2, so with similar characteristics, just scaled down for a lower power.
 

·
Registered
Joined
·
23 Posts
Hi All!

Some more bits and thoughs.
Just one more Prius 04 transmission project.

I spun the motors(with no load), sometime ago, and i didn't see difference in the way they perform.
Except the different base speed.
Jeff, if MG1 and MG2 have identical design, shouldn't the shape of the BEMF diagrams look alike, if scaled properly?

Here is some more info on the resolver part. The links may be usefull.
http://www.designnews.com/author.asp?section_id=1419&doc_id=259600

If we search for ready solutions and high integration, TI shares great amount of information on the motor control and have reference designes for their DSPs. Looks like they have what we need, but not everithing is open source. At least it is tested. Thoughs?
 

·
Registered
Joined
·
482 Posts
Discussion Starter · #19 · (Edited)
Hi All!

Some more bits and thoughs.
Just one more Prius 04 transmission project.

I spun the motors(with no load), sometime ago, and i didn't see difference in the way they perform.
Except the different base speed.
Jeff, if MG1 and MG2 have identical design, shouldn't the shape of the BEMF diagrams look alike, if scaled properly?

Here is some more info on the resolver part. The links may be usefull.
http://www.designnews.com/author.asp?section_id=1419&doc_id=259600

If we search for ready solutions and high integration, TI shares great amount of information on the motor control and have reference designes for their DSPs. Looks like they have what we need, but not everithing is open source. At least it is tested. Thoughs?
Welcome bldc
Give us some details regarding your project. How far along are you with your control solution?

I also got the motors to spin no load but when I put it in a car under a load it was a very different experience. The motor behaves very different under a load. I was able to drive the car around at golf cart speeds with 48v.

I was not using any current regulation. I was just supplying a modulated voltage that followed the resolver.

Regards
Jeff
 

·
Registered
Joined
·
482 Posts
Discussion Starter · #20 · (Edited)
My understanding (but I could well be wrong) is that reluctance motors have just as good regen as other AC motor types. If it wasn't for the slight additional improvement in efficiency that a permanent magnet provides, most commercial EVs would be using SR motors. In fact, if the rare earth materials for the magnets become scarce and/or expensive, EVs could switch to reluctance motors rather than induction motors. What I'm trying to say is that their performance is pretty close to PM and induction motors.
Perhaps you are referring to dynamic braking. I am only referring to the type of dynamic braking that can put energy back into the battery like a generator. In a SR (switched reluctance) motor the rotor does not have a magnetic source to induce a voltage onto the stator so no generator effects that I can see.

edit: I am mistaken about SR motors regen. It will take me a while to figure this part out but it is probably important for this type of combo motor.

Coulomb said:
If the paper I'm still reading through is correct, then flux weakening is needed for all speeds above a fairly low figure, 2500 RPM comes to mind. In that case, you would need flux weakening (Id < 0) for regen at all speeds above this threshold, because otherwise the back EMF would result in the DC bus going higher than 500 VDC (on the high side of the booster), and that would be dangerous for the electronics. I note that you would have to provide Id < 0 at *all times* that the motor is spinning above 2500 RPM, or the electronics that the motors would be connected to would cause the diodes across the IGBTs to rectify the motor output into DC bus, which may cause a dangerous overvoltage. In the Prius, with MG2 connected to the wheels (so to speak), you can't stop it spinning above 2500 RPM above a rather modest speed (around 30 MPH perhaps).

It's a little scary to think that if the processor driving the motors ever crashed at a speed above this, it would likely fry the electronics and put a short circuit across the motor, giving you way more regen than you would want (I think it would almost lock the wheels). I've never heard of this happening, although I have seen it discussed in papers defending the use of PM motors. They seemed to claim that rectifying the motor output into the battery would be a serious event (with quite strong braking and quite high currents), but the electronics and the battery are likely to survive it. I wonder though about the Prius and its boost converter; the IGBT diodes would not connect directly to the battery, and the limited power of the DC-DC converter would mean it could not all get to the battery. Without the battery to absorb the power, I think it would fry a most of the power section of the inverter.
I don't think it works exactly like you present. Yes the bemf will get rectified onto the bus if the controller stops at higher speeds but the frequency of the peaks above battery voltage and the stator inductance + the boost converter inductance are what keep things manageable.

I did a simulation for a disabled controller so no switching which is what happens when the prius inverter faults for over current. I used 400Hz electrical cycles (6000 motor rpm) producing +/-800V bemf. Let this get rectified into a 200V battery pack through 5mH stator inductance and 373uH boost inductor.

Text Technology Font Screenshot Electronic device



The result is +/- 60A stator current and 35A going into the battery.

This doesn't seem as violent as you describe.

I am not sure my analysis is correct but that might explain why we haven't seen a Prius wreck as a result of what you describe.

Jeff
 
1 - 20 of 145 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top