Exemplo n.º 1
0
Arquivo: Cmd.cs Projeto: radtek/INCC6
        static void BuildMeasurement()
        {
            Detector          det = null;
            AcquireParameters ap  = null;

            AssaySelector.MeasurementOption mo = (AssaySelector.MeasurementOption)N.App.Config.Cur.AssayType;
            Integ.GetCurrentAcquireDetectorPair(ref ap, ref det);
            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, ap.item_type, DateTime.Now);

            N.App.DB.ReplaceAcquireParams(sel, ap);             // add new or replace existing with new

            // The acquire is set to occur, build up the measurement state
            Integ.BuildMeasurement(ap, det, mo);
        }
Exemplo n.º 2
0
        static void BuildMeasurement()
        {
            Detector          det = null;
            AcquireParameters ap  = null;

            AssaySelector.MeasurementOption mo = (AssaySelector.MeasurementOption)NC.App.Config.Cur.AssayType;
            Integ.GetCurrentAcquireDetectorPair(ref ap, ref det);
            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, ap.item_type, DateTime.Now);

            NC.App.DB.AcquireParametersMap().Add(sel, ap);  // it's a new one, not the existing one modified
            NC.App.DB.UpdateAcquireParams(ap, det.ListMode);

            // The acquire is set to occur, build up the measurement state
            Integ.BuildMeasurement(ap, det, mo);
        }
Exemplo n.º 3
0
 public IDDCollarAcquire(NormParameters npp)
 {
     InitializeComponent();
     ap = Integ.GetCurrentAcquireParams();
     col = new INCCAnalysisParams.collar_combined_rec();
     ah = new AcquireHandlers();
     ah.mo = AssaySelector.MeasurementOption.verification;
     Text += " for detector " + ah.det.Id.DetectorName;
     //ableTermControls();
     Detector d= new Detector();
     Integ.GetCurrentAcquireDetectorPair(ref ap, ref d);
     npp.CopyTo(norm);
     Integ.BuildMeasurement(ap, d, AssaySelector.MeasurementOption.verification);
     am = Integ.GetMethodSelections(ah.ap);
     // Main window checks if Collar is defined for material type. No check needed here.
     FillForm();
 }
Exemplo n.º 4
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            //If they didn't load a passive measurement from the DB, so measure it.

            if (passive == null)
            {
                ItemId Cur = NC.App.DB.ItemIds.Get(ap.item_id);
                Cur.IsoApply(NC.App.DB.Isotopics.Get(ap.isotopics_id));           // apply the iso dates to the item

                NC.App.DB.ItemIds.Set();  // writes any new or modified item ids to the DB
                NC.App.DB.ItemIds.Refresh();    // save and update the in-memory item list 

                if (DialogResult == DialogResult.OK)
                {
                    Visible = false;
                    // Add strata update to measurement object.    HN 9.23.2015              
                    UIIntegration.Controller.SetAssay();  // tell the controller to do an assay operation using the current measurement state
                    UIIntegration.Controller.Perform();  // start the measurement file or DAQ thread
                }
                DialogResult = DialogResult.None;
                passive = NCC.CentralizedState.App.Opstate.Measurement;
            }
            else // We've got the passive data, go ahead and get the active cycles
            {
                Visible = false;
                INCCAnalysisParams.collar_combined_rec ka = (INCCAnalysisParams.collar_combined_rec)am.GetMethodParameters(AnalysisMethod.CollarAmLi);
                Integ.BuildMeasurement(ap, Integ.GetCurrentAcquireDetector(), AssaySelector.MeasurementOption.verification);
                Integ.PersistDetectorAndAssociations(Integ.GetCurrentAcquireDetector());
                //active = new Measurement(AssaySelector.MeasurementOption.verification, NC.App.Loggers.DataLogger);
                //active.InitializeResultsSummarizers();
                //active.InitializeContext(true);
                //active.Persist();
                // Add strata update to measurement object.    HN 9.23.2015              
                UIIntegration.Controller.SetAssay();  // tell the controller to do an assay operation using the current measurement state
                UIIntegration.Controller.Perform();  // start the measurement file or DAQ thread
                Close();
            }
        }
