MPG Cruise Control Algorithm - Page 3 - Fuelly Forums

Android Users - Coming Soon! - Migrating from aCar 4.8 to 5.0

Reply
 
Thread Tools Display Modes
 
Old 04-08-2009, 07:30 AM   #21
Registered Member
 
Join Date: Mar 2009
Posts: 1,139
Country: United States
I saw that thread previously but didn't realize it ran into trouble with hybrids. I have a friend in RI that I told about it (he coasts in neutral all the time) and he was less than concerned. He was surprised he'd never heard of it having lived there for 30 years, but compared to us both not knowing until last year that prostitution was unregulated in RI (indoors, anyway), coasting laws are pretty minor!

You ever have any trouble with coasting in RI?
__________________

__________________


Main Entry: co de pen dence - see codependency
co de pen den cy
Pronunciation: \kō-di-ˈpen-dən(t)-sē\
Function: noun
Date: 1979

: a psychological condition or a relationship in which a person is controlled or manipulated by another who is affected with a pathological condition (as an addiction to alcohol or heroin) ; broadly : dependence on the needs of or control by another
GasSavers_maximilian is offline   Reply With Quote
Old 04-08-2009, 07:39 AM   #22
Registered Member
 
theholycow's Avatar
 
Join Date: Apr 2008
Posts: 6,624
Country: United States
Send a message via ICQ to theholycow Send a message via AIM to theholycow Send a message via MSN to theholycow Send a message via Yahoo to theholycow
Most of my commute is in MA. I live two miles from the CT border, pass through CT for ~10 miles, then the remaining ~26 miles are in MA.

Anyway, I've never heard of anyone anywhere ever having any legal trouble with coasting, but it's good to know and obey the laws either way.

RI can be real weird about laws. The populace is strongly left-aligned, and our presidential voting history is almost entirely on that side. OTOH, we elect lots of republican governors. Our laws have the same split; lots of heavy liberal stuff, sprinkled with a few strong conservative or libertarian laws. We've got a strong castle doctrine, for example, though not the wide-open gun rights that you have in VT.
__________________

__________________
This sig may return, some day.
theholycow is offline   Reply With Quote
Old 04-08-2009, 07:56 AM   #23
Registered Member
 
