Example #1
0
 public TalkToLMMMM(LMLoggers.LognLM logger)
 {
     cmdprocessor = new LMMMLingo(); // same for cfg copy
     
     commlog = logger;
     cmdprocessor.CommLog = logger;
 }
Example #2
0
 /// <summary>
 /// Create a container for generating a line-based report, defaults to CSV fields and file suffix
 /// </summary>
 /// <param name="loggers">the logger handle, lines are output to the logger as well as the output file</param>
 public TabularReport(LMLoggers loggers)
 {
     this.loggers = loggers;
     Separator    = ',';
     rows         = new Row[0]; // non-null to start
     f            = new ResultsOutputFile(loggers.Logger(LMLoggers.AppSection.App));
 }
Example #3
0
 /// <summary>
 /// Create a container for generating a line-based report, defaults to CSV fields and file suffix
 /// </summary>
 /// <param name="et">the column header type</param>
 /// <param name="loggers">the logger handle, lines are output to the logger as well as the output file</param>
 public TabularReport(System.Type et, LMLoggers loggers)
 {
     this.loggers = loggers;
     Separator    = ',';
     GenColumns(et);
     rows = new Row[0]; // non-null to start
     f    = new ResultsOutputFile(loggers.Logger(LMLoggers.AppSection.App));
 }
Example #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;
 }
Example #5
0
 public static bool ExcelPresent(LMLoggers.LognLM optlog = null)
 {
     try
     {
         if (Type.GetTypeFromProgID("Excel.Application") != null)
             return true;
     }
     catch (Exception e)
     {
         if (optlog != null)
             optlog.TraceException(e);
     }
     return false;
 }
Example #6
0
 /// <summary>
 /// Extract root path from INCC5 incc.ini file, and use that path to construct 3 new paths for use by the iRAP software.
 /// Assumes iRAP runtime directory structure (data and output directories).
 /// </summary>
 /// <param name="ctrllog">log handle for error output</param>
 /// <returns>paths, non-null empty array if no INCC5 in file is used, or
 ///          an array of 3 paths, 0: common input path, 1: data path, 2: log file path</returns>
 public static string[] ProcessINCC5IniFile(LMLoggers.LognLM ctrllog)
 {
     string [] paths = new string[] { string.Empty };
     if (!NC.App.AppContext.UseINCC5Ini)
         return paths;
     string filename = System.IO.Path.Combine(NC.App.AppContext.INCC5IniLoc, "incc.ini");
     if (!System.IO.File.Exists(filename))
     {
         if (ctrllog != null)
             ctrllog.TraceEvent(LogLevels.Warning, 112, "INCC5 ini file does not exist or cannot be opened: " + filename);
         return paths;
     }
     string inputpath = string.Empty;
     using (System.IO.StreamReader sr = new System.IO.StreamReader(filename))
     {
         string line;
         // Read lines from the file until the end of the file is reached or the relevant tag is found
         while ((line = sr.ReadLine()) != null)
         {
             string tline = line.TrimStart();
             if (tline.StartsWith(@"//") || tline.StartsWith(@"#"))
                 continue;
             if (tline.TrimStart().StartsWith("RT_COMMON_DATABASE_PATH")) // lolz
             {
                 string[] otkens = line.Split();
                 inputpath = otkens.Length > 1 ? otkens[1] : string.Empty;
                 break;
             }
         }
     }
     if (!string.IsNullOrEmpty(inputpath))
     {
         System.IO.DirectoryInfo parentpath = System.IO.Directory.GetParent(inputpath.TrimEnd(new char[] {'\\', '/'}));
         paths = new string[] { inputpath,   // as specified in the ini file entry
                                 System.IO.Path.Combine(System.IO.Path.GetFullPath("./"), @"Data"),  // todo: hard-coded path from examples in iRAP, but could be wrong
                                 System.IO.Path.Combine(parentpath.FullName, @"output") }; // log file goes into the final sweep output path
     }
     return paths;
 }
Example #7
0
 public static string LoggableFileProcessingStatus(EventType EH, LMLoggers.LognLM log, LogLevels lvl, object o)
 {
     string s = EH.ToString() + ": ";
     if (o != null)
     {
         string ss = string.Empty;
         if (o is FileCtrl)
         {
             FileCtrl f = (FileCtrl)o;
             ss = f.LoggableInstrStatusString(f.PseudoInstrument, true);
         }
         else if (o is Measurement)
         {
             Measurement m = (Measurement)o;
             ss = FileCtrl.MeasStatusString(m);
         }
         s += ss;
     }
     log.TraceEvent(lvl, FileCtrl.logid[EH], s);
     return s;  // just in case it could be of further use
 }
