Exemplo n.º 1
0
        //Flags up warning if count rate difference between PMTs varies by more than half of average
        private void PMTCompare()
        {
            Console.WriteLine("PMT Compare");
            int PMT1Check = 0;
            int PMT2Check = 0;

            //Sums first 500 values for each PMT from DataBuffer
            for (int i = 0; i < 1000; i++)
            {
                if (i % 2 == 0)
                {
                    PMT1Check += DataBuffer[i];
                }
                if (i % 2 == 1)
                {
                    PMT2Check += DataBuffer[i];
                }
            }

            double FracDiff = Math.Abs(PMT1Check - PMT2Check) / ((PMT1Check + PMT2Check) / 2);

            if (FracDiff >= 0.5)
            {
                Console.WriteLine("PMT ERROR!!!");
                Pause = true;

                //Brings up pop up warning if PMTs vary by more than specified fraction
                PopUpWarning popup = new PopUpWarning();
                DialogResult dialogresult = popup.ShowDialog();
                if (dialogresult == DialogResult.OK)
                {
                    if (popup.IsChecked() == true)
                    {
                        StopWarningPMT = true;
                    }
                    else
                    {
                        StopWarningPMT = false;
                    }
                    Console.WriteLine("OK");
                    Pause = false;
                }
                popup.Dispose();
            }
            FPGA.EmptyBuffer(); //Clears huge number of bytes that will have built up in UART buffer
        }
Exemplo n.º 2
0
        private void PMTCompare()
        {
            int PMT1Check = 0;
            int PMT2Check = 0;
            for (int i = 0; i < 1000; i++)
            {

                if (i % 2 == 0)
                {
                    PMT1Check += DataBuffer[i];
                }
                if (i % 2 == 1)
                {
                    PMT2Check += DataBuffer[i];
                }
            }
            double FracDiff = Math.Abs(PMT1Check - PMT2Check) / ((PMT1Check + PMT2Check) / 2);
            // Current level of PMT difference set to 50% before triggereing warning
            if (FracDiff >= 0.5)
            {
                Console.WriteLine("PMT ERROR!!!");
                Pause = true;
                PopUpWarning popup = new PopUpWarning();

                DialogResult dialogresult = popup.ShowDialog();
                if (dialogresult == DialogResult.OK)
                {
                    if (popup.IsChecked() == true)
                    {
                        StopWarningPMT = true;
                    }
                    else
                    {
                        StopWarningPMT = false;
                    }
                    Console.WriteLine("OK");
                    Pause = false;
                }
                popup.Dispose();
            }
            FPGA.EmptyBuffer();
        }