Ejemplo n.º 1
0
 private void Init(Multiplicity src = null)
 {
     if (src != null)
     {
         FA = src.FA;
         backgroundGateTimeStepInTics = src.backgroundGateTimeStepInTics;
         accidentalsGateDelayInTics   = src.accidentalsGateDelayInTics;
         SR     = new ShiftRegisterParameters(src.SR);
         reason = string.Copy(src.reason);
         Rank   = src.Rank;
     }
     else
     {
         //10240 NOT a reasonable default value for FA analysis per Martyn. HN 6.24.2015
         if (FA == FAType.FAOn)
         {
             backgroundGateTimeStepInTics = 10;
             accidentalsGateDelayInTics   = 10; // 1Mhz
         }
         else
         {
             backgroundGateTimeStepInTics = 40960; //Not used for slow? HN
             accidentalsGateDelayInTics   = 40960; // Per Daniela
         }
         SR = new ShiftRegisterParameters();
     }
 }
Ejemplo n.º 2
0
 private void Init(Multiplicity src = null)
 {
     if (src != null)
     {
         FA = src.FA;
         backgroundGateTimeStepInTics = src.backgroundGateTimeStepInTics;
         accidentalsGateDelayInTics   = src.accidentalsGateDelayInTics;
         SR     = new ShiftRegisterParameters(src.SR);
         reason = string.Copy(src.reason);
     }
     else
     {
         //10240 NOT a reasonable default value for FA analysis per Martyn. HN 6.24.2015
         if (FA == FAType.FAOn)
         {
             backgroundGateTimeStepInTics = 2;
             accidentalsGateDelayInTics   = 2;
         }
         else
         {
             backgroundGateTimeStepInTics = 10240;
             accidentalsGateDelayInTics   = 10240; // 10240 matches some traditional HW, larger values produce more accurate results, but slow down the processing
         }
         SR = new ShiftRegisterParameters();
     }
 }
Ejemplo n.º 3
0
 public Coincidence()
     : base()
 {
     backgroundGateTimeStepInTics = 40960;
     accidentalsGateDelayInTics   = 40960; // what are good defaults here? same as SR?
     gateWidthTics = 240;
     _sr           = new ShiftRegisterParameters();
 }
Ejemplo n.º 4
0
 public INCCSR(ShiftRegisterParameters sr, DataSourceIdentifier id, AcquireParameters acq, TestParameters test, LMLoggers.LognLM log)
 {
     sr_parms = new ShiftRegisterParameters(sr);
     dsid = new DataSourceIdentifier(id);
     dsid.SerialPort -= 1; // serial ports are 0 based at the HW layer 
     acquire_parms = new AcquireParameters(acq);
     test_parms = new TestParameters(test);
     this.log = log;
 }
Ejemplo n.º 5
0
 public INCCSR(ShiftRegisterParameters sr, DataSourceIdentifier id, AcquireParameters acq, TestParameters test, LMLoggers.LognLM log)
 {
     sr_parms         = new ShiftRegisterParameters(sr);
     dsid             = new DataSourceIdentifier(id);
     dsid.SerialPort -= 1; // serial ports are 0 based at the HW layer
     acquire_parms    = new AcquireParameters(acq);
     test_parms       = new TestParameters(test);
     this.log         = log;
 }
Ejemplo n.º 6
0
 public MeasSetup()
 {
     InitializeComponent();
     Detector d = (Detector)detectors.SelectedItem;
     if (d == null)
         sr = new ShiftRegisterParameters();
     else
         sr = new ShiftRegisterParameters(d.SRParams);
 }
Ejemplo n.º 7
0
 public MeasSetup()
 {
     InitializeComponent();
     Detector d = (Detector)detectors.SelectedItem;
     if (d == null)
         sr = new ShiftRegisterParameters();
     else
         sr = new ShiftRegisterParameters(d.SRParams);
     WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
 }
Ejemplo n.º 8
0
 public void CopyValues(Multiplicity mul)
 {
     if (mul == null)
     {
         return;
     }
     FA = mul.FA;
     backgroundGateTimeStepInTics = mul.backgroundGateTimeStepInTics;
     accidentalsGateDelayInTics   = mul.accidentalsGateDelayInTics;
     SR     = new ShiftRegisterParameters(mul.SR);
     reason = string.Copy(mul.reason);
 }
