Ejemplo n.º 1
0
        private static void MapCurrentFlowResidualOutput(Output output)
        {
            Dictionary <string, OutputMeasurement> currentFlowResiduals = m_network.Model.CurrentResidualOutput.ToDictionary(x => x.Key, x => x);

            PerformanceTimer.Reset();
            PerformanceTimer.Start();
            for (int i = 0; i < output.OutputMeta.CurrentFlowMagnitudeResiduals.Length; i++)
            {
                string            magnitudeKey = output.OutputMeta.CurrentFlowMagnitudeResiduals[i].ID.ToString();
                OutputMeasurement magnitude    = null;
                currentFlowResiduals.TryGetValue(magnitudeKey, out magnitude);
                if (magnitude != null)
                {
                    output.OutputData.CurrentFlowMagnitudeResiduals[i] = magnitude.Value;
                }

                string            angleKey = output.OutputMeta.CurrentFlowAngleResiduals[i].ID.ToString();
                OutputMeasurement angle    = null;
                currentFlowResiduals.TryGetValue(angleKey, out angle);
                if (angle != null)
                {
                    output.OutputData.CurrentFlowAngleResiduals[i] = angle.Value;
                }
            }
            PerformanceTimer.Stop();
            m_network.PerformanceMetrics.OutputPreparationExecutionTime += PerformanceTimer.ElapsedTicks;
        }
Ejemplo n.º 2
0
        private static void MapCircuitBreakerStatusOutput(Output output)
        {
            Dictionary <string, OutputMeasurement> circuitBreakerStatuses = new Dictionary <string, OutputMeasurement>();

            foreach (OutputMeasurement measurement in m_network.Model.CircuitBreakerStatusOutput)
            {
                if (!circuitBreakerStatuses.ContainsKey(measurement.Key))
                {
                    circuitBreakerStatuses.Add(measurement.Key, measurement);
                }
            }

            PerformanceTimer.Reset();
            PerformanceTimer.Start();
            for (int i = 0; i < output.OutputMeta.CircuitBreakerStatuses.Length; i++)
            {
                string            key    = output.OutputMeta.CircuitBreakerStatuses[i].ID.ToString();
                OutputMeasurement status = null;
                circuitBreakerStatuses.TryGetValue(key, out status);
                if (status != null)
                {
                    output.OutputData.CircuitBreakerStatuses[i] = status.Value;
                }
            }
            PerformanceTimer.Stop();
            m_network.PerformanceMetrics.OutputPreparationExecutionTime += PerformanceTimer.ElapsedTicks;
        }
Ejemplo n.º 3
0
        public void CreateMeasurement(OutputMeasurement measurement)
        {
            MetaSignal metaSignal = new MetaSignal()
            {
                AnalyticProjectName  = measurement.DevicePrefix,
                AnalyticInstanceName = measurement.DeviceSuffix,
                SignalType           = measurement.SignalType,
                PointTag             = measurement.PointTag,
                Description          = measurement.Description
            };

            string message = new ConnectionStringParser <SettingAttribute>().ComposeConnectionString(metaSignal);

            Subscriber.SendServerCommand((ServerCommand)ECAServerCommand.MetaSignal, message);
        }
Ejemplo n.º 4
0
        //private static void MapSwitchStatusOutput(Output output)
        //{
        //    Dictionary<string, OutputMeasurement> switchStatuses = m_network.Model.SwitchStatusOutput.ToDictionary(x => x.Key, x => x);

        //    for (int i = 0; i < output.OutputMeta.CircuitBreakerStatuses.Length; i++)
        //    {
        //        string key = output.OutputMeta.CircuitBreakerStatuses[i].ID.ToString();
        //        OutputMeasurement status = null;
        //        switchStatuses.TryGetValue(key, out status);
        //        if (status != null)
        //        {
        //            output.OutputData.CircuitBreakerStatuses[i] = status.Value;
        //        }
        //    }
        //}

        private static void MapTopologyProfilingOutput(Output output)
        {
            Dictionary <string, OutputMeasurement> topologyProfiling = m_network.Model.TopologyProfilingOutput.ToDictionary(x => x.Key, x => x);

            PerformanceTimer.Reset();
            PerformanceTimer.Start();
            for (int i = 0; i < output.OutputMeta.TopologyProfilingData.Length; i++)
            {
                string            key  = output.OutputMeta.TopologyProfilingData[i].ID.ToString();
                OutputMeasurement data = null;
                topologyProfiling.TryGetValue(key, out data);
                if (data != null)
                {
                    output.OutputData.TopologyProfilingData[i] = data.Value;
                }
            }
            PerformanceTimer.Stop();
            m_network.PerformanceMetrics.OutputPreparationExecutionTime += PerformanceTimer.ElapsedTicks;
        }
Ejemplo n.º 5
0
        // Some methods for getting text based status should go here.
        #endregion

        #region [ Output Mapping ]

        /// <summary>
        /// Maps the outgoing measurement validation flags to their appropriate output measurements for openECA.
        /// </summary>
        /// <param name="output">The output data frame as provided by openECA.</param>
        private static void MapMeasurementValidationFlagOutput(Output output)
        {
            Dictionary <string, OutputMeasurement> validationFlags = new Dictionary <string, OutputMeasurement>();

            foreach (OutputMeasurement measurement in m_network.Model.MeasurementValidationFlagOutput)
            {
                if (!validationFlags.ContainsKey(measurement.Key))
                {
                    validationFlags.Add(measurement.Key, measurement);
                }
            }

            for (int i = 0; i < output.OutputMeta.MeasurementValidationFlags.Length; i++)
            {
                string            key  = output.OutputMeta.MeasurementValidationFlags[i].ID.ToString();
                OutputMeasurement flag = null;
                validationFlags.TryGetValue(key, out flag);
                if (flag != null)
                {
                    output.OutputData.MeasurementValidationFlags[i] = flag.Value;
                }
            }
        }