コード例 #1
0
        private void AddNextBtn_Click(object sender, EventArgs e)
        {
            SelectorPanel.Visible        = false;
            AddDetectorTypePanel.Visible = false;

            // Create new detector with default parameters for the selected type
            DataSourceIdentifier did = new DataSourceIdentifier();

            did.DetectorName = AddDetectorNameTextBox.Text;
            InstrType dt;

            INCCDB.Descriptor desc = (INCCDB.Descriptor)AddDetectorTypeComboBox.SelectedItem;
            System.Enum.TryParse <InstrType>(desc.Name, out dt);
            did.SRType       = dt;
            did.FullConnInfo = new LMConnectionInfo();
            Multiplicity mkey = new Multiplicity(InstrTypeExtensions.DefaultFAFor(did.SRType));

            det = new Detector(did, mkey, null);

            // Jump to an edit panel for the parameters of the appropriate type
            if (det != null)
            {
                if (det.Id.SRType == InstrType.MCA527)
                {
                    PopulateMCA527ParamFields();
                }
                else
                {
                    PopulateLMMM_PTR32ParamFields();
                }
            }
            AddingNew = true;
        }
コード例 #2
0
        //public Detector GetIt(ShiftRegisterParameters sr)
        //{
        //    Detector d = null;
        //    d = Find(det => det.SRParams.Equals(sr));
        //    if (d == null)
        //        d = new Detector();
        //    return d;
        //}
        public Detector GetIt(DataSourceIdentifier dsid)
        {
            Detector d = null;

            d = Find(det => det.Item1.Equals(dsid));
            return(d);
        }
コード例 #3
0
        /// <summary>
        /// transform run_rec_ext results into a MultiplicityCountingRes, also see INCKnew.RunToCycle
        /// later step will place results on current cycle in appropriate results map using the Det.MultiplicityParams key
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="cycle"></param>
        public void TransformResults(DataSourceIdentifier Id, Cycle cycle)
        {
            FAType fa = Id.SRType.DefaultFAFor();

            tds.mcr = new MultiplicityCountingRes(fa, 0);
            RunValuesToResults(tds.run, cycle, Det.MultiplicityParams, tds.mcr);
        }
コード例 #4
0
 public SRInstrument(Detector det)
     : base()
 {
     id       = new DataSourceIdentifier(det.Id);
     srstatus = new SRInstrStatus();
     DAQState = DAQInstrState.Offline;  // different scheme, we need to connect after the Instrument is known, rather than connect because the instrument is known
 }
コード例 #5
0
 public Instrument()
 {
     id       = new DataSourceIdentifier();
     daqstate = DAQInstrState.Online;
     selected = true;
     id.dt    = System.DateTime.Now;
 }
コード例 #6
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;
 }
コード例 #7
0
 public LMInstrument(Detector det)
     : base()
 {
     id       = new DataSourceIdentifier(det.Id);
     lmstatus = new LMInstrStatus();
     file     = new NCDFile();
     file.Log = NC.App.Loggers.Logger(LMLoggers.AppSection.Collect);
     Init(null, null);
 }
コード例 #8
0
ファイル: INCCSR.cs プロジェクト: tempbottle/INCC6
 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;
 }
コード例 #9
0
ファイル: Cycle.cs プロジェクト: radtek/INCC6
 public Cycle(LMLoggers.LognLM logger = null)
 {
     // Raw counts aka totals
     singles      = new VTuple();
     dsid         = new DataSourceIdentifier();
     qcstatus     = new QCStatusMap();
     countresults = new CountingResults();
     daqStatus    = CycleDAQStatus.None;
     this.logger  = logger;
     hitsPerChn   = new double[NC.ChannelCount];
 }
コード例 #10
0
        // dev note: prolly need to lock access to data on these thread classes
        public void GetLastStatus(DataSourceIdentifier dsid, ref int lastSr, ref int lastMeas)
        {
            SRControlThread srct;

            if (threads.ContainsKey(dsid))
            {
                srct     = threads[dsid];
                lastSr   = srct.SRCtrl.LastSRStatus;
                lastMeas = srct.SRCtrl.LastMeasStatus;
            }
        }
コード例 #11
0
 public SRInstrument MatchByDSID(DataSourceIdentifier id)
 {
     return((SRInstrument)this.Find(i =>
     {
         if (i is SRInstrument)
         {
             SRInstrument sr = (SRInstrument)i;
             return id.Equals(sr);
         }
         else
         {
             return false;
         }
     }
                                    ));
 }
