**Important** reality check on motor, voltage, current etc.

Luke

I agree with everything you say. I batt will always be smaller than I phase to the left of the line and less or equal to I phase everywhere.

I think the important point is that even at low speed we can make I batt go down by using a low value of D. PWM drives I batt down all the time. If we determine D using speed as a factor we can make Ibatt so low we will have a low enough Iphase to avoid as much heating. We know the speed of the motor from the Halls.

Lets make D = F(throttle) * F(speed)

F(throttle) just equals 0 - 1 like always

F(speed) = F(speed zero) + (actual speed/KV )/(throttle aim speed/KV ). F(speed zero) is there to provide acceleration when speed is low. That second term is just Vbemf/ V desired.

So with no motion, F(speed) = F(speed zero) a very small fraction used to avoid heating. As actual speed gets up toward the speed the throttle would like speed = KV *vbatt, for full throttle, the second term goes to one. We clip F(speed) at one. In this way we adjust the duty cycle to set Ibatt to a level that causes an acceptable Iphase and gives us acceleration.
 
Some persistant dislexia, Don?...

liveforphysics said:
It is the soonest point (lowest speed) that battery current and phase current can be equal, any lower speed or lower throttle setting will ALWAYS result in higher phase current that battery current.[...]
After the red line, if you go partial throttle, phase current will always be greater than battery current, but both will be lower than full throttle would give.
Before the red line, phase current is always greater than battery current.
donob08 said:
I agree with everything you say. I batt will always be larger than I phase to the left of the line and Greater or equal to I phase everywhere.

I batt simply cannot ever be larger than I phase... read wikipedia's buck converter page if you havent yet.

Maybe imagining the controller as a current controlled device instead of a voltage controlled device would help you, as this is closer to how motor controllers actually work.
 
Rewinding for a moment...
swbluto said:
Let's use an example. Say one is using a 50 volt battery pushing 40 amps. If the duty cycle is at 10%, you'd *gasp* say that the motor current must be 400 amps. But, what happens is that the output voltage is reduced by 10 times. That's 5 volts. But, wait, there's a diode drop in the controller... so now it's down to 4.1 volts. Now let's take a low motor resistance of .03 ohms. That's a stall current of 4.1/.03 = 136 amps... not quite the 400 amps you originally expected. In actuality, those numbers don't actually work together - they actually follow a fairly specific formula that's not been mentioned yet. I'd pull it up but... well, no one is interested, as far as I can tell, and it doesn't seem anyone would care to understand it anyways. But, if it whets anyone's appetite, it involves a quadratic. :)
Ironically, safe stumbled on that aspect a while back.
Snipped from history:
justin_le said:
Safe is right. The simulator does the calculation assuming the user throttle setting to determine 'D'. If the resulting battery current at this throttle setting exceeds the controller current limit, then it goes the other way, assumes that the current limit is being drawn from the battery pack and then calculates the equations backwards to determine the value for 'D'. Justin
 
Tyler- SWbluto's example doesn't show a limit or flaw to current multiplication, it just uses numbers that can't work. He picked a fictional situation where the controller could not be in constant power-IN (battery current limiting mode) at 10% duty with those specs. It's just showing a non-functional example of current multiplication (because it's an impossible situation, if the phase current can't be high enough at the given voltage, than the controller could not be drawing 40amps at 50v).


Justin's example there is just showing how throttle input can't make a bigger duty cycle than the battery current limit protects, so throttle input does not directly mean duty cycle. (until you pass the red line on the graph, then it does.)
 
Guys

I think you missed that I corrected that statement to say Ibatt less than Iphase. I did that right after I read my post. I think what bothers me is that Iphase defines Ibatt, not the other way around. The low value of Vmotor = D*Vbatt says Iphase will be small and Ibatt will be smaller than that by 1/D. It's really a result that Ibatt is so much smaller not a cause. It is more like there is current division between the Iphase and Ibatt, rather than calling it current multiplcation. The fact that the Ibatt occurs only 1/D of the time makes its average current = 1/D of the Iphase current which is constant.

I guess I should have said reducing D reduces effective motor voltage which reduces Iphase, but Luke is always talking about current.

Also Luke your statement "This is the soonest point (lowest speed) the controller can have 100% duty cycle (regardless of throttle signal input obviously.)" is really only true if the controller is measuring phase current and cutting the PWM cycle as a result. Without this intelligent controller the PWM cycle would equal 100% if WOT, all the way to the left, right?