Example #8
0
		public static string LogAndSkimFileProcessingStatus(EventType EH, LMLoggers.LognLM log, LogLevels lvl, object o)
		{
			LoggableFileProcessingStatus(EH,log,lvl,o);
			return SuccinctFileProcessingStatus(EH,o);
		}
Example #9
0
        public AnalyzerHandler(double theTicSizeInSeconds, LMLoggers.LognLM logger)
        {
            TickSizeInSeconds = theTicSizeInSeconds;
            log = logger;
            verboseTrace = log.ShouldTrace(LogLevels.Verbose);
            InitCounters();

            #if USE_SPINTIME
            ResetSpinTime();
            #endif
            //create stack of RawAnalysisProperties.circularListBlockIncrement neutron events, as a starting point
            //InitializeEventList(RawAnalysisProperties.circularListBlockIncrement);

            permissionToUseEndOfEvents = new SemaphoreSlim(1, 1); // LMKV-52 fix: create here with counter set at 1 and only 1 thread

            //set up the AH BackgroundWorker
            AHWorkerStopNow = false;
            AHWorkerHasCompleted = false;
            AHWorkerStopAtEndOfEvents = false;
            AHWorker = new BackgroundWorker();
            AHWorker.WorkerSupportsCancellation = false;  //parent will stop the worker with the boolean flags
            AHWorker.DoWork += new DoWorkEventHandler(AHWorkerDoWork);
            AHWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(AHWorkerRunWorkerCompleted);
            AHWorker.RunWorkerAsync();

            // permissionToUseEndOfEventsRelease();  // LMKV-52 fix: allow 1 thread at a time now that bkg worker started
            //pause until the AHWorker is working...
            while (AHWorker.IsBusy == false)
            {
                //spin
            }

            log.TraceEvent(LogLevels.Verbose, (int)AnalyzerEventCode.AnalyzerHandlerEvent, "AnalyzerHandler constructor started its thread.");
        }
Example #10
0
 public static string LoggableDAQProcessingStatus(EventType EH, LMLoggers.LognLM log, LogLevels lvl, object o)
 {
     string s = String.Empty;
     if (o != null)
     {
         string ss = string.Empty;
         if (o is DAQControl)
         {
             DAQControl d = (DAQControl)o;
             ss = d.InstrStatusString(Instruments.Active.FirstActive(), true);
         }
         else if (o is Measurement)
         {
             Measurement m = (Measurement)o;
             ss = DAQControl.MeasStatusString(m);
         }
         s += ss;
     }
     log.TraceEvent(lvl, DAQControl.logid[EH], s);
     return s;  // just in case it could be of further use
 }
Example #11
0
        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];
        }
Example #12
0
 public ExcelPush(LMLoggers.LognLM ctrllog)
 {
     this.ctrllog = ctrllog;
 }
Example #13
0
 public INCCFileInfo(LMLoggers.LognLM logger)
 {
     mlogger = logger;
 }
Example #14
0
 /*============================================================================
 *
 * function name: SRControl() et al. from takedata.cpp
 *
 * purpose: acquire a set of shift register data (measurement).
 *
 * return value: SUCCESS/FAIL/MEAS_ABORTED/SR_FAIL/CHECKSUM_FAIL/ACC_SNGL_FAIL
 *
 * special notes: 
 *
 * revision history:
 *
 *  date	author		revision
 *  ----	------		--------
 *  12/09/93	Bill Harker	created
 *  03/29/11 Frank Black reimplemented in C#
 *============================================================================*/
 public SRControl(int identifyingNumber, LMLoggers.LognLM log, Measurement meas, Detector det)
 {
     this.log = log;
     this.identifyingNumber = identifyingNumber;
     LastSRStatus = sr_h.SR_SUCCESS;
     LastMeasStatus = SR.SUCCESS;
     SaveOnTerminate = true;
     this.meas = meas;
     this.detector = det;
 }
