Exemplo n.º 1
0
        public void BDReadСобытие(ClassZapicBD100 classZapicBD100, bool bad, bool test)
        {
            if (FlagSaveBD)
            {
                if (wayDataBD.Split('.')[1] == "db" || wayDataBD.Split('.')[1] == "db3")
                {
                    if (!test)
                    {
                        DataAccesBDData.Path = wayDataBD;
                        int x = 0;
                        if (bad)
                        {
                            x = 1;
                        }
                        int[] nll = new int[12];
                        for (int i = 0; i < 12; i++)
                        {
                            nll[i] = Convert.ToInt32(classZapicBD100.Nl[i]);
                        }

                        DataAccesBDData.AddDataTablSob100(classZapicBD100.nameRanBD, classZapicBD100.nameFileBD, classZapicBD100.nameBAAKBD, classZapicBD100.timeBD, classZapicBD100.Amp, classZapicBD100.nameklasterBD, classZapicBD100.Amp, classZapicBD100.TmaxACh,
                                                          classZapicBD100.TfACh, classZapicBD100.TeACh, classZapicBD100.TpmA, classZapicBD100.TA14Ch, classZapicBD100.TA34Ch, classZapicBD100.QCh, classZapicBD100.SBCh, classZapicBD100.SCh, classZapicBD100.Nl, classZapicBD100.sig, x);
                    }
                }
                else
                {
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// записываем данных о событии из очереди в в бд
        /// </summary>
        public override void WriteInFileIzOcherediBD()
        {
            ClassZapicBD100 BDData = new ClassZapicBD100();

            try
            {
                OcherediNaZapicBD.TryDequeue(out BDData);
                if (BDData != null)
                {
                    //TODO (string nameFile, string nameBAAK, string time, string nameRan, int Amp, string nameklaster, int Nl, Double sig, int nD, int TimeFirst, int TimeAmp)
                    BDReadСобытие(BDData, false, false); //пишем в бд


                    КолПакетовОчер2++;
                }
            }
            catch (InvalidOperationException)
            {
            }
            catch (NullReferenceException ee)
            {
                Debug.WriteLine("Error 590");
            }
            catch (Exception e)
            {
                CтатусБААК12 = "Ошибка. Отключена " + e;
                InDe(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// записываем данные из очереди в файл и в бд
        /// </summary>
        public override void WriteInFileIzOcheredi()//работа с данными из очереди
        {
            try
            {
                bool?ed = OcherediNaZapic.TryDequeue(out dataYu);
                if (ed == true)
                {
                    if (dataYu.ListData != null)
                    {
                        byte[] d = new byte[dataYu.ListData.Count];
                        int    x = 0;
                        foreach (Byte b in dataYu.ListData)
                        {
                            d[x] = b;
                            x++;
                        }
                        if (data_w != null)
                        {
                            data_w.Write(d);
                        }


                        Double[]        sigm            = new double[12];
                        ClassZapicBD100 classZapicBD100 = new ClassZapicBD100();
                        Obrabotka(dataYu.ListData, out int[] Ampl, out double[] NL, (int)DataLenght, out int dN, out bool neutron, ref classZapicBD100);  //парсинг данных

                        // if (neu)
                        {
                            OcherediNaZapicBD.Enqueue(classZapicBD100);
                        }

                        КолПакетовОчер++;
                        // DataBAAKList1 = null;
                        d = null;
                    }
                }
            }
            catch (InvalidOperationException)
            {
            }
            catch (NullReferenceException)
            {
            }
            catch (Exception e)
            {
                CтатусБААК12 = "Ошибка. Отключена " + e;
                InDe(false);
            }
        }
Exemplo n.º 4
0
        private void Obrabotka(List <Byte> buf00, out int[] Amp, out double[] Nul, int dl, out int dn, out bool neutron, ref ClassZapicBD100 classZapicBD100)
        {
            int[,] data = new int[12, 1024 * dl];

            Nul = new double[12];

            dn      = 0;
            neutron = false;
            bool bad = false;

            Amp = new int[12];

            int[] coutN1 = new int[12];
            int[] timeS  = new int[12];



            try
            {
                ParserBAAK12.ParseBinFileBAAK12.ParseBinFileBAAK200(buf00.ToArray(), dl, out data, out classZapicBD100.timeBD);
                if (grafOtob)
                {
                    //  Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
                    //  {
                    Application.Current.Dispatcher.Invoke((Action) delegate { MyGrafic.AddPointRaz(data, "Кластер" + namKl, masnul); });
                    //  }));
                }
                if (windowChart != null)
                {
                    // Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
                    // {
                    Application.Current.Dispatcher.Invoke((Action) delegate
                    {
                        windowChart.AddPointRaz(data);
                    });
                    //  }));
                }
                // To Do
                ParserBAAK12.ParseBinFileBAAK12.MaxAmpAndNul(data, ref classZapicBD100.sig, ref Amp, ref Nul, ref bad, false, 0.6, 5);

                ObrabotcaURAN.Obrabotca.AmpAndTime(data, Nul, out classZapicBD100.TmaxACh, out classZapicBD100.Amp);



                classZapicBD100.TfACh = ObrabotcaURAN.Obrabotca.FirstTme(classZapicBD100.TmaxACh, classZapicBD100.Amp, data, Nul, ref classZapicBD100.TpmA, out classZapicBD100.TA34Ch, out classZapicBD100.TA14Ch);



                classZapicBD100.SCh  = ObrabotcaURAN.Obrabotca.ColSigVatias(data, Nul);
                classZapicBD100.SBCh = ObrabotcaURAN.Obrabotca.ColBin(data, Nul);

                for (int i = 0; i < 12; i++)
                {
                    int x = 0;
                    for (int j = 350; j < 1024; j++)
                    {
                        // Debug.WriteLine(data1[i, j].ToString());
                        //Debug.WriteLine(data1[i, j].ToString() +"-"+ Nul[i].ToString());
                        // data1S[i, j] = Convert.ToDouble(data1[i, j]) - Nul[i];
                        int AN = data[i, j] - Convert.ToInt32(Nul[i]);
                        if (AN > 5)
                        {
                            classZapicBD100.SumD[i] += AN;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }