public static void GetRCModel(List <SourceData> SDList, Project project, ref RCModel rcModel) { RCModel output = rcModel; output.SourceList = SDList; Int32 iMinVoltage; Int32 iMaxVoltage; TableMakerService.GetVoltageBondary(SDList, out iMinVoltage, out iMaxVoltage); output.MinVoltage = iMinVoltage; output.MaxVoltage = iMaxVoltage; foreach (var sd in SDList) { if (!output.listfTemp.Contains(sd.fTemperature)) //not exist in list add it { output.listfTemp.Add(sd.fTemperature); } if (!output.listfCurr.Contains(sd.fCurrent)) //not exis in list add it { output.listfCurr.Add(sd.fCurrent); } } UInt32 uErr = 0; CreateRCPoints_TableMini(ref uErr, ref output, SDList, project); }
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); }