/// <summary>
        /// checks injector constant value: should be over 5 and under 25
        /// </summary>
        /// <param name="filename"></param>
        private void CheckInjectionConstant(string filename, bool showreport, Trionic5Resume resume)
        {
            byte[] injector_constant = readdatafromfile(filename, GetSymbolAddress("Inj_konst!"), GetSymbolLength("Inj_konst!"));
            byte   b = (byte)injector_constant.GetValue(0);

            if (b <= 5 || b > 25)
            {
                if (showreport)
                {
                    resume.AddToResumeTable("Found anomaly! Injector constant has an invalid value: " + b.ToString());
                }
            }
        }
        /// <summary>
        /// Check boost request maps (Tryck_mat & Tryck_mat_a) against limiters
        /// </summary>
        /// <param name="filename"></param>
        private void CheckBoostRequestMapAgainstBoostLimiters(string filename, bool showreport, Trionic5Resume resume)
        {
            byte[] boost_request_map     = readdatafromfile(filename, GetSymbolAddress("Tryck_mat!"), GetSymbolLength("Tryck_mat!"));
            byte[] boost_request_map_aut = readdatafromfile(filename, GetSymbolAddress("Tryck_mat_a!"), GetSymbolLength("Tryck_mat_a!"));
            byte[] fuel_cut_map          = readdatafromfile(filename, GetSymbolAddress("Tryck_vakt_tab!"), GetSymbolLength("Tryck_vakt_tab!"));
            byte[] boost_maps_axis       = readdatafromfile(filename, GetSymbolAddress("Pwm_ind_rpm!"), GetSymbolLength("Pwm_ind_rpm!"));

            int numberofrows    = (boost_maps_axis.Length / 2);
            int numberofcolumns = boost_request_map.Length / numberofrows;

            for (int fct = 0; fct < fuel_cut_map.Length; fct++)
            {
                byte boostlimit = (byte)fuel_cut_map.GetValue(fct);
                for (int ct = 0; ct < numberofcolumns; ct++)
                {
                    // look in tryck_mat & tryck_mat_a
                    byte boost_req_value = (byte)boost_request_map.GetValue((fct * numberofcolumns) + ct);
                    if (boost_req_value >= boostlimit)
                    {
                        if (showreport)
                        {
                            resume.AddToResumeTable("Found anomaly! Boost request value higher than boost limiter (fuel cut value) in Tryck_mat");
                            resume.AddToResumeTable("--> row: " + fct.ToString() + " column: " + ct.ToString());
                        }
                    }
                    boost_req_value = (byte)boost_request_map_aut.GetValue((fct * numberofcolumns) + ct);
                    if (boost_req_value >= boostlimit)
                    {
                        if (showreport)
                        {
                            resume.AddToResumeTable("Found anomaly! Boost request value higher than boost limiter (fuel cut value) in Tryck_mat_a");
                            resume.AddToResumeTable("--> row: " + fct.ToString() + " column: " + ct.ToString());
                        }
                    }
                }
            }
        }
        private void CheckEigthBitAxisAgainstBoostPressure(string filename, bool showreport, int maxboostvalue, string symbolname, Trionic5Resume resume)
        {
            byte[] axis  = readdatafromfile(filename, GetSymbolAddress(symbolname), GetSymbolLength(symbolname));
            bool   found = false;

            foreach (byte b in axis)
            {
                int i = (int)b;
                if (i >= maxboostvalue)
                {
                    found = true;
                }
            }
            if (!found && showreport)
            {
                resume.AddToResumeTable(symbolname + " does not support the maximum boost request value!");
            }
        }
        private void CheckSixteenBitAxisAgainstBoostPressure(string filename, bool showreport, int maxboostvalue, string symbolname, Trionic5Resume resume)
        {
            byte[] axis = readdatafromfile(filename, GetSymbolAddress(symbolname), GetSymbolLength(symbolname));
            if (axis.Length < 2)
            {
                return;
            }
            bool found = false;

            for (int t = 0; t < axis.Length; t += 2)
            {
                int i = Convert.ToInt32(axis.GetValue(t));
                i *= 256;
                i += Convert.ToInt32(axis.GetValue(t + 1));
                if (i >= maxboostvalue)
                {
                    found = true;
                }
            }
            if (!found && showreport)
            {
                resume.AddToResumeTable(symbolname + " does not support the maximum boost request value!");
            }
        }
        /// <summary>
        /// Check binary file for anomalies that cannot be right
        /// </summary>
        /// <param name="filename"></param>
        public void CheckBinForAnomalies(string filename, Trionic5Resume resume, bool fixproblems, bool showreport, IECUFileInformation fileInformation)
        {
            m_fileInformation = fileInformation;
            if (showreport)
            {
                resume.AddToResumeTable("Checking file " + Path.GetFileName(filename));
                resume.AddToResumeTable("Checking injection map against fuel knock map");
            }
            CheckInjectionMapAgainstFuelKnockMap(filename, showreport, fixproblems, resume);
            if (showreport)
            {
                resume.AddToResumeTable("Checking injection constant value");
            }
            CheckInjectionConstant(filename, showreport, resume);
            if (showreport)
            {
                resume.AddToResumeTable("Checking boost request maps agains boost limiters");
            }
            CheckBoostRequestMapAgainstBoostLimiters(filename, showreport, resume);

            if (showreport)
            {
                resume.AddToResumeTable("Checking axis against maximum requested boost level");
            }
            try
            {
                CheckBoostRequestAgainstAxisRanges(filename, true, resume);
            }
            catch (Exception E)
            {
                Console.WriteLine("CheckBoostRequestAgainstAxisRanges: " + E.Message);
            }
            if (showreport)
            {
                // seperator for next file... maybe
                resume.AddToResumeTable("");
            }
        }