Don
 
Zapat

In case you are reading real time I needed to correct my explanation of my earlier correction. I edited just after posting to make greater into less in the first sentence. The edit doesn't show. Just the correct statement shows. I guess it is dyslexia. I'm bothered by the backward "cause effect" description calling division multiplication by looking at it upside down.

Don
 
donob08 said:
I think you missed that I corrected that statement to say Ibatt greater than Iphase.
I didn't miss anything, Don, just look above to my post with your quote and you'll see your same upside-down statement you just posted here once again. Battery current can NEVER be higher than motor current.

A buck converter like our motor controllers can only lower voltage and raise current from battery to motor, not raise voltage and lower current... please read that wikipedia page about buck converters, or any other pages you can find on google about buck converters.

You are talking about the controllers as though they are setup in a boost converter arrangement from battery to motor, but they aren't. The only time a controller works as a boost converter is when it is doing regen, when current is flowing from the motor to battery instead of the opposite way (but don't think about this yet until you understand the basics).


I think what bothers me is that Iphase defines Ibatt, not the other way around.
This is the right way to think of it, but just remember that since your controller's input voltage (battery side) is *always* higher than it's output voltage (motor side), it's output current is also higher than it's input current in the same ratio as the voltage change, because the input and output power is roughly equal.
 
Zapat

I'm not going to use the words > or <. I think you'll agree with my statements as the appear if you refresh the page.

Don
 
donob08 said:
Zapat

In case you are reading real time I needed to correct my explanation of my earlier correction. I edited just after posting to make greater into less in the first sentence. The edit doesn't show. Just the correct statement shows. I guess it is dyslexia. I'm bothered by the backward "cause effect" description calling division multiplication by looking at it upside down.

Don
:D I see your two edits now after posting the above!

But I do understand what you mean about about not seeing it as a battery to motor current multiplication, but instead as a motor to battery current division. This seems to be a more descriptive way of explaining how the controller works.

Pat
 
zapat

Now, does using motor speed, as measured by the Halls, to help set the PWM duty cycle make sense? Making D a function of present speed relative to aim speed (Vbemf/Vbatt) as a multiplier on throttle position would set D to a safe level without measuring or trying to estimate Iphase.

The best way To describe it, I think, is that it will cut effective motor voltage D*Vbatt to a level that could be chosen to give acceleration with less heat. It would be like having a lower battery voltage, which we know would make less heat. But this low voltage changes with motor speed so that we are always pushing the motor, but not too hard.
 
Using motor speed to regulate duty cycle would require knowledge of the motors Kv constant (which will be different for different motors). It's generally easier to estimate phase current using Ibatt/D which requires no knowledge of the motor.
 
Just letting everyone know... my previous controller heat calculations are WRONG. The switching heat equation was off by a factor of 10 because I used 10 uS instead of 1 uS (A typo). So, my past admissions of hills being partial throttle being "so bad" and what not are a wee bit exaggerated. I'll get the new numbers going once I get everything working correctly, but I suspect it's somewhere in the 20-50 watt range, not 200-1000 watts.

EDIT:

After refining the calculations... I seem to be getting roughly the same charts, so maybe they weren't that
off. Actually, they weren't wrong. The program seemed to think that 1/1000000 meant "zero" which produced zero switching losses. :)

View attachment 1
Here's john's example bike at 6.5 mph cruising. I don't know if the wheel's torque would ever slow down to 4 mph due to a bump/rock/dip/pot-hole or if the wheel would just slip if the bike got that slow, looking at the motor torque. The watts at 4 mph is around 100 watts

Here's what it looks like if the throttle is accidentally pulsed to 15% instead of at 7% in the previous graph.



At 6.5 mph, if he accidentally pushes to 15% for a moment like might happen if going over bumpy terrain, then the controller is putting out something like 325 watts in heat at the steady speed of 6.5 mph. I suspect this is probably the most significant factor in controller heating with john's bike at low throttle and going over bumpy terrain. Accidental throttle pulsing.

Now, in theory, if he was going over a perfectly glass-smooth ground and maintained a steady 6.5 mph with no wind and a constant and perfectly unchanging throttle, then his controller should only put out 15-20 watts overall which isn't bad.

