Пример #1
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmBasicHAO(AppDirs appDirs, ArchiveConfig archiveConfig)
     : this()
 {
     this.appDirs       = appDirs ?? throw new ArgumentNullException(nameof(appDirs));
     this.archiveConfig = archiveConfig ?? throw new ArgumentNullException(nameof(archiveConfig));
     options            = new BasicHAO(archiveConfig.CustomOptions);
 }
Пример #2
0
        private TrendTable updatedTable;                                // the trend table that is currently being updated


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public BasicHAL(IArchiveContext archiveContext, ArchiveConfig archiveConfig, int[] cnlNums,
                        ModuleConfig moduleConfig) : base(archiveContext, archiveConfig, cnlNums)
        {
            this.moduleConfig = moduleConfig ?? throw new ArgumentNullException(nameof(moduleConfig));
            options           = new BasicHAO(archiveConfig.CustomOptions);
            appLog            = archiveContext.Log;
            arcLog            = options.LogEnabled ? CreateLog(ModuleUtils.ModuleCode) : null;
            stopwatch         = new Stopwatch();
            adapter           = new TrendTableAdapter
            {
                ArchiveCode = Code,
                CnlNumCache = new MemoryCache <long, CnlNumList>(ModuleUtils.CacheExpiration, ModuleUtils.CacheCapacity)
            };
            tableCache    = new MemoryCache <DateTime, TrendTable>(ModuleUtils.CacheExpiration, ModuleUtils.CacheCapacity);
            slice         = new Slice(DateTime.MinValue, cnlNums);
            writingPeriod = GetPeriodInSec(options.WritingPeriod, options.WritingUnit);

            nextWriteTime = DateTime.MinValue;
            cnlIndexes    = null;
            cnlNumList    = new CnlNumList(cnlNums);
            currentTable  = null;
            updatedTable  = null;
        }
Пример #3
0
        private TrendTable updatedTable;                                // the trend table that is currently being updated


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public BasicHAL(IArchiveContext archiveContext, ArchiveConfig archiveConfig, int[] cnlNums)
            : base(archiveContext, archiveConfig, cnlNums)
        {
            options   = new BasicHAO(archiveConfig.CustomOptions);
            appLog    = archiveContext.Log;
            arcLog    = options.LogEnabled ? CreateLog(ModuleUtils.ModuleCode) : null;
            stopwatch = new Stopwatch();
            adapter   = new TrendTableAdapter
            {
                ParentDirectory = Path.Combine(archiveContext.AppConfig.PathOptions.GetArcDir(options.IsCopy), Code),
                ArchiveCode     = Code,
                CnlNumCache     = new MemoryCache <long, CnlNumList>(ModuleUtils.CacheExpiration, ModuleUtils.CacheCapacity)
            };
            tableCache    = new MemoryCache <DateTime, TrendTable>(ModuleUtils.CacheExpiration, ModuleUtils.CacheCapacity);
            slice         = new Slice(DateTime.MinValue, cnlNums);
            writingPeriod = GetPeriodInSec(options.WritingPeriod, options.WritingUnit);

            nextWriteTime = DateTime.MinValue;
            cnlIndexes    = null;
            cnlNumList    = new CnlNumList(cnlNums);
            currentTable  = null;
            updatedTable  = null;
        }