Пример #6
0
        /// <summary>
        /// Check binary file for anomalies that cannot be right
        /// </summary>
        /// <param name="filename"></param>
        public void CheckBinForAnomalies(string filename, Trionic5Resume resume, bool fixproblems, bool showreport, IECUFileInformation fileInformation)
        {
            m_fileInformation = fileInformation;
            if (showreport)
            {
                resume.AddToResumeTable("Checking file " + Path.GetFileName(filename));
                resume.AddToResumeTable("Checking injection map against fuel knock map");
            }
            CheckInjectionMapAgainstFuelKnockMap(filename, showreport, fixproblems, resume);
            if (showreport)
            {
                resume.AddToResumeTable("Checking injection constant value");
            }
            CheckInjectionConstant(filename, showreport, resume);
            if (showreport)
            {
                resume.AddToResumeTable("Checking boost request maps agains boost limiters");
            }
            CheckBoostRequestMapAgainstBoostLimiters(filename, showreport, resume);

            if (showreport)
            {
                resume.AddToResumeTable("Checking axis against maximum requested boost level");
            }
            try
            {
                CheckBoostRequestAgainstAxisRanges(filename, true, resume);
            }
            catch (Exception E)
            {
                Console.WriteLine("CheckBoostRequestAgainstAxisRanges: " + E.Message);
            }
            if (showreport)
            {
                // seperator for next file... maybe
                resume.AddToResumeTable("");
            }
        }
Пример #7
0
        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();
        }
Пример #8
0
        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;
        }
Пример #9
0
 private void CopySymbol(string symbolname, string fromfilename, IECUFile FileToTransferTo, int fromflashaddress, int fromlength, string targetfilename, int targetflashaddress, int targetlength, Trionic5Resume resume)
 {
     if (fromlength != targetlength)
     {
         resume.AddToResumeTable("Unable to transfer symbol " + symbolname + " because source and target lengths don't match!");
     }
     else
     {
         try
         {
             while (fromflashaddress > m_trionicFileInformation.Filelength) fromflashaddress -= m_trionicFileInformation.Filelength;
             FileInfo fi = new FileInfo(targetfilename);
             while (targetflashaddress > fi.Length) targetflashaddress -= (int)fi.Length;
             byte[] mapdata = m_trionicFile.ReadDataFromFile(fromfilename, (uint)fromflashaddress, (uint)fromlength);
             FileToTransferTo.WriteData(mapdata, (uint)targetflashaddress);
             resume.AddToResumeTable("Transferred symbol " + symbolname + " successfully");
         }
         catch (Exception E)
         {
             resume.AddToResumeTable("Failed to transfer symbol " + symbolname + ": " + E.Message);
         }
     }
 }
