public void SetMapSensorTypes(MapSensorType fromType, MapSensorType toType) { memoEdit1.Text += Environment.NewLine; string targetMapSensorString = "3 bar mapsensor"; switch (toType) { case MapSensorType.MapSensor25: targetMapSensorString = "2.5 bar mapsensor"; break; case MapSensorType.MapSensor30: targetMapSensorString = "3.0 bar mapsensor"; break; case MapSensorType.MapSensor35: targetMapSensorString = "3.5 bar mapsensor"; break; case MapSensorType.MapSensor40: targetMapSensorString = "4.0 bar mapsensor"; break; case MapSensorType.MapSensor50: targetMapSensorString = "5.0 bar mapsensor"; break; } string sourceMapSensorString = "3 bar mapsensor"; switch (fromType) { case MapSensorType.MapSensor25: sourceMapSensorString = "2.5 bar mapsensor"; break; case MapSensorType.MapSensor30: sourceMapSensorString = "3.0 bar mapsensor"; break; case MapSensorType.MapSensor35: sourceMapSensorString = "3.5 bar mapsensor"; break; case MapSensorType.MapSensor40: sourceMapSensorString = "4.0 bar mapsensor"; break; case MapSensorType.MapSensor50: sourceMapSensorString = "5.0 bar mapsensor"; break; } memoEdit1.Text += "You are converting from a " + sourceMapSensorString + " to a " + targetMapSensorString; //All boost related tables will be altered to make sure the correct values are calculated within the ECU based on the new mapsensor type. }
private double CalculateConversionFactor(MapSensorType fromSensorType, MapSensorType toSensorType) { double factor = 1.2; switch (fromSensorType) { case MapSensorType.MapSensor25: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 1.0; // from 2.5 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 1.2; // from 2.5 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 1.4; // from 2.5 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 1.6; // from 2.5 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 2.0; // from 2.5 to 5.0 mapsensor break; } break; case MapSensorType.MapSensor30: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 0.8333; // from 3.0 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 1.0; // from 3.0 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 1.1666; // from 3.0 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 1.3333; // from 3.0 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 1.6667; // from 3.0 to 5.0 mapsensor break; } break; case MapSensorType.MapSensor35: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 0.7143; // from 3.5 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 0.8571; // from 3.5 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 1.0; // from 3.5 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 1.1429; // from 3.5 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 1.4285; // from 3.5 to 5.0 mapsensor break; } break; case MapSensorType.MapSensor40: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 0.6250; // from 4.0 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 0.75; // from 4.0 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 0.875; // from 4.0 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 1.0; // from 4.0 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 1.25; // from 4.0 to 5.0 mapsensor break; } break; case MapSensorType.MapSensor50: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 0.5; // from 5.0 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 0.6; // from 5.0 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 0.7; // from 5.0 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 0.8; // from 5.0 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 1.0; // from 5.0 to 5.0 mapsensor break; } break; } return factor; }
/// <summary> /// Take care of threebar conversion as well! /// </summary> /// <param name="symbolname"></param> /// <param name="ecudata"></param> /// <returns></returns> public double ConvertSymbol(string symbolname, byte[] ecudata, MapSensorType _mapsensor, double _userCorrectionFactor, double _userCorrectionOffset, bool UseUserCorrection) { double retval = 0; if (UseUserCorrection) { retval = ConvertByteStringToDouble(ecudata); retval *= _userCorrectionFactor; retval += _userCorrectionOffset; } else { //convert data depending on symbolname double _correctionForMapsensor = 1; switch (_mapsensor) { case MapSensorType.MapSensor25: _correctionForMapsensor = 1; break; case MapSensorType.MapSensor30: _correctionForMapsensor = 1.2; break; case MapSensorType.MapSensor35: _correctionForMapsensor = 1.4; break; case MapSensorType.MapSensor40: _correctionForMapsensor = 1.6; break; case MapSensorType.MapSensor50: _correctionForMapsensor = 2.0; break; } switch (symbolname) { case "P_medel": case "P_Manifold10": case "P_Manifold": case "Max_tryck": case "Regl_tryck": // inlet manifold pressure retval = ConvertByteStringToDouble(ecudata); retval *= _correctionForMapsensor; retval *= 0.01F; retval -= 1; break; case "Lufttemp": retval = ConvertByteStringToDouble(ecudata); if (retval > 128) retval = -(256 - retval); break; case "Kyl_temp": retval = ConvertByteStringToDouble(ecudata); if (retval > 128) retval = -(256 - retval); break; case "Rpm": retval = ConvertByteStringToDouble(ecudata); retval *= 10; // factor 10 break; case "AD_sond": // should average, no the realtime panel does that retval = ConvertByteStringToDouble(ecudata); retval = ConvertToAFR(retval); break; case "AD_EGR": retval = ConvertByteStringToDouble(ecudata); retval = ConvertToWidebandAFR(retval); //retval = ConvertToAFR(retval); break; case "Pgm_status": // now what, just pass it on in a seperate structure retval = ConvertByteStringToDoubleStatus(ecudata); break; case "Insptid_ms10": retval = ConvertByteStringToDouble(ecudata); retval /= 10; break; case "Lacc_mangd": case "Acc_mangd": case "Lret_mangd": case "Ret_mangd": retval = ConvertByteStringToDouble(ecudata); // 4 values in one variable, one for each cylinder break; case "Ign_angle": retval = ConvertByteStringToDouble(ecudata); if (retval > 32000) retval = -(65536 - retval); retval /= 10; break; case "Knock_offset1": case "Knock_offset2": case "Knock_offset3": case "Knock_offset4": case "Knock_offset1234": retval = ConvertByteStringToDouble(ecudata); if (retval > 32000) retval = -(65536 - retval); retval /= 10; break; case "Medeltrot": retval = ConvertByteStringToDouble(ecudata); retval -= 34; //TODO: should substract trot_min from this value? break; case "Apc_decrese": retval = ConvertByteStringToDouble(ecudata); retval *= _correctionForMapsensor; retval *= 0.01F; // to bar! break; case "P_fak": case "I_fak": case "D_fak": retval = ConvertByteStringToDouble(ecudata); if (retval > 32000) retval = -(65535 - retval); break; case "PWM_ut10": retval = ConvertByteStringToDouble(ecudata); break; case "Knock_count_cyl1": case "Knock_count_cyl2": case "Knock_count_cyl3": case "Knock_count_cyl4": retval = ConvertByteStringToDouble(ecudata); break; case "Knock_average": retval = ConvertByteStringToDouble(ecudata); break; case "Bil_hast": retval = ConvertByteStringToDouble(ecudata); break; case "TQ": retval = ConvertByteStringToDouble(ecudata); retval *= _correctionForMapsensor; break; default: retval = ConvertByteStringToDouble(ecudata); break; } } return retval; }
public void SetMapSensorType(MapSensorType mapsensor) { comboBoxEdit1.SelectedIndex = (int)mapsensor; }
private void UpdateMaxima(TurboType turbo, InjectorType injectors, MapSensorType mapSensor) { switch (mapSensor) { case MapSensorType.MapSensor25: // max achievable 400Nm / 1.45 bar if (injectors == InjectorType.Stock) { spinEdit1.Properties.MaxValue = 400; spinEdit2.Properties.MaxValue = (decimal)1.30; } else { spinEdit1.Properties.MaxValue = 450; spinEdit2.Properties.MaxValue = (decimal)1.45; } break; case MapSensorType.MapSensor30: switch (injectors) { case InjectorType.Stock: spinEdit1.Properties.MaxValue = 400; spinEdit2.Properties.MaxValue = (decimal)1.30; break; case InjectorType.GreenGiants: switch (turbo) { case TurboType.Stock: case TurboType.TD0415T: spinEdit1.Properties.MaxValue = 450; spinEdit2.Properties.MaxValue = (decimal)1.45; break; case TurboType.GT28BB: case TurboType.GT28RS: case TurboType.TD0419T: spinEdit1.Properties.MaxValue = 550; spinEdit2.Properties.MaxValue = (decimal)1.70; break; case TurboType.GT3071R: case TurboType.HX35w: spinEdit1.Properties.MaxValue = 550; spinEdit2.Properties.MaxValue = (decimal)1.50; break; case TurboType.HX40w: case TurboType.S400SX371: spinEdit1.Properties.MaxValue = 550; spinEdit2.Properties.MaxValue = (decimal)1.40; break; } break; case InjectorType.Siemens630Dekas: // 3.0 bar sensor, 630cc injectors -> max 600Nm switch (turbo) { case TurboType.Stock: case TurboType.TD0415T: spinEdit1.Properties.MaxValue = 450; spinEdit2.Properties.MaxValue = (decimal)1.45; break; case TurboType.GT28BB: case TurboType.GT28RS: case TurboType.TD0419T: spinEdit1.Properties.MaxValue = 580; spinEdit2.Properties.MaxValue = (decimal)1.75; break; case TurboType.GT3071R: case TurboType.HX35w: spinEdit1.Properties.MaxValue = 600; spinEdit2.Properties.MaxValue = (decimal)1.80; break; case TurboType.HX40w: case TurboType.S400SX371: spinEdit1.Properties.MaxValue = 600; spinEdit2.Properties.MaxValue = (decimal)1.70; break; } break; case InjectorType.Siemens875Dekas: case InjectorType.Siemens1000cc: // 3.0 bar sensor, 630cc injectors -> limit to turbo only switch (turbo) { case TurboType.Stock: case TurboType.TD0415T: spinEdit1.Properties.MaxValue = 450; spinEdit2.Properties.MaxValue = (decimal)1.45; break; case TurboType.GT28BB: case TurboType.GT28RS: case TurboType.TD0419T: spinEdit1.Properties.MaxValue = 580; spinEdit2.Properties.MaxValue = (decimal)1.75; break; case TurboType.GT3071R: case TurboType.HX35w: spinEdit1.Properties.MaxValue = 620; spinEdit2.Properties.MaxValue = (decimal)1.9; break; case TurboType.HX40w: case TurboType.S400SX371: spinEdit1.Properties.MaxValue = 670; spinEdit2.Properties.MaxValue = (decimal)2.0; break; } break; } break; case MapSensorType.MapSensor35: case MapSensorType.MapSensor40: case MapSensorType.MapSensor50: switch (injectors) { case InjectorType.Stock: spinEdit1.Properties.MaxValue = 400; spinEdit2.Properties.MaxValue = (decimal)1.30; break; case InjectorType.GreenGiants: switch (turbo) { case TurboType.Stock: case TurboType.TD0415T: spinEdit1.Properties.MaxValue = 450; spinEdit2.Properties.MaxValue = (decimal)1.45; break; case TurboType.GT28BB: case TurboType.GT28RS: case TurboType.TD0419T: spinEdit1.Properties.MaxValue = 550; spinEdit2.Properties.MaxValue = (decimal)1.70; break; case TurboType.GT3071R: case TurboType.HX35w: spinEdit1.Properties.MaxValue = 550; spinEdit2.Properties.MaxValue = (decimal)1.50; break; case TurboType.HX40w: case TurboType.S400SX371: spinEdit1.Properties.MaxValue = 550; spinEdit2.Properties.MaxValue = (decimal)1.40; break; } break; case InjectorType.Siemens630Dekas: // 3.0 bar sensor, 630cc injectors -> max 600Nm switch (turbo) { case TurboType.Stock: case TurboType.TD0415T: spinEdit1.Properties.MaxValue = 450; spinEdit2.Properties.MaxValue = (decimal)1.45; break; case TurboType.GT28BB: case TurboType.GT28RS: case TurboType.TD0419T: spinEdit1.Properties.MaxValue = 580; spinEdit2.Properties.MaxValue = (decimal)1.75; break; case TurboType.GT3071R: case TurboType.HX35w: spinEdit1.Properties.MaxValue = 600; spinEdit2.Properties.MaxValue = (decimal)1.80; break; case TurboType.HX40w: case TurboType.S400SX371: spinEdit1.Properties.MaxValue = 600; spinEdit2.Properties.MaxValue = (decimal)1.70; break; } break; case InjectorType.Siemens875Dekas: case InjectorType.Siemens1000cc: // 3.0 bar sensor, 630cc injectors -> limit to turbo only switch (turbo) { case TurboType.Stock: case TurboType.TD0415T: spinEdit1.Properties.MaxValue = 450; spinEdit2.Properties.MaxValue = (decimal)1.45; break; case TurboType.GT28BB: case TurboType.GT28RS: case TurboType.TD0419T: spinEdit1.Properties.MaxValue = 580; spinEdit2.Properties.MaxValue = (decimal)1.75; break; case TurboType.GT3071R: case TurboType.HX35w: spinEdit1.Properties.MaxValue = 620; spinEdit2.Properties.MaxValue = (decimal)1.9; break; case TurboType.HX40w: case TurboType.S400SX371: spinEdit1.Properties.MaxValue = 670; spinEdit2.Properties.MaxValue = (decimal)2.2; break; } break; } break; } UpdateStage(); }
public void ConvertFileToThreeBarMapSensor(IECUFileInformation fileinformation, MapSensorType fromSensorType, MapSensorType toSensorType) { m_fileInformation = fileinformation; // frmProgress progress = new frmProgress(); // progress.Show(); // progress.SetProgress("Checking current configuration..."); m_resume = new Trionic5Resume(); m_resume.ResumeTuning = new System.Data.DataTable(); m_resume.ResumeTuning.Columns.Add("Description"); if (fromSensorType == toSensorType) return; string infoStr = "Tuning your binary from "; string infoCopyStr = "beforetuningfrom"; switch (fromSensorType) { case MapSensorType.MapSensor25: infoStr += " 2.5 bar sensor to "; infoCopyStr += "250kpasensorto"; break; case MapSensorType.MapSensor30: infoStr += " 3.0 bar sensor to "; infoCopyStr += "300kpasensorto"; break; case MapSensorType.MapSensor35: infoStr += " 3.5 bar sensor to "; infoCopyStr += "350kpasensorto"; break; case MapSensorType.MapSensor40: infoStr += " 4.0 bar sensor to "; infoCopyStr += "400kpasensorto"; break; case MapSensorType.MapSensor50: infoStr += " 5.0 bar sensor to "; infoCopyStr += "500kpasensorto"; break; } switch (toSensorType) { case MapSensorType.MapSensor25: infoStr += " 2.5 bar sensor"; infoCopyStr += "250kpasensor"; break; case MapSensorType.MapSensor30: infoStr += " 3.0 bar sensor"; infoCopyStr += "300kpasensor"; break; case MapSensorType.MapSensor35: infoStr += " 3.5 bar sensor"; infoCopyStr += "350kpasensor"; break; case MapSensorType.MapSensor40: infoStr += " 4.0 bar sensor"; infoCopyStr += "400kpasensor"; break; case MapSensorType.MapSensor50: infoStr += " 5.0 bar sensor"; infoCopyStr += "500kpasensor"; break; } infoStr += ": " + Path.GetFileName(m_fileInformation.Filename); m_resume.AddToResumeTable(infoStr); // get the software ID from the bainery //progress.SetProgress("Creating backup file..."); File.Copy(m_fileInformation.Filename, Path.GetDirectoryName(m_fileInformation.Filename) + "\\" + Path.GetFileNameWithoutExtension(m_fileInformation.Filename) + DateTime.Now.ToString("yyyyMMddHHmmss") + infoCopyStr + ".bin", true); m_resume.AddToResumeTable("Backup file created (" + Path.GetFileNameWithoutExtension(m_fileInformation.Filename) + DateTime.Now.ToString("yyyyMMddHHmmss") + infoCopyStr + ".bin" + ")"); // symbols with MAP as values infoStr = "Altering tables for"; switch (toSensorType) { case MapSensorType.MapSensor25: infoStr += " 2.5 bar sensor..."; break; case MapSensorType.MapSensor30: infoStr += " 3.0 bar sensor..."; break; case MapSensorType.MapSensor35: infoStr += " 3.5 bar sensor..."; break; case MapSensorType.MapSensor40: infoStr += " 4.0 bar sensor..."; break; } //progress.SetProgress(infoStr); double factor = CalculateConversionFactor(fromSensorType, toSensorType); AlterTableForThreeBarSensor("Tryck_mat!", factor); AlterTableForThreeBarSensor("Tryck_mat_a!", factor); AlterTableForThreeBarSensor("Tryck_vakt_tab!", factor); AlterTableForThreeBarSensor("Regl_tryck_fgaut!", factor); AlterTableForThreeBarSensor("Regl_tryck_fgm!", factor); AlterTableForThreeBarSensor("Regl_tryck_sgm!", factor); AlterTableForThreeBarSensor("Limp_tryck_konst!", factor); AlterTableForThreeBarSensor("Idle_tryck!", factor); AlterTableForThreeBarSensor("Knock_press_tab!", factor); AlterTableForThreeBarSensor("Turbo_knock_tab!", factor); AlterTableForThreeBarSensor("Iv_min_load!", factor); // new symbols 25/03/2008 AlterTableForThreeBarSensor("Open_loop!", factor); AlterTableForThreeBarSensor("Open_loop_knock!", factor); AlterTableForThreeBarSensor("Open_loop_adapt!", factor); AlterTableForThreeBarSensor("Lacc_clear_tab!", factor); AlterTableForThreeBarSensor("Lner_detekt!", factor); AlterTableForThreeBarSensor("Lupp_detekt!", factor); AlterTableForThreeBarSensor("Sond_heat_tab!", factor); AlterTableForThreeBarSensor("Grund_last!", factor); AlterTableForThreeBarSensor("Grund_last_max!", factor); //end /* Detect_map_x_axis (1.2 factor, normal) Reg_last (1.2 factor, normal) Overstid_tab op 0 gezet (bigger turbo???) Fuel_knock_xaxis factor 1.2 + increasing in last 5 stages Fuel_map_xaxis factor 1.2 + increasing in last 5 stages Ign_map_6_x_axis factor 1.2 Ign_map_2_x_axis factor 1.2 Ign_map_0_x_axis factor 1.2 + increasing in last 8 stages Misfire_map_x_axis factor 1.2 * * */ //progress.SetProgress("Altering axis for" + infoStr); // symbols with MAP in x axis // these three need increasing last steps AlterXAxisForThreeBarSensor("Fuel_map_xaxis!", false, factor); AlterXAxisForThreeBarSensor("Fuel_knock_xaxis!", false, factor); AlterXAxisForThreeBarSensor("Ign_map_0_x_axis!", true, factor); AlterXAxisForThreeBarSensor("Ign_map_2_x_axis!", true, factor); AlterXAxisForThreeBarSensor("Ign_map_3_x_axis!", true, factor); //AlterXAxisForThreeBarSensor("Ign_map_4_x_axis!", false, factor); AlterXAxisForThreeBarSensor("Ign_map_6_x_axis!", true, factor); AlterXAxisForThreeBarSensor("Ign_map_8_x_axis!", true, factor); AlterXAxisForThreeBarSensor("Temp_reduce_x_st!", false, factor); AlterXAxisForThreeBarSensor("Misfire_map_x_axis!", true, factor); //AlterXAxisForThreeBarSensor("Mis200_map!", factor); //AlterXAxisForThreeBarSensor("Misfire_map!", factor); AlterXAxisForThreeBarSensor("Detect_map_x_axis!", true, factor); //AlterXAxisForThreeBarSensor("Knock_ref_matrix!", factor); AlterXAxisForThreeBarSensor("Idle_st_last!", false, factor); AlterXAxisForThreeBarSensor("Reg_last!", false, factor); // new symbols 25/03/2008 AlterXAxisForThreeBarSensor("Min_load_gadapt!", false, factor); AlterXAxisForThreeBarSensor("Max_load_gadapt!", false, factor); AlterXAxisForThreeBarSensor("Kadapt_load_low!", false, factor); AlterXAxisForThreeBarSensor("Kadapt_load_high!", false, factor); AlterXAxisForThreeBarSensor("Last_cyl_komp!", false, factor); AlterXAxisForThreeBarSensor("Overs_tab_xaxis!", false, factor); // end //if (!m_appSettings.PreventThreeBarRescaling) { TuneAndSmoothTable("Insp_mat!", 16); TuneAndSmoothTable("Fuel_knock_mat!", 12); TuneAndSmoothTableSixteen("Ign_map_0!", 18); TuneAndSmoothTableSixteen("Ign_map_4!", 18); } // ALTER Grund_last! // ALTER Lam_laststeg! // symbols with MAP in Y axis //AlterYAxisForThreeBarSensor("Lambdamatris!"); // Also scale inj_konst with factor 1.2 because the measured MAP value will be 1.2 factor lower // and this value is used to determine Grund_tid in injection duration calculation. //<GS-30062010> Probably better to do this after all (have a look at ChrisDuram examples) ScaleInjectorConstant(factor); //<GS-06072010> ??? should this be done? WriteThreeBarConversionMarker(m_fileInformation.Filename, toSensorType); //TryVerifyChecksum(m_fileInformation.Filename); //CheckBinForAnomalies(m_fileInformation.Filename, true, false); //progress.Close(); }
public TuningResult FreeTuneBinary(IECUFile m_File, double peakTorque, double peakBoost, bool tuneBasedOnTorque, MapSensorType mapType, TurboType turboType, InjectorType injectorType, BPCType valve, int rpmlimiter, int knockTime) { Trionic5Resume _localResume = new Trionic5Resume(); m_fileInformation = m_File.GetFileInfo(); string filename = m_fileInformation.Filename; // first set things right by running the tunetostagex wizard // generate a nice x_scale for ignition map (18 long) PressureToTorque ptt = new PressureToTorque(); double peak_boost = ptt.CalculatePressureFromTorque(peakTorque, turboType); if (!tuneBasedOnTorque) peak_boost = peakBoost; double peak_boost_request = peak_boost; double correction = 1.0; if (mapType == MapSensorType.MapSensor30) correction = 1.2; if (mapType == MapSensorType.MapSensor35) correction = 1.4; if (mapType == MapSensorType.MapSensor40) correction = 1.6; if (mapType == MapSensorType.MapSensor50) correction = 2.0; peak_boost_request *= 100; peak_boost_request += 100; peak_boost_request /= correction; peak_boost_request -= 100; peak_boost_request /= 100; double min_pressure = -1; double max_pressure = peak_boost; #region preparation /********* start of prepare phase *********/ string enginetp = readenginetype(filename); string partnumber = readpartnumber(filename); PartNumberConverter pnc = new PartNumberConverter(); ECUInformation ecuinfo = pnc.GetECUInfo(partnumber, enginetp); bool isLpt = true; if (ReadTunedToStageMarker(filename) > 0) { return TuningResult.TuningFailedAlreadyTuned; } else if (ReadThreeBarConversionMarker(filename) > 0) { return TuningResult.TuningFailedThreebarSensor; } Trionic5Properties t5p = m_File.GetTrionicProperties(); if (ecuinfo.Valid) { if (ecuinfo.Isaero || ecuinfo.Isfpt) { isLpt = false; } } if (t5p.MapSensorType != mapType) { ConvertFileToThreeBarMapSensor(m_fileInformation, t5p.MapSensorType, mapType); } // check injector type if (t5p.InjectorType != injectorType) { int inj_konst_diff = DetermineDifferenceInInjectorConstant(t5p.InjectorType, injectorType); AddToInjectorConstant(filename, inj_konst_diff); SetInjectorBatteryCorrectionMap(m_File, injectorType); //TODO: check this function for correctness! } /*if (injectorType == InjectorType.Stock) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 19); else if (injectorType == InjectorType.GreenGiants) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 18); else if (injectorType == InjectorType.Siemens630Dekas) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 15); else if (injectorType == InjectorType.Siemens875Dekas) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 13); else if (injectorType == InjectorType.Siemens875Dekas) writebyteinfile(filename, GetSymbolAddress("Inj_konst!"), 13);*/ t5p.TurboType = turboType; t5p.InjectorType = injectorType; t5p.MapSensorType = mapType; // determine stage?? int stage = 0; if (peak_boost < 1.2) stage = 1; else if (peak_boost < 1.3) stage = 2; else if (peak_boost < 1.4) stage = 3; else if (peak_boost < 1.5) stage = 4; else if (peak_boost < 1.6) stage = 5; else if (peak_boost < 1.7) stage = 6; else if (peak_boost < 1.8) stage = 7; else if (peak_boost < 1.9) stage = 8; else stage = 9; m_File.SetTrionicOptions(t5p); TuneToStage(filename, stage, peak_boost_request, 0.52, 1.0, 0.52, 1.54, 90, isLpt, turboType, injectorType, mapType); _localResume.ResumeTuning = m_resume.ResumeTuning.Copy(); /*********** end of prepare phase **************/ // set limiter, bpc valve type and knock time SetBPCValveType(filename, valve); _localResume.AddToResumeTable("Set BPC driving frequencies"); SetRPMLimiter(filename, rpmlimiter); _localResume.AddToResumeTable("Set RPM limiter"); SetKnockTime(filename, knockTime); _localResume.AddToResumeTable("Set knock time value"); #endregion // if mapsensor != stock and injectors are 630 cc or bigger if (mapType != MapSensorType.MapSensor25 && (injectorType == InjectorType.Siemens630Dekas || injectorType == InjectorType.Siemens875Dekas || injectorType == InjectorType.Siemens1000cc)) { // now scale it double step = (max_pressure - min_pressure) / 17; double[] axisforIgnitionMap = new double[18]; for (int i = 0; i < 18; i++) { axisforIgnitionMap.SetValue(min_pressure + (i * step), i); } byte[] actualAxis = new byte[36]; int j = 0; for (int i = 0; i < 18; i++) { double currValue = Convert.ToDouble(axisforIgnitionMap.GetValue(i)); currValue *= 100; currValue += 100; if (mapType == MapSensorType.MapSensor30) currValue /= 1.2; else if (mapType == MapSensorType.MapSensor35) currValue /= 1.4; else if (mapType == MapSensorType.MapSensor40) currValue /= 1.6; else if (mapType == MapSensorType.MapSensor50) currValue /= 2.0; int ival = Convert.ToInt32(currValue); byte v1 = (byte)(ival / 256); byte v2 = (byte)(ival - (int)v1 * 256); actualAxis.SetValue(v1, j++); actualAxis.SetValue(v2, j++); } m_File.WriteData(actualAxis, (uint)m_File.GetFileInfo().GetSymbolAddressFlash("Ign_map_0_x_axis!")); _localResume.AddToResumeTable("Generated and saved new ignition map x axis"); //Generate the ignition map based on the axis values GenerateAndSaveNewIgnitionMap(m_File, false); _localResume.AddToResumeTable("Generated and saved new ignition map"); min_pressure = -0.8; step = (max_pressure - min_pressure) / 15; // now setup x axis for fuel map double[] axisforFuelMap = new double[16]; for (int i = 0; i < 16; i++) { axisforFuelMap.SetValue(min_pressure + (i * step), i); } byte[] actualFuelAxis = new byte[16]; for (int i = 0; i < 16; i++) { double currValue = Convert.ToDouble(axisforFuelMap.GetValue(i)); currValue *= 100; currValue += 100; if (mapType == MapSensorType.MapSensor30) currValue /= 1.2; else if (mapType == MapSensorType.MapSensor35) currValue /= 1.4; else if (mapType == MapSensorType.MapSensor40) currValue /= 1.6; else if (mapType == MapSensorType.MapSensor50) currValue /= 2.0; int ival = Convert.ToInt32(currValue); if (ival > 255) ival = 255; actualFuelAxis.SetValue((byte)ival, i); } m_File.WriteData(actualFuelAxis, (uint)m_File.GetFileInfo().GetSymbolAddressFlash("Fuel_map_xaxis!")); _localResume.AddToResumeTable("Generated and saved new fuel map x axis"); //Generate the ignition map based on the axis values GenerateAndSaveNewFuelMap(m_File); _localResume.AddToResumeTable("Generated and saved new fuel map"); min_pressure = -0.3; step = (max_pressure - min_pressure) / 11; // now setup x axis for fuel map double[] axisforFuelKnockMap = new double[12]; for (int i = 0; i < 12; i++) { axisforFuelKnockMap.SetValue(min_pressure + (i * step), i); } byte[] actualFuelKnockAxis = new byte[12]; for (int i = 0; i < 12; i++) { double currValue = Convert.ToDouble(axisforFuelKnockMap.GetValue(i)); currValue *= 100; currValue += 100; if (mapType == MapSensorType.MapSensor30) currValue /= 1.2; else if (mapType == MapSensorType.MapSensor35) currValue /= 1.4; else if (mapType == MapSensorType.MapSensor40) currValue /= 1.6; else if (mapType == MapSensorType.MapSensor50) currValue /= 2.0; int ival = Convert.ToInt32(currValue); if (ival > 255) ival = 255; actualFuelKnockAxis.SetValue((byte)ival, i); } m_File.WriteData(actualFuelKnockAxis, (uint)m_File.GetFileInfo().GetSymbolAddressFlash("Fuel_knock_xaxis!")); _localResume.AddToResumeTable("Generated and saved new fuel knock map x axis"); //Generate the ignition map based on the axis values GenerateAndSaveNewFuelKnockMap(m_File); _localResume.AddToResumeTable("Generated and saved new fuel knock map"); // mesh up a boost request map for this.. already possible // adjust peak boost to be scaled for the mapsensor type SetBoostRequestMaps(turboType, injectorType, mapType, m_File.GetFileInfo().Filename, peak_boost_request, 100, isLpt); _localResume.AddToResumeTable("Generated boost request maps"); } m_resume.ResumeTuning = _localResume.ResumeTuning.Copy(); return TuningResult.TuningSuccess; }
/// <summary> /// Take care of threebar conversion as well! /// </summary> /// <param name="symbolname"></param> /// <param name="ecudata"></param> /// <returns></returns> public double ConvertSymbol(string symbolname, byte[] ecudata, MapSensorType _mapsensor, double _userCorrectionFactor, double _userCorrectionOffset, bool UseUserCorrection) { double retval = 0; if (UseUserCorrection) { retval = ConvertByteStringToDouble(ecudata); retval *= _userCorrectionFactor; retval += _userCorrectionOffset; } else { //convert data depending on symbolname double _correctionForMapsensor = 1; switch (_mapsensor) { case MapSensorType.MapSensor25: _correctionForMapsensor = 1; break; case MapSensorType.MapSensor30: _correctionForMapsensor = 1.2; break; case MapSensorType.MapSensor35: _correctionForMapsensor = 1.4; break; case MapSensorType.MapSensor40: _correctionForMapsensor = 1.6; break; case MapSensorType.MapSensor50: _correctionForMapsensor = 2.0; break; } switch (symbolname) { case "P_medel": case "P_Manifold10": case "P_Manifold": case "Max_tryck": case "Regl_tryck": // inlet manifold pressure retval = ConvertByteStringToDouble(ecudata); retval *= _correctionForMapsensor; retval *= 0.01F; retval -= 1; break; case "Lufttemp": retval = ConvertByteStringToDouble(ecudata); if (retval > 128) { retval = -(256 - retval); } break; case "Kyl_temp": retval = ConvertByteStringToDouble(ecudata); if (retval > 128) { retval = -(256 - retval); } break; case "Rpm": retval = ConvertByteStringToDouble(ecudata); retval *= 10; // factor 10 break; case "AD_sond": // should average, no the realtime panel does that retval = ConvertByteStringToDouble(ecudata); retval = ConvertToAFR(retval); break; case "AD_EGR": retval = ConvertByteStringToDouble(ecudata); retval = ConvertToWidebandAFR(retval); //retval = ConvertToAFR(retval); break; case "Pgm_status": // now what, just pass it on in a seperate structure retval = ConvertByteStringToDoubleStatus(ecudata); break; case "Insptid_ms10": retval = ConvertByteStringToDouble(ecudata); retval /= 10; break; case "Lacc_mangd": case "Acc_mangd": case "Lret_mangd": case "Ret_mangd": retval = ConvertByteStringToDouble(ecudata); // 4 values in one variable, one for each cylinder break; case "Ign_angle": retval = ConvertByteStringToDouble(ecudata); if (retval > 32000) { retval = -(65536 - retval); } retval /= 10; break; case "Knock_offset1": case "Knock_offset2": case "Knock_offset3": case "Knock_offset4": case "Knock_offset1234": retval = ConvertByteStringToDouble(ecudata); if (retval > 32000) { retval = -(65536 - retval); } retval /= 10; break; case "Medeltrot": retval = ConvertByteStringToDouble(ecudata); retval -= 34; //TODO: should substract trot_min from this value? break; case "Apc_decrese": retval = ConvertByteStringToDouble(ecudata); retval *= _correctionForMapsensor; retval *= 0.01F; // to bar! break; case "P_fak": case "I_fak": case "D_fak": retval = ConvertByteStringToDouble(ecudata); if (retval > 32000) { retval = -(65535 - retval); } break; case "PWM_ut10": retval = ConvertByteStringToDouble(ecudata); break; case "Knock_count_cyl1": case "Knock_count_cyl2": case "Knock_count_cyl3": case "Knock_count_cyl4": retval = ConvertByteStringToDouble(ecudata); break; case "Knock_average": retval = ConvertByteStringToDouble(ecudata); break; case "Bil_hast": retval = ConvertByteStringToDouble(ecudata); break; case "TQ": retval = ConvertByteStringToDouble(ecudata); retval *= _correctionForMapsensor; break; default: retval = ConvertByteStringToDouble(ecudata); break; } } return(retval); }
private void TuneToStage(string m_currentfile, int stage, double maxBoostValue, double maxBoostFirstGear, double maxBoostSecondGear, double maxBoostFirstGearAUT, double fuelCutLevel, double AutoGearBoxPercentage, bool isLpt, TurboType turboType, InjectorType injectorType, MapSensorType mapSensorType) { m_resume = new Trionic5Resume(); m_resume.AddToResumeTable("Tuning your binary to stage: " + stage.ToString()); // get the software ID from the bainery string enginetp = readenginetype(m_currentfile); string partnumber = readpartnumber(m_currentfile); // look up parameters for this sw id PartNumberConverter pnc = new PartNumberConverter(); ECUInformation ecuinfo = pnc.GetECUInfo(partnumber, enginetp); File.Copy(m_currentfile, Path.GetDirectoryName(m_currentfile) + "\\" + Path.GetFileNameWithoutExtension(m_currentfile) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetuningtostage" + stage.ToString() + ".bin", true); m_resume.AddToResumeTable("Backup file created (" + Path.GetFileNameWithoutExtension(m_currentfile) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetuningtostage" + stage.ToString() + ".bin" + ")"); switch (stage) { case 1: SetRegKonMatFirstGearManual(m_currentfile, 30); SetRegKonMatSecondGearManual(m_currentfile, 45); SetRegKonMatFirstGearAutomatic(m_currentfile, 30); break; case 2: SetRegKonMatFirstGearManual(m_currentfile, 45); SetRegKonMatSecondGearManual(m_currentfile, 45); SetRegKonMatFirstGearAutomatic(m_currentfile, 45); break; case 3: default: SetRegKonMatFirstGearManual(m_currentfile, 45); SetRegKonMatSecondGearManual(m_currentfile, 45); SetRegKonMatFirstGearAutomatic(m_currentfile, 45); break; } if (CheckBoostRegulationMapEmpty(m_currentfile)) { // empty reg_kon_mat switch (stage) { case 1: FillRegulationMapValue(m_currentfile, 45); break; case 2: FillRegulationMapValue(m_currentfile, 45); break; case 3: default: FillRegulationMapValue(m_currentfile, 45); break; } } if (CheckBoostRegulationAUTMapEmpty(m_currentfile)) { switch (stage) { case 1: FillRegulationAUTMapValue(m_currentfile, 45); break; case 2: FillRegulationAUTMapValue(m_currentfile, 45); break; case 3: default: FillRegulationAUTMapValue(m_currentfile, 45); break; } } if (CheckPIDControlEmpty(m_currentfile)) { FillDefaultPIDControls(m_currentfile); } if (CheckPIDControlAUTEmpty(m_currentfile)) { FillDefaultPIDAUTControls(m_currentfile); } //depending on turbotype!!! SetBoostRequestMaps(turboType, injectorType, mapSensorType, m_currentfile, maxBoostValue, AutoGearBoxPercentage, isLpt); if (/*!isLpt*/true) // don't if T5.2&& m_currentfile_size > 0x20000 { // should be percentages /* SetInjectionMap(m_currentfile,15, 15, 255); SetInjectionMap(m_currentfile,14, 15, 253); SetInjectionMap(m_currentfile,13, 15, 253); SetInjectionMap(m_currentfile,12, 15, 249); SetInjectionMap(m_currentfile,11, 15, 248); SetInjectionMap(m_currentfile,10, 15, 245); SetInjectionMap(m_currentfile,9, 15, 236); SetInjectionMap(m_currentfile,15, 14, 255); SetInjectionMap(m_currentfile,14, 14, 253); SetInjectionMap(m_currentfile,13, 14, 253); SetInjectionMap(m_currentfile,12, 14, 235); SetInjectionMap(m_currentfile,11, 14, 234); SetInjectionMap(m_currentfile,10, 14, 226); SetInjectionMap(m_currentfile,9, 14, 225); SetInjectionMap(m_currentfile,15, 13, 248); SetInjectionMap(m_currentfile,14, 13, 245); SetInjectionMap(m_currentfile,13, 13, 245); SetInjectionMap(m_currentfile,12, 13, 224); SetInjectionMap(m_currentfile,11, 13, 217); SetInjectionMap(m_currentfile,10, 13, 205); SetInjectionMap(m_currentfile,9, 13, 189); SetInjectionMap(m_currentfile,15, 12, 219); SetInjectionMap(m_currentfile,14, 12, 215); SetInjectionMap(m_currentfile,13, 12, 213); SetInjectionMap(m_currentfile,12, 12, 206); SetInjectionMap(m_currentfile,11, 12, 205); SetInjectionMap(m_currentfile,10, 12, 198); SetInjectionMap(m_currentfile,9, 12, 176); SetInjectionMap(m_currentfile,15, 11, 198); SetInjectionMap(m_currentfile,14, 11, 192); SetInjectionMap(m_currentfile,13, 11, 191); SetInjectionMap(m_currentfile,12, 11, 190); SetInjectionMap(m_currentfile,11, 11, 190); SetInjectionMap(m_currentfile,10, 11, 183); SetInjectionMap(m_currentfile,9, 11, 163);*/ } IncreaseInjectionKnockMap(m_currentfile, 0, 4); IncreaseInjectionKnockMap(m_currentfile, 1, 4); IncreaseInjectionKnockMap(m_currentfile, 2, 4); //SetIgnitionMap(m_currentfile, 15, 17, 1.5); //SetIgnitionMap(m_currentfile, 14, 17, 1.0); //SetIgnitionMap(m_currentfile, 13, 17, 0.5); //byte fuelcut = (byte)((fuelCutLevel + 1) * 100); SetBoostLimitMap(m_currentfile, 254 /* fuelcut */); //m_resume.m_resume.AddToResumeTable("Updated fuelcut map to: " + fuelCutLevel.ToString() + " bar"); byte fglimit = (byte)((maxBoostFirstGear + 1) * 100); SetFirstGearLimiter(m_currentfile, fglimit); m_resume.AddToResumeTable("Updated first gear limiter (MAN) to: " + maxBoostFirstGear.ToString() + " bar"); byte fgalimit = (byte)((maxBoostFirstGearAUT + 1) * 100); SetFirstGearLimiterAutoTrans(m_currentfile, fgalimit); m_resume.AddToResumeTable("Updated first gear limiter (AUT) to: " + maxBoostFirstGearAUT.ToString() + " bar"); byte sglimit = (byte)((maxBoostSecondGear + 1) * 100); SetSecondGearLimiter(m_currentfile, sglimit); m_resume.AddToResumeTable("Updated second gear limiter (MAN) to: " + maxBoostSecondGear.ToString() + " bar"); // <Guido> add Max_regl_temp1 Max_regl_temp2 SetMaxReglTempValues(m_currentfile, 250); try { Trionic5Anomalies anomalies = new Trionic5Anomalies(); anomalies.CheckBinForAnomalies(m_currentfile, m_resume, false, true, m_fileInformation ); } catch (Exception E) { Console.WriteLine("CheckBinForAnomalies: " + E.Message); } // mark this particular file as tuned to stage X, to prevent running the wizard on this file again! //enginetp = enginetp.Substring(0, enginetp.Length - 4); //enginetp += "T5S" + stage.ToString(); //writeenginetype(enginetp); WriteTunedToStageMarker(m_currentfile, stage); m_resume.AddToResumeTable("Updated binary description with tuned stage"); Trionic5File file = new Trionic5File(); file.LibraryPath = Application.StartupPath + "\\Binaries"; file.SetAutoUpdateChecksum(m_autoUpdateChecksum); file.UpdateChecksum(m_currentfile); }
private void SetBoostRequestMaps(TurboType turboType, InjectorType injectorType, MapSensorType mapSensorType, string m_currentfile, double maxBoostValue, double AutoGearBoxPercentage, bool isLpt) { switch (turboType) { case TurboType.Stock: SetBoostRequestMap(m_currentfile, 0, 6, maxBoostValue * 0.85, AutoGearBoxPercentage); // % of max boost SetBoostRequestMap(m_currentfile, 1, 6, maxBoostValue * 0.87, AutoGearBoxPercentage); // low rpm SetBoostRequestMap(m_currentfile, 2, 6, maxBoostValue * 0.89, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 3, 6, maxBoostValue * 0.90, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 4, 6, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 5, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 6, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 7, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 8, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 9, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 6, maxBoostValue * 0.9, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 6, maxBoostValue * 0.8, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 6, maxBoostValue * 0.7, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 6, maxBoostValue * 0.65, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 6, maxBoostValue * 0.6, AutoGearBoxPercentage); // high rpm SetBoostRequestMap(m_currentfile, 0, 7, maxBoostValue * 0.85, AutoGearBoxPercentage); // % of max boost SetBoostRequestMap(m_currentfile, 1, 7, maxBoostValue * 0.89, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 2, 7, maxBoostValue * 0.9, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 3, 7, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 4, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 5, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 6, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 7, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 8, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 9, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 7, maxBoostValue * 0.9, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 7, maxBoostValue * 0.8, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 7, maxBoostValue * 0.7, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 7, maxBoostValue * 0.65, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 7, maxBoostValue * 0.6, AutoGearBoxPercentage); break; case TurboType.TD0415T: // hold longer than stock SetBoostRequestMap(m_currentfile, 0, 6, maxBoostValue * 0.85, AutoGearBoxPercentage); // % of max boost SetBoostRequestMap(m_currentfile, 1, 6, maxBoostValue * 0.87, AutoGearBoxPercentage); // low rpm SetBoostRequestMap(m_currentfile, 2, 6, maxBoostValue * 0.89, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 3, 6, maxBoostValue * 0.90, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 4, 6, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 5, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 6, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 7, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 8, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 9, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 6, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 6, maxBoostValue * 0.9, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 6, maxBoostValue * 0.80, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 6, maxBoostValue * 0.65, AutoGearBoxPercentage); // high rpm SetBoostRequestMap(m_currentfile, 0, 7, maxBoostValue * 0.85, AutoGearBoxPercentage); // % of max boost SetBoostRequestMap(m_currentfile, 1, 7, maxBoostValue * 0.89, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 2, 7, maxBoostValue * 0.9, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 3, 7, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 4, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 5, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 6, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 7, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 8, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 9, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 7, maxBoostValue , AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 7, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 7, maxBoostValue * 0.90, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 7, maxBoostValue * 0.80, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 7, maxBoostValue * 0.65, AutoGearBoxPercentage); break; case TurboType.TD0419T: // hold longer than stock but spool later case TurboType.GT28BB: // hold longer than stock but spool later case TurboType.GT28RS: // hold longer than stock but spool later SetBoostRequestMap(m_currentfile, 0, 6, maxBoostValue * 0.60, AutoGearBoxPercentage); // % of max boost SetBoostRequestMap(m_currentfile, 1, 6, maxBoostValue * 0.60, AutoGearBoxPercentage); // low rpm SetBoostRequestMap(m_currentfile, 2, 6, maxBoostValue * 0.60, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 3, 6, maxBoostValue * 0.65, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 4, 6, maxBoostValue * 0.80, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 5, 6, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 6, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 7, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 8, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 9, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 6, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 6, maxBoostValue * 0.9, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 6, maxBoostValue * 0.85, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 6, maxBoostValue * 0.70, AutoGearBoxPercentage); // high rpm SetBoostRequestMap(m_currentfile, 0, 7, maxBoostValue * 0.60, AutoGearBoxPercentage); // % of max boost SetBoostRequestMap(m_currentfile, 1, 7, maxBoostValue * 0.60, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 2, 7, maxBoostValue * 0.60, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 3, 7, maxBoostValue * 0.65, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 4, 7, maxBoostValue * 0.80, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 5, 7, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 6, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 7, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 8, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 9, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 7, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 7, maxBoostValue * 0.90, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 7, maxBoostValue * 0.85, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 7, maxBoostValue * 0.70, AutoGearBoxPercentage); break; case TurboType.GT3071R: // hold longer than stock case TurboType.HX35w: // hold longer than stock SetBoostRequestMap(m_currentfile, 0, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); // % of max boost SetBoostRequestMap(m_currentfile, 1, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); // low rpm SetBoostRequestMap(m_currentfile, 2, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 3, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 4, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 5, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 6, 6, maxBoostValue * 0.65, AutoGearBoxPercentage, 0.8); SetBoostRequestMap(m_currentfile, 7, 6, maxBoostValue * 0.75, AutoGearBoxPercentage, 1.0); SetBoostRequestMap(m_currentfile, 8, 6, maxBoostValue * 0.95, AutoGearBoxPercentage, 1.2); SetBoostRequestMap(m_currentfile, 9, 6, maxBoostValue * 0.98, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 6, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 6, maxBoostValue * 0.80, AutoGearBoxPercentage); // high rpm SetBoostRequestMap(m_currentfile, 0, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); // % of max boost SetBoostRequestMap(m_currentfile, 1, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); // low rpm SetBoostRequestMap(m_currentfile, 2, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 3, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 4, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 5, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 6, 7, maxBoostValue * 0.65, AutoGearBoxPercentage, 0.8); SetBoostRequestMap(m_currentfile, 7, 7, maxBoostValue * 0.75, AutoGearBoxPercentage, 1.0); SetBoostRequestMap(m_currentfile, 8, 7, maxBoostValue * 0.95, AutoGearBoxPercentage, 1.2); SetBoostRequestMap(m_currentfile, 9, 7, maxBoostValue * 0.98, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 7, maxBoostValue * 0.95, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 7, maxBoostValue * 0.80, AutoGearBoxPercentage); break; case TurboType.HX40w: // hold longer than stock case TurboType.S400SX371: SetBoostRequestMap(m_currentfile, 0, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); // % of max boost SetBoostRequestMap(m_currentfile, 1, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); // low rpm SetBoostRequestMap(m_currentfile, 2, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 3, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 4, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 5, 6, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 6, 6, maxBoostValue * 0.65, AutoGearBoxPercentage, 0.8); SetBoostRequestMap(m_currentfile, 7, 6, maxBoostValue * 0.75, AutoGearBoxPercentage, 1.0); SetBoostRequestMap(m_currentfile, 8, 6, maxBoostValue * 0.95, AutoGearBoxPercentage, 1.2); SetBoostRequestMap(m_currentfile, 9, 6, maxBoostValue * 0.98, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 6, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 6, maxBoostValue * 0.98, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 6, maxBoostValue * 0.93, AutoGearBoxPercentage); // high rpm SetBoostRequestMap(m_currentfile, 0, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); // % of max boost SetBoostRequestMap(m_currentfile, 1, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); // low rpm SetBoostRequestMap(m_currentfile, 2, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 3, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 4, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 5, 7, maxBoostValue * 0.60, AutoGearBoxPercentage, 0.7); SetBoostRequestMap(m_currentfile, 6, 7, maxBoostValue * 0.65, AutoGearBoxPercentage, 0.8); SetBoostRequestMap(m_currentfile, 7, 7, maxBoostValue * 0.75, AutoGearBoxPercentage, 1.0); SetBoostRequestMap(m_currentfile, 8, 7, maxBoostValue * 0.95, AutoGearBoxPercentage, 1.2); SetBoostRequestMap(m_currentfile, 9, 7, maxBoostValue * 0.98, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 7, maxBoostValue, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 7, maxBoostValue * 0.98, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 7, maxBoostValue * 0.93, AutoGearBoxPercentage); break; } if (isLpt) { // more columns need adjusting SetBoostRequestMap(m_currentfile, 0, 5, maxBoostValue * 0.55, AutoGearBoxPercentage); // % of max boost SetBoostRequestMap(m_currentfile, 1, 5, maxBoostValue * 0.55, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 2, 5, maxBoostValue * 0.55, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 3, 5, maxBoostValue * 0.57, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 4, 5, maxBoostValue * 0.58, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 5, 5, maxBoostValue * 0.58, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 6, 5, maxBoostValue * 0.58, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 7, 5, maxBoostValue * 0.57, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 8, 5, maxBoostValue * 0.57, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 9, 5, maxBoostValue * 0.56, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 5, maxBoostValue * 0.53, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 5, maxBoostValue * 0.50, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 5, maxBoostValue * 0.45, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 5, maxBoostValue * 0.40, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 5, maxBoostValue * 0.40, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 5, maxBoostValue * 0.35, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 0, 4, maxBoostValue * 0.35, AutoGearBoxPercentage); // 75% of max boost SetBoostRequestMap(m_currentfile, 1, 4, maxBoostValue * 0.35, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 2, 4, maxBoostValue * 0.35, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 3, 4, maxBoostValue * 0.30, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 4, 4, maxBoostValue * 0.30, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 5, 4, maxBoostValue * 0.30, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 6, 4, maxBoostValue * 0.30, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 7, 4, maxBoostValue * 0.30, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 8, 4, maxBoostValue * 0.30, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 9, 4, maxBoostValue * 0.30, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 10, 4, maxBoostValue * 0.25, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 11, 4, maxBoostValue * 0.2, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 12, 4, maxBoostValue * 0.18, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 13, 4, maxBoostValue * 0.15, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 14, 4, maxBoostValue * 0.15, AutoGearBoxPercentage); SetBoostRequestMap(m_currentfile, 15, 4, maxBoostValue * 0.1, AutoGearBoxPercentage); } }
private void AddFilesToLibrary(string path) { Application.DoEvents(); DataTable dt = new DataTable("UserLib"); dt.Columns.Add("Filename"); dt.Columns.Add("FilenameNoPath"); dt.Columns.Add("EngineType"); dt.Columns.Add("Stage"); dt.Columns.Add("Injectors"); dt.Columns.Add("Mapsensor"); dt.Columns.Add("Torque"); dt.Columns.Add("E85", Type.GetType("System.Boolean")); dt.Columns.Add("T7Valve", Type.GetType("System.Boolean")); dt.Columns.Add("Partnumber"); dt.Columns.Add("SoftwareID"); dt.Columns.Add("CPU"); dt.Columns.Add("RAMlocked", Type.GetType("System.Boolean")); if (File.Exists(Application.StartupPath + "\\UserLib.xml")) { dt.ReadXml(Application.StartupPath + "\\UserLib.xml"); } string[] files = Directory.GetFiles(path, "*.bin", SearchOption.AllDirectories); foreach (string file in files) { FileInfo fi = new FileInfo(file); this.Text = "User library browser - " + Path.GetFileName(file); Application.DoEvents(); if (fi.Length == 0x20000 || fi.Length == 0x40000) { try { foreach (DataRow dr in dt.Rows) { if (dr["Filename"] != DBNull.Value) { if (dr["Filename"].ToString() == file) { dt.Rows.Remove(dr); break; } } } Trionic5File _file = new Trionic5File(); _file.SelectFile(file); Trionic5FileInformation m_trionicFileInformation = _file.ParseFile(); Trionic5Properties props = _file.GetTrionicProperties(); // get information about the file MapSensorType mapsensor = _file.GetMapSensorType(true); ECUFileType fileType = _file.DetermineFileType(); //t5p.Enginetype //t5p.Partnumber //t5p.CPUspeed //t5p.SoftwareID //t5p.RAMlocked //TuningStage _stage = m_trionicFile.DetermineTuningStage(out m_maxBoost); int injkonst = _file.GetSymbolAsInt("Inj_konst!"); bool m_E85 = false; int max_injection = _file.GetMaxInjection(); max_injection *= injkonst; // de maximale waarde uit fuel_map_x_axis! aub byte[] fuelxaxis = _file.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash("Fuel_map_xaxis!"), (uint)m_trionicFileInformation.GetSymbolLength("Fuel_map_xaxis!")); int max_value_x_axis = Convert.ToInt32(fuelxaxis.GetValue(fuelxaxis.Length - 1)); if (mapsensor == MapSensorType.MapSensor30) { max_value_x_axis *= 120; max_value_x_axis /= 100; } else if (mapsensor == MapSensorType.MapSensor35) { max_value_x_axis *= 140; max_value_x_axis /= 100; } else if (mapsensor == MapSensorType.MapSensor40) { max_value_x_axis *= 160; max_value_x_axis /= 100; } else if (mapsensor == MapSensorType.MapSensor50) { max_value_x_axis *= 200; max_value_x_axis /= 100; } //Console.WriteLine("max x: " + max_value_x_axis.ToString()); float max_support_boost = max_value_x_axis; max_support_boost /= 100; max_support_boost -= 1; float corr_inj = 1.4F / max_support_boost; corr_inj *= 100; //Console.WriteLine("corr_inj = " + corr_inj.ToString()); max_injection *= (int)corr_inj; max_injection /= 100; // dtReport.Rows.Add("Max injection: "+ max_injection.ToString()); if (max_injection > 7500) { m_E85 = true; } if (injkonst > 26) { m_E85 = true; } //TODO: nog extra controleren of er andere indicatoren zijn of er E85 gebruikt wordt // we kunnen dit aan de start verrijkingen zien en aan de ontstekingstijdstippen bij // vollast (ontsteking scherper), let op want dit laatste is bij W/M injectie ook zo. // de een na laatste waarde uit Eftersta_fak! geeft een duidelijke indicatie byte[] eftstafak = _file.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash("Eftersta_fak!"), (uint)m_trionicFileInformation.GetSymbolLength("Eftersta_fak!")); if (eftstafak.Length == 15) { int eftstafakvalue = Convert.ToInt32(eftstafak.GetValue(13)); if (eftstafakvalue > 170) { m_E85 = true; } } if (m_E85) { max_injection *= 10; max_injection /= 14; // dtReport.Rows.Add("Probable fuel: E85"); } // get peak from insp_mat and multiply by injector constant InjectorType inj_type = InjectorType.Stock; if (max_injection > 5000) { inj_type = InjectorType.Stock; } else if (max_injection > 3500) { inj_type = InjectorType.GreenGiants; } else if (max_injection > 2000) { inj_type = InjectorType.Siemens630Dekas; } else if (max_injection > 1565) { inj_type = InjectorType.Siemens875Dekas; } else { inj_type = InjectorType.Siemens1000cc; } // Add info about T5/T7 valve int frek230 = _file.GetSymbolAsInt("Frek_230!"); int frek250 = _file.GetSymbolAsInt("Frek_250!"); bool T7Valve = false; if (fileType == ECUFileType.Trionic52File) { if (frek230 == 728 || frek250 == 935) { T7Valve = false; } else { T7Valve = true; } } else if (fileType == ECUFileType.Trionic55File) { if (frek230 == 90 || frek250 == 70) { T7Valve = false; } else { T7Valve = true; } } int torque = 0; float m_maxBoost = 0; TuningStage _stage = _file.DetermineTuningStage(out m_maxBoost); PressureToTorque ptt = new PressureToTorque(); torque = Convert.ToInt32(ptt.CalculateTorqueFromPressure(m_maxBoost, props.TurboType)); dt.Rows.Add(file, Path.GetFileName(file), props.Enginetype, _stage.ToString(), inj_type.ToString(), mapsensor.ToString(), torque.ToString(), m_E85, T7Valve, props.Partnumber, props.SoftwareID, props.CPUspeed, props.RAMlocked); } catch (Exception E) { Console.WriteLine(E.Message); } } } dt.WriteXml(Application.StartupPath + "\\UserLib.xml"); gridControl1.DataSource = dt; gridView1.BestFitColumns(); this.Text = "User library browser"; }
private double CalculateConversionFactor(MapSensorType fromSensorType, MapSensorType toSensorType) { double factor = 1.2; switch (fromSensorType) { case MapSensorType.MapSensor25: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 1.0; // from 2.5 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 1.2; // from 2.5 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 1.4; // from 2.5 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 1.6; // from 2.5 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 2.0; // from 2.5 to 5.0 mapsensor break; } break; case MapSensorType.MapSensor30: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 0.8333; // from 3.0 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 1.0; // from 3.0 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 1.1666; // from 3.0 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 1.3333; // from 3.0 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 1.6667; // from 3.0 to 5.0 mapsensor break; } break; case MapSensorType.MapSensor35: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 0.7143; // from 3.5 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 0.8571; // from 3.5 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 1.0; // from 3.5 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 1.1429; // from 3.5 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 1.4285; // from 3.5 to 5.0 mapsensor break; } break; case MapSensorType.MapSensor40: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 0.6250; // from 4.0 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 0.75; // from 4.0 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 0.875; // from 4.0 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 1.0; // from 4.0 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 1.25; // from 4.0 to 5.0 mapsensor break; } break; case MapSensorType.MapSensor50: switch (toSensorType) { case MapSensorType.MapSensor25: factor = 0.5; // from 5.0 to 2.5 mapsensor break; case MapSensorType.MapSensor30: factor = 0.6; // from 5.0 to 3.0 mapsensor break; case MapSensorType.MapSensor35: factor = 0.7; // from 5.0 to 3.5 mapsensor break; case MapSensorType.MapSensor40: factor = 0.8; // from 5.0 to 4.0 mapsensor break; case MapSensorType.MapSensor50: factor = 1.0; // from 5.0 to 5.0 mapsensor break; } break; } return(factor); }
/// <summary> /// Write the threebar conversion marker to the binary. This is kept at address (length - 0x1FF) /// </summary> /// <param name="filename"></param> /// <param name="stage"></param> /// <returns></returns> private void WriteThreeBarConversionMarker(string filename, MapSensorType sensorType) { int address = m_fileInformation.Filelength - 0x1FF; if (address > 0) { switch (sensorType) { case MapSensorType.MapSensor25: writebyteinfile(filename, address, 0xFF); // original break; case MapSensorType.MapSensor30: writebyteinfile(filename, address, 0x01); break; case MapSensorType.MapSensor35: writebyteinfile(filename, address, 0x02); break; case MapSensorType.MapSensor40: writebyteinfile(filename, address, 0x03); break; case MapSensorType.MapSensor50: writebyteinfile(filename, address, 0x04); break; } } }
internal void BuildGraph() { if (_trionicFile != null) { Trionic5FileInformation m_trionicFileInformation = _trionicFile.GetFileInfo(); X_axisvalues = _trionicFile.GetMapYaxisValues(m_trionicFileInformation.GetBoostRequestMap()); // injection map Y = rpm Trionic5Properties props = _trionicFile.GetTrionicProperties(); byte[] tryck_mat = _trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetBoostRequestMap()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetBoostRequestMap())); if (props.AutomaticTransmission) { tryck_mat = _trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetBoostRequestMapAUT()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetBoostRequestMapAUT())); } /* new */ Insp_mat = _trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetInjectionMap()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetInjectionMap())); //Fuel_knock_mat = m_trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetInjectionKnockMap()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetInjectionKnockMap())); //injectiontiming.Idle_fuel_map = m_trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetIdleFuelMap()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetIdleFuelMap())); Batt_korr_tab = _trionicFile.GetSymbolAsIntArray(m_trionicFileInformation.GetBatteryCorrectionMap()); Min_tid = _trionicFile.GetSymbolAsInt("Min_tid!"); Fuel_map_x_axis = _trionicFile.GetXaxisValues(m_trionicFileInformation.Filename, _trionicFile.GetFileInfo().GetInjectionMap()); Fuel_map_y_axis = _trionicFile.GetYaxisValues(m_trionicFileInformation.Filename, _trionicFile.GetFileInfo().GetInjectionMap()); //injectiontiming.Fuel_knock_map_x_axis = m_trionicFile.GetXaxisValues(m_trionicFileInformation.Filename, "Fuel_knock_mat!"); //injectiontiming.Fuel_knock_map_y_axis = m_trionicFile.GetYaxisValues(m_trionicFileInformation.Filename, "Fuel_knock_mat!"); //injectiontiming.Idle_fuel_x_axis = m_trionicFile.GetXaxisValues(m_trionicFileInformation.Filename, "Idle_fuel_korr!"); //injectiontiming.Idle_fuel_y_axis = m_trionicFile.GetYaxisValues(m_trionicFileInformation.Filename, "Idle_fuel_korr!"); Luft_kompfak = _trionicFile.Luft_kompfak_array; //Temp_steg = _trionicFile.Temp_steg_array; Kyltemp_steg = _trionicFile.Kyltemp_steg_array; Kyltemp_tab = _trionicFile.Kyltemp_tab_array; Lufttemp_steg = _trionicFile.Lufttemp_steg_array; Lufttemp_tab = _trionicFile.Lufttemp_tab_array; byte[] data = _trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetInjectorConstant()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetInjectorConstant())); int inj_konst = Convert.ToInt32(data.GetValue(0)); Inj_konst = inj_konst; /* new */ // get every 8th byte double[] values = new double[16]; MapSensorType mst = _trionicFile.GetMapSensorType(_appSettings.AutoDetectMapsensorType); double[] injdc = new double[16]; // fill with injector DC in max values for (int i = 0; i < 16; i++) { double val = Convert.ToDouble(tryck_mat[i * 8 + 7]); if (mst == MapSensorType.MapSensor30) { val *= 1.2; } else if (mst == MapSensorType.MapSensor35) { val *= 1.4; } else if (mst == MapSensorType.MapSensor40) { val *= 1.6; } else if (mst == MapSensorType.MapSensor50) { val *= 2.0; } injdc.SetValue(BoostRpmToInjectorDuration(Convert.ToInt32(val), Convert.ToInt32(X_axisvalues.GetValue(i))), i); val -= 100; val /= 100; values.SetValue(val, i); } FillGraph(values, injdc, props.TurboType); } }
private void RunMapSensorWizard(MapSensorType targetMapSensorType) { if (m_trionicFile.Exists()) { Trionic5Tuner _tuner = new Trionic5Tuner(); string targetMapSensorString = "3 bar mapsensor"; switch (targetMapSensorType) { case MapSensorType.MapSensor25: targetMapSensorString = "2.5 bar mapsensor"; break; case MapSensorType.MapSensor30: targetMapSensorString = "3.0 bar mapsensor"; break; case MapSensorType.MapSensor35: targetMapSensorString = "3.5 bar mapsensor"; break; case MapSensorType.MapSensor40: targetMapSensorString = "4.0 bar mapsensor"; break; case MapSensorType.MapSensor50: targetMapSensorString = "5.0 bar mapsensor"; break; } MapSensorType fromMapSensortype = m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType); frmMapSensorWizard mapSensorWiz = new frmMapSensorWizard(); mapSensorWiz.SetMapSensorTypes(fromMapSensortype, targetMapSensorType); if (mapSensorWiz.ShowDialog() == DialogResult.OK) { _tuner.AutoUpdateChecksum = m_appSettings.AutoChecksum; _tuner.ConvertFileToThreeBarMapSensor(m_trionicFileInformation, fromMapSensortype, MapSensorType.MapSensor30); props = m_trionicFile.GetTrionicProperties(); m_trionicFile.UpdateChecksum(); TuningReport tuningrep = new TuningReport(); tuningrep.ReportTitle = targetMapSensorString + " report"; tuningrep.DataSource = _tuner.Resume.ResumeTuning; tuningrep.CreateReport(); tuningrep.ShowPreview(defaultLookAndFeel1.LookAndFeel); } } }