public DetectorRequestManager(DetectorsDataAccess dataAccess, DetectorsStatusManager statusManager, EventLoggerAccess logger)
     : base (dataAccess, statusManager, logger)
 {
     _logger = logger;
     _dataAccess = dataAccess;
     _dataAccess.DisplayControlUpdateRequest += new DashboardControlUpdateHandler(ProcessControlUpdateRequest);
 }
Beispiel #2
0
        public BusinessManager(DetectorsDataAccess dataAccess, EventLoggerAccess log)
        {
            _dataAccess = dataAccess;
            _log = log;

            _statusManager = new DetectorsStatusManager(dataAccess, log);
            _requestManager = new RequestManager(dataAccess, (StatusManager)_statusManager, log);

            log.LogInfo("Using calibration: " + AppConfiguration.CalibrationMode.ToString());
            if (AppConfiguration.CalibrationMode == AppConfiguration.CalibrationModeEnum.Inline)
                _calibration = new CalibrationInline(log, _dataAccess, _statusManager);
            else if (AppConfiguration.CalibrationMode == AppConfiguration.CalibrationModeEnum.Persistent)
                _calibration = new CalibrationPersistent(log, _dataAccess, _statusManager);
            else if (AppConfiguration.CalibrationMode == AppConfiguration.CalibrationModeEnum.InlineStandstill)
                _calibration = new CalibrationInline(log, _dataAccess, _statusManager);
            _normalize = new NormalizeData(log, dataAccess, _calibration);

            _processThread = Threads.Create(ProcessDataThreadMethod, ref _processEnd, "Business Data thread");
            _processThread.Start();
        }
Beispiel #3
0
 protected virtual void SetupCalibration(EventLoggerAccess log, DetectorsDataAccess dataAccess, DetectorsStatusManager statusManager)
 {
     _dataAccess = dataAccess;
     _logger = log;
     _badDetectorsList = new List<int>();
 }
Beispiel #4
0
 public CalibrationInline(EventLoggerAccess log, DetectorsDataAccess dataAccess, DetectorsStatusManager statusManager)
 {
     SetupCalibration(log, dataAccess, statusManager);
     _DataCollection = new CalibrationDataCollection();
 }
        protected override void SetupCalibration(EventLoggerAccess log, DetectorsDataAccess dataAccess, DetectorsStatusManager statusManager)
        {
            base.SetupCalibration(log, dataAccess, statusManager);

            _statusMgr = statusManager;
            
            _warningMaxNumBadDetectors = Math.Max((int)(AppConfiguration.WarningPercentBadDetectors * dataAccess.Detectors.PixelsPerColumn), 1);
            _errorMaxNumBadDetectors = Math.Max((int)(AppConfiguration.ErrorPercentBadDetectors * dataAccess.Detectors.PixelsPerColumn), 1);
            _contiguousNumBadDetectorsFound = false;

            _allCalibrationDataFound = false;
            _calibrationStorageLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Calibrations");

            _DualDataCollection = new Dictionary<PulseWidth, CalibrationDataCollection>();
            _HighDataCollection = new Dictionary<PulseWidth, CalibrationDataCollection>();
            _LowDataCollection = new Dictionary<PulseWidth, CalibrationDataCollection>();
            //_LowDoseDataCollection = new Dictionary<PulseWidth, CalibrationDataCollection>();

            //foreach (PulseWidth pulseWidth in Enum.GetValues(typeof(PulseWidth)))
            {
                _DualDataCollection.Add(PulseWidth.PulseWidth1, new CalibrationDataCollection());
                _HighDataCollection.Add(PulseWidth.PulseWidth2, new CalibrationDataCollection());
                _LowDataCollection.Add(PulseWidth.PulseWidth3, new CalibrationDataCollection());
                //_LowDoseDataCollection.Add(PulseWidth.PulseWidth3, new CalibrationDataCollection());
            }
            _calibrationLoaded = false;

            _linacEnergyTagUpdated = new AutoResetEvent(false);
            _apcsEnergyValueUpdated = new AutoResetEvent(false);
            _apcsPulseWidthValueUpdated = new AutoResetEvent(false);
            _linacStateTagUpdated = new AutoResetEvent(false);

            //subscribe to tag updates
            _dataAccess.TagUpdate += new PLCTagUpdateHandler(DataAccess_TagUpdate);
            _dataAccess.Apcs.ApcsUpdate += new ApcsUpdateHandler(Apcs_ApcsUpdate);
        }
        public CalibrationPersistent(EventLoggerAccess log, DetectorsDataAccess dataAccess, DetectorsStatusManager statusManager)
        {
            SetupCalibration(log, dataAccess, statusManager);

            ///////////////////
            LoadStoredData();
        }