Exemple #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;
        }
Exemple #2
0
        private int[] cnlIndexes;                   // the channel mapping indexes


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

            hasError      = false;
            conn          = null;
            thread        = null;
            terminated    = false;
            nextWriteTime = DateTime.MinValue;
            cnlIndexes    = null;
        }