Ejemplo n.º 9
0
        public MeasSetup()
        {
            InitializeComponent();
            Detector d = (Detector)detectors.SelectedItem;

            if (d == null)
            {
                sr = new ShiftRegisterParameters();
            }
            else
            {
                sr = new ShiftRegisterParameters(d.SRParams);
            }
        }
Ejemplo n.º 10
0
        public MeasSetup()
        {
            InitializeComponent();
            Detector d = (Detector)detectors.SelectedItem;

            if (d == null)
            {
                sr = new ShiftRegisterParameters();
            }
            else
            {
                sr = new ShiftRegisterParameters(d.SRParams);
            }
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
        }
Ejemplo n.º 11
0
 public bool EqualsButForLMValues(ShiftRegisterParameters other)
 {
     if (other != null &&
         SR.dieAwayTime.Equals(other.dieAwayTime) &&
         SR.efficiency.Equals(other.efficiency) &&
         SR.doublesGateFraction.Equals(other.doublesGateFraction) &&
         SR.triplesGateFraction.Equals(other.triplesGateFraction) &&
         SR.deadTimeCoefficientTinNanoSecs.Equals(other.deadTimeCoefficientTinNanoSecs) &&
         SR.deadTimeCoefficientAinMicroSecs.Equals(other.deadTimeCoefficientAinMicroSecs) &&
         SR.deadTimeCoefficientBinPicoSecs.Equals(other.deadTimeCoefficientBinPicoSecs) &&
         SR.deadTimeCoefficientCinNanoSecs.Equals(other.deadTimeCoefficientCinNanoSecs) &&
         SR.highVoltage.Equals(other.highVoltage))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 12
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            // check for modifications to detector and srparams, do the copy back to the real det.
            bool mod = false;
            

            if (det.Id.SRType < InstrType.NPOD)
            {
                string c = (String)(ShiftRegisterSerialPortComboBox.SelectedItem);
				//"COM PORT nnn (some text)"
                // HA, I crashed this.  I disconnected the JSR-15 with INCC6 running, so COM3 went away and this was fubar
                // need to check for existence. Do we need to do something to check at startup also? hn 5.7.2015
                if (!String.IsNullOrEmpty(c))
                {
                    string[] s = c.Split();
                    if (s.Length > 2)
                    {
                        Int32 p = 0;
                        Int32.TryParse(s[2], out p);
                        if (p != det.Id.SerialPort)
                        {
                            det.Id.SerialPort = p;
                            mod = true;
                        }
                    }
                }
            }


            if (det.Id.SRType.isVirtualAMSR())
            {
                string c = (String)(BaudCombo.SelectedItem);
                Int32 p = 0;
                Int32.TryParse(c, out p);
                if (p != det.Id.BaudRate)
                {
                    det.Id.BaudRate = p;
                    mod = true;
                }
            }


            //Was not storing all predelays and gate lengths because of order op to get a ulong hn 5.7.2015
            double pd = PredelayTextBox.Value * 10;
            double gl = GateLengthTextBox.Value * 10;
            ShiftRegisterParameters sr1 = new ShiftRegisterParameters((ulong)pd,(ulong)gl,HighVoltageTextBox.Value,DieAwayTimeTextBox.Value*10,
                EfficiencyTextBox.Value,DoublesGateFractionTextBox.Value,TriplesGateFractionTextBox.Value, 
                DeadtimeCoefficientATextBox.Value,DeadtimeCoefficientBTextBox.Value, DeadtimeCoefficientCTextBox.Value,MultiplicityDeadtimeTextBox.Value);
            bool modified = sr1.CompareTo(det.SRParams) != 0;

            if (m_bgateTriggerTypeChange)
            {
                AcquireParameters acq = Integ.GetCurrentAcquireParamsFor(det);
                acq.lm.FADefault = m_curGateTriggerType;
                NC.App.DB.UpdateAcquireParams(acq, isLM: true); // update it
            }
            if (det.Id.modified) // type changed only, so gotta save the change in the Detectors table, as well as the sr_parms table
            {
                if (modified || mod)  // also updates the params in one step  /* Update SR Params */                   
                    det.SRParams.CopyValues(sr1);
                NC.App.DB.UpdateDetector(det); // also updates the params in one step
                det.Id.modified = false;
                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else if (modified || mod)  // only SR params changed
            {
                DialogResult = System.Windows.Forms.DialogResult.OK;
                /* Update SR Params */
                det.SRParams.CopyValues(sr1);
                NC.App.DB.UpdateDetectorParams(det); // detector must exist in DB prior to this call
            }
            else
                DialogResult = System.Windows.Forms.DialogResult.Ignore;
            this.Close();
        }
Ejemplo n.º 13
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            // check for modifications to detector and srparams, do the copy back to the real det.
            bool mod = false;


            if (det.Id.SRType < InstrType.NPOD)
            {
                string c = (String)(ShiftRegisterSerialPortComboBox.SelectedItem);
                //"COM PORT nnn (some text)"
                // HA, I crashed this.  I disconnected the JSR-15 with INCC6 running, so COM3 went away and this was fubar
                // need to check for existence. Do we need to do something to check at startup also? hn 5.7.2015
                if (!String.IsNullOrEmpty(c))
                {
                    string[] s = c.Split();
                    if (s.Length > 2)
                    {
                        Int32 p = 0;
                        Int32.TryParse(s[2], out p);
                        if (p != det.Id.SerialPort)
                        {
                            det.Id.SerialPort = p;
                            mod = true;
                        }
                    }
                }
            }


            if (det.Id.SRType.isVirtualAMSR())
            {
                string c = (String)(BaudCombo.SelectedItem);
                Int32  p = 0;
                Int32.TryParse(c, out p);
                if (p != det.Id.BaudRate)
                {
                    det.Id.BaudRate = p;
                    mod             = true;
                }
            }


            //Was not storing all predelays and gate lengths because of order op to get a ulong hn 5.7.2015
            double pd = PredelayTextBox.Value * 10;
            double gl = GateLengthTextBox.Value * 10;
            ShiftRegisterParameters sr1 = new ShiftRegisterParameters((ulong)pd, (ulong)gl, HighVoltageTextBox.Value, DieAwayTimeTextBox.Value * 10,
                                                                      EfficiencyTextBox.Value, DoublesGateFractionTextBox.Value, TriplesGateFractionTextBox.Value,
                                                                      DeadtimeCoefficientATextBox.Value, DeadtimeCoefficientBTextBox.Value, DeadtimeCoefficientCTextBox.Value, MultiplicityDeadtimeTextBox.Value);
            bool modified = sr1.CompareTo(det.SRParams) != 0;

            if (m_bgateTriggerTypeChange)
            {
                AcquireParameters acq = Integ.GetCurrentAcquireParamsFor(det);
                acq.lm.FADefault = m_curGateTriggerType;
                NC.App.DB.UpdateAcquireParams(acq, isLM: true); // update it
            }
            if (det.Id.modified)                                // type changed only, so gotta save the change in the Detectors table, as well as the sr_parms table
            {
                if (modified || mod)                            // also updates the params in one step  /* Update SR Params */
                {
                    det.SRParams.CopyValues(sr1);
                }
                NC.App.DB.UpdateDetector(det); // also updates the params in one step
                det.Id.modified = false;
                DialogResult    = System.Windows.Forms.DialogResult.OK;
            }
            else if (modified || mod)  // only SR params changed
            {
                DialogResult = System.Windows.Forms.DialogResult.OK;
                /* Update SR Params */
                det.SRParams.CopyValues(sr1);
                NC.App.DB.UpdateDetectorParams(det); // detector must exist in DB prior to this call
            }
            else
            {
                DialogResult = System.Windows.Forms.DialogResult.Ignore;
            }
            this.Close();
        }
