private void CalcKartaEvcc() { sdsKartaEvcc = new double[4]; var thread = new Thread(() => { for (int i = 0; i < 4; i++) { double d = i * 0.25 + 1.25; string dirPath = Path.Combine(Global.GetPathBaseDir(_baseParams), "Generation-D" + d); KartaEvcc kartaEvcc = new KartaEvcc(_baseParams); kartaEvcc.DirPath = dirPath; kartaEvcc.CalcUclLcl(); sdsKartaEvcc[i] = kartaEvcc.ArrEt.GetLength(0); for (int t = 0; t < kartaEvcc.ArrEt.GetLength(0); t++) { if (kartaEvcc.ArrEt[t] > kartaEvcc.Ucl[t] || kartaEvcc.ArrEt[t] < kartaEvcc.Lcl[t]) { sdsKartaEvcc[i] = t; break; } } } if (ChangePerc != null) { ChangePerc(0); } if (ChangeText != null) { ChangeText("Расчет ЭВСС завершен"); } }); thread.Start(); }
public void CalcUclLcl() { CalcParams(); var hAvTmp = 0.0; for (int i = 0; i < _lstFiles.Count; i++) { var kartaEvccCur = new KartaEvcc(new BaseParams(_lstFiles[i])); var maxEt = 0.0; var minEt = 0.0; var hCurMax = 0.0; var hCurMin = 0.0; for (var t = 0; t < _baseParams.CntViborka; t++) { if (maxEt < kartaEvccCur.ArrEt[t]) { maxEt = kartaEvccCur.ArrEt[t]; } if (minEt > kartaEvccCur.ArrEt[t] && kartaEvccCur.ArrEt[t] >= 0.0) { minEt = kartaEvccCur.ArrEt[t]; } // ReSharper disable once CompareOfFloatsByEqualityOperator if (minEt == 0.0) { minEt = kartaEvccCur.ArrEt[t]; } hCurMax = (maxEt - new KartaObDisp(new BaseParams(_lstFiles[i])).DetArrS) / SigmaEt[t]; hCurMin = (-minEt + new KartaObDisp(new BaseParams(_lstFiles[i])).DetArrS) / SigmaEt[t]; } if (ChangePerc != null) { ChangePerc(Convert.ToInt32(i * 100.0 / _lstFiles.Count)); } hAvTmp += hCurMax + hCurMin; } hAvTmp /= _lstFiles.Count * _baseParams.CntViborka; HAv = hAvTmp; Ucl = new double[_baseParams.CntViborka]; Lcl = new double[_baseParams.CntViborka]; // ReSharper disable once CompareOfFloatsByEqualityOperator if (_hAvUser != 0.0) { for (var t = 0; t < _baseParams.CntViborka; t++) { Ucl[t] = _kartaObDisp.DetArrS + _hAvUser * SigmaEt[t]; Lcl[t] = _kartaObDisp.DetArrS - _hAvUser * SigmaEt[t]; } } else { for (var t = 0; t < _baseParams.CntViborka; t++) { Ucl[t] = _kartaObDisp.DetArrS + HAv * SigmaEt[t]; Lcl[t] = _kartaObDisp.DetArrS - HAv * SigmaEt[t]; } } if (ChangePerc != null) { ChangePerc(0); } if (ChangeText != null) { ChangeText("Обсчет карты прошел успешно"); } }