当前位置: 首页>>代码示例>>C#>>正文


C# Instrument.PendingReset方法代码示例

本文整理汇总了C#中Instrument.PendingReset方法的典型用法代码示例。如果您正苦于以下问题:C# Instrument.PendingReset方法的具体用法?C# Instrument.PendingReset怎么用?C# Instrument.PendingReset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Instrument的用法示例。


在下文中一共展示了Instrument.PendingReset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NCDFileAssay

        /// <summary>
        /// Process a list of NCD files
        /// </summary>
        void NCDFileAssay()
        {
            if (!NC.App.Opstate.Measurement.Detectors[0].ListMode)
                ctrllog.TraceEvent(LogLevels.Warning, 439, NC.App.Opstate.Measurement.Detectors[0].Id.DetectorName + " is not a list mode detector.");

            List<string> ext = new List<string>() { ".ncd" };
            FileList<NCDFile> hdlr = new FileList<NCDFile>();
            hdlr.Init(ext, ctrllog);
            FileList<NCDFile> files = null;

            /// this section now occurs in the caller, the state is set up earlier
            Measurement meas = NC.App.Opstate.Measurement;

            PseudoInstrument = new LMDAQ.LMInstrument(meas.Detectors[0]);  // psuedo LM until we can map from user or deduce from file content at run-time
            PseudoInstrument.selected = true;
            if (!Instruments.Active.Contains(PseudoInstrument))
                Instruments.Active.Add(PseudoInstrument); // add to global runtime list
            DataSourceIdentifier did = meas.Detectors[0].Id;
            LMRawDataTransform rdt = (LMRawDataTransform)PseudoInstrument.RDT;
            rdt.SetLMState(((LMConnectionInfo)(PseudoInstrument.id.FullConnInfo)).NetComm);

            // initialize operation timer here
            NC.App.Opstate.ResetTimer(0, filegather, files, 170, (int)NC.App.AppContext.StatusTimerMilliseconds);
            FireEvent(EventType.ActionPrep, this);
            NC.App.Opstate.StampOperationStartTime();

            // get the list of files from the named folder, or use the supplied list
            if (NC.App.AppContext.FileInputList == null)
                files = (FileList<NCDFile>)hdlr.BuildFileList(NC.App.AppContext.FileInput, NC.App.AppContext.Recurse, false);
            else
                files = (FileList<NCDFile>)hdlr.BuildFileList(NC.App.AppContext.FileInputList);
            if (files == null || files.Count() < 1)
            {
                NC.App.Opstate.StopTimer(0);
                return;
            }

            NC.App.Opstate.ResetTimer(0, this.neutronCountingPrep, 0, 170, (int)NC.App.AppContext.StatusTimerMilliseconds / 4);

            rdt.SetupCountingAnalyzerHandler(NC.App.Config, did.source.TimeBase(did.SRType),
                        (string s) =>
                        {
                            PseudoInstrument.PendingComplete();
                            ctrllog.TraceEvent(LogLevels.Verbose, 439, "Neutron counting processing complete: '" + s + "'");
                        },
                        (string s) =>
                        {
                            PseudoInstrument.PendingComplete();
                            ctrllog.TraceEvent(LogLevels.Error, 438, "Neutron counting processing stopped with error: '" + s + "'");
                            rdt.EndAnalysisImmediately();
                            throw new FatalNeutronCountingException(s);  // emergency exit, caught and noted in file processing loop below
                        },
                        (string s) =>
                        {
                            PseudoInstrument.PendingComplete();
                            ctrllog.TraceEvent(LogLevels.Error, 437, "Neutron counting processing [Block] stopped with error: '" + s + "'");
                            rdt.EndAnalysisImmediately();
                            throw new FatalNeutronCountingException(s);  // emergency exit, caught and noted in file processing loop below
                        }
                    );


            meas.AcquireState.num_runs = (ushort)files.Count(); // RequestedRepetitions

            rdt.PrepareAndStartCountingAnalyzers(meas.AnalysisParams);
            NC.App.Opstate.StopTimer(0);

            FireEvent(EventType.ActionStart, this);

            meas.CurrentRepetition = 0;
            NC.App.Opstate.ResetTimer(0, filerawprocessing, PseudoInstrument, 250, (int)NC.App.AppContext.StatusTimerMilliseconds);
            foreach (var ncd in files)
            {
                if (NC.App.Opstate.IsQuitRequested)  // cancellation occurs here and at selected steps in the internal file and analyzer processing 
                    break;
                if (!ncd.OpenForReading())
                    continue;
                PseudoInstrument.PendingReset();
                if (meas.CurrentRepetition == 0)
                {
                    meas.MeasDate = ncd.DTO;
                    meas.Detectors[0].Id.source = ConstructedSource.NCDFile;
                    PseudoInstrument.id.source = ConstructedSource.NCDFile;
                }

                Cycle cycle = new Cycle(ctrllog);
                cycle.UpdateDataSourceId(ConstructedSource.NCDFile, InstrType.LMMM /* revisit this, it could be from any source */,
                                         ncd.DTO, ncd.Filename);
                meas.Add(cycle);
                rdt.StartCycle(cycle);
                meas.CurrentRepetition++;
                rdt.NumProcessedRawDataBuffers = 0;
                int thisread = 0;
                long read = 0, fulllen = ncd.stream.Length;
                NC.App.Opstate.SOH = NCC.OperatingState.Living;
                PseudoInstrument.id.FileName = ncd.Filename;

//.........这里部分代码省略.........
开发者ID:tempbottle,项目名称:INCC6,代码行数:101,代码来源:FileCtrl.cs

示例2: PTRFilePairAssay

        protected void PTRFilePairAssay()
        {

            List<string> ext = new List<string>() { ".chn", ".bin" };
            FileList<PTRFilePair> hdlr = new FileList<PTRFilePair>();
            FileList<PTRFilePair> files = null;
            hdlr.Init(ext, datalog);

            // initialize operation timer here
            NC.App.Opstate.ResetTimer(0, filegather, files, 170, (int)NC.App.AppContext.StatusTimerMilliseconds);
            FireEvent(EventType.ActionPrep, this);
            NC.App.Opstate.StampOperationStartTime();


            // get the list of files from the named folder, or use the supplied list
            if (NC.App.AppContext.FileInputList == null)
                files = (FileList<PTRFilePair>)hdlr.BuildFileList(NC.App.AppContext.FileInput, NC.App.AppContext.Recurse, false);
            else
                files = (FileList<PTRFilePair>)hdlr.BuildFileList(NC.App.AppContext.FileInputList);
            if (files == null || files.Count() < 1)
            {
                NC.App.Opstate.StopTimer(0);
                return;
            }
            int removed = files.RemoveAll(f => f.PairEntryFileExtension(".chn"));
            if (files.Count() < 1)
            {
                NC.App.Opstate.StopTimer(0);
                return;
            }

            Measurement meas = NC.App.Opstate.Measurement;

            PseudoInstrument = new LMDAQ.LMInstrument(meas.Detectors[0]);  // psuedo LM until we can map from user or deduce from file content at run-time
            PseudoInstrument.selected = true;
            if (!Instruments.Active.Contains(PseudoInstrument))
                Instruments.Active.Add(PseudoInstrument); // add to global runtime list

            // Force RDT.State to be a LM ptrFile file RDT, this shows a design failure, so need to rework the entire scheme, (like there is still time . . .)
            LMRawDataTransform rdt = (PseudoInstrument as LMDAQ.LMInstrument).RDT;
            rdt.SetLMState(((LMConnectionInfo)(PseudoInstrument.id.FullConnInfo)).NetComm);
            PTRFileProcessingState c = new PTRFileProcessingState(rdt.State.maxValuesInBuffer * 2, (LMProcessingState)PseudoInstrument.RDT.State);  // expects 8 bytes, we only use 4
            PseudoInstrument.RDT.State = c;
            rdt.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
            rdt.RawDataBuff = null;// free it back up, don't need it

            NC.App.Opstate.ResetTimer(0, this.neutronCountingPrep, 0, 170, (int)NC.App.AppContext.StatusTimerMilliseconds / 4);
            DataSourceIdentifier did = meas.Detectors[0].Id;
            rdt.SetupCountingAnalyzerHandler(NC.App.Config, did.source.TimeBase(did.SRType), // 1e-8 expected here
                        (string s) =>
                        {
                            PseudoInstrument.PendingComplete();
                            ctrllog.TraceEvent(LogLevels.Verbose, 439, "Neutron counting processing complete: '" + s + "'");
                        },
                        (string s) =>
                        {
                            PseudoInstrument.PendingComplete();
                            ctrllog.TraceEvent(LogLevels.Error, 438, "Neutron counting processing stopped with error: '" + s + "'");
                            rdt.EndAnalysisImmediately();
                            throw new FatalNeutronCountingException(s);  // emergency exit, caught and noted in file processing loop below
                        },
                        (string s) =>
                        {
                            PseudoInstrument.PendingComplete();
                            ctrllog.TraceEvent(LogLevels.Error, 437, "Neutron counting processing [Block] stopped with error: '" + s + "'");
                            rdt.EndAnalysisImmediately();
                            throw new FatalNeutronCountingException(s);  // emergency exit, caught and noted in file processing loop below
                        }
                    );


            meas.AcquireState.num_runs = (ushort)files.Count(); // RequestedRepetitions

            rdt.PrepareAndStartCountingAnalyzers(meas.AnalysisParams);
            NC.App.Opstate.StopTimer(0);

            FireEvent(EventType.ActionStart, this);

            meas.CurrentRepetition = 0;
            NC.App.Opstate.ResetTimer(0, filerawprocessing, PseudoInstrument, 250, (int)NC.App.AppContext.StatusTimerMilliseconds);

            PTRFileProcessingState pps = PseudoInstrument.RDT.State as PTRFileProcessingState;
            foreach (var ptrFile in files)
            {
                if (NC.App.Opstate.IsQuitRequested)  // cancellation occurs here and at selected steps in the internal file and analyzer processing 
                    break;
                if (!ptrFile.OpenForReading())
                    continue;
                PseudoInstrument.PendingReset();
                if (meas.CurrentRepetition == 0)
                {
                    meas.MeasDate = new DateTimeOffset(ptrFile.DTO.Ticks, ptrFile.DTO.Offset);
                    meas.Detectors[0].Id.source = ConstructedSource.PTRFile;
                    PseudoInstrument.id.source = ConstructedSource.PTRFile;
                }

                Cycle cycle = new Cycle(ctrllog);
                cycle.UpdateDataSourceId(ConstructedSource.PTRFile, InstrType.PTR32 /* revisit this, it could be from any source */,
                                         ptrFile.DTO, ptrFile.Filename);
                meas.Add(cycle);
//.........这里部分代码省略.........
开发者ID:tempbottle,项目名称:INCC6,代码行数:101,代码来源:FileCtrl.cs

示例3: SortedPulseFileAssay

        protected void SortedPulseFileAssay()
        {

            List<string> ext = new List<string>() { ".pulse.sorted", ".txt.sorted" };
            FileList<SortedPulseFile> hdlr = new FileList<SortedPulseFile>();
            hdlr.Init(ext, ctrllog);
            FileList<SortedPulseFile> files = null;

            // initialize operation timer here
            NC.App.Opstate.ResetTimer(0, filegather, files, 170, (int)NC.App.AppContext.StatusTimerMilliseconds);
            FireEvent(EventType.ActionPrep, this);
            NC.App.Opstate.StampOperationStartTime();

            // get the list of files from the named folder
            files = (FileList<SortedPulseFile>)hdlr.BuildFileList(NC.App.AppContext.FileInput, NC.App.AppContext.Recurse, true);
            if (files == null || files.Count() < 1)
            {
                NC.App.Opstate.StopTimer(0);
                return;
            }

            Measurement meas = NC.App.Opstate.Measurement;

            PseudoInstrument = new LMDAQ.LMInstrument(meas.Detectors[0]);  // psuedo LM until we can map from user or deduce from file content at run-time
            PseudoInstrument.selected = true;
            if (!Instruments.Active.Contains(PseudoInstrument))
                Instruments.Active.Add(PseudoInstrument); // add to global runtime list

            // Force RDT.State To be a pulse file RDT, this shows a design failure, so need to rework the entire scheme
            LMRawDataTransform rdt = (PseudoInstrument as LMDAQ.LMInstrument).RDT;
            PulseProcessingState c = new PulseProcessingState(rdt.State.maxValuesInBuffer);
            PseudoInstrument.RDT.State = null;
            PseudoInstrument.RDT.State = c;
            rdt.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
            rdt.SetLMState(((LMConnectionInfo)(PseudoInstrument.id.FullConnInfo)).NetComm);
            rdt.RawDataBuff = null;// free it back up, don't need it

            NC.App.Opstate.ResetTimer(0, this.neutronCountingPrep, 0, 170, (int)NC.App.AppContext.StatusTimerMilliseconds / 4);
            DataSourceIdentifier did = meas.Detectors[0].Id;
            rdt.SetupCountingAnalyzerHandler(NC.App.Config, did.source.TimeBase(did.SRType), // 1e-8 expected here
                        (string s) =>
                        {
                            PseudoInstrument.PendingComplete();
                            ctrllog.TraceEvent(LogLevels.Verbose, 439, "Neutron counting processing complete: '" + s + "'");
                        },
                        (string s) =>
                        {
                            PseudoInstrument.PendingComplete();
                            ctrllog.TraceEvent(LogLevels.Error, 438, "Neutron counting processing stopped with error: '" + s + "'");
                            rdt.EndAnalysisImmediately();
                            throw new FatalNeutronCountingException(s);  // emergency exit, caught and noted in file processing loop below
                        },
                        (string s) =>
                        {
                            PseudoInstrument.PendingComplete();
                            ctrllog.TraceEvent(LogLevels.Error, 437, "Neutron counting processing [Block] stopped with error: '" + s + "'");
                            rdt.EndAnalysisImmediately();
                            throw new FatalNeutronCountingException(s);  // emergency exit, caught and noted in file processing loop below
                        }
                    );


            meas.AcquireState.num_runs = (ushort)files.Count(); // RequestedRepetitions

            rdt.PrepareAndStartCountingAnalyzers(meas.AnalysisParams);
            NC.App.Opstate.StopTimer(0);

            FireEvent(EventType.ActionStart, this);

            meas.CurrentRepetition = 0;
            NC.App.Opstate.ResetTimer(0, filerawprocessing, PseudoInstrument, 250, (int)NC.App.AppContext.StatusTimerMilliseconds);

            Random rand = new Random();
            int a = rand.Next(0, 3);
            byte byt = (byte)(1 << (byte)rand.Next(1, 7));
            PulseProcessingState pps = PseudoInstrument.RDT.State as PulseProcessingState;
            foreach (var sortedpulse in files)
            {
                if (NC.App.Opstate.IsQuitRequested)  // cancellation occurs here and at selected steps in the internal file and analyzer processing 
                    break;
                if (!sortedpulse.OpenForReading())
                    continue;
                PseudoInstrument.PendingReset();
                if (meas.CurrentRepetition == 0)
                {
                    meas.MeasDate = new DateTimeOffset(sortedpulse.DTO.Ticks, sortedpulse.DTO.Offset);
                    meas.Detectors[0].Id.source = ConstructedSource.SortedPulseTextFile;
                    PseudoInstrument.id.source = ConstructedSource.SortedPulseTextFile;
                }

                Cycle cycle = new Cycle(ctrllog);
                cycle.UpdateDataSourceId(ConstructedSource.SortedPulseTextFile, InstrType.LMMM, // MCNPX is common source of pulse files, but we need an explicit LM type here /* revisit this, it could be from any source */,
                          sortedpulse.DTO, sortedpulse.Filename);
                meas.Add(cycle);
                rdt.StartCycle(cycle);
                meas.CurrentRepetition++;
                pps.Reset();
                NC.App.Opstate.SOH = NCC.OperatingState.Living;
                PseudoInstrument.id.FileName = sortedpulse.Filename;

//.........这里部分代码省略.........
开发者ID:tempbottle,项目名称:INCC6,代码行数:101,代码来源:FileCtrl.cs


注:本文中的Instrument.PendingReset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。