Пример #10
0
        public void ConvertToE85(IECUFile m_File)
        {
            m_resume = new Trionic5Resume();

            m_resume.AddToResumeTable("Start tuning for E85");
            GenerateAndSaveNewIgnitionMap(m_File, true);
            m_resume.AddToResumeTable("Generated and saved ignition map for E85 use");
            // now set fuelling enrichment
            IncreaseByteVariableWith140Percent(m_File, "Inj_konst!");
            m_resume.AddToResumeTable("Increased injector constant by 40%");
            IncreaseByteVariableWith140Percent(m_File, "Eftersta_fak!");
            IncreaseByteVariableWith140Percent(m_File, "Eftersta_fak2!");
            m_resume.AddToResumeTable("Increased afterstart factors by 40%");
            GenerateStartVevFak(m_File);
            m_resume.AddToResumeTable("Generated starting enrichment factors");
        }
Пример #11
0
        /// <summary>
        /// Check boost request maps (Tryck_mat & Tryck_mat_a) against limiters
        /// </summary>
        /// <param name="filename"></param>
        private void CheckBoostRequestMapAgainstBoostLimiters(string filename, bool showreport, Trionic5Resume resume)
        {
            byte[] boost_request_map = readdatafromfile(filename, GetSymbolAddress( "Tryck_mat!"), GetSymbolLength( "Tryck_mat!"));
            byte[] boost_request_map_aut = readdatafromfile(filename, GetSymbolAddress( "Tryck_mat_a!"), GetSymbolLength( "Tryck_mat_a!"));
            byte[] fuel_cut_map = readdatafromfile(filename, GetSymbolAddress( "Tryck_vakt_tab!"), GetSymbolLength( "Tryck_vakt_tab!"));
            byte[] boost_maps_axis = readdatafromfile(filename, GetSymbolAddress( "Pwm_ind_rpm!"), GetSymbolLength( "Pwm_ind_rpm!"));

            int numberofrows = (boost_maps_axis.Length / 2);
            int numberofcolumns = boost_request_map.Length / numberofrows;

            for (int fct = 0; fct < fuel_cut_map.Length; fct++)
            {
                byte boostlimit = (byte)fuel_cut_map.GetValue(fct);
                for (int ct = 0; ct < numberofcolumns; ct++)
                {
                    // look in tryck_mat & tryck_mat_a
                    byte boost_req_value = (byte)boost_request_map.GetValue((fct * numberofcolumns) + ct);
                    if (boost_req_value >= boostlimit)
                    {
                        if (showreport)
                        {
                            resume.AddToResumeTable("Found anomaly! Boost request value higher than boost limiter (fuel cut value) in Tryck_mat");
                            resume.AddToResumeTable("--> row: " + fct.ToString() + " column: " + ct.ToString());
                        }
                    }
                    boost_req_value = (byte)boost_request_map_aut.GetValue((fct * numberofcolumns) + ct);
                    if (boost_req_value >= boostlimit)
                    {
                        if (showreport)
                        {
                            resume.AddToResumeTable("Found anomaly! Boost request value higher than boost limiter (fuel cut value) in Tryck_mat_a");
                            resume.AddToResumeTable("--> row: " + fct.ToString() + " column: " + ct.ToString());
                        }
                    }
                }
            }
        }
Пример #12
0
 private void CheckSixteenBitAxisAgainstBoostPressure(string filename, bool showreport, int maxboostvalue, string symbolname, Trionic5Resume resume)
 {
     byte[] axis = readdatafromfile(filename, GetSymbolAddress( symbolname), GetSymbolLength( symbolname));
     if (axis.Length < 2) return;
     bool found = false;
     for (int t = 0; t < axis.Length; t += 2)
     {
         int i = Convert.ToInt32(axis.GetValue(t));
         i *= 256;
         i += Convert.ToInt32(axis.GetValue(t + 1));
         if (i >= maxboostvalue) found = true;
     }
     if (!found && showreport)
     {
         resume.AddToResumeTable(symbolname + " does not support the maximum boost request value!");
     }
 }
