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; }
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; }
public static void Main(string[] args) { RunPuzzleA(); Console.WriteLine("Press any key to begin Puzzle B"); Console.Read(); PerformanceTimer.Reset(); RunPuzzleB(); }
private static void MapInput(Input inputData, _InputMeta inputMeta) { PerformanceTimer.Reset(); PerformanceTimer.Start(); MapVoltagePhasorInput(inputData, inputMeta); MapCurrentPhasorInput(inputData, inputMeta); MapStatusWordInput(inputData, inputMeta); MapDigitalsInput(inputData, inputMeta); PerformanceTimer.Stop(); m_network.PerformanceMetrics.ParsingExecutionTime = PerformanceTimer.ElapsedTicks; }
//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; }