Пример #1
0
 public MeasurementLookup(MeasurementMap map)
 {
     map.binaryMap.ForEach(m => binaryMap.Add(m.dnpIndex, m));
     map.analogMap.ForEach(m => analogMap.Add(m.dnpIndex, m));
     map.counterMap.ForEach(m => counterMap.Add(m.dnpIndex, m));
     map.frozenCounterMap.ForEach(m => frozenCounterMap.Add(m.dnpIndex, m));
     map.controlStatusMap.ForEach(m => controlStatusMap.Add(m.dnpIndex, m));
     map.setpointStatusMap.ForEach(m => setpointStatusMap.Add(m.dnpIndex, m));
     map.doubleBitBinaryMap.ForEach(m => doubleBitBinaryMap.Add(m.dnpIndex, m));
 }
Пример #2
0
        /// <summary>
        /// Initializes <see cref="DNP3InputAdapter"/>
        /// </summary>
        public override void Initialize()
        {
            Dictionary <string, string> settings = Settings;
            string setting;
            double pollingInterval;
            double timestampDifferentiation;

            base.Initialize();

            if (!settings.TryGetValue("CommsFilePath", out m_commsFilePath) || string.IsNullOrWhiteSpace(m_commsFilePath))
            {
                throw new ArgumentException("The required commsFile parameter was not specified");
            }

            if (!settings.TryGetValue("MappingFilePath", out m_mappingFilePath) || string.IsNullOrWhiteSpace(m_mappingFilePath))
            {
                throw new ArgumentException("The required mappingFile parameter was not specified");
            }

            if (settings.TryGetValue("PollingInterval", out setting) && double.TryParse(setting, out pollingInterval))
            {
                PollingInterval = pollingInterval;
            }

            m_masterConfig   = ReadConfig <MasterConfiguration>(m_commsFilePath);
            m_measurementMap = ReadConfig <MeasurementMap>(m_mappingFilePath);

            m_soeHandler = new TimeSeriesSOEHandler(new MeasurementLookup(m_measurementMap));
            m_soeHandler.NewMeasurements += OnNewMeasurements;

            // The TimestampDifferentiation property is a passthrough to the m_soeHandler.TimestampDifferentiation,
            // so m_soeHandler must be initialized before reading this property from the connection string
            if (settings.TryGetValue("TimestampDifferentiation", out setting) && double.TryParse(setting, out timestampDifferentiation))
            {
                TimestampDifferentiation = timestampDifferentiation;
            }

            lock (s_adapters)
            {
                // Add adapter to list of available adapters
                s_adapters.Add(this);

                // If no adapter has been designated as the status proxy, might as well be this one
                if ((object)s_statusProxy == null)
                {
                    s_statusProxy = this;
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Initializes <see cref="DNP3InputAdapter"/>
        /// </summary>
        public override void Initialize()
        {
            Dictionary <string, string> settings = Settings;

            base.Initialize();

            settings.TryGetValue("CommsFilePath", out m_commsFilePath);

            if (string.IsNullOrWhiteSpace(m_commsFilePath))
            {
                throw new ArgumentException("The required commsFile parameter was not specified");
            }

            settings.TryGetValue("MappingFilePath", out m_mappingFilePath);

            if (string.IsNullOrWhiteSpace(m_mappingFilePath))
            {
                throw new ArgumentException("The required mappingFile parameter was not specified");
            }

            m_masterConfig   = ReadConfig <MasterConfiguration>(m_commsFilePath);
            m_measurementMap = ReadConfig <MeasurementMap>(m_mappingFilePath);

            m_soeHandler = new TimeSeriesSOEHandler(new MeasurementLookup(m_measurementMap));
            m_soeHandler.NewMeasurements += OnNewMeasurements;

            lock (s_adapters)
            {
                // Add adapter to list of available adapters
                s_adapters.Add(this);

                // If no adapter has been designated as the status proxy, might as well be this one
                if ((object)s_statusProxy == null)
                {
                    s_statusProxy = this;
                }
            }
        }