Пример #13
0
        /// <summary>
        /// Checks is fuelknock map values are higher for every load/site than injection map
        /// </summary>
        /// <param name="filename"></param>
        private void CheckInjectionMapAgainstFuelKnockMap(string filename, bool showreport, bool fixproblems, Trionic5Resume resume)
        {
            bool changes_made = false;
            byte[] fuel_injection_map = readdatafromfile(filename, GetSymbolAddress( "Insp_mat!"), GetSymbolLength( "Insp_mat!"));
            byte[] fuel_knock_map = readdatafromfile(filename, GetSymbolAddress( "Fuel_knock_mat!"), GetSymbolLength( "Fuel_knock_mat!"));
            byte[] fuel_injection_xaxis = readdatafromfile(filename, GetSymbolAddress( "Fuel_map_xaxis!"), GetSymbolLength( "Fuel_map_xaxis!"));
            byte[] fuel_knock_xaxis = readdatafromfile(filename, GetSymbolAddress( "Fuel_knock_xaxis!"), GetSymbolLength( "Fuel_knock_xaxis!"));
            byte[] fuel_knock_yaxis = readdatafromfile(filename, GetSymbolAddress( "Fuel_map_yaxis!"), GetSymbolLength( "Fuel_map_yaxis!"));

            // t5.2 insp_mat = 16 * 16
            // t5.2 fuel_knock_mat = 8 * 16

            // t5.5 insp_mat = 16 * 16
            // t5.5 fuel_knock_mat = 12 * 16

            int fuel_numberrows = 16; // always 16 rows
            int fuel_numbercolumns = fuel_injection_map.Length / fuel_numberrows;

            int numberrows = 16; // always 16 rows
            int numbercolumns = fuel_knock_map.Length / numberrows;

            // handle all rows
            for (int rt = 0; rt < numberrows; rt++)
            {
                // and all columns
                for (int ct = 0; ct < numbercolumns; ct++)
                {
                    byte fuel_knock_byte = (byte)fuel_knock_map.GetValue((rt * numbercolumns) + ct);
                    // fetch pressure & rpm for this cell
                    byte fuel_knock_pressure = (byte)fuel_knock_xaxis.GetValue(ct);

                    // now find the nearest column in fuel_map_xaxis
                    double diff = 255;
                    int idx_found = -1;
                    for (int xt = 0; xt < fuel_injection_xaxis.Length; xt++)
                    {
                        byte fuel_map_pressure_temp = (byte)fuel_injection_xaxis.GetValue(xt);
                        double tempdiff = Math.Abs((double)fuel_knock_pressure - (double)fuel_map_pressure_temp);
                        if (tempdiff < diff)
                        {
                            idx_found = xt;
                            diff = tempdiff;
                        }
                    }
                    if (idx_found >= 0)
                    {
                        // found it, we can compare
                        byte fuel_map_byte = (byte)fuel_injection_map.GetValue((rt * fuel_numbercolumns) + idx_found);
                        if (fuel_map_byte >= fuel_knock_byte)
                        {
                            // ANOMALY!!
                            if (showreport)
                            {
                                resume.AddToResumeTable("Found anomaly! Fuel injection map value larger than or equal to knock map");
                            }
                            if (fixproblems)
                            {
                                if (fuel_knock_byte < 255)
                                {
                                    fuel_knock_byte = fuel_map_byte;
                                    for (int corrt = 0; corrt < 5; corrt++)
                                    {
                                        if (fuel_knock_byte < 255) fuel_knock_byte++;
                                    }
                                    // write to symbol
                                    fuel_knock_map.SetValue(fuel_knock_byte, (rt * numbercolumns) + ct);
                                    resume.AddToResumeTable("Adjusted a value in the knock fuel matrix");
                                    changes_made = true;
                                }
                            }

                            double pressure = (double)fuel_knock_pressure;
                            pressure *= GetMapCorrectionFactor("Tryck_mat!");
                            pressure += GetMapCorrectionOffset("Tryck_mat!");

                            try
                            {
                                int rpm = Convert.ToInt32(fuel_knock_yaxis.GetValue(rt * 2)) * 256;
                                rpm += Convert.ToInt32(fuel_knock_yaxis.GetValue((rt * 2) + 1));
                                rpm *= 10;
                                if (showreport)
                                {
                                    resume.AddToResumeTable("--> pressure = " + pressure.ToString() + " bar, rpm = " + rpm.ToString());
                                }
                            }
                            catch (Exception E)
                            {
                                Console.WriteLine(E.Message);
                            }
                        }
                    }
                }
            }
            if (fixproblems && changes_made)
            {
                savedatatobinary(GetSymbolAddress( "Fuel_knock_mat!"), GetSymbolLength( "Fuel_knock_mat!"), fuel_knock_map, filename);
            }
        }