Exemplo n.º 5
0
        //// BUTTONCLICK HANDLERS ///////////////////////////////////////////////

        public DialogResult OKButton_Click(object sender, EventArgs e)
        {
            DialogResult dr = DialogResult.Cancel;

            if (ap.modified)
            {
                INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, ap.item_type, DateTime.Now);
                ap.MeasDateTime = sel.TimeStamp; ap.lm.TimeStamp = sel.TimeStamp;
                NC.App.DB.AddAcquireParams(sel, ap);  // it's a new one, not the existing one modified
            }

            // The acquire is set to occur
            if (ap.data_src != ConstructedSource.Reanalysis)  // Reanalysis is a bit backwards, the correct measurement is fully constructed before this point
            {
                LMAcquire.ResetMeasurement();
            }

            switch (ap.data_src)
            {
            case ConstructedSource.Live:                 // set up the instrument list for the action controller
                Integ.BuildMeasurement(ap, det, mo);
                UIIntegration.Controller.file = false;   // make sure to use the DAQ controller, not the file controller
                NC.App.AppContext.FileInput   = null;    // reset the cmd line file input flag
                if (det.ListMode)
                {
                    // patch override lm.Interval with run_count_time from dialog
                    // the acquire dialogs field values, as seen and modified by the user, override the LM-only acquire settings for virtual SR measurements
                    NC.App.Opstate.Measurement.AcquireState.lm.Interval = NC.App.Opstate.Measurement.AcquireState.run_count_time;
                    NC.App.Opstate.Measurement.AcquireState.lm.Cycles   = NC.App.Opstate.Measurement.AcquireState.num_runs;

                    // Check NC.App.Opstate.Measurement.AnalysisParams for at least one VSR
                    // If not present, inform and pop up the wizard
                    // If present, inform with new dialog, do not pop up the wizard
                    if (NC.App.Opstate.Measurement.AnalysisParams.HasMatchingVSR(det.MultiplicityParams))
                    {
                        dr = DialogResult.OK;
                    }
                    else
                    {
                        dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();        // analyzers are created in here, placed on global measurement
                        if (dr == DialogResult.OK)
                        {
                            NC.App.DB.UpdateAcquireParams(ap);     //update it again
                            NC.App.DB.UpdateDetector(det);
                        }
                    }

                    if (dr == DialogResult.OK)
                    {
                        // if ok, the analyzers are set up, so can kick it off now.
                        UIIntegration.Controller.ActivateDetector(det);
                    }
                }
                else
                {
                    SRInstrument sri = new SRInstrument(det);
                    sri.selected = true;
                    sri.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
                    if (!Instruments.All.Contains(sri))
                    {
                        Instruments.All.Add(sri);     // add to global runtime list
                    }
                    dr = DialogResult.OK;
                }
                break;

            case ConstructedSource.DB:
                NC.App.AppContext.DBDataAssay = true;
                UIIntegration.Controller.file = true;
                IDDAcquireDBMeas dbdlg = new IDDAcquireDBMeas(this);
                if (dbdlg.HasItems())
                {
                    dr = dbdlg.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        Integ.BuildMeasurement(ap, det, mo);
                        DateTimeOffset dto = dbdlg.measurementId.MeasDateTime;
                        NC.App.Logger(LMLoggers.AppSection.App).TraceEvent(LogLevels.Info, 87654,
                                                                           "Using " + dto.ToString("MMM dd yyy HH:mm:ss.ff K"));
                        NC.App.Opstate.Measurement.MeasDate = dto;
                        // get the cycles for the selected measurement from the database, and add them to the current measurement
                        CycleList cl = NC.App.DB.GetCycles(det, dbdlg.measurementId, ap.data_src);     // APluralityOfMultiplicityAnalyzers: // URGENT: get all the cycles associated with each analzyer, restoring into the correct key->result pair
                        NC.App.Opstate.Measurement.Add(cl);
                        // use the cycle time interval as found in the data, taking the first entry because equal intervals are assumed
                        if (cl.Count > 0)
                        {
                            NC.App.Opstate.Measurement.AcquireState.lm.Interval             = NC.App.Opstate.Measurement.AcquireState.run_count_time
                                                                                            = cl[0].TS.TotalSeconds;
                        }
                        NC.App.DB.UpdateAcquireParams(ap);     //update it again
                    }
                }
                else
                {
                    MessageBox.Show("No items found in database matching these parameters", "WARNING");
                }
                break;

            case ConstructedSource.Manual:
                UIIntegration.Controller.file = true;
                NC.App.AppContext.DBDataAssay = true;
                IDDManualDataEntry mdlg = new IDDManualDataEntry();
                mdlg.AH = this;
                dr      = mdlg.ShowDialog(); // the work constructing the measurement is done in the dialog class
                break;

            case ConstructedSource.Reanalysis:
                UIIntegration.Controller.file = true;
                NC.App.AppContext.DBDataAssay = true;
                dr = DialogResult.OK;
                // the measurement re-creation work is done in the IDDReanalysisAssay dialog class prior to reaching this point
                break;

            case ConstructedSource.CycleFile:
                Integ.BuildMeasurementMinimal(ap, det, mo);                          // the measurement is reconstructed before each test data file processing, so this is meant as a carrier for certain kick-off values
                NC.App.AppContext.TestDataFileAssay = true;
                UIIntegration.Controller.file       = true;
                dr = UIIntegration.GetUsersFile("Select a test data (disk) file", NC.App.AppContext.FileInput, "INCC5 Test data (disk)", "dat", "cnn");
                break;

            case ConstructedSource.ReviewFile:
                Integ.BuildMeasurementMinimal(ap, det, mo);                          // acquire type and measurement option are read from each NCC file itself, so this instance is an acquire state kick-off carrier value
                NC.App.AppContext.ReviewFileAssay = true;
                UIIntegration.Controller.file     = true;
                dr = UIIntegration.GetUsersFile("Select an NCC file", NC.App.AppContext.FileInput, "INCC5 Review", "NCC");
                break;

            case ConstructedSource.NCDFile:
                Integ.BuildMeasurement(ap, det, mo);
                NC.App.AppContext.NCDFileAssay = true;
                UIIntegration.Controller.file  = true;
                if (det.ListMode || NC.App.Opstate.Measurement.MeasOption.IsListMode())
                {
                    dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select NCD files or folder", NC.App.AppContext.FileInput, "LMMM NCD", "ncd");
                }
                break;

            case ConstructedSource.SortedPulseTextFile:
                Integ.BuildMeasurement(ap, det, mo);
                NC.App.AppContext.PulseFileAssay = true;
                UIIntegration.Controller.file    = true;
                if (det.ListMode || NC.App.Opstate.Measurement.MeasOption.IsListMode())
                {
                    dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select pulse files or folder", NC.App.AppContext.FileInput, "pulse", "txt");
                }
                break;

            case ConstructedSource.PTRFile:
                Integ.BuildMeasurement(ap, det, mo);
                NC.App.AppContext.PTRFileAssay = true;
                UIIntegration.Controller.file  = true;
                if (det.ListMode || NC.App.Opstate.Measurement.MeasOption.IsListMode())
                {
                    dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select PTR-32 files or folder", NC.App.AppContext.FileInput, "PTR-32", "bin", "chn");
                }
                break;

            case ConstructedSource.MCA527File:
                Integ.BuildMeasurement(ap, det, mo);
                NC.App.AppContext.MCA527FileAssay = true;
                UIIntegration.Controller.file     = true;
                if (det.ListMode || NC.App.Opstate.Measurement.MeasOption.IsListMode())
                {
                    dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select MCA files or folder", NC.App.AppContext.FileInput, "MCA527", "mca");
                }
                break;

            default:
                break;
            }
            return(dr);
        }
