VAGSuite.EDC16FileParser.NameKnownMaps C# (CSharp) Method

NameKnownMaps() public method

public NameKnownMaps ( byte allBytes, SymbolCollection newSymbols, List newCodeBlocks ) : void
allBytes byte
newSymbols SymbolCollection
newCodeBlocks List
return void
        public override void NameKnownMaps(byte[] allBytes, SymbolCollection newSymbols, List<CodeBlock> newCodeBlocks)
        {
            SymbolAxesTranslator st = new SymbolAxesTranslator();

            foreach (SymbolHelper sh in newSymbols)
            {
               // sh.X_axis_descr = st.TranslateAxisID(sh.X_axis_ID);
               // sh.Y_axis_descr = st.TranslateAxisID(sh.Y_axis_ID);
                if (sh.X_axis_length == 4 && sh.Y_axis_length == 20)
                {
                    sh.Category = "Detected maps";
                    sh.Subcategory = "Limiters";
                    //int lmCount = GetMapNameCountForCodeBlock("Torque limiter", sh.CodeBlock, newSymbols, false);
                    sh.Varname = "Torque limiter [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";
                    sh.Z_axis_descr = "Maximum IQ (mg)";
                    //sh.Y_axis_descr = "Atm. pressure (mbar)";
                    sh.Y_axis_descr = "Engine speed (rpm)";
                    sh.Correction = 0.01;
                    sh.YaxisUnits = "rpm";
                }

                if (sh.X_axis_length == 4 && sh.Y_axis_length == 21)
                {
                    sh.Category = "Detected maps";
                    sh.Subcategory = "Limiters";
                    //int lmCount = GetMapNameCountForCodeBlock("Torque limiter", sh.CodeBlock, newSymbols, false);
                    sh.Varname = "Torque limiter [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";
                    sh.Z_axis_descr = "Maximum IQ (mg)";
                    //sh.Y_axis_descr = "Atm. pressure (mbar)";
                    sh.Y_axis_descr = "Engine speed (rpm)";
                    sh.Correction = 0.01;
                    sh.YaxisUnits = "rpm";
                }
                else if (sh.X_axis_length == 3 && sh.Y_axis_length == 21)
                {
                    if (!CollectionContainsMapInSize(newSymbols, 21, 4))
                    {
                        sh.Category = "Detected maps";
                        sh.Subcategory = "Limiters";
                        //int lmCount = GetMapNameCountForCodeBlock("Torque limiter", sh.CodeBlock, newSymbols, false);
                        sh.Varname = "Torque limiter [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";
                        sh.Z_axis_descr = "Maximum IQ (mg)";
                        //sh.Y_axis_descr = "Atm. pressure (mbar)";
                        sh.Y_axis_descr = "Engine speed (rpm)";
                        sh.Correction = 0.01;
                        sh.YaxisUnits = "rpm";
                    }
                }
                else if (sh.X_axis_length == 16 && sh.Y_axis_length == 8)
                {
                    sh.Category = "Detected maps";
                    sh.Subcategory = "Misc";
                    int dwCount = GetMapNameCountForCodeBlock("Driver wish ", sh.CodeBlock, newSymbols, false);

                    sh.Varname = "Driver wish (" + dwCount.ToString() + ") [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";
                    sh.Correction = 0.01;
                    sh.X_axis_correction = 0.01;
                    sh.X_axis_descr = "Throttle  position";
                    sh.Z_axis_descr = "Requested IQ (mg)";
                    sh.Y_axis_descr = "Engine speed (rpm)";
                    sh.YaxisUnits = "rpm";
                    sh.XaxisUnits = "TPS %";
                }
                else if (sh.X_axis_length == 15 && sh.Y_axis_length == 16)
                {
                    sh.Category = "Detected maps";
                    sh.Subcategory = "Misc";
                    sh.Varname = "IQ to Torque conversion [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";
                    sh.Correction = 0.01;
                    sh.X_axis_correction = 0.1;
                    sh.X_axis_descr = "Torque";
                    sh.Z_axis_descr = "IQ (mg)";
                    sh.Y_axis_descr = "Engine speed (rpm)";
                    sh.YaxisUnits = "rpm";
                    sh.XaxisUnits = "Nm";
                }
                else if (sh.X_axis_length == 11 && sh.Y_axis_length == 10)
                {
                    sh.Category = "Detected maps";
                    sh.Subcategory = "Limiters";
                    sh.Varname = "Boost limit map [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";// " + sh.Flash_start_address.ToString("X8") + " " + sh.X_axis_ID.ToString("X4") + " " + sh.Y_axis_ID.ToString("X4");
                    //   sh.Correction = 0.01;
                    //sh.X_axis_correction = 0.01;
                    sh.X_axis_descr = "Atmospheric pressure (mbar)";
                    sh.Z_axis_descr = "Maximum boost pressure (mbar)";
                    sh.Y_axis_descr = "Engine speed (rpm)";
                    sh.YaxisUnits = "rpm";
                    sh.XaxisUnits = "mbar";
                }
                else if (sh.X_axis_length == 19 && sh.Y_axis_length == 15)
                {
                    sh.Category = "Detected maps";
                    sh.Subcategory = "Fuel";
                    int injDurCount = GetMapNameCountForCodeBlock("Injector duration", sh.CodeBlock, newSymbols, false);
                    sh.Varname = "Injector duration " + injDurCount.ToString("D2") + " [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";// " + sh.Flash_start_address.ToString("X8") + " " + sh.X_axis_ID.ToString("X4") + " " + sh.Y_axis_ID.ToString("X4");
                    sh.Y_axis_correction = 0.01; // TODO: Check for x or y
                    sh.Correction = 0.023437;
                    sh.X_axis_descr = "Engine speed (rpm)";
                    //sh.Y_axis_descr = "Airflow mg/stroke";
                    sh.Y_axis_descr = "Requested Quantity mg/stroke";

                    sh.Z_axis_descr = "Duration (crankshaft degrees)";
                    sh.XaxisUnits = "rpm";
                    sh.YaxisUnits = "mg/st";
                }
                else if (sh.X_axis_length == 16 && sh.Y_axis_length == 12)
                {
                    //int xmax = GetMaxAxisValue(allBytes, sh, MapViewerEx.AxisIdent.X_Axis);
                    //int ymax = GetMaxAxisValue(allBytes, sh, MapViewerEx.AxisIdent.Y_Axis);
                    //Console.WriteLine(xmax.ToString() + " " + ymax.ToString() + " " + sh.Flash_start_address.ToString("X8"));
                    if (GetMaxAxisValue(allBytes, sh, MapViewerEx.AxisIdent.Y_Axis) < 4000)
                    {
                        sh.Category = "Detected maps";
                        sh.Subcategory = "Limiters";
                        sh.Varname = "Smoke limiter [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";
                        sh.Z_axis_descr = "Maximum IQ (mg)";
                        sh.Y_axis_descr = "Engine speed (rpm)";
                        sh.X_axis_descr = "Manifold pressure (mbar)";
                        sh.Correction = 0.01;
                        //sh.X_axis_correction = 0.1; // TODO: Check for x or y
                        sh.YaxisUnits = "rpm";
                        sh.XaxisUnits = "mbar";
                    }
                }
                else if (sh.X_axis_length == 16 && sh.Y_axis_length == 14)
                {
                    // SOI
                    sh.Category = "Detected maps";
                    sh.Subcategory = "Fuel";
                    int injDurCount = GetMapNameCountForCodeBlock("Start of injection (SOI)", sh.CodeBlock, newSymbols, false);

                    //Console.WriteLine("Temperature switch for SOI " + injDurCount.ToString() + " " + tempRange.ToString());
                    //sh.Varname = "Start of injection (SOI) " + injDurCount.ToString("D2") + " [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";// " + sh.Flash_start_address.ToString("X8") + " " + sh.X_axis_ID.ToString("X4") + " " + sh.Y_axis_ID.ToString("X4");
                    sh.Varname = "Start of injection (SOI) " + injDurCount.ToString() + " [" + DetermineNumberByFlashBank(sh.Flash_start_address, newCodeBlocks) + "]";// " + sh.Flash_start_address.ToString("X8") + " " + sh.X_axis_ID.ToString("X4") + " " + sh.Y_axis_ID.ToString("X4");

                    sh.Correction = 0.023437;
                    //sh.Offset = 78;

                    sh.Y_axis_descr = "Engine speed (rpm)";
                    sh.YaxisUnits = "rpm";
                    sh.X_axis_correction = 0.01; // TODODONE : Check for x or y
                    sh.XaxisUnits = "mg/st";

                    sh.X_axis_descr = "IQ (mg/stroke)";
                    sh.Z_axis_descr = "Start position (degrees BTDC)";
                }
            }
        }