Пример #14
0
 /// <summary>
 /// checks injector constant value: should be over 5 and under 25
 /// </summary>
 /// <param name="filename"></param>
 private void CheckInjectionConstant(string filename, bool showreport, Trionic5Resume resume)
 {
     byte[] injector_constant = readdatafromfile(filename, GetSymbolAddress( "Inj_konst!"), GetSymbolLength( "Inj_konst!"));
     byte b = (byte)injector_constant.GetValue(0);
     if (b <= 5 || b > 25)
     {
         if (showreport)
         {
             resume.AddToResumeTable("Found anomaly! Injector constant has an invalid value: " + b.ToString());
         }
     }
 }
Пример #15
0
 private void CheckEigthBitAxisAgainstBoostPressure(string filename, bool showreport, int maxboostvalue, string symbolname, Trionic5Resume resume)
 {
     byte[] axis = readdatafromfile(filename, GetSymbolAddress( symbolname), GetSymbolLength( symbolname));
     bool found = false;
     foreach (byte b in axis)
     {
         int i = (int)b;
         if (i >= maxboostvalue) found = true;
     }
     if (!found && showreport)
     {
         resume.AddToResumeTable(symbolname + " does not support the maximum boost request value!");
     }
 }
Пример #16
0
        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);
        }
        /// <summary>
        /// Checks is fuelknock map values are higher for every load/site than injection map
        /// </summary>
        /// <param name="filename"></param>
        private void CheckInjectionMapAgainstFuelKnockMap(string filename, bool showreport, bool fixproblems, Trionic5Resume resume)
        {
            bool changes_made = false;

            byte[] fuel_injection_map   = readdatafromfile(filename, GetSymbolAddress("Insp_mat!"), GetSymbolLength("Insp_mat!"));
            byte[] fuel_knock_map       = readdatafromfile(filename, GetSymbolAddress("Fuel_knock_mat!"), GetSymbolLength("Fuel_knock_mat!"));
            byte[] fuel_injection_xaxis = readdatafromfile(filename, GetSymbolAddress("Fuel_map_xaxis!"), GetSymbolLength("Fuel_map_xaxis!"));
            byte[] fuel_knock_xaxis     = readdatafromfile(filename, GetSymbolAddress("Fuel_knock_xaxis!"), GetSymbolLength("Fuel_knock_xaxis!"));
            byte[] fuel_knock_yaxis     = readdatafromfile(filename, GetSymbolAddress("Fuel_map_yaxis!"), GetSymbolLength("Fuel_map_yaxis!"));

            // t5.2 insp_mat = 16 * 16
            // t5.2 fuel_knock_mat = 8 * 16

            // t5.5 insp_mat = 16 * 16
            // t5.5 fuel_knock_mat = 12 * 16

            int fuel_numberrows    = 16; // always 16 rows
            int fuel_numbercolumns = fuel_injection_map.Length / fuel_numberrows;


            int numberrows    = 16; // always 16 rows
            int numbercolumns = fuel_knock_map.Length / numberrows;

            // handle all rows
            for (int rt = 0; rt < numberrows; rt++)
            {
                // and all columns
                for (int ct = 0; ct < numbercolumns; ct++)
                {
                    byte fuel_knock_byte = (byte)fuel_knock_map.GetValue((rt * numbercolumns) + ct);
                    // fetch pressure & rpm for this cell
                    byte fuel_knock_pressure = (byte)fuel_knock_xaxis.GetValue(ct);

                    // now find the nearest column in fuel_map_xaxis
                    double diff      = 255;
                    int    idx_found = -1;
                    for (int xt = 0; xt < fuel_injection_xaxis.Length; xt++)
                    {
                        byte   fuel_map_pressure_temp = (byte)fuel_injection_xaxis.GetValue(xt);
                        double tempdiff = Math.Abs((double)fuel_knock_pressure - (double)fuel_map_pressure_temp);
                        if (tempdiff < diff)
                        {
                            idx_found = xt;
                            diff      = tempdiff;
                        }
                    }
                    if (idx_found >= 0)
                    {
                        // found it, we can compare
                        byte fuel_map_byte = (byte)fuel_injection_map.GetValue((rt * fuel_numbercolumns) + idx_found);
                        if (fuel_map_byte >= fuel_knock_byte)
                        {
                            // ANOMALY!!
                            if (showreport)
                            {
                                resume.AddToResumeTable("Found anomaly! Fuel injection map value larger than or equal to knock map");
                            }
                            if (fixproblems)
                            {
                                if (fuel_knock_byte < 255)
                                {
                                    fuel_knock_byte = fuel_map_byte;
                                    for (int corrt = 0; corrt < 5; corrt++)
                                    {
                                        if (fuel_knock_byte < 255)
                                        {
                                            fuel_knock_byte++;
                                        }
                                    }
                                    // write to symbol
                                    fuel_knock_map.SetValue(fuel_knock_byte, (rt * numbercolumns) + ct);
                                    resume.AddToResumeTable("Adjusted a value in the knock fuel matrix");
                                    changes_made = true;
                                }
                            }

                            double pressure = (double)fuel_knock_pressure;
                            pressure *= GetMapCorrectionFactor("Tryck_mat!");
                            pressure += GetMapCorrectionOffset("Tryck_mat!");

                            try
                            {
                                int rpm = Convert.ToInt32(fuel_knock_yaxis.GetValue(rt * 2)) * 256;
                                rpm += Convert.ToInt32(fuel_knock_yaxis.GetValue((rt * 2) + 1));
                                rpm *= 10;
                                if (showreport)
                                {
                                    resume.AddToResumeTable("--> pressure = " + pressure.ToString() + " bar, rpm = " + rpm.ToString());
                                }
                            }
                            catch (Exception E)
                            {
                                Console.WriteLine(E.Message);
                            }
                        }
                    }
                }
            }
            if (fixproblems && changes_made)
            {
                savedatatobinary(GetSymbolAddress("Fuel_knock_mat!"), GetSymbolLength("Fuel_knock_mat!"), fuel_knock_map, filename);
            }
        }