Exemplo n.º 6
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            if (hvp.modified)
            {
                DialogResult = System.Windows.Forms.DialogResult.OK;
                HVCalibrationParameters c = NC.App.DB.HVParameters.Get(det.Id.DetectorName);
                if (c != null)
                {
                    c.Copy(hvp);  // copy changes back to original on user affirmation
                }
                else
                {
                    c = hvp;
                    NC.App.DB.HVParameters.GetMap().Add(det, c);
                }
                NC.App.DB.HVParameters.Set(det, c);
                // dev note: LM HV vals on LM Acquire record, but SR uses separate DB table so move HV vals so unify the scheme
            }
            else
            {
                DialogResult = System.Windows.Forms.DialogResult.Ignore;
            }

            // The acquire is set to occur, build up the measurement state
            Integ.BuildMeasurement(acq, det, AssaySelector.MeasurementOption.unspecified);

            if (acq.modified)
            {
                INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, DateTime.Now);
                acq.MeasDateTime = sel.TimeStamp; acq.lm.TimeStamp = sel.TimeStamp;
                NC.App.DB.AcquireParametersMap().Add(sel, acq);  // it's a new one, not the existing one modified
                NC.App.DB.UpdateAcquireParams(acq, det.ListMode);
            }

            UIIntegration.Controller.file = false; // make sure to use the DAQ controller, not the file controller
            NC.App.AppContext.FileInput   = null;  // reset the cmd line file input flag
            if (NC.App.Opstate.Measurement.Detectors[0].ListMode)
            {
                if (NC.App.Opstate.Measurement.Detectors[0].Id.SRType == InstrType.PTR32)
                {
                    Ptr32Instrument instrument = new Ptr32Instrument(NC.App.Opstate.Measurement.Detectors[0]);
                    instrument.DAQState = DAQInstrState.Offline;
                    instrument.selected = true;
                    instrument.Init(NC.App.Logger(LMLoggers.AppSection.Data), NC.App.Logger(LMLoggers.AppSection.Analysis));

                    if (!Instruments.Active.Contains(instrument))
                    {
                        Instruments.Active.Add(instrument);
                    }
                }
                else
                {
                    // if ok, the analyzers are set up, so can kick it off now.
                    LMInstrument lm = new LMInstrument(NC.App.Opstate.Measurement.Detectors[0]);
                    lm.DAQState = DAQInstrState.Offline; // these are manually initiated as opposed to auto-pickup
                    lm.selected = false;                 //must broadcast first to get it selected
                    if (!Instruments.All.Contains(lm))
                    {
                        Instruments.All.Add(lm); // add to global runtime list
                    }
                }
            }
            else
            {
                SRInstrument sri = new SRInstrument(NC.App.Opstate.Measurement.Detectors[0]);
                sri.selected = true;
                sri.Init(null, null);
                if (!Instruments.All.Contains(sri))
                {
                    Instruments.All.Add(sri); // add to global runtime list
                }
            }

            UIIntegration.Controller.SetHVCalib(); // tell the controller to do an HV operation using the current measurement state
            UIIntegration.Controller.Perform();    // start the HV DAQ thread


            this.Close();
        }
