 dkjones96 Sweet! 04-08-2009, 08:06 AM
|
04-08-2009, 07:35 AM
|
#17
|
Registered Member
Join Date: Nov 2007
Posts: 1,111
|
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
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Car Talk & Chit Chat |
|
|
|
|
|
» Fuelly iOS Apps |
|
» Fuelly Android Apps |
|
|