Пример #1
0
        public Frame()
        {
            m_measurementsList = new List <VIMeasurement>();
            VIMeasurement Measurement_temp = new VIMeasurement();

            m_measurementsList.Add(Measurement_temp);

            /*m_measurementsDict = new Dictionary<string, double>();
             * string TKey = "Start";
             * double TValue = 0.00;
             * m_measurementsDict.Add(TKey, TValue);*/
        }
Пример #2
0
        //public void AddMeasurementToFrameDictionary(Measurement MeasuredResult)
        //{
        //    //m_measuredResults = new Dictionary<string, double>();
        //    //Measurement MeasuredResult = new Measurement();
        //    string TKey = "L" + MeasuredResult.LineNumber.ToString() +
        //        "B" + MeasuredResult.BusNumber.ToString() +
        //        "T" + MeasuredResult.TypeMeasured;

        //    try
        //    {
        //        m_measurementsDict.Add(TKey, MeasuredResult.ValueMeasured);
        //    }
        //    catch (Exception exception)
        //    {
        //        //throw new Exception("Failed to Add Measurement to Frame");
        //        Console.WriteLine("Failed to Add Measurement to Frame");
        //    }

        //}

        public void AddMeasurementToFrame(VIMeasurement MeasurementResult)
        {
            try
            {
                if (m_measurementsList[0].LineNumber == 0)
                {
                    m_measurementsList[0] = MeasurementResult;
                }
                else
                {
                    m_measurementsList.Add(MeasurementResult);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                Console.WriteLine("Need to be fixed.");
            }
        }
Пример #3
0
        public void openECADataIntegration(openECARawDataSet openECADataStreams)
        {
            int Frame_number       = openECADataStreams.RawDataSet.Count;
            int Measurement_number = openECADataStreams.RawDataSet[0].Measurements.Count();

            for (int idx0 = 0; idx0 < Frame_number; idx0++) // select raw measurements by frame
            {
                Frame CurrentFrame = new Frame();
                CurrentFrame.TimeStamp = idx0 + 1;
                Measurement_set CurrentMeasurementSet = openECADataStreams.RawDataSet[idx0];

                for (int idx1 = 0; idx1 < Measurement_number; idx1++) // find measuremnents line by line
                {
                    int CurrentLineNumber    = m_network.LineBusInfo[idx1, 0];
                    int CurrentFromBusNumber = m_network.LineBusInfo[idx1, 1];
                    int CurrentToBusNumber   = m_network.LineBusInfo[idx1, 2];

                    //From bus voltage Mag and Ang
                    VIMeasurement CurrentMeasurementV1M = new VIMeasurement();
                    CurrentMeasurementV1M.ValueMeasured = CurrentMeasurementSet.Measurements[idx1].From_bus.Voltage.Magnitude;
                    CurrentMeasurementV1M.TypeMeasured  = VIMeasurementType.PositiveSequenceVoltageMagnitude;
                    CurrentMeasurementV1M.LineNumber    = CurrentLineNumber;
                    CurrentMeasurementV1M.BusNumber     = CurrentFromBusNumber;

                    VIMeasurement CurrentMeasurementV1A = new VIMeasurement();
                    CurrentMeasurementV1A.ValueMeasured = CurrentMeasurementSet.Measurements[idx1].From_bus.Voltage.Angle;
                    CurrentMeasurementV1A.TypeMeasured  = VIMeasurementType.PositiveSequenceVoltageAngle;
                    CurrentMeasurementV1A.LineNumber    = CurrentLineNumber;
                    CurrentMeasurementV1A.BusNumber     = CurrentFromBusNumber;

                    //From bus current Mag and Ang
                    VIMeasurement CurrentMeasurementI1M = new VIMeasurement();
                    CurrentMeasurementI1M.ValueMeasured = CurrentMeasurementSet.Measurements[idx1].From_bus.Current.Magnitude;
                    CurrentMeasurementI1M.TypeMeasured  = VIMeasurementType.PositiveSequenceCurrentMagnitude;
                    CurrentMeasurementI1M.LineNumber    = CurrentLineNumber;
                    CurrentMeasurementI1M.BusNumber     = CurrentFromBusNumber;

                    VIMeasurement CurrentMeasurementI1A = new VIMeasurement();
                    CurrentMeasurementI1A.ValueMeasured = CurrentMeasurementSet.Measurements[idx1].From_bus.Current.Angle;
                    CurrentMeasurementI1A.TypeMeasured  = VIMeasurementType.PositiveSequenceCurrentAngle;
                    CurrentMeasurementI1A.LineNumber    = CurrentLineNumber;
                    CurrentMeasurementI1A.BusNumber     = CurrentFromBusNumber;

                    //To bus voltage Mag and Ang
                    VIMeasurement CurrentMeasurementV2M = new VIMeasurement();
                    CurrentMeasurementV2M.ValueMeasured = CurrentMeasurementSet.Measurements[idx1].To_bus.Voltage.Magnitude;
                    CurrentMeasurementV2M.TypeMeasured  = VIMeasurementType.PositiveSequenceVoltageMagnitude;
                    CurrentMeasurementV2M.LineNumber    = CurrentLineNumber;
                    CurrentMeasurementV2M.BusNumber     = CurrentToBusNumber;

                    VIMeasurement CurrentMeasurementV2A = new VIMeasurement();
                    CurrentMeasurementV2A.ValueMeasured = CurrentMeasurementSet.Measurements[idx1].To_bus.Voltage.Angle;
                    CurrentMeasurementV2A.TypeMeasured  = VIMeasurementType.PositiveSequenceVoltageAngle;
                    CurrentMeasurementV2A.LineNumber    = CurrentLineNumber;
                    CurrentMeasurementV2A.BusNumber     = CurrentToBusNumber;

                    //To bus current Mag and Ang
                    VIMeasurement CurrentMeasurementI2M = new VIMeasurement();
                    CurrentMeasurementI2M.ValueMeasured = CurrentMeasurementSet.Measurements[idx1].To_bus.Current.Magnitude;
                    CurrentMeasurementI2M.TypeMeasured  = VIMeasurementType.PositiveSequenceCurrentMagnitude;
                    CurrentMeasurementI2M.LineNumber    = CurrentLineNumber;
                    CurrentMeasurementI2M.BusNumber     = CurrentToBusNumber;

                    VIMeasurement CurrentMeasurementI2A = new VIMeasurement();
                    CurrentMeasurementI2A.ValueMeasured = CurrentMeasurementSet.Measurements[idx1].To_bus.Current.Angle;
                    CurrentMeasurementI2A.TypeMeasured  = VIMeasurementType.PositiveSequenceCurrentAngle;
                    CurrentMeasurementI2A.LineNumber    = CurrentLineNumber;
                    CurrentMeasurementI2A.BusNumber     = CurrentToBusNumber;

                    if (CurrentFrame.MeasurementsList[0].ValueMeasured == 0)
                    {
                        CurrentFrame.MeasurementsList[0] = CurrentMeasurementV1M;
                    }
                    else
                    {
                        CurrentFrame.MeasurementsList.Add(CurrentMeasurementV1M);
                    }
                    CurrentFrame.MeasurementsList.Add(CurrentMeasurementV1A);
                    CurrentFrame.MeasurementsList.Add(CurrentMeasurementI1M);
                    CurrentFrame.MeasurementsList.Add(CurrentMeasurementI1A);
                    CurrentFrame.MeasurementsList.Add(CurrentMeasurementV2M);
                    CurrentFrame.MeasurementsList.Add(CurrentMeasurementV2A);
                    CurrentFrame.MeasurementsList.Add(CurrentMeasurementI2M);
                    CurrentFrame.MeasurementsList.Add(CurrentMeasurementI2A);
                }

                AddFrameToTimeSeriesFrames(CurrentFrame);
            }
        }