Exemplo n.º 7
0
        //// BUTTONCLICK HANDLERS ///////////////////////////////////////////////

        public DialogResult OKButton_Click(object sender, EventArgs e)
        {
            DialogResult dr = DialogResult.Cancel;

            if (ap.modified)
            {
                INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, ap.item_type, DateTime.Now);
                ap.MeasDateTime = sel.TimeStamp; ap.lm.TimeStamp = sel.TimeStamp;
                NC.App.DB.AcquireParametersMap().Add(sel, ap);  // it's a new one, not the existing one modified
                NC.App.DB.UpdateAcquireParams(ap, det.ListMode);
            }

            // The acquire is set to occur, build up the measurement state
            AnalysisWizard.ResetMeasurement();
            Integ.BuildMeasurement(ap, det, mo);

            switch (ap.data_src)
            {
            case ConstructedSource.Live:                 // set up the instrument list for the action controller
                UIIntegration.Controller.file = false;   // make sure to use the DAQ controller, not the file controller
                NC.App.AppContext.FileInput   = null;    // reset the cmd line file input flag
                if (det.ListMode)
                {
                    // patch override lm.Interval with run_count_time from dialog
                    NC.App.Opstate.Measurement.AcquireState.lm.Interval = NC.App.Opstate.Measurement.AcquireState.run_count_time;

                    // Check NC.App.Opstate.Measurement.AnalysisParams for at least one VSR
                    // If not present, inform and pop up the wizard
                    // If present, inform with new dialog, do not pop up the wizard
                    if (NC.App.Opstate.Measurement.AnalysisParams.HasMultiplicity())
                    {
                        dr = DialogResult.OK;
                    }
                    else
                    {
                        AnalysisWizard awl = new AnalysisWizard(AnalysisWizard.AWSteps.Step2B, ap, det);      // analyzers are created in here, placed on global measurement
                        dr = awl.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            NC.App.DB.UpdateAcquireParams(ap);     //update it again
                            NC.App.DB.UpdateDetector(det);
                        }
                    }

                    if (dr == DialogResult.OK)
                    {
                        // if ok, the analyzers are set up, so can kick it off now.
                        UIIntegration.Controller.ActivateDetector(det);
                    }
                }
                else
                {
                    SRInstrument sri = new SRInstrument(det);
                    sri.selected = true;
                    sri.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
                    if (!Instruments.All.Contains(sri))
                    {
                        Instruments.All.Add(sri);     // add to global runtime list
                    }
                    dr = DialogResult.OK;
                }
                break;

            case ConstructedSource.DB:
                NC.App.AppContext.DBDataAssay = true;
                UIIntegration.Controller.file = true;
                IDDAcquireDBMeas dbdlg = new IDDAcquireDBMeas(this);
                if (dbdlg.HasItems())
                {
                    dr = dbdlg.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        DateTimeOffset dto = dbdlg.measurementId.MeasDateTime;
                        DateTimeOffset cur = new DateTimeOffset(dto.Ticks, dto.Offset);
                        NC.App.Logger(NCCReporter.LMLoggers.AppSection.App).TraceEvent(NCCReporter.LogLevels.Info, 87654,
                                                                                       "Using " + dto.ToString("MMM dd yyy HH:mm:ss.ff K"));

                        // get the cycles for the selected measurement from the database, and add them to the current measurement
                        CycleList cl = NC.App.DB.GetCycles(det, dbdlg.measurementId);
                        foreach (Cycle cycle in cl)     // add the necessary meta-data to the cycle identifier instance
                        {
                            cycle.UpdateDataSourceId(ap.data_src, det.Id.SRType,
                                                     cur.AddTicks(cycle.TS.Ticks), det.Id.FileName);
                            cur = cycle.DataSourceId.dt;
                        }

                        NC.App.Opstate.Measurement.Add(cl);

                        // TODO: for Reanalysis, a full reconstruction of the measurement state based on the ResultsRec state and the method parameter map contents (for Calib and Verif)
                    }
                }
                else
                {
                    MessageBox.Show("No items found in database matching these parameters", "WARNING");
                }
                break;

            case ConstructedSource.Manual:
                UIIntegration.Controller.file = true;
                NC.App.AppContext.DBDataAssay = true;
                IDDManualDataEntry mdlg = new IDDManualDataEntry();
                mdlg.AH = this;
                dr      = mdlg.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    // the work is done in the dialog class
                }
                break;

            case ConstructedSource.CycleFile:
                NC.App.AppContext.TestDataFileAssay = true;
                UIIntegration.Controller.file       = true;
                dr = UIIntegration.GetUsersFile("Select a test data (disk) file", NC.App.AppContext.FileInput, "INCC5 Test data (disk)", "dat");
                break;

            case ConstructedSource.ReviewFile:
                NC.App.AppContext.ReviewFileAssay = true;
                UIIntegration.Controller.file     = true;
                dr = UIIntegration.GetUsersFile("Select an NCC file", NC.App.AppContext.FileInput, "INCC5 Review", "NCC");
                break;

            case ConstructedSource.NCDFile:
                NC.App.AppContext.NCDFileAssay = true;
                UIIntegration.Controller.file  = true;
                if (NC.App.Opstate.Measurement.MeasOption == AssaySelector.MeasurementOption.unspecified)
                {
                    AnalysisWizard aw = new AnalysisWizard(AnalysisWizard.AWSteps.Step2A, ap, det);
                    dr = aw.ShowDialog();     // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select NCD files or folder", NC.App.AppContext.FileInput, "LMMM NCD", "ncd");
                }
                break;

            case ConstructedSource.SortedPulseTextFile:
                NC.App.AppContext.PulseFileAssay = true;
                UIIntegration.Controller.file    = true;
                if (NC.App.Opstate.Measurement.MeasOption == AssaySelector.MeasurementOption.unspecified)
                {
                    AnalysisWizard aw1 = new AnalysisWizard(AnalysisWizard.AWSteps.Step2A, ap, det);
                    dr = aw1.ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select pulse files or folder", NC.App.AppContext.FileInput, "pulse", "txt");
                }
                break;

            case ConstructedSource.PTRFile:
                NC.App.AppContext.PTRFileAssay = true;
                UIIntegration.Controller.file  = true;
                if (NC.App.Opstate.Measurement.MeasOption == AssaySelector.MeasurementOption.unspecified)
                {
                    AnalysisWizard aw2 = new AnalysisWizard(AnalysisWizard.AWSteps.Step2A, ap, det);
                    dr = aw2.ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select PTR-32 files or folder", NC.App.AppContext.FileInput, "PTR-32", "bin", "chn");
                }
                break;

            case ConstructedSource.NILAFile:
                NC.App.AppContext.NILAFileAssay = true;
                UIIntegration.Controller.file   = true;
                dr = UIIntegration.GetUsersFilesFolder("Select NILA files or folder", NC.App.AppContext.FileInput, "MTS NILA", "dat");
                //dr = DialogResult.Cancel;
                break;

            default:
                break;
            }
            return(dr);
        }