コード例 #12
0
        public int StartSRActionAndWait(DataSourceIdentifier dsid, SROp op, int setpt = -1, int runtime = -1)
        {
            SRControlThread srct;
            int             res = SR.SUCCESS;

            if (threads.ContainsKey(dsid))
            {
                srct = threads[dsid];
                if (srct == null || !srct.IsBusy)
                {
                    return(res);
                }

                try
                {
                    if (setpt >= 0)
                    {
                        srct.SRCtrl.HVSet(setpt, runtime);
                    }

                    srct.op = op;
                    // tell caller to wait, then kick the thread into action
                    srct.callwait.Reset();

                    // tell the thread to go ahead
                    srct.opgate.Set();

                    // caller will now wait for completion
                    srct.callwait.Wait(srct.cts.Token);

                    // fire the operation completed event here, consciously placed out of the executing SR service thread context
                    srct.SROpCompletedEvent(srct.status);
                }
                catch (OperationCanceledException)
                {
                }
                finally
                {
                    res = srct.SRCtrl.LastMeasStatus;
                }
            }
            return(res);
        }
コード例 #13
0
ファイル: Cycle.cs プロジェクト: radtek/INCC6
 public Cycle(Cycle copyFrom)
 {
     // Raw counts aka totals
     singles  = new VTuple(copyFrom.singles);
     dsid     = new DataSourceIdentifier(copyFrom.dsid);
     qcstatus = new QCStatusMap();
     foreach (KeyValuePair <Multiplicity, QCStatus> kvp in copyFrom.qcstatus)
     {
         qcstatus.Add(kvp.Key, kvp.Value);
     }
     countresults = new CountingResults();
     foreach (KeyValuePair <SpecificCountingAnalyzerParams, object> cr in copyFrom.countresults)
     {
         countresults.Add(cr.Key, cr.Value);
     }
     daqStatus   = CycleDAQStatus.None;
     ts          = copyFrom.TS;
     this.logger = null;
     hitsPerChn  = new double[NC.ChannelCount];
 }
コード例 #14
0
        public void SetAction(DataSourceIdentifier dsid, SROp op)
        {
            SRControlThread srct;

            if (threads.ContainsKey(dsid))
            {
                srct = threads[dsid];
                if (!srct.IsBusy)
                {
                    return;
                }

                srct.op = op;

                // tell caller to wait, then kick the waiting thread into action
                srct.callwait.Reset();

                srct.opgate.Set();
            }
        }
コード例 #15
0
ファイル: Overview.cs プロジェクト: radtek/INCC6
        List <string> GenDetIdStr(DataSourceIdentifier dsid)
        {
            List <string> ls = new List <string>();

            ls.Add(string.Format("{0,10}: {1}", "Name", dsid.DetectorId));
            if (dsid.SRType.IsListMode())
            {
                ls.Add(string.Format("{0,10}: {1}", "LM type", dsid.SRType.ToString()));
            }
            else
            {
                ls.Add(string.Format("{0,10}: {1}", "SR type", dsid.SRType.INCC5ComboBoxString()));
            }
            ls.Add(string.Format("{0,10}: {1}", "User type", dsid.Type));
            ls.Add(string.Format("{0,10}: {1}", "Elec. id", dsid.ElectronicsId));
            if (dsid.SRType.IsCOMPortBasedSR())
            {
                ls.Add(string.Format("{0,10}: {1}", "Baud rate", dsid.BaudRate));
            }
            ls.Add(string.Format("{0,10}: {1}", "Data src", dsid.source.HappyFunName()));
            if (dsid.SRType.IsListMode())
            {
                LMConnectionInfo lm = (LMConnectionInfo)dsid.FullConnInfo;                 // todo: finish this
                //lm.NetComm and
                //lm.DeviceConfig
                //ls.Add(string.Format("{0,10}: {1}", "Port", lm.NetComm.));
                //ls.Add(string.Format("{0,10}: {1}", "Port", dsid.FullConnInfo.Port));
            }
            if (!string.IsNullOrEmpty(dsid.FullConnInfo.Port))
            {
                ls.Add(string.Format("{0,10}: {1}", "COM port", dsid.FullConnInfo.Port));
            }
            if (dsid.FullConnInfo.Wait != 0)
            {
                ls.Add(string.Format("{0,10}: {1}", "Wait", dsid.FullConnInfo.Wait) + " mSec");
            }

            return(ls);
        }
