Beispiel #1
0
        void MonitorData(MonitoredMeasurement measurement, DataValue NewValue)
        {
            OpcMetric metric = new OpcMetric();

            metric.Timestamp   = NewValue.SourceTimestamp;
            metric.OpcValue    = NewValue.WrappedValue.Value;
            metric.Opcstatus   = NewValue.StatusCode.ToString();
            metric.Measurement = (MeasurementDto)measurement;

            l_metricCollection.Add(metric);
        }
Beispiel #2
0
        void InitializeMeasurements()
        {
            MonitoredMeasurements = new List <MonitoredMeasurement>();
            PolledMeasurements    = new List <PolledMeasurement>();
            foreach (MeasurementConfig item in l_opcDaPluginConfig.Measurements)
            {
                Dictionary <string, string> tags = null;
                if (!item.Tags.Equals(""))
                {
                    tags = item.Tags.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
                           .Select(part => part.Split(':'))
                           .ToDictionary(split => split[0], split => split[1]);
                }
                switch (item.CollectionType)
                {
                case "monitored":

                    var monitoredpoint = new MonitoredMeasurement()
                    {
                        Name = item.Name,
                        Path = item.Path,
                        MonitorResolution = item.MonitorResolution > 0 ? item.MonitorResolution : 0,
                        DeadbandAbsolute  = item.DeadbandAbsolute > 0 ? item.DeadbandAbsolute : 0,
                        DeadbandRelative  = item.DeadbandRelative > 0 ? item.DeadbandRelative : 0,
                        DataType          = item.DataType,
                        Tags = tags
                    };

                    MonitoredMeasurements.Add(monitoredpoint);
                    break;

                case "polled":
                    var polledPoint = new PolledMeasurement()
                    {
                        Name             = item.Name,
                        Path             = item.Path,
                        DeadbandAbsolute = item.DeadbandAbsolute > 0 ? item.DeadbandAbsolute : 0,
                        DeadbandRelative = item.DeadbandRelative > 0 ? item.DeadbandRelative : 0,
                        PollInterval     = item.PollInterval,
                        DataType         = item.DataType,
                        Tags             = tags
                    };

                    PolledMeasurements.Add(polledPoint);

                    break;

                default:
                    //no collection type, log
                    l_logger.DebugFormat("no collection type at: {0}", item.Name);
                    break;
                }
            }
        }
Beispiel #3
0
        private void MonitorData(MonitoredMeasurement measurement, OpcDa.ItemValueResult p)
        {
            OpcMetric metric = new OpcMetric()
            {
                Timestamp   = p.Timestamp,
                OpcValue    = p.Value,
                Opcstatus   = p.ResultID.ToString(),
                Measurement = (MeasurementDto)measurement
            };

            l_metricCollection.Add(metric);
        }