Any progress?
as for me,
Warmup has been added to the OBD code.
Trigger
if (TPS == 0 && ECT < 60) {Warmup_mode = true;} else {Warmup_mode = false; }
I don't know how I will deal with off throttle Decel when coolant is low. I might need to bring Truck speed into the code too lol.
Warmup
/////////////////////WarmUp//////////////////////////////////
//Manages the vanes during Warmup
void WarmupManage() {
if (IAT == 12 || IAT == 13 ||IAT == 14){
if ( EngineRPM > 1000) {
constrain(vane_position, 918, 960);
vane_position += .05;
if (vane_position > 940) {vane_position = 800;}
}
else{vane_position = last_vane_position - 10;}
}
else if (IAT == 22 || IAT == 23 || IAT == 24){
vane_position = 960;
}
else {vane_position = 1000;}
// }
}
Another cool think I can do with the arduino is tell what gear I am in by the speed vs rpm. not sure what I can do with that, but I might come up with something.
Position code has been cleaned up some. I have moved the TPS_range variable to a overall position below, rather than on EVERY calc. Same goes for the new RPM variable. turbo limit has been reduced to 140,000 rpm vs 145,000
/* This code is put in place to control an HE351ve turbo using Turbo RPM and other inputs.
*
* Sections of this code, including but not limited to the rpm based vane position calculations, Freq Measure, and
* Timer setup are thanks to Curtis R Hacker at lilbb.com and his RPM based HE351vgt arduino shield.
*
* This work is licensed under the
* Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* To view a copy of this license,
* visit http://creativecommons.org/licenses/by-nc-sa/4.0/.
*/
/////////////////////////////POS Manage////////////////////////////////////////
void PosManage() {
if (turbo_rpm <= curve_rpm[4]) {
if (ThrottlePosition < 3) { // Idle Section
if (turbo_rpm > BarkRpm) {AntiBark = true; vane_position = min_position;} else {AntiBark = false;} // this will slap the vane positon wide open if turbo is above barkrpm and TPS is below 3
if(turbo_rpm <= idle_rpm) { //if tps is below 3 and turbo rpm is below idle rpm post is idle position
vane_position = idle_position;
idle_walkdown_mode = false;
} else {
if (turbo_rpm <= idle_walkdown_rpm) { idle_walkdown_mode = true;} else { idle_walkdown_mode = false; } //idle walk down walks the turbo position to idle position slowly.
if (idle_walkdown_mode) { vane_position = idle_position - two_cm;}
}
}else { AntiBark = false;
// -----
// Curve section
if (curved){ // if in curved , cruise mode, the turbo will not do a map unless starting from a stop. Otherwise it jut jumps to a position, 65mpg cruise turbo rpm should hang around 35,000 which puts the turbo at 14cm
if (turbo_rpm <= curve_rpm[0]) { vane_position = constrain(map(turbo_rpm, idle_rpm , curve_rpm[0], Offidle_position, turbo_curve[0]), Offidle_position, turbo_curve[0]);} // This will snap the vanes from idle position to starting position whne tps sense.
else if (turbo_rpm <= curve_rpm[1]) { vane_position = turbo_curve[0];} //this is the high end mapping of the turbo.
else if (turbo_rpm <= curve_rpm[2]) { vane_position = turbo_curve[1];} //this is the high end mapping of the turbo.
else if (turbo_rpm <= curve_rpm[3]) { vane_position = turbo_curve[2];} //this is the high end mapping of the turbo.
else { vane_position = turbo_curve[3];}
}
else{
if (turbo_rpm <= curve_rpm[0]){
if ( ThrottlePosition < 20) { vane_position = constrain(map(turbo_rpm, idle_rpm , curve_rpm[0], Offidle_position, turbo_curve[0]), Offidle_position, turbo_curve[0]);} // This will snap the vanes from idle position to starting position whne tps sense.
else { vane_position = turbo_curve[0];} // This will snap the vanes from idle position to starting position whne tps sense.
}
else if (turbo_rpm <= curve_rpm[1]) { vane_position = map(turbo_rpm, curve_rpm[0], curve_rpm[1], turbo_curve[0], turbo_curve[1]);} //this is the high end mapping of the turbo.
else if (turbo_rpm <= curve_rpm[2]) { vane_position = turbo_curve[1];} //this is the high end mapping of the turbo.
else if (turbo_rpm <= curve_rpm[3]) { vane_position = map(turbo_rpm, curve_rpm[2], curve_rpm[3], turbo_curve[1], turbo_curve[2]);} //this is the high end mapping of the turbo.
else { vane_position = map(turbo_rpm, curve_rpm[3], curve_rpm[4], turbo_curve[2], turbo_curve[3]);} //this is the high end mapping of the turbo.
}
}
} else if (turbo_rpm < lit_rpm) { AntiBark = false;
vane_position = map(turbo_rpm, curve_rpm[4], lit_rpm, turbo_curve[3], turbo_curve[4]);}//- TPS_range was put into place to open the vane more if throttle input was higher while boost is low
/////////////////This is the top end controls. The turbo really does increase rpms VERY quickly the trick to to find the sweet spot where rpms stay steady at wot.
////////////////
else {
AntiBark = false;
if (curvea){ //end pos of 18cm starts 12 cm
if (turbo_rpm <= 120000) { vane_position = 584;} //************************ the 6.7 logs we have show the turbo jumping to positions when at WOT rather than stepping.
else if (turbo_rpm <= 126000) { vane_position = 540;}
else if (turbo_rpm <= 132000) { vane_position = 500;} //************************ this will jump to a higher position at given rpms on the top end to slow the turbo down.
else if (turbo_rpm <= 140000) { vane_position = 420;}
}// according to holset the turbo is balanced to 130,000 rpm.
if (curveb){ //End pos of 16cm start 11cm
if (turbo_rpm <= 120000) { vane_position = 645;} //************************
else if (turbo_rpm <= 126000) { vane_position = 624;}
else if (turbo_rpm <= 132000) { vane_position = 600;} //************************
else if (turbo_rpm <= 140000) { vane_position = 502;}
}
if (curvec){ //End pos of 14cm 456 start 10cm
if (turbo_rpm <= 120000) { vane_position = 700;} //************************
else if (turbo_rpm <= 126000) { vane_position = 685;} //************************
else if (turbo_rpm <= 132000) { vane_position = 640;} //************************
else if (turbo_rpm <= 140000) { vane_position = 544;}
}
if (curved){ //End pos of 17cm start 16cm
if (turbo_rpm <= 120000) { vane_position = 458;} //************************
else if (turbo_rpm <= 128000) { vane_position = 416;} //************************
}
if (turbo_rpm > curve_rpm[3]) {vane_position -= TPS_range;}
if (turbo_rpm > curve_rpm[4]) {vane_position -= RPM;}
if (turbo_rpm > 110000) {
if (turbo_accel[2] > 60) { vane_position -= 10; }
if (turbo_accel[2] > 90) { vane_position -= 10; }
}
// Overrun protection
if (turbo_rpm > 140000 ){ // 140,000 rpms is where I get worried about shaft speed.
if (turbo_accel[2] > 0 && BoostPressure > 25) {vane_position = last_vane_position - 2;} //this will creep the vane position more open each code cycle if turbo rpms are above 150,000 if not in curvea ( perf mode defined by "F_watchpot" tab)
else if (turbo_accel[2] > 0 && BoostPressure < 25) {vane_position = last_vane_position - 1;}
else {vane_position = last_vane_position;}
}
if (turbo_rpm > 155000) {
vane_position -=10;
}
if (turbo_rpm > 160000) {
vane_position -=40;
}
}
}
To be able to use Engine RPMs I have mapped the reading ( 0, 3200, 0, 80) So at 0 rpm the turbo adjustment is 0 and at 3200 ppm adjustment is 80 or about 2 cm.
int ReadEngineRPM(){
if (obd.read(PID_RPM, EngineRPM));
return map(EngineRPM, 0, 3200, 0, 80); // read the value from the sensor I am mapping the rpms to give a reasonable vane adjustment without having to divide later.
}
Not sure if I like that yet, but I can't really see a need to not have it mapped. Mapping it allows me to not do a bunch of dividing in the code, which I guess is slow lolol.