コード例 #16
0
            public CycleProcessingStateSnapshot(Instrument inst)
            {
                if (inst == null || inst.RDT == null || inst.RDT.Cycle == null)
                {
                    return;
                }
                Cycle c = inst.RDT.Cycle;

                seq            = c.seq;
                ts             = new TimeSpan(c.TS.Ticks);
                singles        = c.Totals;
                rawsinglesrate = c.SinglesRate;
                totalevents    = c.TotalEvents;
                totals         = c.Totals;
                message        = c.Message;
                hitsPerChn     = new double[c.HitsPerChannel.Length];
                Array.Copy(c.HitsPerChannel, hitsPerChn, hitsPerChn.Length);
                highVoltage = c.HighVoltage;
                dsid        = new DataSourceIdentifier(c.DataSourceId);
                daqStatus   = c.DaqStatus;
                //cycle = c;
            }
コード例 #17
0
ファイル: SRDAQHandler.cs プロジェクト: tempbottle/INCC6
        public void SetAction(DataSourceIdentifier dsid, SROp op)
        {
            SRControlThread srct;
            if (threads.ContainsKey(dsid))
            {
                srct = threads[dsid];
                if (!srct.IsBusy)
                    return;

                srct.op = op;

                // tell caller to wait, then kick the waiting thread into action
                srct.callwait.Reset();

                srct.opgate.Set();
            }
        }
コード例 #18
0
ファイル: Overview.cs プロジェクト: hnordquist/INCC6
 string GenDetIdLabelStr(DataSourceIdentifier dsid)
 {
     string s = dsid.ToString();
     return s;
 }
コード例 #19
0
ファイル: SRDAQHandler.cs プロジェクト: tempbottle/INCC6
 // dev note: prolly need to lock access to data on these thread classes
 public void GetLastStatus(DataSourceIdentifier dsid, ref int lastSr, ref int lastMeas)
 {
     SRControlThread srct;
     if (threads.ContainsKey(dsid))
     {
         srct = threads[dsid];
         lastSr = srct.SRCtrl.LastSRStatus;
         lastMeas = srct.SRCtrl.LastMeasStatus;
     }
 }
コード例 #20
0
ファイル: SRDAQHandler.cs プロジェクト: tempbottle/INCC6
        public int StartSRActionAndWait(DataSourceIdentifier dsid, SROp op, int setpt = -1, int runtime = -1)
        {
            SRControlThread srct;
            int res = SR.SUCCESS;
            if (threads.ContainsKey(dsid))
            {
                srct = threads[dsid];
                if (srct == null || !srct.IsBusy)
                    return res;

                try
                {
                    if (setpt >= 0)
                        srct.SRCtrl.HVSet(setpt, runtime);

                    srct.op = op;
                    // tell caller to wait, then kick the thread into action
                    srct.callwait.Reset();

                    // tell the thread to go ahead
                    srct.opgate.Set();

                    // caller will now wait for completion
                    srct.callwait.Wait(srct.cts.Token);

                    // fire the operation completed event here, consciously placed out of the executing SR service thread context
                    srct.SROpCompletedEvent(srct.status);
                }
                catch (OperationCanceledException)
                {
                }
                finally
                {
                    res = srct.SRCtrl.LastMeasStatus;
                }
            }
            return res;
        }
コード例 #21
0
ファイル: Cycle.cs プロジェクト: hnordquist/INCC6
        private TimeSpan ts; // timestamp of last neutron v. requested time

        #endregion Fields

        #region Constructors

        public Cycle(LMLoggers.LognLM logger)
        {
            // Raw counts aka totals
            singles = new VTuple();
            dsid = new DataSourceIdentifier();
            qcstatus = new QCStatusMap();
            countresults = new CountingResults();
            daqStatus = CycleDAQStatus.None;
            this.logger = logger;
            hitsPerChn = new double[NC.ChannelCount];
        }
