private void btnTuneBinary_ItemClick(object sender, ItemClickEventArgs e) { if (ValidateFile()) { // read tuned marker to see if binary has been tuned before T7FileHeader fh = new T7FileHeader(); fh.init(m_currentfile, m_appSettings.AutoFixFooter); PartNumberConverter pnc = new PartNumberConverter(); ECUInformation ecuinfo = pnc.GetECUInfo(fh.getPartNumber().Trim(), ""); //<GS-05102010> Need to validate the type of binary file loaded (which engine type and turbo type, A/M transmission) // and base the initially targeted torque and power figures on that frmTuningWizard tunWiz = new frmTuningWizard(); string msg = "Partnumber not recognized, tuning will continue anyway, please verify settings afterwards"; //msg += Environment.NewLine + " desired airmass " + maxairmass.ToString() + " mg/c and peak torque " + peaktorque.ToString() + " Nm"; if (ecuinfo.Valid) { msg = "Partnumber " + fh.getPartNumber() + ", carmodel " + ecuinfo.Carmodel.ToString() + ", engine " + ecuinfo.Enginetype.ToString(); //msg += Environment.NewLine + " desired airmass " + maxairmass.ToString() + " mg/c and peak torque " + peaktorque.ToString() + " Nm"; } tunWiz.ExtraInfo = msg; if (ecuinfo.Stage1torque != 0) { tunWiz.PeakTorque = Convert.ToInt32(ecuinfo.Stage1torque); } if (tunWiz.ShowDialog() == DialogResult.OK) { int desiredHP = tunWiz.DesiredHP; bool carRunsE85 = tunWiz.CarRunsE85; // convert HP to torque and airmass //int torque = PowerToTorque(desiredHP, 6000); //int peaktorque = (110 * torque) / 100; int peaktorque = tunWiz.PeakTorque; int maxairmass = TorqueToAirmass(peaktorque, carRunsE85); // give user a warning if airmass/c > 1300 mg/c if (maxairmass > 1300) { frmInfoBox info = new frmInfoBox("Your maximum requested airmass exceeds 1300 mg/c [" + maxairmass.ToString() + " mg/c]. Please make sure all your other maps will support this airflow!"); } TuneToStageNew(1, maxairmass, peaktorque, desiredHP, ecuinfo.Enginetype, carRunsE85); TuningReport tuningrep = new TuningReport(); tuningrep.DataSource = resumeTuning; tuningrep.CreateReport(); tuningrep.ShowPreview(defaultLookAndFeel1.LookAndFeel); } // start window to ask user for desired horses (depending on E85 usage?) /*frmTuneBinary frmTune = new frmTuneBinary(); if (ecuinfo.Stage1torque != 0) { frmTune.PeakTorque = Convert.ToInt32(ecuinfo.Stage1torque); } if (frmTune.ShowDialog() == DialogResult.OK) { int desiredHP = frmTune.DesiredHP; bool carRunsE85 = frmTune.CarRunsE85; // convert HP to torque and airmass //int torque = PowerToTorque(desiredHP, 6000); //int peaktorque = (110 * torque) / 100; int peaktorque = frmTune.PeakTorque; int maxairmass = TorqueToAirmass(peaktorque, carRunsE85); // give user a warning if airmass/c > 1300 mg/c if (maxairmass > 1300) { MessageBox.Show("Your maximum requested airmass exceeds 1300 mg/c [" + maxairmass.ToString() + " mg/c]. Please make sure all your other maps will support this airflow!", "Warning!", MessageBoxButtons.OK); } string msg = "Partnumber not recognized, tuning will continue anyway, please verify settings afterwards"; msg += Environment.NewLine + " desired airmass " + maxairmass.ToString() + " mg/c and peak torque " + peaktorque.ToString() + " Nm"; if (ecuinfo.Valid) { msg = "Partnumber " + fh.getPartNumber() + ", carmodel " + ecuinfo.Carmodel.ToString() + ", engine " + ecuinfo.Enginetype.ToString(); msg += Environment.NewLine + " desired airmass " + maxairmass.ToString() + " mg/c and peak torque " + peaktorque.ToString() + " Nm"; } PSTaskDialog.cTaskDialog.ForceEmulationMode = false; PSTaskDialog.cTaskDialog.EmulatedFormWidth = 600; PSTaskDialog.cTaskDialog.UseToolWindowOnXP = false; PSTaskDialog.cTaskDialog.VerificationChecked = true; PSTaskDialog.cTaskDialog.ShowTaskDialogBox("Tune me up™ wizard", "This wizard will tune your binary.", "Several maps will be altered" + Environment.NewLine + msg, "Happy driving!!!\nDilemma © 2009", "The author does not take responsibility for any damage done to your car or other objects in any form!", "Show me a summary after tuning", "", "Yes, tune me up!|No thanks!", eTaskDialogButtons.None, eSysIcons.Information, eSysIcons.Warning); switch (PSTaskDialog.cTaskDialog.CommandButtonResult) { case 0: // tune to stage x // must use fixed maps, scaled to be good for the current airmass (e.g. pedalrequest map) TuneToStageNew(1, maxairmass, peaktorque, desiredHP, ecuinfo.Enginetype, carRunsE85); break; case 1: // cancel break; } if (PSTaskDialog.cTaskDialog.VerificationChecked && PSTaskDialog.cTaskDialog.CommandButtonResult != 1) { TuningReport tuningrep = new TuningReport(); tuningrep.DataSource = resumeTuning; tuningrep.CreateReport(); tuningrep.ShowPreview(defaultLookAndFeel1.LookAndFeel); } }*/ } }
private void Information_firmwareInformation_ItemClick(object sender, ItemClickEventArgs e) { // show firmware information screen! bool _correctFooter = m_appSettings.AutoFixFooter; frmFirmwareInformation frminfo = new frmFirmwareInformation(); if (m_currentfile != null) { if (File.Exists(m_currentfile)) { T7FileHeader t7InfoHeader = new T7FileHeader(); t7InfoHeader.init(m_currentfile, m_appSettings.AutoFixFooter); string swVersion = t7InfoHeader.getSoftwareVersion(); PartNumberConverter pnc = new PartNumberConverter(); ECUInformation ecuinfo = pnc.GetECUInfo(t7InfoHeader.getPartNumber().Trim(), ""); frminfo.SIDDate = t7InfoHeader.getSIDDate(); if (ecuinfo.Valid) { frminfo.OriginalCarType = ecuinfo.Carmodel.ToString(); frminfo.OriginalEngineType = ecuinfo.Enginetype.ToString(); } if (swVersion.Trim() == "EU0AF01C.55P" || swVersion.Trim() == "EU0AF01C.46T" || swVersion.Trim().StartsWith("ET02U01C") || swVersion.Trim() == "ET03F01C.46S") { // additional requirements for the bytes in that location // http://www.trionictuning.com/forum/viewtopic.php?f=17&t=109&p=8569#p8537 // set these options correct if (swVersion.Trim().StartsWith("EU0AF01C") || swVersion.Trim() == "ET03F01C.46S") { if ((CheckBytesInFile(m_currentfile, 0x4968E, 0, 2) || (CheckBytesInFile(m_currentfile, 0x4968E, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x4968F, 0x80, 1))) && (CheckBytesInFile(m_currentfile, 0x496B4, 0, 2) || (CheckBytesInFile(m_currentfile, 0x496B4, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x496B5, 0x80, 1))) && (CheckBytesInFile(m_currentfile, 0x49760, 0, 2) || (CheckBytesInFile(m_currentfile, 0x49760, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x49761, 0x80, 1)))) { frminfo.EnableSIDAdvancedOptions(true); if (/*CheckBytesInFile(m_currentfile, 0x495FA, 0, 2) &&*/ CheckBytesInFile(m_currentfile, 0x4968E, 0, 2) && CheckBytesInFile(m_currentfile, 0x496B4, 0, 2)) { frminfo.SIDDisableStartScreen = true; } else { frminfo.SIDDisableStartScreen = false; } if (CheckBytesInFile(m_currentfile, 0x49760, 0, 2)) // should be 0x49760 in stead of 0x4975E { frminfo.SIDDisableAdaptionMessages = true; } else { frminfo.SIDDisableAdaptionMessages = false; } /* * Remove startup screen: change to 00 00 instead of 00 80 000495FA // not needed!!! <GS-11042011> 0004968E 000496B4 Remove adaptation messages: Change 0x49760 to 00 00 instead of 00 80 */ } else { frminfo.EnableSIDAdvancedOptions(false); } } else { if ((CheckBytesInFile(m_currentfile, 0x46F4D, 0, 1) || CheckBytesInFile(m_currentfile, 0x46F4D, 0x80, 1)) && (CheckBytesInFile(m_currentfile, 0x4701F, 0, 1) || CheckBytesInFile(m_currentfile, 0x4701F, 0x80, 1))) { frminfo.EnableSIDAdvancedOptions(true); //Disable startscreen, change 0x00046F4D to 00 in stead of 80 if (CheckBytesInFile(m_currentfile, 0x46F4D, 0, 1)) { frminfo.SIDDisableStartScreen = true; } else { frminfo.SIDDisableStartScreen = false; } //Remove the adaption messages, change 0x0004701F to 00 in stead of 80 if (CheckBytesInFile(m_currentfile, 0x4701F, 0, 1)) { frminfo.SIDDisableAdaptionMessages = true; } else { frminfo.SIDDisableAdaptionMessages = false; } } else { frminfo.EnableSIDAdvancedOptions(false); } } } else { frminfo.EnableSIDAdvancedOptions(false); } // Pavel Angelov created this modification. // Disable effect of the emission limitation function. if (swVersion.Trim().StartsWith("EU0AF01C")) { if (CheckBytesInFile(m_currentfile, 0x13837, 0x03, 1)) { frminfo.EmissionLimitation = true; frminfo.EnableEmissionLimitation(true); } else if (CheckBytesInFile(m_currentfile, 0x13837, 0x02, 1)) { frminfo.EmissionLimitation = false; frminfo.EnableEmissionLimitation(true); } else { frminfo.EnableEmissionLimitation(false); } } else { frminfo.EnableEmissionLimitation(false); } frminfo.SoftwareID = t7InfoHeader.getSoftwareVersion(); frminfo.ChassisID = t7InfoHeader.getChassisID(); frminfo.EngineType = t7InfoHeader.getCarDescription(); frminfo.Partnumber = t7InfoHeader.getPartNumber(); frminfo.ImmoID = t7InfoHeader.getImmobilizerID(); frminfo.SoftwareIsOpen = IsBinaryFileOpen(); frminfo.BioPowerSoftware = IsBinaryBiopower(); frminfo.BioPowerEnabled = IsBioPowerEnabled(); frminfo.CompressedSymboltable = IsBinaryPackedVersion(m_currentfile); frminfo.MissingSymbolTable = IsBinaryMissingSymbolTable(); if (frminfo.MissingSymbolTable) frminfo.BioPowerSoftware = true; // only missing in biopower software frminfo.ChecksumEnabled = HasBinaryChecksumEnabled(); frminfo.TorqueLimitersEnabled = HasBinaryTorqueLimiterEnabled(); if (!HasBinaryTorqueLimiters()) frminfo.TorqueLimitersPresent = false; //if (!frminfo.MissingSymbolTable) { frminfo.OBDIIPresent = HasBinaryOBDIIMaps(); if (!frminfo.OBDIIPresent) { frminfo.OBDIIEnabled = false; } else { frminfo.OBDIIEnabled = HasBinaryOBDIIEnabled(); } } if (HasBinaryOBDIIMaps()) { frminfo.OBDIIEnabled = HasBinaryOBDIIEnabled(); } frminfo.SecondLambdaEnabled = HasBinarySecondLambdaEnabled(); if (!HasBinarySecondLambdaMap()) frminfo.SecondLambdaPresent = false; if (!HasBinaryTipInOutParameters()) frminfo.FastThrottleResponsePresent = false; else frminfo.FastThrottleResponsePresent = true; frminfo.FastThrottleReponse = HasBinaryFastThrottleResponse(); frminfo.ExtraFastThrottleReponse = HasBinaryExtraFastThrottleResponse(); if (!HasBinaryTipInOutParameters()) { frminfo.FastThrottleReponse = false; frminfo.ExtraFastThrottleReponse = false; } if (!HasBinaryCatalystLightOffParameters()) frminfo.CatalystLightoffPresent = false; else frminfo.CatalystLightoffPresent = true; frminfo.CatalystLightOff = HasBinaryCatalystLightOffEnabled(); frminfo.ProgrammingDateTime = GetProgrammingDateTime(); if (!m_appSettings.WriteTimestampInBinary) { frminfo.DisableTimeStamping(); } if (frminfo.ShowDialog() == DialogResult.OK) { if (t7InfoHeader.IsTISBinary(m_currentfile)) { // user is trying to update a TIS file, ask for footer correction. if ((frminfo.ImmoID != t7InfoHeader.getImmobilizerID()) || frminfo.ChassisID != t7InfoHeader.getChassisID()) { if (!_correctFooter) { if (MessageBox.Show("It seems you are trying to update data in a TIS file, would you like T7Suite to correct the footer information?", "TIS file question", MessageBoxButtons.YesNo) == DialogResult.Yes) { //_correctFooter = true; // create a backup file at this point File.Copy(m_currentfile, Path.GetDirectoryName(m_currentfile) + "\\" + Path.GetFileNameWithoutExtension(m_currentfile) + DateTime.Now.ToString("yyyyMMddHHmmss") + ".binarybackup", true); t7InfoHeader.init(m_currentfile, true); } } } } t7InfoHeader.setImmobilizerID(frminfo.ImmoID); t7InfoHeader.setSoftwareVersion(frminfo.SoftwareID); t7InfoHeader.setCarDescription(frminfo.EngineType); t7InfoHeader.setChassisID(frminfo.ChassisID); t7InfoHeader.setSIDDate(frminfo.SIDDate); if (GetProgrammingDateTime() != frminfo.ProgrammingDateTime) { SetProgrammingDateTime(frminfo.ProgrammingDateTime); } if (frminfo.SoftwareIsOpen) { SetBinaryFileOpen(); } else { SetBinaryFileClosed(); } if (frminfo.TorqueLimitersEnabled && !HasBinaryTorqueLimiterEnabled() && HasBinaryTorqueLimiters()) { SetTorqueLimiterEnabled(true); } else if (!frminfo.TorqueLimitersEnabled && HasBinaryTorqueLimiterEnabled() && HasBinaryTorqueLimiters()) { SetTorqueLimiterEnabled(false); } if (frminfo.OBDIIEnabled && !HasBinaryOBDIIEnabled()) { SetOBDIIEnabled(true); } else if (!frminfo.OBDIIEnabled && HasBinaryOBDIIEnabled()) { SetOBDIIEnabled(false); } if (frminfo.SecondLambdaEnabled && HasBinarySecondLambdaMap()/*&& !HasBinarySecondLambdaEnabled()*/) { SetSecondLambdaEnabled(true); } else if (!frminfo.SecondLambdaEnabled && HasBinarySecondLambdaMap() && HasBinarySecondLambdaEnabled()) { SetSecondLambdaEnabled(false); } if (HasBinaryTipInOutParameters()) { if (frminfo.FastThrottleReponse && !HasBinaryFastThrottleResponse()) { SetFastThrottleResponse(true); } else if (!frminfo.FastThrottleReponse && HasBinaryFastThrottleResponse()) { SetFastThrottleResponse(false); } if (frminfo.ExtraFastThrottleReponse && !HasBinaryExtraFastThrottleResponse()) { SetExtraFastThrottleResponse(true); } else if (!frminfo.ExtraFastThrottleReponse && !frminfo.FastThrottleReponse && HasBinaryExtraFastThrottleResponse()) { SetExtraFastThrottleResponse(false); } else if (!frminfo.ExtraFastThrottleReponse && frminfo.FastThrottleReponse && HasBinaryExtraFastThrottleResponse()) { SetActG2(false); } } if (HasBinaryCatalystLightOffParameters()) { if (frminfo.CatalystLightOff && !HasBinaryCatalystLightOffEnabled()) { SetCatalystLightOff(true); } else if (!frminfo.CatalystLightOff && HasBinaryCatalystLightOffEnabled()) { SetCatalystLightOff(false); } } if (IsBinaryBiopower()) { if (frminfo.BioPowerEnabled && !IsBioPowerEnabled()) { SetBioPowerEnabled(true); } else if (!frminfo.BioPowerEnabled && IsBioPowerEnabled()) { SetBioPowerEnabled(false); } } t7InfoHeader.save(m_currentfile); if (swVersion.Trim() == "EU0AF01C.55P" || swVersion.Trim() == "EU0AF01C.46T" || swVersion.Trim().StartsWith("ET02U01C") || swVersion.Trim() == "ET03F01C.46S") { if (swVersion.Trim().StartsWith("EU0AF01C") || swVersion.Trim() == "ET03F01C.46S") { if ((CheckBytesInFile(m_currentfile, 0x4968E, 0, 2) || (CheckBytesInFile(m_currentfile, 0x4968E, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x4968F, 0x80, 1))) && (CheckBytesInFile(m_currentfile, 0x496B4, 0, 2) || (CheckBytesInFile(m_currentfile, 0x496B4, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x496B5, 0x80, 1))) && (CheckBytesInFile(m_currentfile, 0x49760, 0, 2) || (CheckBytesInFile(m_currentfile, 0x49760, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x49761, 0x80, 1)))) { if (frminfo.SIDDisableStartScreen) { byte[] data2write = new byte[2]; data2write.SetValue((byte)0x00, 0); data2write.SetValue((byte)0x00, 1); //savedatatobinary(0x495FA, 2, data2write, m_currentfile, false); savedatatobinary(0x4968E, 2, data2write, m_currentfile, false); savedatatobinary(0x496B4, 2, data2write, m_currentfile, false); } else { byte[] data2write = new byte[2]; data2write.SetValue((byte)0x00, 0); data2write.SetValue((byte)0x80, 1); //savedatatobinary(0x495FA, 2, data2write, m_currentfile, false); savedatatobinary(0x4968E, 2, data2write, m_currentfile, false); savedatatobinary(0x496B4, 2, data2write, m_currentfile, false); } if (frminfo.SIDDisableAdaptionMessages) { byte[] data2write = new byte[2]; data2write.SetValue((byte)0x00, 0); data2write.SetValue((byte)0x00, 1); savedatatobinary(0x49760, 2, data2write, m_currentfile, false); } else { byte[] data2write = new byte[2]; data2write.SetValue((byte)0x00, 0); data2write.SetValue((byte)0x80, 1); savedatatobinary(0x49760, 2, data2write, m_currentfile, false); } } } else { if ((CheckBytesInFile(m_currentfile, 0x46F4D, 0, 1) || CheckBytesInFile(m_currentfile, 0x46F4D, 0x80, 1)) && (CheckBytesInFile(m_currentfile, 0x4701F, 0, 1) || CheckBytesInFile(m_currentfile, 0x4701F, 0x80, 1))) { //Disable startscreen, change 0x00046F4D to 00 in stead of 80 //Remove the adaption messages, change 0x0004701F to 00 in stead of 80 if (frminfo.SIDDisableStartScreen) { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x00, 0); savedatatobinary(0x46F4D, 1, data2write, m_currentfile, false); } else { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x80, 0); savedatatobinary(0x46F4D, 1, data2write, m_currentfile, false); } if (frminfo.SIDDisableAdaptionMessages) { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x00, 0); savedatatobinary(0x4701F, 1, data2write, m_currentfile, false); } else { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x80, 0); savedatatobinary(0x4701F, 1, data2write, m_currentfile, false); } } } } // Disable effect of the emission limitation function. if (swVersion.Trim().StartsWith("EU0AF01C")) { if (frminfo.EmissionLimitation) { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x03, 0); savedatatobinary(0x13837, 1, data2write, m_currentfile, false); } else { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x02, 0); savedatatobinary(0x13837, 1, data2write, m_currentfile, false); } } UpdateChecksum(m_currentfile); } } } }
private void ctrlCompressorMap1_onRefreshData(object sender, EventArgs e) { if (sender is ctrlCompressorMap) { // refresh the entire airmass viewer for data in the binary might have changed Calculate(m_currentfile, m_symbols); if (gridControl1.DataSource != null) { TurboType tt = TurboType.TD0415T; if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.T25_55 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.T25_60 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT17) { tt = TurboType.Stock; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD04 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD0416T) { tt = TurboType.TD0415T; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD0418T || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD0419T) { tt = TurboType.TD0419T; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT2871R || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT28RS) { tt = TurboType.GT28RS; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT3071R86 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT30R) { tt = TurboType.GT3071R; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT40R || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.HX40W) { tt = TurboType.HX40w; } DataTable dt = (DataTable)gridControl1.DataSource; double[] boost_req = new double[dt.Columns.Count]; /*PressureToTorque ptt = new PressureToTorque(); for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++) { double o = Convert.ToDouble(dt.Rows[0].ItemArray.GetValue(i)); // we get the airmass from this.. now convert to boost pressure double trq = AirmassToTorque(Convert.ToInt32(o), Convert.ToInt32(x_axisvalues.GetValue(i)), checkEdit7.Checked); double val = ptt.CalculatePressureFromTorque(trq, tt); boost_req.SetValue(val, i); }*/ for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++) { double o = Convert.ToDouble(dt.Rows[0].ItemArray.GetValue(i)); boost_req.SetValue(o, i); } ctrlCompressorMap1.Boost_request = boost_req; // set rpm range ctrlCompressorMap1.Rpm_points = x_axisvalues; PartNumberConverter pnc = new PartNumberConverter(); // /*T7FileHeader header = new T7FileHeader(); header.init(m_currentfile, false); ECUInformation ecuinfo = pnc.GetECUInfo(header.getPartNumber().Trim(), ""); if (ecuinfo.Is2point3liter) ctrlCompressorMap1.Current_engineType = ctrlCompressorMap.EngineType.Liter23; else ctrlCompressorMap1.Current_engineType = ctrlCompressorMap.EngineType.Liter2;*/ //ctrlCompressorMap1.SetCompressorType(ctrlCompressorMap.CompressorMap.TD04); //TODO: always for now, later rewrite and add the GT17 map ctrlCompressorMap1.Redraw(); } } }
private void LoadCompressorMapWithDetails() { // we should get the top line like for the chart if (gridControl1.DataSource != null) { TurboType tt = TurboType.TD0415T; if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.T25_55 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.T25_60 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT17) { tt = TurboType.Stock; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD04 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD0416T) { tt = TurboType.TD0415T; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD0418T || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD0419T) { tt = TurboType.TD0419T; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT2871R || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT28RS) { tt = TurboType.GT28RS; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT3071R86 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT30R) { tt = TurboType.GT3071R; } else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT40R || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.HX40W) { tt = TurboType.HX40w; } DataTable dt = (DataTable)gridControl1.DataSource; double[] boost_req = new double[dt.Columns.Count]; /*PressureToTorque ptt = new PressureToTorque(); <GS-09032011> changed to airmass calculation for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++) { double o = Convert.ToDouble(dt.Rows[0].ItemArray.GetValue(i)); // we get the airmass from this.. now convert to boost pressure double trq = AirmassToTorque(Convert.ToInt32(o), Convert.ToInt32(x_axisvalues.GetValue(i)), checkEdit7.Checked); double val = ptt.CalculatePressureFromTorque(trq, tt ); boost_req.SetValue(val, i); }*/ for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++) { double o = Convert.ToDouble(dt.Rows[0].ItemArray.GetValue(i)); boost_req.SetValue(o, i); } ctrlCompressorMap1.Boost_request = boost_req; // set rpm range ctrlCompressorMap1.Rpm_points = x_axisvalues; PartNumberConverter pnc = new PartNumberConverter(); // T7FileHeader header = new T7FileHeader(); header.init(m_currentfile, false); ECUInformation ecuinfo = pnc.GetECUInfo(header.getPartNumber().Trim(), ""); if (!ctrlCompressorMap1.IsInitiallyLoaded) { if (ecuinfo.Is2point3liter) ctrlCompressorMap1.Current_engineType = ctrlCompressorMap.EngineType.Liter23; else ctrlCompressorMap1.Current_engineType = ctrlCompressorMap.EngineType.Liter2; if (ecuinfo.Isaero) ctrlCompressorMap1.SetCompressorType(ctrlCompressorMap.CompressorMap.TD04); else ctrlCompressorMap1.SetCompressorType(ctrlCompressorMap.CompressorMap.GT17); } ctrlCompressorMap1.IsInitiallyLoaded = true; ctrlCompressorMap1.Redraw(); } }
private void ConvertPartNumber() { PartNumberConverter pnc = new PartNumberConverter(); ECUInformation ecuinfo = pnc.GetECUInfo(buttonEdit1.Text, ""); lblCarModel.Text = "---"; lblEngineType.Text = "---"; lblPower.Text = "---"; lblTorque.Text = "---"; checkEdit1.Checked = false; checkEdit2.Checked = false; checkEdit4.Checked = false; checkEdit5.Checked = false; if (ecuinfo.Valid) { lblCarModel.Text = ecuinfo.Carmodel.ToString(); lblEngineType.Text = ecuinfo.Enginetype.ToString(); lblPower.Text = ecuinfo.Bhp.ToString() + " bhp"; //lblStageI.Text = ecuinfo.Stage1boost.ToString() + " bar"; //lblStageII.Text = ecuinfo.Stage2boost.ToString() + " bar"; //lblStageIII.Text = ecuinfo.Stage3boost.ToString() + " bar"; if (ecuinfo.Is2point3liter) { checkEdit1.Checked = false; checkEdit2.Checked = true; } else { checkEdit1.Checked = true; checkEdit2.Checked = false; } if (ecuinfo.Isturbo) checkEdit4.Checked = true; if (ecuinfo.Isfpt) { checkEdit5.Checked = true; checkEdit4.Checked = true; } if (ecuinfo.Isaero) { checkEdit4.Checked = true; checkEdit5.Checked = true; } lblTorque.Text = ecuinfo.Torque.ToString() + " Nm"; if (System.IO.File.Exists(Path.Combine(Application.StartupPath, "Binaries\\" + buttonEdit1.Text + ".BIN"))) { simpleButton2.Enabled = true; simpleButton3.Enabled = true; simpleButton4.Enabled = true; } else { simpleButton2.Enabled = false; simpleButton3.Enabled = false; simpleButton4.Enabled = false; } } else { MessageBox.Show("The entered partnumber was not recognized by T7Suite"); } }
private void LoadCompressorMapWithDetails() { // we should get the top line like for the chart if (gridControl1.DataSource != null) { DataTable dt = (DataTable)gridControl1.DataSource; double[] boost_req = new double[dt.Columns.Count]; /*PressureToTorque ptt = new PressureToTorque(); for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++) { double o = Convert.ToDouble(dt.Rows[0].ItemArray.GetValue(i)); // we get the airmass from this.. now convert to boost pressure double trq = AirmassToTorque(Convert.ToInt32(o), Convert.ToInt32(x_axisvalues.GetValue(i)), checkEdit7.Checked); double val = ptt.CalculatePressureFromTorque(trq, TurboType.TD0415T); boost_req.SetValue(val, i); }*/ for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++) { double o = Convert.ToDouble(dt.Rows[0].ItemArray.GetValue(i)); boost_req.SetValue(o, i); } ctrlCompressorMap1.Boost_request = boost_req; // set rpm range ctrlCompressorMap1.Rpm_points = x_axisvalues; PartNumberConverter pnc = new PartNumberConverter(); // T7FileHeader header = new T7FileHeader(); header.init(m_currentfile, false); ECUInformation ecuinfo = pnc.GetECUInfo(header.getPartNumber().Trim(), ""); if (ecuinfo.Is2point3liter) ctrlCompressorMap1.Current_engineType = ctrlCompressorMap.EngineType.Liter23; else ctrlCompressorMap1.Current_engineType = ctrlCompressorMap.EngineType.Liter2; //ctrlCompressorMap1.SetCompressorType(ctrlCompressorMap.CompressorMap.TD04); //TODO: always for now, later rewrite and add the GT17 map ctrlCompressorMap1.Redraw(); } }
private void AddPartNumber(string part, string my) { PartNumberConverter pnc = new PartNumberConverter(); ECUInformation ecuinfo = new ECUInformation(); ecuinfo = pnc.GetECUInfo(part, ""); dt.Rows.Add(ecuinfo.Carmodel.ToString(), ecuinfo.Enginetype.ToString(), part, ecuinfo.Turbomodel.ToString(), ecuinfo.Isturbo.ToString(), ecuinfo.Bhp.ToString(), ecuinfo.Torque.ToString(), ecuinfo.Softwareversion, ecuinfo.EmissionVariant.ToString().Replace('_', ' ').Replace("x", " ").Replace("None", ""), my); }