Exemplo n.º 8
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            if (hvp.modified)
            {
                DialogResult = DialogResult.OK;
                HVCalibrationParameters c = NC.App.DB.HVParameters.Get(det.Id.DetectorName);
                if (c != null)
                {
                    c.Copy(hvp);  // copy changes back to original on user affirmation
                }
                else
                {
                    c = hvp;
                    NC.App.DB.HVParameters.GetMap().Add(det, c);
                }
                NC.App.DB.HVParameters.Set(det, c);
                // dev note: LM HV vals on LM Acquire record, but SR uses separate DB table so move HV vals so unify the scheme
            }
            else
            {
                DialogResult = DialogResult.Ignore;
            }

            acq.data_src = ConstructedSource.Live;
            if (OpenInExcel.Checked != acq.lm.HVX)
            {
                acq.lm.HVX = OpenInExcel.Checked;
                NC.App.DB.UpdateAcquireParams(acq, det.ListMode);
            }

            // The acquire is set to occur, build up the measurement state
            Integ.BuildMeasurement(acq, det, AssaySelector.MeasurementOption.unspecified);
            NC.App.Opstate.Measurement.Detector.Id.source = ConstructedSource.Live;
            if (acq.modified)
            {
                INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, DateTime.Now);
                acq.MeasDateTime = sel.TimeStamp; acq.lm.TimeStamp = sel.TimeStamp;
                NC.App.DB.AddAcquireParams(sel, acq);  // it's a new one, not the existing one modified
            }

            UIIntegration.Controller.file = false; // make sure to use the DAQ controller, not the file controller
            NC.App.AppContext.FileInput   = null;  // reset the cmd line file input flag
            Instrument instrument = null;

            if (NC.App.Opstate.Measurement.Detector.ListMode)
            {
                if (NC.App.Opstate.Measurement.Detector.Id.SRType == InstrType.PTR32)
                {
                    instrument = new Ptr32Instrument(NC.App.Opstate.Measurement.Detector);
                }
                else if (NC.App.Opstate.Measurement.Detector.Id.SRType == InstrType.MCA527)
                {
                    instrument = new MCA527Instrument(NC.App.Opstate.Measurement.Detector);
                    ((Analysis.MCA527ProcessingState)instrument.RDT.State).writingFile = false;                      // force this
                }
                else if (NC.App.Opstate.Measurement.Detector.Id.SRType == InstrType.LMMM)
                {
                    instrument = new LMInstrument(NC.App.Opstate.Measurement.Detector);
                }
                instrument.DAQState = DAQInstrState.Offline;
                instrument.selected = true;
                instrument.Init(NC.App.Logger(LMLoggers.AppSection.Data), NC.App.Logger(LMLoggers.AppSection.Analysis));
                if (!Instruments.Active.Exists(i => instrument.id.Equals(i.id)))
                {
                    Instruments.Active.Add(instrument);
                }
            }
            else
            {
                instrument          = new SRInstrument(NC.App.Opstate.Measurement.Detector);
                instrument.selected = true;
                instrument.Init(null, null);
                if (!Instruments.Active.Exists(i => instrument.id.Equals(i)))
                {
                    Instruments.All.Add(instrument);                     // add to global runtime list
                }
            }

            UIIntegration.Controller.SetHVCalib(); // tell the controller to do an HV operation using the current measurement state
            UIIntegration.Controller.Perform();    // start the HV DAQ thread


            Close();
        }