So, the final answer: low throttle by itself doesn't cause significant controller heating. It's low throttle + real-world dynamics that likely causes significant controller heating at low throttle.
 
Eric

I think it may be contagious.. I think below you wrote Iphase approximately equals Ibatt/D.
;)
Don

rhitee05 said:
Using motor speed to regulate duty cycle would require knowledge of the motors Kv constant (which will be different for different motors). It's generally easier to estimate phase current using Ibatt/D which requires no knowledge of the motor.
 
donob08 said:
I think it may be contagious.. I think below you wrote Iphase approximately equals Ibatt/D.

Yes, I did. D is always less than one so Iphase will always be >= Ibatt. At 50% duty cycle, Iphase=Ibatt/0.5=2*Ibatt, at 25% duty cycle Iphase=Ibatt/0.25=4*Ibatt, etc.
 
liveforphysics said:
...When you are giving full throttle signal, the following is true at the red line:

This is the soonest point (lowest speed) the controller can have 100% duty cycle (regardless of throttle signal input obviously.)

It is the highest speed the controller can maintain it's constant power-IN.

It is the soonest point (lowest speed) that battery current and phase current can be equal, any lower speed or lower throttle setting will ALWAYS result in higher phase current that battery current.

After this red line, the BEMF takes over the roll PWM was doing to regulate battery current draw.

After the red line, if you remain full throttle, phase current and battery current will be equal.

After the red line, if you go partial throttle, phase current will always be greater than battery current, but both will be lower than full throttle would give.

Before the red line, phase current is always greater than battery current.

I take it to also mean that maximum power also occurs at the "red line".
 
swbluto said:
...At 6.5 mph, if he accidentally pushes to 15% for a moment like might happen if going over bumpy terrain, then the controller is putting out something like 325 watts in heat at the steady speed of 6.5 mph. I suspect this is probably the most significant factor in controller heating with john's bike at low throttle and going over bumpy terrain. Accidental throttle pulsing.

Now, in theory, if he was going over a perfectly glass-smooth ground and maintained a steady 6.5 mph with no wind and a constant and perfectly unchanging throttle, then his controller should only put out 15-20 watts overall which isn't bad.

So, the final answer: low throttle by itself doesn't cause significant controller heating. It's low throttle + real-world dynamics that likely causes significant controller heating at low throttle.

Yes, I suspected the same thing and that's why I mentioned it in the first post. I've ridden at low speeds many time, but not that slow over a bumpy road. Whatever micro pulses were occurring weren't enough to make the bike speed up and slow down, but I can see how crazy high very short term voltage spikes could have occurred.

FWIW, Lyen is running the idea of a current multiplication cap up the flagpole with the engineers in China. I think all it needs is a couple lines of code in the current limiting section of the program to also compare phase current to battery current, and if the ratio is too high, then lower the duty cycle. Extreme multiplication serves no benefit, so let's cut it off at the knees and problem solved.

John
 
A phase controlled throttle should also avoid this problem. If you accidentally spike your throttle from 7% to 15%, your motor current doesn't just jump from 10 amps to 120 amps, it'll only jump from... 10 to 20 or something like that. The controller heat generation would be much lower at 20 amps than 120.
 
I think this is worth reading if you get a chance.

Lets make D = F(throttle) * F(speed)

F(throttle) just equals 0 - 1 like always