Example #15
0
        // SemaphoreSlim pendingCompletion;
        #endregion

        #region Constructors

        public SRTakeDataHandler(LMLoggers.LognLM logger)
        {
            this.logger = logger;
            // this.pendingCompletion = new SemaphoreSlim(0, 1);
            threads = new Dictionary<DataSourceIdentifier, SRControlThread>();
        }
Example #16
0
 public SRControlThread(int count, LMLoggers.LognLM log, Measurement meas, Detector det)
 {
     op = SROp.Nothing;
     SRCtrl = new SRControl(count, log, meas, det);
     opgate = new ManualResetEventSlim(false);
     callwait = new ManualResetEventSlim(false);
     cts = new CancellationTokenSource();
 }
Example #17
0
 public void SetLogger(LMLoggers.LognLM analogger)
 {
     logger = analogger;
 }
Example #18
0
 public INCCKnew(LMLoggers.LognLM logger)
 {
     mlogger = logger;
 }
Example #19
0
 public LMLoggers.LognLM Logger(LMLoggers.AppSection wp)
 {
     if (loggers != null)
         return loggers.Logger(wp);
     else
         return null;
 }
Example #20
0
 public INCCFileOrFolderInfo(LMLoggers.LognLM logger, string searchPattern = "")
     : base(logger)
 {
     this.searchPattern = searchPattern;
 }
Example #21
0
 // dev note: pre-define template somewhere, and use it, having the very nice graph already prepared for line by line updating here
 public ExcelPush(string existingWB, LMLoggers.LognLM ctrllog)
 {
     this.ctrllog = ctrllog;
 }
Example #22
0
        public bool Initialize(Config cfg)
        {
            this.cfg = cfg;
            bool good = cfg.ParseCommandShellArgs();// override defaults and stored config values with flags from the command line
            if (good)
            {
                cfg.CmdLineActionOverride(); // override default file input setting with active command action (if any) from cmd line
                name = Config.AppName;
                Opstate.Action = (NCCAction)cfg.Cur.Action;  // command line flag can set this, the override above makes sure the cmd line is the state

                loggers = new LMLoggers(cfg);
                pest.logger = Logger(LMLoggers.AppSection.DB);
            }
            return good;
        }
Example #23
0
 public override void Init(LMLoggers.LognLM datalogger, LMLoggers.LognLM alogger)
 {
     base.Init(datalogger, alogger);
 }
Example #24
0
 public virtual void Init(LMLoggers.LognLM datalogger, LMLoggers.LognLM alogger)
 {
     //cfg = config;
     this.logger = datalogger;
     this.analogger = alogger;
     state.logger = datalogger;
 }
Example #25
0
        public AnalyzerHandler(double theTicSizeInSeconds, LMLoggers.LognLM logger)
        {

            ticSizeInSeconds = theTicSizeInSeconds;
            log = logger;
            verboseTrace = log.ShouldTrace(LogLevels.Verbose);
            numNeutronEventsReceived = 0;
            numNeutronEventsReceivedWhetherProcessedOrNot = 0;
            numNeutronEventsCompleted = 0;
            numCircuits = 0;
            timeOfLastNeutronEvent = 0;
            if (ticSizeInSeconds == 1e-7)
            {
                timeBaseConversion = 1ul;  // no external to internal conversion
            }
            else if (ticSizeInSeconds == 1e-8)
            {
                timeBaseConversion = 10ul; // shift gate units from tics (1e-7) to shakes (1e-8)
            }

#if USE_SPINTIME
            ResetSpinTime();
#endif
            //create stack of RawAnalysisProperties.circularListBlockIncrement neutron events, as a starting point
            InitializeEventList();

            permissionToUseEndOfEvents = new SemaphoreSlim(1, 1); // LMKV-52 fix: create here with counter set at 1 and only 1 thread

            //set up the AH BackgroundWorker
            AHWorkerStopNow = false;
            AHWorkerHasCompleted = false;
            AHWorkerStopAtEndOfEvents = false;
            AHWorker = new BackgroundWorker();
            AHWorker.WorkerSupportsCancellation = false;  //parent will stop the worker with the boolean flags
            AHWorker.DoWork += new DoWorkEventHandler(AHWorkerDoWork);
            AHWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(AHWorkerRunWorkerCompleted);
            AHWorker.RunWorkerAsync();

            // permissionToUseEndOfEventsRelease();  // LMKV-52 fix: allow 1 thread at a time now that bkg worker started
            //pause until the AHWorker is working...
            while (AHWorker.IsBusy == false)
            {
                //spin
            }

            log.TraceEvent(LogLevels.Verbose, (int)AnalyzerEventCode.AnalyzerHandlerEvent, "AnalyzerHandler constructor started its thread.");
        }