Ejemplo n.º 14
0
        private void detectors_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            Detector d = (Detector)detectors.SelectedItem;

            sr = new ShiftRegisterParameters(d.SRParams);
            int idx = -1, i = 0;

            foreach (object o in this.TypeCombo.Items)
            {
                if (o.ToString().CompareTo(d.Id.SRType.ToString()) == 0)
                {
                    idx = i;
                    break;
                }
                i++;
            }
            //int idx = this.TypeCombo.Items( d.Id.SRType.ToString());
            this.TypeCombo.SelectedIndex = idx;

            this.predelay.Text        = sr.predelayMS.ToString();
            this.dieaway.Text         = sr.dieAwayTimeMS.ToString();
            this.MDTA.Text            = sr.deadTimeCoefficientAinMicroSecs.ToString();
            this.MDTB.Text            = sr.deadTimeCoefficientBinPicoSecs.ToString();
            this.MDTC.Text            = sr.deadTimeCoefficientCinNanoSecs.ToString();
            this.mdeadtime.Text       = sr.deadTimeCoefficientMultiplicityinNanoSecs.ToString();
            this.DoublesGateFrac.Text = sr.doublesGateFraction.ToString();
            this.TriplesGateFrac.Text = sr.triplesGateFraction.ToString();
            this.efficiency.Text      = sr.efficiency.ToString();
            this.hv.Text         = sr.highVoltage.ToString();
            this.gatelength.Text = sr.gateLengthMS.ToString();
            if (d.Id.SRType < InstrType.NPOD)
            {
                COMvNetLabel.Content = "Serial Port";
                string cur = "COM" + d.Id.SerialPort.ToString();
                idx = -1; i = 0;
                string[] ports = System.IO.Ports.SerialPort.GetPortNames();
                CommComboBox.Items.Clear();
                foreach (string p in ports)
                {
                    CommComboBox.Items.Add(p);
                    if (p.CompareTo(cur) == 0)
                    {
                        idx = i;
                    }
                    i++;
                }
                if (idx >= 0)
                {
                    CommComboBox.SelectedIndex = idx;
                }
                else
                {
                    CommComboBox.Items.Add(cur);
                    CommComboBox.SelectedIndex = 0;
                }
            }
            else if (d.Id.SRType < InstrType.MCNPX)
            {
                COMvNetLabel.Content = "TCP/IP Addr";
            }
            else
            {
                COMvNetLabel.Content = "Whah?";
            }
        }
