Beispiel #1
0
        private static List <string> GetCFileContent(string strCFileStandardName, string strHFileStandardName, List <string> strHHeaderComments, List <int> ilstOCVVolt, List <int> voltList, List <float> listfTemp, List <float> listfCurr, List <List <int> > outYValue, double fCTABase, double fCTASlope)
        {
            string        line           = "";
            List <string> output         = new List <string>();
            int           i              = 0;
            int           iLineCmtHCFile = 4;
            string        strCTmp        = "";

            foreach (string scc in strHHeaderComments)
            {
                if (i == iLineCmtHCFile)
                {
                    output.Add(scc + strCFileStandardName);
                }
                else
                {
                    output.Add(scc);
                }
                i++;
            }
            output.Add(string.Format("#include \"{0}\"", strHFileStandardName));
            output.Add(string.Format("\n"));
            //write ocv_data
            output.Add(string.Format("/*****************************************************************************"));
            output.Add(string.Format("* OCV table"));
            output.Add(string.Format("* x_dat:\tcell mini-voltage"));
            output.Add(string.Format("* y_dat:\tresidual capacity in percentage format"));
            output.Add(string.Format("****************************************************************************/"));
            output.Add(string.Format("one_latitude_data_t ocv_data[OCV_DATA_NUM] = "));
            output.Add(string.Format("{{"));


            var ilstOCVSoC = TableMakerService.GetOCVSocPoints();

            for (i = 0; i < ilstOCVVolt.Count; i++)
            {
                strCTmp = string.Format("\t{{{0}, \t{1}", ilstOCVVolt[i], Math.Round(ilstOCVSoC[i], 0)) + "},";
                if ((i > 2) && (i % 10 == 9))
                {
                    line += (strCTmp);
                    output.Add(line);
                    line = "";
                }
                else
                {
                    line += (strCTmp);
                }
            }
            output.Add(line);
            line = "";
            output.Add(string.Format("}};"));
            //write sample cell_temp_data
            output.Add(string.Format("/*****************************************************************************"));
            output.Add(string.Format("* Cell temperature table"));
            output.Add(string.Format("* x_dat:	cell mini-voltage"));
            output.Add(string.Format("* y_dat:	temperature in 0.1degC format"));
            output.Add(string.Format("****************************************************************************/"));
            output.Add(string.Format("one_latitude_data_t cell_temp_data[TEMPERATURE_DATA_NUM] = "));
            output.Add(string.Format("{{"));

            var ilstCellTempData = TableMakerService.GenerateSampleCellTempData();

            for (i = 0; i < ilstCellTempData.Count; i++)
            {
                strCTmp = string.Format("\t{{{0}, \t{1}", ilstCellTempData[i], ilstCellTempData[++i]) + "},";
                if ((i > 2) && (i % 10 == 9))
                {
                    line += (strCTmp);
                    output.Add(line);
                    line = "";
                }
                else
                {
                    line += (strCTmp);
                }
            }
            output.Add(line);
            output.Add(string.Format("}};\n"));

            //RC table X Axis value, in mV format
            //2550, 2595, 2632, 2680, 2711, 2771, 2816, 2859, 2916, 2941, 2967, 2990, 3005, 3029, 3052, 3063, 3084, 3105, 3130, 3158, 3193, 3228, 3256, 3285, 3308, 3340, 3360, 3392, 3413, 3446, 3474, 3502, 3525, 3559, 3581, 3613, 3633, 3658, 3675, 3705, 3730, 3758, 3793, 3828, 3856, 3885, 3908, 3940, 3960, 3992, 4013, 4046, 4074, 4102, 4125, 4159, 4181, 4194, 4200};
            output.Add(string.Format("// RC table X Axis value, in mV format"));
            line = (string.Format("int\tXAxisElement[XAxis] = {{"));
            for (i = 0; i < voltList.Count; i++)
            {
                if ((i == voltList.Count - 1))
                {
                    strCTmp = string.Format("{0}", voltList[i]);
                }
                else
                {
                    strCTmp = string.Format("{0},", voltList[i]);
                }
                line += (strCTmp);
            }
            line += "};";
            output.Add(line);
            output.Add(string.Empty);
            //RC table Y Axis value, in mA format
            //1000, 3000, 6000, 10000, 15000, 20000, 25000};
            output.Add(string.Format("// RC table Y Axis value, in mA format"));
            line = (string.Format("int\tYAxisElement[YAxis] = {{"));
            for (i = 0; i < listfCurr.Count; i++)
            {
                if ((i == listfCurr.Count - 1))
                {
                    strCTmp = string.Format("{0}", listfCurr[i] * -1);
                }
                else
                {
                    strCTmp = string.Format("{0},", listfCurr[i] * -1);
                }
                line += (strCTmp);
            }
            line += "};";
            output.Add(line);
            output.Add(string.Empty);
            // RC table Z Axis value, in 10*'C format
            //-49, 100, 200, 300, 400, 500};
            output.Add(string.Format("// RC table Z Axis value, in 10*'C format"));
            line = (string.Format("int\tZAxisElement[ZAxis] = {{"));
            for (i = 0; i < listfTemp.Count; i++)
            {
                if ((i == listfTemp.Count - 1))
                {
                    strCTmp = string.Format("{0}", (Convert.ToInt16(listfTemp[i])) * 10);
                }
                else
                {
                    strCTmp = string.Format("{0},", (Convert.ToInt16(listfTemp[i])) * 10);
                }
                line += (strCTmp);
            }
            line += "};";
            output.Add(line);
            output.Add(string.Empty);
            // contents of RC table, its unit is 10000C, 1C = DesignCapacity
            //const int	RCtable[YAxis*ZAxis][XAxis]={
            output.Add(string.Format("// contents of RC table, its unit is 10000C, 1C = DesignCapacity"));
            output.Add(string.Format("int\tRCtable[YAxis*ZAxis][XAxis]={{"));
            for (i = 0; i < listfTemp.Count; i++)
            {
                output.Add(string.Format("\n//temp = {0} ^C", listfTemp[i]));
                for (int ic = 0; ic < listfCurr.Count; ic++)
                {
                    line = (string.Format("{{"));
                    for (int iv = 0; iv < voltList.Count; iv++)
                    {
                        if (iv == voltList.Count - 1)
                        {
                            strCTmp = string.Format("{0}", outYValue[i * listfCurr.Count + ic][iv]);
                        }
                        else
                        {
                            strCTmp = string.Format("{0},", outYValue[i * listfCurr.Count + ic][iv]);
                        }
                        line += (strCTmp);
                    }
                    line += "},";
                    output.Add(line);
                }
            }
            output.Add(string.Format("}};"));
            return(output);
        }
        private static bool GetLstTblM_OCV(List <SourceData> lstSample2, out List <float> fLstTblM_OCV)
        {
            Int32 iMinVoltage;
            Int32 iMaxVoltage;

            TableMakerService.GetVoltageBondary(lstSample2, out iMinVoltage, out iMaxVoltage);
            fLstTblM_OCV = new List <float>();
            bool       bReturn = false;
            int        indexLow, indexHigh;
            SourceData lowcurSample, higcurSample;
            float      fTmpSoC1, fTmpSoC2, fTmpVolt1;
            int        fmulti = (int)(((float)(iMaxVoltage - iMinVoltage)) * 10F / TableMakerService.iSOCStepmV);
            int        ileft = (int)fmulti % 10;
            int        ii, jj;
            //(200902)francis, for table_mini
            float        fFullCapacity = 0, fACCMiniStep = 0;// = fMiniTableSteps * 0.01F * (TableSourceData[0].fFullCapacity - TableSourceData[0].fCapacityDiff);
            List <float> flstLoCurVoltPoints = new List <float>();
            List <float> flstHiCurVoltPoints = new List <float>();

            #region assign low/high current sample, and assign SoC points (as default or input)
            //lstSample2.Count definitely is 2
            if (Math.Abs(lstSample2[0].fCurrent) < Math.Abs(lstSample2[1].fCurrent))
            {
                lowcurSample = lstSample2[0];
                higcurSample = lstSample2[1];
            }
            else
            {
                lowcurSample = lstSample2[1];
                higcurSample = lstSample2[0];
            }
            //fHdAbsMaxCap = lstSample2[0].fAbsMaxCap;
            //fHdCapacityDiff = lstSample2[0].fCapacityDiff;

            //(A200902)Francis, use the low_cur header setting to calculate
            fFullCapacity = lowcurSample.fAbsMaxCap - lowcurSample.fCapacityDiff;
            fACCMiniStep  = fMiniTableSteps * 0.01F * (lowcurSample.fAbsMaxCap - lowcurSample.fCapacityDiff);
            #endregion

            //calculate TSOCbyOCV, high/low voltage is coming from user input
            fmulti   /= 10;
            fTmpVolt1 = fmulti * TableMakerService.iSOCStepmV + iMinVoltage;

            if ((ileft != 0) || (fTmpVolt1 != iMaxVoltage))
            {
                if (fTmpVolt1 < iMaxVoltage)    //should not bigger than iMaxVoltage
                {
                    iMaxVoltage = (int)(fTmpVolt1 + 0.5);
                }
            }



            #region (A200902)francis, for table_mini
            #region find <SoC, Volt> from low current data
            indexLow = 0;
            flstLoCurVoltPoints.Clear();
            //fSoCbk = lowcurSample.AdjustedExpData[indexLow].fAccMah;
            for (; indexLow < lowcurSample.AdjustedExpData.Count; indexLow++)
            {
                fTmpVolt1 = lowcurSample.AdjustedExpData[indexLow].fVoltage;
                fTmpSoC1  = lowcurSample.AdjustedExpData[indexLow].fAccMah;
                if (flstLoCurVoltPoints.Count < fFullCapacity)
                {
                    if (flstLoCurVoltPoints.Count == 0)
                    {
                        flstLoCurVoltPoints.Add(fTmpVolt1);
                        continue;
                    }
                    else
                    {
                        //fTmpSoC1 = fSoCbk - fTmpSoC1;
                        //fTmpSoC1 /= iNumOfMiniPoints;
                        if (fTmpSoC1 < flstLoCurVoltPoints.Count)
                        {
                        }
                        else
                        {
                            flstLoCurVoltPoints.Add(fTmpVolt1);
                        }
                    }
                }
            }
            for (int ilo = flstLoCurVoltPoints.Count; ilo <= fFullCapacity; ilo++)
            {
                flstLoCurVoltPoints.Add(iMinVoltage);
            }
            #endregion
            #region find <SoC, Volt> from high current data
            indexHigh = 0;
            flstHiCurVoltPoints.Clear();
            //fSoCbk = higcurSample.AdjustedExpData[indexHigh].fAccMah;
            for (; indexHigh < higcurSample.AdjustedExpData.Count; indexHigh++)
            {
                fTmpVolt1 = higcurSample.AdjustedExpData[indexHigh].fVoltage;
                fTmpSoC2  = higcurSample.AdjustedExpData[indexHigh].fAccMah;
                if (flstHiCurVoltPoints.Count < fFullCapacity)
                {
                    if (flstHiCurVoltPoints.Count == 0)
                    {
                        flstHiCurVoltPoints.Add(fTmpVolt1);
                        continue;
                    }
                    else
                    {
                        //fTmpSoC2 = fSoCbk - fTmpSoC1;
                        //fTmpSoC2 /= iNumOfMiniPoints;
                        if (fTmpSoC2 < flstHiCurVoltPoints.Count)
                        {
                        }
                        else
                        {
                            flstHiCurVoltPoints.Add(fTmpVolt1);
                        }
                    }
                }
            }
            for (int ihi = flstHiCurVoltPoints.Count; ihi <= fFullCapacity; ihi++)
            {
                flstHiCurVoltPoints.Add(iMinVoltage);
            }
            #endregion

            jj       = 0;
            indexLow = 0; indexHigh = 0;
            fTmpSoC1 = flstLoCurVoltPoints[indexLow];
            fTmpSoC2 = flstHiCurVoltPoints[indexHigh];
            for (jj = 0; jj < (iNumOfMiniPoints + 1); jj++)
            {
                for (; indexLow < flstLoCurVoltPoints.Count; indexLow++)
                {
                    if (indexLow < (jj * fACCMiniStep))
                    {
                        fTmpSoC1 = flstLoCurVoltPoints[indexLow];
                    }
                    else
                    {
                        break;
                    }
                }
                for (; indexHigh < flstHiCurVoltPoints.Count; indexHigh++)
                {
                    if (indexHigh < (jj * fACCMiniStep))
                    {
                        fTmpSoC2 = flstHiCurVoltPoints[indexHigh];
                    }
                    else
                    {
                        break;
                    }
                }
                if (jj == 0)
                {
                    fTmpVolt1 = (fTmpSoC2 + fTmpSoC1) / 2;
                }
                else
                {
                    //fCurrent is saving in mA format
                    fTmpVolt1  = (fTmpSoC2 - fTmpSoC1) / ((Math.Abs(lowcurSample.fCurrent) - Math.Abs(higcurSample.fCurrent)) / 1000);
                    fTmpVolt1 *= (Math.Abs(lowcurSample.fCurrent) / 1000);
                    fTmpVolt1 += fTmpSoC1;
                }
                fLstTblM_OCV.Add(fTmpVolt1);
            }   //for (jj=0; jj < (iNumOfMiniPoints+1);jj++)
            #endregion

            return(bReturn);
        }
        private static void GenerateMiniCHFiles(string OutFolder, string strCFileMiniName, string strHFileMiniName, List <string> strHHeaderComments, List <int> ilstOCVVolt, double fCTABase, double fCTASlope, List <double> poly2EstFACC, List <double> poly2EstIR)
        {
            short        iEnlargeIR  = 10000;
            FileStream   fswrite     = null;
            StreamWriter FileContent = null;

            #region create Driver H file
            var strMiniC = System.IO.Path.Combine(OutFolder, strCFileMiniName);
            var strMiniH = System.IO.Path.Combine(OutFolder, strHFileMiniName);
            try
            {
                fswrite     = File.Open(strMiniH, FileMode.Create, FileAccess.Write, FileShare.None);
                FileContent = new StreamWriter(fswrite, new UTF8Encoding(false));// Encoding.Default);
            }
            catch { }

            int i = 0;
            foreach (string shc in strHHeaderComments)
            {
                FileContent.WriteLine(shc);
            }

            var ilstCellTempData = TableMakerService.GenerateSampleCellTempData();
            #region write H file content to
            FileContent.WriteLine(string.Format("#ifndef _TABLE_MINI_H_"));
            FileContent.WriteLine(string.Format("#define _TABLE_MINI_H_"));
            FileContent.WriteLine(string.Format("\n"));
            FileContent.WriteLine(string.Format("#define FGM_OCV_NUM\t\t{0}", ilstOCVVolt.Count));
            FileContent.WriteLine(string.Format("#define FGM_TEMPERATURE_NUM\t\t{0}", ilstCellTempData.Count / 2));
            FileContent.WriteLine(string.Format("#define FGM_TR_NUM\t\t2"));//{0}", (int)(dbTmp2)));        //currently we direct code 2
            FileContent.WriteLine(string.Format(""));
            FileContent.WriteLine(string.Format("#define CTABASE\t\t{0}", fCTABase));
            FileContent.WriteLine(string.Format("#define CTASLOPE\t\t{0}", fCTASlope));
            FileContent.WriteLine(string.Format(""));
            FileContent.WriteLine(string.Format("/****************************************************************************"));
            FileContent.WriteLine(string.Format("* Struct section"));
            FileContent.WriteLine(string.Format("*  add struct #define here if any"));
            FileContent.WriteLine(string.Format("***************************************************************************/"));
            FileContent.WriteLine(string.Format("typedef struct tag_one_latitude_data {{"));
            FileContent.WriteLine(string.Format("\tshort\t\t\t\t\tx;//"));
            FileContent.WriteLine(string.Format("\tshort\t\t\t\t\ty;//"));
            FileContent.WriteLine(string.Format("}} one_latitude_data_t;"));
            FileContent.WriteLine(string.Format(""));
            FileContent.WriteLine(string.Format("typedef struct tag_cof_func_data {{"));
            FileContent.WriteLine(string.Format("\tint\t\t\t\t\ta;//"));
            FileContent.WriteLine(string.Format("\tint\t\t\t\t\tb;//"));
            FileContent.WriteLine(string.Format("\tint\t\t\t\t\tc;//"));
            FileContent.WriteLine(string.Format("}} cof_func_data_t;"));
            FileContent.WriteLine(string.Format(""));
            FileContent.WriteLine(string.Format("/****************************************************************************"));
            FileContent.WriteLine(string.Format("* extern variable declaration section"));
            FileContent.WriteLine(string.Format("***************************************************************************/"));
            FileContent.WriteLine(string.Format("extern one_latitude_data_t fgm_ocv_data[];"));
            FileContent.WriteLine(string.Format("extern one_latitude_data_t fgm_cell_temp_data[];"));
            FileContent.WriteLine(string.Format("extern cof_func_data_t fgm_tr_data[];"));
            FileContent.WriteLine(string.Format("\n"));
            FileContent.WriteLine(string.Format("#endif	//_TABLE_MINI_H_"));
            #endregion
            FileContent.Close();
            fswrite.Close();
            #endregion

            #region create Driver C file
            try
            {
                fswrite     = File.Open(strMiniC, FileMode.Create, FileAccess.Write, FileShare.None);
                FileContent = new StreamWriter(fswrite, new UTF8Encoding(false));// Encoding.Default);
            }
            catch (Exception ec)
            {
            }

            i = 0;
            foreach (string scc in strHHeaderComments)
            {
                FileContent.WriteLine(scc);
            }
            #region write C file content to
            FileContent.WriteLine(string.Format("#include \"{0}\"", strHFileMiniName));
            FileContent.WriteLine(string.Format("\n"));
            FileContent.WriteLine(string.Format("/*****************************************************************************"));
            FileContent.WriteLine(string.Format("* OCV table"));
            FileContent.WriteLine(string.Format("* x_dat:\tcell mini-voltage"));
            FileContent.WriteLine(string.Format("* y_dat:\tresidual capacity in percentage format"));
            FileContent.WriteLine(string.Format("****************************************************************************/"));
            FileContent.WriteLine(string.Format("one_latitude_data_t fgm_ocv_data[FGM_OCV_NUM] = "));
            FileContent.WriteLine(string.Format("{{"));
            string       strCTmp    = "";
            List <float> ilstOCVSoC = TableMakerService.GetOCVSocPoints();
            for (i = 0; i < ilstOCVVolt.Count; i++)
            {
                strCTmp = string.Format("\t{{{0}, \t{1}", ilstOCVVolt[i], Math.Round(ilstOCVSoC[i], 0)) + "},";
                if ((i > 2) && (i % 10 == 9))
                {
                    FileContent.WriteLine(strCTmp);
                }
                else
                {
                    FileContent.Write(strCTmp);
                }
            }
            //strCTmp = strCFileContents[iLineOCVCont];
            //strCTmp = strCTmp.Substring(strCTmp.IndexOf('{')+1);
            //strCTmp = strCTmp.Substring(0, strCTmp.IndexOf(';')-1);
            //string[] strOCVCont = strCTmp.Split(chSeperate, StringSplitOptions.None);
            //i = 1;
            //foreach(string strPo in strOCVCont)
            //{
            //    if ((i > 2) && (i % 20 == 0))
            //    {
            //        FileContent.WriteLine(string.Format("{0}, ", strPo));
            //    }
            //    else
            //    {
            //        FileContent.Write(string.Format("{0}, ", strPo));
            //    }
            //    i += 1;
            //}
            FileContent.Write(string.Format("\n"));
            FileContent.WriteLine(string.Format("}};"));
            //write sample cell_temp_data
            FileContent.WriteLine(string.Format("/*****************************************************************************"));
            FileContent.WriteLine(string.Format("* Cell temperature table"));
            FileContent.WriteLine(string.Format("* x_dat:	cell mini-voltage"));
            FileContent.WriteLine(string.Format("* y_dat:	temperature in 0.1degC format"));
            FileContent.WriteLine(string.Format("****************************************************************************/"));
            FileContent.WriteLine(string.Format("one_latitude_data_t fgm_cell_temp_data[FGM_TEMPERATURE_NUM] = "));
            FileContent.WriteLine(string.Format("{{"));
            for (i = 0; i < ilstCellTempData.Count; i++)
            {
                strCTmp = string.Format("\t{{{0}, \t{1}", ilstCellTempData[i], ilstCellTempData[++i]) + "},";
                if ((i > 2) && (i % 10 == 9))
                {
                    FileContent.WriteLine(strCTmp);
                }
                else
                {
                    FileContent.Write(strCTmp);
                }
            }
            FileContent.Write(string.Format("\n"));
            FileContent.WriteLine(string.Format("}};"));
            FileContent.WriteLine(string.Format("\n"));
            FileContent.WriteLine(string.Format("/*****************************************************************************"));
            FileContent.WriteLine(string.Format("* TR table"));
            FileContent.WriteLine(string.Format("* tr data: tr function coefficient table"));
            FileContent.WriteLine(string.Format("*\t\t\tfunc_1: facc estimation"));
            FileContent.WriteLine(string.Format("*\t\t\tfunc_2: mid-ir estimation"));
            FileContent.WriteLine(string.Format("****************************************************************************/"));
            FileContent.WriteLine(string.Format("cof_func_data_t fgm_tr_data[FGM_TR_NUM]={{"));
            //for (int ic = 0; ic < dbTmp2; ic++)
            //{
            //    FileContent.WriteLine(string.Format("\t{{{0},\t{1}", ilstTemp[ic], ilstOutIR[ic]) + "},");
            //}
            FileContent.Write(string.Format("\t{{"));
            for (int ic = poly2EstFACC.Count - 1; ic >= 0; ic--)
            {
                if (ic == 0)
                {
                    FileContent.WriteLine(string.Format("{0}}},", Convert.ToInt32(poly2EstFACC[ic])));
                }
                else
                {
                    FileContent.Write(string.Format("{0},\t\t", Convert.ToInt32(poly2EstFACC[ic] * iEnlargeIR)));
                }
            }
            FileContent.Write(string.Format("\t{{"));
            for (int ic = poly2EstIR.Count - 1; ic >= 0; ic--)
            {
                if (ic == 0)
                {
                    FileContent.WriteLine(string.Format("{0}}},", Convert.ToInt32(poly2EstIR[ic])));
                }
                else
                {
                    FileContent.Write(string.Format("{0},\t\t", Convert.ToInt32(poly2EstIR[ic] * iEnlargeIR)));
                }
            }
            FileContent.WriteLine(string.Format("}};"));
            #endregion

            FileContent.Close();
            fswrite.Close();
            #endregion

            #endregion
        }
        private static List <string> GetCFileContent(string strCFileStandardName, string strHFileStandardName, List <string> strHHeaderComments, List <int> ilstOCVVolt, List <int> voltList, List <float> listfTemp, List <float> listfCurr, List <List <int> > outYValue, double fCTABase, double fCTASlope)
        {
            string        line           = "";
            List <string> output         = new List <string>();
            int           i              = 0;
            int           iLineCmtHCFile = 4;
            string        strCTmp        = "";

            foreach (string scc in strHHeaderComments)
            {
                if (i == iLineCmtHCFile)
                {
                    output.Add(scc + strCFileStandardName);
                }
                else
                {
                    output.Add(scc);
                }
                i++;
            }
            output.Add("#include <linux/kernel.h>");
            output.Add("#include \"table.h\" ");
            output.Add("");
            output.Add(string.Format("/*****************************************************************************"));
            output.Add(string.Format("* Global variables section - Exported"));
            output.Add(string.Format("* add declaration of global variables that will be exported here"));
            output.Add(string.Format("* e.g."));
            output.Add(string.Format("*	int8_t foo;"));
            output.Add(string.Format("****************************************************************************/"));

            output.Add(string.Format("const char* table_version = \"xxxx\";"));
            output.Add("");
            output.Add(string.Format("const char * battery_id[BATTERY_ID_NUM] = {{ \"XXXX\", \"YYYY\" }};")); //line 9
            output.Add($"//const int32_t fCTABase = {fCTABase};");                                            //line 10
            output.Add($"//const int32_t fCTASlope = {fCTASlope};");                                          //line 11
            //write ocv_data
            output.Add("");
            line  = (string.Format("one_latitude_data_t ocv_data[OCV_DATA_NUM] = "));
            line += (string.Format("{{"));


            var ilstOCVSoC = TableMakerService.GetOCVSocPoints();

            for (i = 0; i < ilstOCVVolt.Count; i++)
            {
                if (i == ilstOCVVolt.Count - 1)
                {
                    strCTmp = string.Format("{{{0}, {1}", ilstOCVVolt[i], Math.Round(ilstOCVSoC[i] / 100, 0)) + "}";
                }
                else
                {
                    strCTmp = string.Format("{{{0}, {1}", ilstOCVVolt[i], Math.Round(ilstOCVSoC[i] / 100, 0)) + "},";
                }
                line += (strCTmp);
            }
            line += "};";
            output.Add(line);
            line = "";
            output.Add("");
            //write sample cell_temp_data
            output.Add("//real current to soc ");
            output.Add("//one_latitude_data_t	charge_data[CHARGE_DATA_NUM] = { };");
            output.Add("");

            //RC table X Axis value, in mV format
            //2550, 2595, 2632, 2680, 2711, 2771, 2816, 2859, 2916, 2941, 2967, 2990, 3005, 3029, 3052, 3063, 3084, 3105, 3130, 3158, 3193, 3228, 3256, 3285, 3308, 3340, 3360, 3392, 3413, 3446, 3474, 3502, 3525, 3559, 3581, 3613, 3633, 3658, 3675, 3705, 3730, 3758, 3793, 3828, 3856, 3885, 3908, 3940, 3960, 3992, 4013, 4046, 4074, 4102, 4125, 4159, 4181, 4194, 4200};
            output.Add(string.Format("//RC table X Axis value, in mV format"));
            line = (string.Format("int32_t\tXAxisElement[XAxis] = {{"));
            for (i = 0; i < voltList.Count; i++)
            {
                if ((i == voltList.Count - 1))
                {
                    strCTmp = string.Format("{0}", voltList[i]);
                }
                else
                {
                    strCTmp = string.Format("{0}, ", voltList[i]);
                }
                line += (strCTmp);
            }
            line += "};";
            output.Add(line);
            output.Add(string.Empty);
            //RC table Y Axis value, in mA format
            //1000, 3000, 6000, 10000, 15000, 20000, 25000};
            output.Add(string.Format("//RC table Y Axis value, in mA format"));
            line = (string.Format("int32_t\tYAxisElement[YAxis] = {{"));
            for (i = 0; i < listfCurr.Count; i++)
            {
                if ((i == listfCurr.Count - 1))
                {
                    strCTmp = string.Format("{0}", listfCurr[i] * -1);
                }
                else
                {
                    strCTmp = string.Format("{0}, ", listfCurr[i] * -1);
                }
                line += (strCTmp);
            }
            line += "};";
            output.Add(line);
            output.Add(string.Empty);
            // RC table Z Axis value, in 10*'C format
            //-49, 100, 200, 300, 400, 500};
            output.Add(string.Format("//RC table Z Axis value, in 10*'C format"));
            line = (string.Format("int32_t\tZAxisElement[ZAxis] = {{"));
            for (i = 0; i < listfTemp.Count; i++)
            {
                if ((i == listfTemp.Count - 1))
                {
                    strCTmp = string.Format("{0}", (Convert.ToInt16(listfTemp[i])) * 10);
                }
                else
                {
                    strCTmp = string.Format("{0}, ", (Convert.ToInt16(listfTemp[i])) * 10);
                }
                line += (strCTmp);
            }
            line += "};";
            output.Add(line);
            output.Add(string.Empty);
            // contents of RC table, its unit is 10000C, 1C = DesignCapacity
            //const int	RCtable[YAxis*ZAxis][XAxis]={
            output.Add(string.Format("// contents of RC table, its unit is 10000C, 1C = DesignCapacity"));
            output.Add(string.Format("int32_t\tRCtable[YAxis*ZAxis][XAxis]={{"));
            for (i = 0; i < listfTemp.Count; i++)
            {
                output.Add(string.Format("\n//temp = {0} ^C", listfTemp[i]));
                for (int ic = 0; ic < listfCurr.Count; ic++)
                {
                    line = (string.Format("{{"));
                    for (int iv = 0; iv < voltList.Count; iv++)
                    {
                        if (iv == voltList.Count - 1)
                        {
                            strCTmp = string.Format("{0}", outYValue[i * listfCurr.Count + ic][iv]);
                        }
                        else
                        {
                            strCTmp = string.Format("{0}, ", outYValue[i * listfCurr.Count + ic][iv]);
                        }
                        line += (strCTmp);
                    }
                    line += "},";
                    output.Add(line);
                }
            }
            output.Add(string.Format("}};"));
            return(output);
        }