コード例 #22
0
ファイル: SRDAQHandler.cs プロジェクト: tempbottle/INCC6
 /// <summary>
 /// transform run_rec_ext results into a MultiplicityCountingRes, also see INCKnew.RunToCycle
 /// later step will place results on current cycle in appropriate results map using the Det.MultiplicityParams key
 /// </summary>
 /// <param name="Id"></param>
 /// <param name="cycle"></param>
 public void TransformResults(DataSourceIdentifier Id, Cycle cycle)
 {
     FAType fa = Id.SRType.DefaultFAFor();
     tds.mcr = new MultiplicityCountingRes(fa, 0);
     RunValuesToResults(tds.run, cycle, Det.MultiplicityParams, tds.mcr);
 }
コード例 #23
0
ファイル: Cycle.cs プロジェクト: radtek/INCC6
 public void SetUpdatedDataSourceId(DataSourceIdentifier dataSourceIdentifier)
 {
     dsid    = new DataSourceIdentifier(dataSourceIdentifier);
     dsid.dt = DateTimeOffset.Now;
 }
コード例 #24
0
ファイル: Cycle.cs プロジェクト: hnordquist/INCC6
 public void SetUpdatedDataSourceId(DataSourceIdentifier dataSourceIdentifier)
 {
     dsid = new DataSourceIdentifier(dataSourceIdentifier);
     dsid.dt = DateTimeOffset.Now;
 }
コード例 #25
0
ファイル: Overview.cs プロジェクト: radtek/INCC6
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            List <string> ls = null;

            if (e.Node.Parent == null)
            {
                if (e.Node.Tag == null)
                {
                    return;
                }
                else
                {
                    Type t = (Type)e.Node.Tag;
                    if (t == typeof(TestParameters))
                    {
                        TestParameters d = N.App.DB.TestParameters.Get();
                        ls = d.ToDBElementList(generate: true).AlignedNameValueList;
                    }
                }
            }
            else
            {
                object o = e.Node.Parent.Tag;
                if (o == null)
                {
                    return;
                }
                else  // display content in the right-hand pane
                {
                    Type t = e.Node.Tag.GetType();
                    if (t == typeof(ItemId))
                    {
                        ls = ((ParameterBase)e.Node.Tag).ToDBElementList(generate: true).AlignedNameValueList;
                    }
                    else if (t == typeof(Detector))
                    {
                        ls = GenDetIdStr(((Detector)e.Node.Tag).Id);
                    }
                    else if (t == typeof(Isotopics))
                    {
                        ls = ((ParameterBase)e.Node.Tag).ToDBElementList(generate: true).AlignedNameValueList;
                    }
                    else if (t == typeof(CompositeIsotopics))
                    {
                        ls = ((ParameterBase)e.Node.Tag).ToDBElementList(generate: true).AlignedNameValueList;
                    }
                    else if (t == typeof(CollarItemId))
                    {
                        ls = ((ParameterBase)e.Node.Tag).ToDBElementList(generate: true).AlignedNameValueList;
                    }
                    else if (t == typeof(Stratum))
                    {
                        ls = ((ParameterBase)e.Node.Tag).ToDBElementList(generate: true).AlignedNameValueList;
                    }
                    else if (t == typeof(INCCDB.Descriptor))
                    {
                        INCCDB.Descriptor d = (INCCDB.Descriptor)e.Node.Tag;
                        ls = new List <string>(); ls.Add(d.Item1 + ": " + d.Item2);
                    }
                    else if (t == typeof(AnalysisMethods))
                    {
                        AnalysisMethods d = (AnalysisMethods)e.Node.Tag;
                        ls = d.ToDBElementList(generate: true).AlignedNameValueList;
                    }
                    else if (t == typeof(AcquireParameters))
                    {
                        AcquireParameters d = (AcquireParameters)e.Node.Tag;
                        ls = d.ToDBElementList(generate: true).AlignedNameValueList;
                    }
                    else if (t == typeof(AlphaBeta))
                    {
                        AlphaBeta AB = (AlphaBeta)e.Node.Tag;
                        ls = GenDetABStr(AB);
                    }
                    else if (t == typeof(Multiplicity))
                    {
                        Multiplicity m = (Multiplicity)e.Node.Tag;
                        ls = GenDetMultStr((Detector)o, m);
                    }
                    else if (t == typeof(DataSourceIdentifier))
                    {
                        DataSourceIdentifier d = (DataSourceIdentifier)e.Node.Tag;
                        ls = GenDetIdStr(d);
                    }
                    else if (t == typeof(INCCDB.IndexedResults))
                    {
                        ls = GenMeasStr((INCCDB.IndexedResults)e.Node.Tag);;
                    }
                }
            }
            StringBuilder sb = new StringBuilder(100);

            if (ls != null)
            {
                foreach (string s in ls)
                {
                    sb.Append(s); sb.Append('\r');
                }
                richTextBox1.Text = sb.ToString();
            }
        }