Join Date: Mar 2009
Posts: 1,139
Country: United States
You are very right about RI's split personality. I jokingly call my friend the conservative liberal: he's economically very liberal, but personally very conservative. I grew up in Rehoboth, MA right near RI (we'd watch Providence weather forecasts) and my mother worked there, so I know it pretty well. Went to college there too. My father also lives there. He told me that the prostitution thing is really more of a loophole nobody's bothered to close than anything else. That the law was written specifically addressing outdoor solicitation.

Here in the Northeast Kingdom (name for the NE part of VT) we have a clash of local conservatism with statewide liberalism. The whole civil union thing caused a big uproar here, but it faded into nothing almost immediately once there were no discernible consequences at all.
__________________


Main Entry: co de pen dence - see codependency
co de pen den cy
Pronunciation: \kō-di-ˈpen-dən(t)-sē\
Function: noun
Date: 1979

: a psychological condition or a relationship in which a person is controlled or manipulated by another who is affected with a pathological condition (as an addiction to alcohol or heroin) ; broadly : dependence on the needs of or control by another
GasSavers_maximilian is offline   Reply With Quote
Old 04-08-2009, 08:35 AM   #24
Registered Member
 
Join Date: Nov 2007
Posts: 1,111
Country: United States
Send a message via AIM to dkjones96
Code:
int angle, speed, set_speed, min_speed, max_speed, stall_speed, tpsi, tpso, tpseff, ovrdrv;
// Set sensor inputs and constants. In an actual program these would repeat
from within and calculate based on if it was needed or not to keep the processor
from constantly making calculations instead of executing code and also enables 
you to set your +- numbers in one spot instead of 500.
input angle;
input set_speed;
input speed;
input tpsi;
set min_speed = (set_speed - 5);
set max_speed = (set_speed + 5);
set surge_speed = (set_speed + 10);
set stall_speed = (set_speed - 10);
set tpso = '0';
set ovrdrv = '1';
set tpseff = '75';

Repeat {
// If your vehicle angle is less than or equal to -10 degrees(downward slope) the 
computer will calculate when to get out of overdrive based on surge_speed which 
is a pre-programmed temporary speed increase above the normal maximum speed. 
By the time you have reached the bottom of a hill you should be at surge speed, 
in overdrive again, with no throttle input. That will continue until the car either reaches 
min_speed (level ground) or stall_speed (going up a hill again).
		if (angle <= -10) {
			if (speed < min_speed) { set tpso = tpsi + 1 };
			elseif (speed > surge_speed and tpso != '0') { set tpso = tpsi - 1 };
			elseif (speed > surge_speed and tpso = '0') {
			repeat {
				if (speed > surge_speed and ovrdrv = '1') { set ovrdrv = '0' };
				elseif (speed <= (surge_speed - 3)) { set ovrdrv = '1', return 0 };
				else { set ovrdrv = '0'};
				};
			else { set tpso = tpsi };
		};
//If the vehicle angle is between -10 degrees and 10 degrees vehicle speed is 
maintained like any other cruise control system.
		elseif (angle > -10 and angle < 10) {
			if (speed < min_speed) { set tpso = tpsi + 1 };
			elseif (speed > max_speed and tpso != '0') { set tpso = tpsi - 1 };
			elseif (speed > max_speed and tpso = '0') {
			repeat {
				if (speed > max_speed and ovrdrv = '1') { set ovrdrv = '0' };
				elseif (speed <= (max_speed - 3)) { set ovrdrv = '1', return 0 };
				else { set ovrdrv = '0'};
				}; 
			else { set tpso = tpsi };
		};
// If the angle is greater than 10 degrees and actual speed decreases to less 
than stall_speed the control system automatically increases throttle to a 
pre-determined efficient throttle position, in this case it is 75%. This area needs 
work because the program currently would set to the efficient throttle setting 
and immediately unlock the torque converter because both of them would then be 
true. Then, it would hold that until the surge speed is attained and would exit the 
loop only to end up stuck in the 'else' holding 75% throttle until the angle 
changes.
		elseif (angle >=10) {
			if (speed < stall_speed) { set tpso = tpseff };
			elseif (speed < stall_speed and tpso = tpseff ) {
			repeat {
				if (speed < stall_speed and ovrdrv = '1' ) { set ovrdrv = '0'};
				elseif (speed >= surge speed) { set ovrdrv = '1', return 0 };
				else { set tpso = tpsi };	
			};
			elseif (speed > surge_speed) { set tpso = tpsi - 2 };
			elseif (speed > max_speed and speed < surge_speed) { set tpso = tpsi - 1 };
			else { set tpso = tpsi };
		};
// If there is an angle sensor failure it would default to this, essentially making it 
a constant-throttle cruise control.
		else { set tpso = tpsi };
};
__________________
- Kyle
dkjones96 is offline   Reply With Quote
Old 04-08-2009, 08:42 AM   #25
Registered Member
 
Join Date: Nov 2007
Posts: 1,111
Country: United States
Send a message via AIM to dkjones96
looks confusing on the forum. bummer.

Of course, this is only the automatic function of the program. The portions of the program where you actually set the speed and interrupts for canceling the program aren't there. Neither are the parts of the program that have to convert the TPS outputs and overdrive commands to actual external commands. A good day of programming and another half day of tweaking for different situations and you should get it down fairly well.

It's a little more involved than I wanted to get by just writing something I'll probably never use but after testing angles you should be able to eventually get a very smooth, almost predictive, cruise control system. I've got some 8Kb/8-bit MCs from freescale that would be perfect for this kind of work.
__________________
- Kyle
dkjones96 is offline   Reply With Quote
Old 04-08-2009, 08:58 AM   #26
Registered Member
 
theholycow's Avatar
 
Join Date: Apr 2008
Posts: 6,624
Country: United States
Send a message via ICQ to theholycow Send a message via AIM to theholycow Send a message via MSN to theholycow Send a message via Yahoo to theholycow
You can preserve formatting by using "Code" tags. They're represented by this button:

The result of code tags looks like this:
Code:
blah blah blah {
	if foo then
		bar
		}
Quote my message to see what it looks like in the editor.
__________________
This sig may return, some day.
theholycow is offline   Reply With Quote
Old 04-08-2009, 09:06 AM   #27
Registered Member
 
Join Date: Nov 2007
Posts: 1,111
Country: United States
Send a message via AIM to dkjones96
Sweet!
__________________
- Kyle
dkjones96 is offline   Reply With Quote
Old 04-08-2009, 09:13 AM   #28
Registered Member
 
Join Date: Mar 2009
Posts: 1,139
Country: United States
Oh fine, wait until I'd almost finished reformatting it! It's OK, xcode did most of the heavy lifting.

That's awesome. I'll walk through it.

What syntax is that anyway? Mine was inspired by C++.
__________________


Main Entry: co de pen dence - see codependency
co de pen den cy
Pronunciation: \kō-di-ˈpen-dən(t)-sē\
Function: noun
Date: 1979

: a psychological condition or a relationship in which a person is controlled or manipulated by another who is affected with a pathological condition (as an addiction to alcohol or heroin) ; broadly : dependence on the needs of or control by another
GasSavers_maximilian is offline   Reply With Quote
Old 04-08-2009, 01:56 PM   #29
Registered Member
 
Join Date: Nov 2007
Posts: 1,111
Country: United States
Send a message via AIM to dkjones96
No real syntax. That is just the way I think. Kinda like code free writing.
__________________
- Kyle
dkjones96 is offline   Reply With Quote
Old 04-08-2009, 05:02 PM   #30
Registered Member
 
Join Date: Mar 2009
Posts: 1,139
Country: United States
OK...that's weird. I thought I posted this already. Huh. Try again.

Anyhow, I've had time to process pulse and glide with hills and it's much simpler than I thought at first. You just want to run the engine at a higher power level as much as you can. Since high speed stops you from doing this (via air resistance and safety), hills give you the opportunity to pulse longer up them. Of course the downhill would interrupt a pulse if it occurred then, but you get more coast out of it too. Do I have this right?

I'm curious to work out the overall efficiency of a blind pulse and glide hill algorithm on randomly spaced and sized hills versus an optimal one. Without stops or really sharp turns, of course (which clearly benefit the smarter version).
__________________

__________________


Main Entry: co de pen dence - see codependency
co de pen den cy
Pronunciation: \kō-di-ˈpen-dən(t)-sē\
Function: noun
Date: 1979

: a psychological condition or a relationship in which a person is controlled or manipulated by another who is affected with a pathological condition (as an addiction to alcohol or heroin) ; broadly : dependence on the needs of or control by another
GasSavers_maximilian is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not very precise mpg calculation larjerr Fuelly Web Support and Community News 4 08-20-2012 02:03 AM
Average fuel mileage line in the history graph? BDC Fuelly Web Support and Community News 1 05-06-2009 01:07 AM
91 CRX DX 5 Speed Head Gasket Confusion UfoTofU General Maintenance and Repair 2 04-26-2008 11:09 AM
Is there a website where I can look up... wehrd1 General Maintenance and Repair 3 04-18-2007 06:23 PM
Congratulations Jared!!! SVOboy General Discussion (Off-Topic) 7 08-13-2006 09:55 PM

Powered by vBadvanced CMPS v3.2.3


All times are GMT -8. The time now is 03:49 AM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.