Exemplo n.º 1
0
        private Dictionary <int, CnlData> updatedCnlData; // holds recently updated channel data


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public PostgreHAL(IArchiveContext archiveContext, ArchiveConfig archiveConfig, int[] cnlNums,
                          ModuleConfig moduleConfig) : base(archiveContext, archiveConfig, cnlNums)
        {
            this.moduleConfig = moduleConfig ?? throw new ArgumentNullException(nameof(moduleConfig));
            archiveOptions    = new PostgreHAO(archiveConfig.CustomOptions);
            appLog            = archiveContext.Log;
            arcLog            = archiveOptions.LogEnabled ? CreateLog(ModuleUtils.ModuleCode) : null;
            stopwatch         = new Stopwatch();
            queryBuilder      = new QueryBuilder(Code);
            pointQueue        = new PointQueue(FixQueueSize(), queryBuilder.InsertHistoricalDataQuery)
            {
                ReturnOnError = true,
                ArchiveCode   = Code,
                AppLog        = appLog,
                ArcLog        = arcLog
            };
            writingPeriod = GetPeriodInSec(archiveOptions.WritingPeriod, archiveOptions.WritingUnit);

            hasError       = false;
            conn           = null;
            thread         = null;
            terminated     = false;
            nextWriteTime  = DateTime.MinValue;
            cnlIndexes     = null;
            prevCnlData    = null;
            updateTime     = DateTime.MinValue;
            updatedCnlData = null;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmPostgreHAO(AppDirs appDirs, ArchiveConfig archiveConfig)
     : this()
 {
     this.appDirs       = appDirs ?? throw new ArgumentNullException(nameof(appDirs));
     this.archiveConfig = archiveConfig ?? throw new ArgumentNullException(nameof(archiveConfig));
     options            = new PostgreHAO(archiveConfig.CustomOptions);
 }