Пример #18
0
        private void TransferMapsToNewBinary(string filename, Trionic5Resume resume)
        {
            IECUFile m_FileToTransferTo = new Trionic5File();
            m_FileToTransferTo.LibraryPath = Application.StartupPath + "\\Binaries";
            m_FileToTransferTo.SetAutoUpdateChecksum(m_appSettings.AutoChecksum);

            m_FileToTransferTo.SelectFile(filename);
            Trionic5FileInformation m_FileInfoToTransferTo = new Trionic5FileInformation();

            if (filename != string.Empty)
            {
                File.Copy(filename, Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetransferringmaps.bin", true);
                resume.AddToResumeTable("Backup file created");
                //bool m_fileparsed = false;
                SetStatusText("Start symbol parsing");
                m_FileInfoToTransferTo = m_FileToTransferTo.ParseFile();
                //m_fileparsed = true;

                foreach (Trionic5Tools.SymbolHelper sh in m_FileInfoToTransferTo.SymbolCollection)
                {
                    if (sh.Flash_start_address > 0)
                    {
                        foreach (Trionic5Tools.SymbolHelper cfsh in m_trionicFileInformation.SymbolCollection)
                        {
                            if (cfsh.Varname == sh.Varname)
                            {
                                //progress.SetProgress("Transferring: " + sh.Varname);
                                CopySymbol(sh.Varname, m_trionicFileInformation.Filename, m_FileToTransferTo, cfsh.Flash_start_address, cfsh.Length, filename, sh.Flash_start_address, sh.Length, resume);
                            }
                        }
                    }
                }
                SetStatusText("Idle.");

            }
        }