コード例 #1
0
        private void startThread()
        {
            inicializujPristroje();
            currentCycleNum = 1;
            CurrentMeasurement = new Meranie(Parameters);

            if (Parameters.Typ.Equals("Mass Scan"))
            {
                massScan();
            }
            else
            {

                while (Parameters.NumberOfCycles == 0 || currentCycleNum <= Parameters.NumberOfCycles)
                {
                    if (currentCycleNum != 1) { Graf.prepareNextCycle(); }
                    aktualnyCyklus = new CyklusMerania(currentCycleNum); //vytvori datovu strukturu CyklusMerania
                    merajAktualnyCyklus(); //zacne meranie aktualneho cyklu

                    CurrentMeasurement.cykly.Add(aktualnyCyklus);  //lokalna struktura
                    if (mainForm.stopAfterCycleChecked) break;  //stlacil user checkbox zastavit???
                    currentCycleNum++;
                }
                //skoncili sa cykly, alebo user nastavil ze sa ma skoncit po ukonceni cyklu
                if (!Parameters.TestRun)
                {
                    db.open();
                    db.addMeranie(CurrentMeasurement);
                    db.close();
                }
                stop();
            }

            //skoncili sme meranie, vypiseme nejaku haluz, povolime spustenie noveho merania atd...
        }
コード例 #2
0
ファイル: Load.cs プロジェクト: TISOrg/Meracia_aparatura
        public static Meranie loadMeranie(int headerId)
        {
            DbCommunication d=new DbCommunication();
            DataRow header=d.header(headerId).Tables[0].Rows[0];

            MeasurementParameters parametre =
                new MeasurementParameters(
                    header["name"].ToString(),
                    header["ion_type"].ToString().Equals("true"),
                    header["note"].ToString(),
                    (int)header["cycles"]);

            string x = "";
            string y = "";
            if (header["type_name"].Equals("Energy Scan"))
            {
                EnergyScanParameters pp=new EnergyScanParameters();

                pp.StartPoint= (double)header["start_point"];
                pp.EndPoint= (double)header["end_point"];
                pp.Constant= Convert.ToInt32(header["constant"]);

                pp.StepTime= (double)header["steptime"];
                pp.NumberOfSteps=(int)header["pocet_krokov"];

                parametre.EnergyScan=pp;
                parametre.Typ = "Energy Scan";
                x = "Electron energy";
                y = "m/z";
            }
            else if (header["type_name"].Equals("Mass Scan"))
            {
                MassScanParameters mp = new MassScanParameters();

                mp.StartPoint = (int)header["start_point"];
                mp.EndPoint = (int)header["end_point"];
                mp.Constant = (double)header["constant"];

                mp.TimePerAmu = (double)header["time_for_amu"];
                mp.Density = (double)header["density"];
                parametre.MassScan = mp;
                parametre.Typ = "Mass Scan";
                x = "m/z";
                y = "Electron energy";

            }
            else if (header["type_name"].Equals("2D Scan")){
                EnergyScanParameters ep = new EnergyScanParameters();

                ep.StartPoint = (double)header["e_start_point"];
                ep.EndPoint = (double)header["e_end_point"];
                ep.StepTime = (double)header["e_steptime"];
                ep.NumberOfSteps = (int)header["pocet_krokov"];
                parametre.EnergyScan = ep;

                MassScanParameters mp = new MassScanParameters();

                mp.StartPoint = (int)header["m_start_point"];
                mp.EndPoint = (int)header["m_end_point"];
                mp.TimePerAmu = (double)header["time_for_amu"];
                mp.Density = (double)header["density"];
                parametre.Typ = "2D Scan";
                parametre.MassScan = mp;
                x = "m/z";
                y = "Electron energy";
            }

            Meranie m=new Meranie(parametre);
            m.cykly = new List<CyklusMerania>();
            for (int c = 0; c < (int)header["cycles"]; c++)
            {
                CyklusMerania cyklus = new CyklusMerania(c);
                cyklus.KrokyMerania = new List<KrokMerania>();
                DataTable data=d.meranie(headerId,c).Tables[0];
                for (int i=0;i<data.Rows.Count ;i++ )
                {

                    KrokMerania krok = new KrokMerania();
                    krok.Intensity= (ulong)data.Rows[i]["Intensity"];
                    krok.Temperature = (double)data.Rows[i]["Temperature"];
                    krok.Chamber = (double)data.Rows[i]["Chamber pressure"];
                    krok.Capillar = (double)data.Rows[i]["Capillar pressure"];
                    krok.X = (double)data.Rows[i][x];
                    krok.Y = (double)data.Rows[i][y];

                    cyklus.KrokyMerania.Add(krok);
                }

                m.cykly.Add(cyklus);
            }

            return m;
        }
コード例 #3
0
 internal void addMeranie(Meranie meranie)
 {
     foreach(CyklusMerania c in meranie.cykly)
     {
         addCyklus(c);
     }
 }