F(speed) = F(speed zero) + (actual speed*KV )/F(throttle)*(Vbatt aim speed*KV ).
F(speed) = F(speed zero) + 1/F(throttle)*actual speed /aim speed
F(speed zero) is just a place holder for now. That second term is just (1/F(throttle)*(Vbemf/ V batt) and is defined when we know F(throttle), speed from the Halls, KV of the motor and Vbatt.

As actual speed gets up toward the speed the throttle would like, speed = KV *vbatt, for full throttle, the second term goes to 1/F(throttle). In this way we adjust the duty cycle to set Ibatt to a level that causes an acceptable Iphase and gives us acceleration.

We need to know KV to determine Aim speed from Vbatt or Vbemf from Actual speed
D = F(throttle) *F(speed)
D = F(throttle) *(( F(speed zero) + (1/F(throttle)*(Actual speed/Aim Speed))
D = F(throttle) * F(speed zero) + (Actual speed/Aim speed)
Which is the same as saying
D = F(throttle) * F(speed zero) + Vbemf / Vbatt)
Since we know the KV we can determine the Vbemf from speed. That is an extra effort for a motor type, but it pays off as you will see.

So DVbatt = F(throttle) * F(speed zero)*Vbatt +Vbemf

Then the voltage driving I phase

Driving voltage = DVbatt -Vbemf
Driving voltage = F(throttle) *( F(speed zero)*Vbatt + Vbemf – Vbemf
Driving voltage = F(throttle)* F(speed zero)*Vbatt

Iphase = Driving voltage/Rphase
Iphase = F(throttle)* F(speed zero)*Vbatt/Rphase

Now F(speed zero) is just a constant number. It appears that Iphase will now be proportional to F(throttle).

Since torque is proportional to Iphase, it would seem that torque would be proportional to throttle position, at any speed.

F(speed zero) could have been set to 1. Without regard to that, with D defined this way Iphase and torque do not change with speed. Torque is only a function of Throttle position and Vbatt.

So it looks like making D a nonlinear function of throttle position and a nonlinear function of speed has paid off.



Summary

With D = F(throttle)*(1 + Actual speed/F(throttle)*Aim speed)
Where Aim speed = Vbatt/KV

Iphase = F(throttle)*Vbatt/Rphase
Torque is proportional to F(throttle)*Vbatt/Rphase

Torque and the Iphase producing it are a function of F(throttle) alone and independent of speed.
 
Making the throttle a function of current (torque) rather than voltage is a good idea. This makes it comparable to the throttle on an ICE system, and some higher-end controllers do implement this.

I applaud the obvious effort that went into that derivation, but I think you're making the problem harder than it needs to be. Your method requires knowledge of the motor's Kv constant, and also requires you to choose an arbitrary constant F(speed zero). It seems easier to look at that as F(speed zero)/Rphase, so what you're really doing is picking a constant which determines the multiplying effect of the throttle on current. But making sense of that constant also requires knowledge of Rphase.

A far simpler technique is to take advantage of modern closed-loop control theory. We already have access to a measurement of current, so we simply need to implement a simple closed-loop PI controller. The user simply needs to set a constant which corresponds to full throttle current. The feedback loop will control the voltage as needed with no knowledge of the motor required. It's very easy to implement a simple PI controller. Since we're controlling current directly, no separate current-limiting function is necessary.

There's a more advanced version of this technique known as field-oriented control. This takes care of the timing advance problems at high speed, and even allows field-weakening control for higher speeds.

Like I said, you obviously put a lot of thought into that. But there's no need to re-invent the wheel. :)
 
Eric

I appreciate your comments. There are a couple of points I should clarify. The concept of F(speed zero) was only put in, as a place holder, because I sensed that D needed to be a nonlinear function of speed in order to control current. In fact, F(speed zero) will always be 1. Notice it doesn't appear in the summary. Rphase doesn't appear anywhere in the math to determine D. Rphase, as your good write up shows is just a characteristic that will affect Iphase. It's an unchanging, independant 'variable'. That is, it is a constant determined by the windings and we have no need to know its value. As your write up shows, stating it explicitly just makes the result the system will provide more understandable.

About the effort in determining KV, we can model the effect if there is an error of +/- 10% in our KV value. This might simulate the case if we use a standard value of KV for a class of motors.

KV is only used in determining D in the function 1+(Actual speed/Aim speed). So if KV is off +/- 10%, D will be miscalculated in this way D = 1 + (Actual speed/Aim speed) +/- 10% (Actual speed/Aim speed). This says for Actual Speed = Aim speed, D will be off by 10%. At Actual speed = 1/2 Aim speed D will be off by 5%. So the %error in D is equal to the %error in KV at full speed and goes to zero as speed goes lower.


This will cause an error in driving voltage with the magnitude Vbemf(error)-Vbemf. Vbemf(error) - Vbemf = Vbemf + %error in KV*Vbemf - Vbemf or %errorKV*Vbemf. Because of that Iphase won't be proportional to throttle. Iphase will will be different from ideal by %errorKV*Vbemf percent. Most of the time thats pretty small. At Actual speed = 0, the error will be zero. That is where we are most concerned about controlling current.

Thanks for the compliment on my work effort. But there wasn't really an hour spent doing this. It seemed intuitive to me that since Iphase = DVbatt -Vbemf and we know Vbemf changes with speed that if we want to control the difference in those terms, we need to make D a function of speed. Non linear made sense. The only task was finding the right terms.

The thing about using a feed back loop to band aid Iphase is that in that case F(throttle) has no identifiable meaning. Speed is not a function of F(throttle). Nothing that we can sense is a function of F(throttle).
 
donob08 said:
The thing about using a feed back loop to band aid Iphase is that in that case F(throttle) has no identifiable meaning. Speed is not a function of F(throttle). Nothing that we can sense is a function of F(throttle).

That's actually not true. Torque is directly proportional to phase current. So, if we make the throttle control phase current, then torque is directly controlled by the throttle. This is how IC engines work and is usually more intuitive than the voltage-controlled throttles provide.

The main point I was trying to make is that a control scheme which requires no knowledge about the system is generally preferable to one which does require information. It's not a band-aid.
 
Eric

If the feed back loop is effecting current, limiting, the throttle is NOT controlling Iphase. With a feedback loop throttle and speed determine Iphase. With my approach Throttle defines current.

As an example for low speed, I phase will equal Iphase(safe) as set in the feedback loop for all positions of the throttle that want Iphase(safe) or more.

Don
 
In think I could make my thought clearer.

Without worrying how we got there:

If D = F(throttle) + Vbemf/Vbatt

Then Iphase and Torque are proportional to F(throttle)*Vbatt

Simply:

DV = D*Vbatt = F(throttle)Vbatt + Vbemf
Driving Voltage = DV – Vbemf
Driving Voltage =F(throttle)Vbatt + Vbemf –Vbemf
Driving Voltage =F(throttle)Vbatt
Iphase = F(throttle)Vbatt / Constant K, In fact K is defined by the resistance of the windings

We need to calculate Vbemf = KV * speed, a pretty good definition of KV will work pretty good. Accuracy would be nice but doesn’t change the impact. Speed we get from the Hall sensors.

Now this doesn’t say that misuse of the throttle can’t cause trouble. Too large a value of F(throttle) will cause too large an Iphase. If we want to limit current, we can put a limit on F(throttle), call it Effective Value of F(throttle).

This differs considerably from an approach that makes D = F(throttle) as the first approximation, figures out somehow how large Iphase will be and then makes D = F(throttle) * F(current limit) to get the current to a safe level. In this case F(throttle) doesn’t determine Iphase. F(current limit) is a function of speed. F(current limit) works to keep the current at the same "safe" level without regard for F(throttle) if F(throttle) is seeking too much current. At speed = 0, F(current limit) has to be a VERY small number. Because F(current limit) changes with speed there is no proportionality between torque, speed or anything else and F(throttle).

The current limit system can be made safe just as a limit on the Effective Value of F(throttle) is above, where Effective Value of F(throttle) is limiting. With The Effective Value of F(throttle) limit, torque is proportional to F(throttle) until it stops increasing as a function of F(throttle). And it is constant torque over the speed range. Using current limiting, torque changes as a function of speed and is never proportional to F(throttle). Over some of the speed range, higher end, steady state speed will be proportional to F(throttle).
 
I don't think you understand what I'm saying. The throttle would directly control the phase current using feedback. The throttle sets the desired current, current sense provides feedback, and the controller uses the resulting error signal to regulate the voltage as necessary to achieve the desired current. This is a very effective scheme and very commonly done. Setting the full-throttle current effectively sets the current limit for the system.
 
Eric

I totally agree. Any feed back system making Iphase a function of F(throttle) is all we need.

I have read so much about "Current Limiting" I assumed you were still riding that horse.

I had to look back to see that on Page 18, July 12 you suggested a classic PI system based on current sensing. I couldn't find any other references to a PI (Proportional Integral) feedback systems anywhere. I'm not saying my search was exhaustive. As you say on P18, you dont need "Current Clipping" if you have feedback current control and Iphase is made a function of F(throttle). I think you would have to get the correct values for KsubP the gain on "Proportional error" and KsubI the gain on "Integral error". There are tools to do that. But I think you would have to do it for a motor type and maybe loading, in order to get good stability (response to bumps/changes in loading) and regulation (responses to change in the throttle position).

This is true using the "speed feedback" model as well. I think we may be getting close to common ground.

Don
 
Back
Top