コード例 #26
0
ファイル: Overview.cs プロジェクト: radtek/INCC6
        string GenDetIdLabelStr(DataSourceIdentifier dsid)
        {
            string s = dsid.ToString();

            return(s);
        }
コード例 #27
0
ファイル: Overview.cs プロジェクト: hnordquist/INCC6
        List<string> GenDetIdStr(DataSourceIdentifier dsid)
        {
            List<string> ls = new List<string>();
            ls.Add(string.Format("{0,10}: {1}", "Name", dsid.DetectorId));
            if (dsid.SRType.IsListMode())
                ls.Add(string.Format("{0,10}: {1}", "LM type", dsid.SRType.ToString()));
            else
                ls.Add(string.Format("{0,10}: {1}", "SR type", dsid.SRType.INCC5ComboBoxString()));
            ls.Add(string.Format("{0,10}: {1}", "User type", dsid.Type));
            ls.Add(string.Format("{0,10}: {1}", "Elec. id", dsid.ElectronicsId));
            if (dsid.SRType.IsCOMPortBasedSR())
                ls.Add(string.Format("{0,10}: {1}", "Baud rate", dsid.BaudRate));
            ls.Add(string.Format("{0,10}: {1}", "Data src", dsid.source.HappyFunName()));
            if (dsid.SRType.IsListMode())
            {
                LMConnectionInfo lm = (LMConnectionInfo)dsid.FullConnInfo; // todo: finish this
                //lm.NetComm and
                //lm.DeviceConfig
                //ls.Add(string.Format("{0,10}: {1}", "Port", lm.NetComm.));
                //ls.Add(string.Format("{0,10}: {1}", "Port", dsid.FullConnInfo.Port));
            }
            if (!string.IsNullOrEmpty(dsid.FullConnInfo.Port))
                ls.Add(string.Format("{0,10}: {1}", "COM port", dsid.FullConnInfo.Port));
            if (dsid.FullConnInfo.Wait != 0)
                ls.Add(string.Format("{0,10}: {1}", "Wait", dsid.FullConnInfo.Wait) + " mSec");

            return ls;
        }
コード例 #28
0
ファイル: Status.cs プロジェクト: tempbottle/INCC6
 public CycleProcessingStateSnapshot(Instrument inst)
 {
     if (inst == null || inst.RDT == null || inst.RDT.Cycle == null)
         return;
     Cycle c = inst.RDT.Cycle;
     seq = c.seq;
     ts = new TimeSpan(c.TS.Ticks);
     singles = c.Totals;
     rawsinglesrate = c.SinglesRate;
     totalevents = c.TotalEvents;
     totals = c.Totals;
     message = c.Message;
     hitsPerChn = new double[c.HitsPerChannel.Length]; 
     Array.Copy(c.HitsPerChannel, hitsPerChn, hitsPerChn.Length);
     highVoltage = c.HighVoltage;
     dsid = new DataSourceIdentifier(c.DataSourceId);
     daqStatus = c.DaqStatus;
     //cycle = c;
 }
コード例 #29
0
        private void AddNextBtn_Click(object sender, EventArgs e)
        {
            this.SelectorPanel.Visible = false;
            this.AddDetectorTypePanel.Visible = false;

            // Create new detector with default parameters for the selected type
            DataSourceIdentifier did = new DataSourceIdentifier();
            did.DetectorName = AddDetectorNameTextBox.Text;
            InstrType dt;
            INCCDB.Descriptor desc = (INCCDB.Descriptor)AddDetectorTypeComboBox.SelectedItem;
            System.Enum.TryParse<InstrType>(desc.Name, out dt);
            did.SRType = dt;
            did.FullConnInfo = new LMConnectionInfo();
            Multiplicity mkey = new Multiplicity(InstrTypeExtensions.DefaultFAFor(did.SRType));
            det = new Detector(did, mkey, null);

            // Jump to an edit panel for the parameters of the appropriate type
           PopulateParamFields();
           AddingNew = true;

        }