Ejemplo n.º 15
0
        private void detectors_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            Detector d = (Detector)detectors.SelectedItem;
            sr = new ShiftRegisterParameters(d.SRParams);
            int idx = -1, i = 0;
            foreach (object o in this.TypeCombo.Items)
            {
                if (o.ToString().CompareTo( d.Id.SRType.ToString()) == 0)
                {
                    idx = i;
                    break;
                }
                i++;
            }
            //int idx = this.TypeCombo.Items( d.Id.SRType.ToString());
            this.TypeCombo.SelectedIndex = idx;

            this.predelay.Text = sr.predelayMS.ToString();
            this.dieaway.Text = sr.dieAwayTimeMS.ToString();
            this.MDTA.Text = sr.deadTimeCoefficientAinMicroSecs.ToString();
            this.MDTB.Text = sr.deadTimeCoefficientBinPicoSecs.ToString();
            this.MDTC.Text = sr.deadTimeCoefficientCinNanoSecs.ToString();
            this.mdeadtime.Text = sr.deadTimeCoefficientMultiplicityinNanoSecs.ToString();
            this.DoublesGateFrac.Text = sr.doublesGateFraction.ToString();
            this.TriplesGateFrac.Text = sr.triplesGateFraction.ToString();
            this.efficiency.Text = sr.efficiency.ToString();
            this.hv.Text = sr.highVoltage.ToString();
            this.gatelength.Text = sr.gateLengthMS.ToString();
            if (d.Id.SRType < InstrType.NPOD)
            {
                COMvNetLabel.Content = "Serial Port";
                string cur = "COM" + d.Id.SerialPort.ToString();
                idx = -1; i = 0;
                string[] ports = System.IO.Ports.SerialPort.GetPortNames();
                CommComboBox.Items.Clear();
                foreach (string p in ports)
                {
                    CommComboBox.Items.Add(p);
                    if (p.CompareTo(cur) == 0)
                    {
                        idx = i;
                    }
                    i++;
                }
                if (idx >= 0)
                    CommComboBox.SelectedIndex = idx;
                else
                {
                    CommComboBox.Items.Add(cur);
                    CommComboBox.SelectedIndex = 0;
                }

            }
            else if (d.Id.SRType < InstrType.MCNPX)
            {
                COMvNetLabel.Content = "TCP/IP Addr";
            }
            else
            {
                COMvNetLabel.Content = "Whah?";
            }
        }