Example #26
0
 public SimpleReport(LMLoggers.LognLM ctrllog)
 {
     this.ctrllog = ctrllog;
 }
Example #27
0
        public bool Initialize(Config cfg)
        {
            this.cfg = cfg;
            bool good = cfg.ParseCommandShellArgs();// override defaults and stored config values with flags from the command line     
            if (good)
            {
                cfg.CmdLineActionOverride(); // override default file input setting with active command action (if any) from cmd line
                name = Config.AppName;
                Opstate.Action = (NCCAction)cfg.Cur.Action;  // command line flag can set this, the override above makes sure the cmd line is the state

                loggers = new LMLoggers(cfg);
                pest.logger = Logger(LMLoggers.AppSection.DB);

                if (!String.IsNullOrEmpty(cfg.Cur.Detector) && !cfg.Cur.Detector.Equals("Default")) // command line set the value
                    IntegrationHelpers.SetNewCurrentDetector(cfg.Cur.Detector);

            }
            return good;
        }
Example #28
0
        public AnalysisDefs.RateResult GetResult(LMLoggers.LognLM log)
        {
            AnalysisDefs.RateResult result;
            RateAccumulator aBlock;
            UInt32 i, j, blockOffset, index;

            result = new AnalysisDefs.RateResult(RawAnalysisProperties.ChannelCount);

            try
            {
                result.gateWidthInTics = this.gateWidth;
                result.numCompletedGates = this.presentDataZeroGateIndexOffset + this.presentData.numCompletedGates;
                result.neutronsPerGate = new UInt32[result.numCompletedGates];
                result.neutronsPerGatePerChannel = new UInt32[result.numCompletedGates][];

                aBlock = this.gateStack;
                blockOffset = 0;
                //copy data from all but the last block
                while (aBlock.next != null)
                {
                    for (i = 0; i < RawAnalysisProperties.rateGatesPerAccumulator; i++)
                    {
                        index = i + blockOffset;
                        result.neutronsPerGate[index] = aBlock.neutronsPerGate[i];
                        result.neutronsPerGatePerChannel[index] = new UInt32[RawAnalysisProperties.ChannelCount];
                        for (j = 0; j < RawAnalysisProperties.ChannelCount; j++)
                        {
                            result.neutronsPerGatePerChannel[index][j] = aBlock.neutronsPerGatePerChannel[i][j];
                        }
                    }
                    blockOffset += RawAnalysisProperties.rateGatesPerAccumulator;
                    aBlock = aBlock.next;
                }
                //copy data from the last block
                for (i = 0; i < aBlock.numCompletedGates; i++)
                {
                    index = i + blockOffset;
                    result.neutronsPerGate[index] = aBlock.neutronsPerGate[i];
                    result.neutronsPerGatePerChannel[index] = new UInt32[RawAnalysisProperties.ChannelCount];
                    for (j = 0; j < RawAnalysisProperties.ChannelCount; j++)
                    {
                        result.neutronsPerGatePerChannel[index][j] = aBlock.neutronsPerGatePerChannel[i][j];
                    }
                }
            }
            catch (System.OutOfMemoryException oom)
            {
                GC.Collect();
                if (log != null) log.TraceException(oom);
            }
            return (result);
        }
Example #29
0
 public ReportMangler(LMLoggers.LognLM ctrllog)
 {
     this.ctrllog = ctrllog;
     INCCResultsReports = new List<List<string>>();
     TestDataFiles = new List<List<string>>();
 }
Example #30
0
 public Persistence(LMLoggers.LognLM logger, DBConfig cfg)
 {
     this.cfg = cfg;
     this.logger = logger;
     DBMain.pest = this;
 }
Example #31
0
 public MethodResultsReport(LMLoggers.LognLM ctrllog)
     : base(ctrllog)
 {
     INCCResultsReports = new List<List<string>>();
     SelectedReportSections = Array.CreateInstance(typeof(bool), Enum.GetValues(typeof(INCCReportSection)).Length);
     foreach (ValueType v in Enum.GetValues(typeof(INCCReportSection)))
         SelectedReportSections.SetValue(false, (int)v);
 }