View Single Post
Old 09-26-2015, 11:10 PM   #2094 (permalink)
thingstodo
Master EcoModder
 
Join Date: Sep 2010
Location: Saskatoon, canada
Posts: 1,488

Ford Prefect - '18 Ford F150 XLT XTR

Tess - '22 Tesla Y LR
Thanks: 749
Thanked 565 Times in 447 Posts
Quote:
Originally Posted by MPaulHolmes View Post
It's so much fun reading all the new posts when all I did was go to costco and eat some pizza. haha. The controller on instructables doesn't have voltage monitoring, but it can control current precisely into the battery pack or from the battery pack.

Here's the piece of code that controls the current into the battery without knowledge of the pack voltage:
Code:
	batteryCurrentLong = __builtin_mulss(Ia,pdc1) + __builtin_mulss(Ib,pdc2) + __builtin_mulss(-Ia-Ib,pdc3);  // batteryCurrent is in [-4096*sqrt(3)/2, 4096*sqrt(3)/2] = [-3547, 3547].


if (batteryCurrentNormalized < -maxBatteryCurrentNormalizedRegen) { // maxRegenCurrent is negative.  Computed in "InitializeThrottleAndCurrentVariables()".
		// averageDuty = (pdc1+pdc2+pdc3)/3.  But division is slow.  So, do this instead:
		// averageDuty = 65536 * ((pdc1+pdc2+pdc3)/3) / 65536
		// averageDuty = 21845 * (pdc1+pdc2+pdc3) / 65536
		// averageDuty = (21845 * (pdc1+pdc2+pdc3)) >> 16
		averageDuty = __builtin_mulss(21845, pdc1+pdc2+pdc3) >> 16;	// avoiding divide by 3.  HAHA.  
		if (averageDuty > 0) {
			temp = -__builtin_divsd(maxBatteryCurrentNormalizedRegen,averageDuty); // This is the first try at IqRefRef.  Later, other values will be calculated based on throttle.  Keep the one closest to zero.
			if (IqRefRef < temp) {
				IqRefRef = temp;  // if it was more negative, then make it smaller in magnitude, 'cuz there's too much friggen current going into the batteries!!!
			}
		}
	}
By the way, I've fixed a few bugs and sensorless is so close to being debugged and working! The code now is much more complete and fancy than the instructables code. well, I think it's gotten better. I'll upload it in just a couple days once it's in a useable place.
Looking forward to it! Maybe I could get a copy of the code as well this time around?

Quote:
EDIT: Without voltage monitoring (which is super easy to include, and actually was included on the revision board that got stolen that was on my laptop, but I'm not angry at all. nope), I think the controller could precisely command constant current into the batteries, somehow using the motor windings for an inductor, but it wouldn't know when to stop, unless it was told somehow. I haven't seen the link you guys are talking about, but I know it could be done. I just feel it way down deep.
Link we are discussing Patent US4920475 - Integrated traction inverter and battery charger apparatus - Google Patents

I didn't realize that there was hardware installed to monitor voltage on the pack. More stuff to add sometime in the future, when the control stuff has been worked out
  Reply With Quote