Beispiel #1
0
        private void optimToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var fKM = new FormKalmanParms();

            if (fKM.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var    iBeg  = fKM.dBeg;
            var    iFin  = fKM.dFin;
            var    iStep = fKM.dStep;
            var    iNums = (int)((iFin - iBeg) / iStep) + 1;
            var    M1X   = new double[iNums];
            var    SD1X  = new double[iNums];
            var    i     = 0;
            string sLog;

            sLog = "X: " + listSourcePC[0].NumFrame.ToString() + "-" +
                   listSourcePC[listSourcePC.Count - 1].NumFrame.ToString();
            LogFile.WriteLog(sLog);
            sLog = "Predict()";
            LogFile.WriteLog(sLog);
            int MMax;

            for (var jc = iBeg; jc < iFin; jc += iStep)
            {
                var KallFilX = new Kalc3Dim("X", true);
                //KallFilX.SetInitParmsQ(jc);
                //KallFilX.SetInitParmsR(jc);
                KallFilX.SetInitParmsQ(jc);
                //private PointsCoordSet CalcKalmanOpt(PointsCoordSet list, string strName,Kalc3Dim KallFil, bool iIsPredict, bool bNoA)
                var listKalmanTemp = CalcKalmanOpt(listSourcePC, sLog, KallFilX, true, false, true);
                //                PointsCoordSet listKalmanTemp = CalcKalmanOpt(listSourcePC, sLog, KallFilX, false, false);
                var iE1X = CalcCompareParams(listMarkedPC, listKalmanTemp, true, out M1X[i], out SD1X[i], out MMax);
                sLog = "Q[i,i] =" + jc.ToString() + " MX = " + M1X[i].ToString() + " SDX = " + SD1X[i].ToString() +
                       " Max=" + MMax.ToString();
                /*sLog = "Q[i,i] =" + jc.ToString() + " MX = " + M1X[i].ToString() + " SDX = " + SD1X[i].ToString();*/
                //sLog = "" + jc.ToString() + " " + M1X[i].ToString() + " " + SD1X[i].ToString();
                //sLog = "" + SD1X[i.ToString();
                i++;
                LogFile.WriteLog(sLog);
            }
        }
Beispiel #2
0
        private int FindOptim(bool bIsX)
        {
            var fKM = new FormKalmanParms();

            if (fKM.ShowDialog() != DialogResult.OK)
            {
                return(-1);
            }
            var    iBeg    = fKM.dBeg;
            var    iFin    = fKM.dFin;
            var    iStep   = fKM.dStep;
            var    iNums   = (int)((iFin - iBeg) / iStep) + 1;
            double M1Min   = 10000;
            double SD1Min  = 10000;
            var    NMaxMin = 10000;
            var    iOpt    = 0;
            var    i       = 0;
            var    sLog    = "Predict()";

            LogFile.WriteLog(sLog);
            double M1;
            double SD1;
            int    NMax;

            //List <int> lInt = new List<int>();
            for (var jc = iBeg; jc < iFin; jc += iStep)
            {
                Kalc3Dim KallFil;
                if (bIsX == true)
                {
                    KallFil = new Kalc3Dim("X", true);
                }
                else
                {
                    KallFil = new Kalc3Dim("Y", false);
                }
                //KallFilX.SetInitParmsQ(jc);
                //KallFilX.SetInitParmsR(jc);
                KallFil.SetInitParmsQ(jc);
                //private PointsCoordSet CalcKalmanOpt(PointsCoordSet list, string strName,Kalc3Dim KallFil, bool iIsPredict, bool bNoA)
                var listKalmanTemp = CalcKalmanOpt(listSourcePC, sLog, KallFil, true, false, bIsX);
//                PointsCoordSet listKalmanTemp = CalcKalmanOpt(listSourcePC, sLog, KallFilX, false, false);
                var iE1 = CalcCompareParams(listMarkedPC, listKalmanTemp, true, out M1, out SD1, out NMax);
                i++;
                if (NMax > NMaxMin)
                {
                    continue;
                }
                if (NMax == NMaxMin)
                {
                    if (M1 > M1Min)
                    {
                        continue;
                    }
                    if (M1 == M1Min)
                    {
                        if (SD1 >= SD1Min)
                        {
                            continue;
                        }
                    }
                    iOpt = i - 1;
                }

                //string sLog1 = "Q[i,i] =" + jc.ToString() + " MX = " + M1X[i].ToString() + " SDX = " + SD1X[i].ToString() + " Max=" + MMax.ToString();
                //LogFile.WriteLog(sLog1);
            }
            return(iOpt);
        }