示例#1
0
        public IHttpActionResult PutVoltageLevel(int id, VoltageLevel voltageLevel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != voltageLevel.ID)
            {
                return(BadRequest());
            }

            db.Entry(voltageLevel).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VoltageLevelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public VoltageLevelDetailViewModel(object voltageLevel)
 {
     if (voltageLevel != null && voltageLevel is VoltageLevel)
     {
         m_voltageLevel = voltageLevel as VoltageLevel;
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            VoltageLevel voltageLevel = db.VoltageLevels.Find(id);

            db.VoltageLevels.Remove(voltageLevel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
 public ChannelAggregate(long id, long ownerId, string name, VoltageLevel voltageLevelId, DateTime beginDate, DateTime endDate, bool isTransit, bool deleted)
 {
     Id             = id;
     Name           = name;
     VoltageLevelId = voltageLevelId;
     BeginDate      = beginDate;
     EndDate        = endDate;
     Deleted        = deleted;
 }
 public ActionResult Edit([Bind(Include = "ID,Name,Description,Notes")] VoltageLevel voltageLevel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(voltageLevel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(voltageLevel));
 }
        /// <summary>
        /// Saves the input VoltageLevel object to DB
        /// </summary>
        /// <param name="voltageLevel">VoltageLevel object</param>
        public void SaveVoltageLevel(VoltageLevel voltageLevel)
        {
            if (this.Context.VoltageLevels.Any(vl => vl.NominalVoltage == voltageLevel.NominalVoltage && vl.SubstationId == voltageLevel.SubstationId))
            {
                return;
            }

            this.Context.VoltageLevels.InsertOnSubmit(voltageLevel);
            this.Context.SubmitChanges();
        }
示例#7
0
 public ConstantFlowAggregate(long id, long ownerId, string name, double consumption, VoltageLevel voltageLevelId, DateTime beginDate, DateTime endDate, bool isTransit, bool deleted)
 {
     Id             = id;
     Name           = name;
     Сonsumption    = consumption;
     VoltageLevelId = voltageLevelId;
     BeginDate      = beginDate;
     EndDate        = endDate;
     Deleted        = deleted;
 }
示例#8
0
        public IHttpActionResult GetVoltageLevel(int id)
        {
            VoltageLevel voltageLevel = db.VoltageLevels.Find(id);

            if (voltageLevel == null)
            {
                return(NotFound());
            }

            return(Ok(voltageLevel));
        }
示例#9
0
        private void AddVoltageLevelToRetainList()
        {
            MainWindowViewModel mainWindow   = m_networkTree.MainWindow as MainWindowViewModel;
            VoltageLevel        voltageLevel = m_networkElement.Element as VoltageLevel;

            if (!mainWindow.RetainedVoltageLevels.Contains(voltageLevel))
            {
                mainWindow.RetainedVoltageLevels.Add(voltageLevel);
                mainWindow.ActionStatus = $"{voltageLevel.Description} added to retained list.";
            }
        }
示例#10
0
 /// <summary>
 /// Designated constructor method for the <see cref="PhasorBase"/> object.
 /// </summary>
 /// <param name="magnitudeKey">The measurement key which corresponds to the magnitude of the phasor.</param>
 /// <param name="angleKey">The measurement key which corresponds to the  angle of the phasor.</param>
 /// <param name="type">The <see cref="PhasorType"/> of the phasor.</param>
 /// <param name="baseKV">The <see cref="VoltageLevel"/> of the phasor.</param>
 public PhasorBase(string magnitudeKey, string angleKey, PhasorType type, VoltageLevel baseKV)
 {
     m_magnitudeValueWasReported = false;
     m_angleValueWasReported     = false;
     m_magnitude      = 0;
     m_angleInDegrees = 0;
     m_magnitudeKey   = magnitudeKey;
     m_angleKey       = angleKey;
     m_type           = type;
     m_baseKV         = baseKV;
 }
        public ActionResult Create([Bind(Include = "ID,Name,Description,Notes")] VoltageLevel voltageLevel)
        {
            if (ModelState.IsValid)
            {
                db.VoltageLevels.Add(voltageLevel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(voltageLevel));
        }
示例#12
0
        public IHttpActionResult PostVoltageLevel(VoltageLevel voltageLevel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.VoltageLevels.Add(voltageLevel);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = voltageLevel.ID }, voltageLevel));
        }
        // GET: VoltageLevels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VoltageLevel voltageLevel = db.VoltageLevels.Find(id);

            if (voltageLevel == null)
            {
                return(HttpNotFound());
            }
            return(View(voltageLevel));
        }
示例#14
0
        public IHttpActionResult DeleteVoltageLevel(int id)
        {
            VoltageLevel voltageLevel = db.VoltageLevels.Find(id);

            if (voltageLevel == null)
            {
                return(NotFound());
            }

            db.VoltageLevels.Remove(voltageLevel);
            db.SaveChanges();

            return(Ok(voltageLevel));
        }
示例#15
0
        /// <summary>
        /// Attempts to get the <see cref="VoltageLevel"/> enum value for the source kV <paramref name="value"/>.
        /// </summary>
        /// <param name="value">kV value to attempt to find.</param>
        /// <param name="level">Mapped <see cref="VoltageLevel"/> enum value, if found.</param>
        /// <returns>
        /// <c>true</c> if matching <see cref="VoltageLevel"/> enum value is found for specified kV
        /// <paramref name="value"/>; otherwise, <c>false</c>.
        /// </returns>
        public static bool TryGetVoltageLevel(this int value, out VoltageLevel level)
        {
            foreach (KeyValuePair <VoltageLevel, int> kvp in m_voltageLevelMap)
            {
                if (kvp.Value == value)
                {
                    level = kvp.Key;
                    return(true);
                }
            }

            level = default;
            return(false);
        }
        public DodajTrafo(String name, String alias, String desc, float voltage)
        {
            s.name        = name;
            s.description = desc;
            Random r = new Random();

            s.mRID              = 'a' + r.Next(1000).ToString();
            s.aliasName         = alias;
            s.connectivityNodes = new List <ConnectivityNode>();

            s.x             = -1;
            s.y             = -1;
            s.Bays          = new List <Bay>();
            s.Equipments    = new List <Equipment>();
            s.VoltageLevels = new List <VoltageLevel>();



            BaseVoltage bv = new BaseVoltage()
            {
                aliasName           = "sub_-" + s.mRID + "_bv_" + s.aliasName,
                mRID                = "sub_-" + s.mRID + "-_bv_-" + s.mRID,
                name                = "sub_-" + s.mRID + "-_bv_-" + s.name,
                description         = name = "sub_-" + s.mRID + "-_bv_-" + s.description,
                nominalVoltage      = voltage,
                ConductingEquipment = new List <ConductingEquipment>()
            };

            VoltageLevel vl = new VoltageLevel()
            {
                aliasName   = "sub_" + s.mRID + "_vl_" + s.aliasName,
                mRID        = "sub_-" + s.mRID + "-_vl_-" + s.mRID,
                name        = "sub_-" + s.mRID + "-_vl_-" + s.name,
                description = name = "sub_-" + s.mRID + "-_vl_-" + s.description,
                BaseVoltage = bv,
                Bays        = new List <Bay>(),
                Equipments  = new List <Equipment>()
            };

            s.VoltageLevels.Add(vl);
        }
示例#17
0
文件: PhasorBase.cs 项目: kdjones/lse
 /// <summary>
 /// A constructor with default values except for the <see cref="PhasorType"/> and the <see cref="VoltageLevel"/> of the phasor.
 /// </summary>
 /// <param name="type">The <see cref="PhasorType"/> of the phasor.</param>
 /// <param name="baseKV">The <see cref="VoltageLevel"/> of the phasor.</param>
 public PhasorBase(PhasorType type, VoltageLevel baseKV)
     : this("Undefined", "Undefined", type, baseKV)
 {
 }
示例#18
0
 /// <summary>
 /// Gets the voltage level for the specified <see cref="VoltageLevel"/> enum value.
 /// </summary>
 /// <param name="level">Target <see cref="VoltageLevel"/> enum value.</param>
 /// <returns>Voltage level for the specified <paramref name="level"/>.</returns>
 public static int Value(this VoltageLevel level) =>
 m_voltageLevelMap.TryGetValue(level, out int value) ? value : 0;
示例#19
0
        static void Main(string[] args)
        {
            //PhasorMeasurement busAVoltage = new PhasorMeasurement()
            //    {
            //        Type = PhasorType.VoltagePhasor,
            //        BaseKV = new VoltageLevel(1, 230),
            //        Magnitude = 133518.0156,
            //        AngleInDegrees = -2.4644
            //    };
            //PhasorMeasurement busBVoltage = new PhasorMeasurement()
            //{
            //    Type = PhasorType.VoltagePhasor,
            //    BaseKV = new VoltageLevel(1, 230),
            //    Magnitude = 133758.7656,
            //    AngleInDegrees = 2.4317
            //};
            //PhasorMeasurement busCVoltage = new PhasorMeasurement()
            //{
            //    Type = PhasorType.VoltagePhasor,
            //    BaseKV = new VoltageLevel(1, 230),
            //    Magnitude = 133666.7188,
            //    AngleInDegrees = -2.1697
            //};
            //PhasorMeasurement busDVoltage = new PhasorMeasurement()
            //{
            //    Type = PhasorType.VoltagePhasor,
            //    BaseKV = new VoltageLevel(1, 230),
            //    Magnitude = 134102.8125,
            //    AngleInDegrees = 0.0096257
            //};
            //PhasorMeasurement busEVoltage = new PhasorMeasurement()
            //{
            //    Type = PhasorType.VoltagePhasor,
            //    BaseKV = new VoltageLevel(1, 230),
            //    Magnitude = 133088.9688,
            //    AngleInDegrees = -7.2477
            //};
            //PhasorMeasurement busFVoltage = new PhasorMeasurement()
            //{
            //    Type = PhasorType.VoltagePhasor,
            //    BaseKV = new VoltageLevel(1, 230),
            //    Magnitude = 133141.7344,
            //    AngleInDegrees = -6.3372
            //};
            //PhasorMeasurement busGVoltage = new PhasorMeasurement()
            //{
            //    Type = PhasorType.VoltagePhasor,
            //    BaseKV = new VoltageLevel(1, 230),
            //    Magnitude = 133346.1094,
            //    AngleInDegrees = -5.8259
            //};
            //PhasorMeasurement busHVoltage = new PhasorMeasurement()
            //{
            //    Type = PhasorType.VoltagePhasor,
            //    BaseKV = new VoltageLevel(1, 230),
            //    Magnitude = 133492.2969,
            //    AngleInDegrees = -4.6002
            //};
            /////
            /////
            ///// Current
            //PhasorMeasurement busBtoBusAFlow = new PhasorMeasurement()
            //    {
            //        Type = PhasorType.CurrentPhasor,
            //        BaseKV = new VoltageLevel(1, 230)
            //    };
            //PhasorMeasurement busBtoBusCFlow = new PhasorMeasurement()
            //{
            //    Type = PhasorType.CurrentPhasor,
            //    BaseKV = new VoltageLevel(1, 230)
            //};
            //PhasorMeasurement busDtoBusCFlow = new PhasorMeasurement()
            //{
            //    Type = PhasorType.CurrentPhasor,
            //    BaseKV = new VoltageLevel(1, 230)
            //};
            //PhasorMeasurement busDtoBusFFlow = new PhasorMeasurement()
            //{
            //    Type = PhasorType.CurrentPhasor,
            //    BaseKV = new VoltageLevel(1, 230)
            //};
            //PhasorMeasurement busAtoBusEFlow = new PhasorMeasurement()
            //{
            //    Type = PhasorType.CurrentPhasor,
            //    BaseKV = new VoltageLevel(1, 230)
            //};
            //PhasorMeasurement busFtoBusEFlow = new PhasorMeasurement()
            //{
            //    Type = PhasorType.CurrentPhasor,
            //    BaseKV = new VoltageLevel(1, 230)
            //};
            //PhasorMeasurement busAtoBusGFlow = new PhasorMeasurement()
            //{
            //    Type = PhasorType.CurrentPhasor,
            //    BaseKV = new VoltageLevel(1, 230)
            //};
            //PhasorMeasurement busHtoBusGFlow = new PhasorMeasurement()
            //{
            //    Type = PhasorType.CurrentPhasor,
            //    BaseKV = new VoltageLevel(1, 230)
            //};
            //PhasorMeasurement busDtoBusHFlow = new PhasorMeasurement()
            //{
            //    Type = PhasorType.CurrentPhasor,
            //    BaseKV = new VoltageLevel(1, 230)
            //};

            //busBtoBusAFlow.PerUnitComplexPhasor = (busBVoltage.PerUnitComplexPhasor - busAVoltage.PerUnitComplexPhasor) / (new Complex(0.0, 0.01));
            //busBtoBusCFlow.PerUnitComplexPhasor = (busBVoltage.PerUnitComplexPhasor - busCVoltage.PerUnitComplexPhasor) / (new Complex(0.0, 0.06));
            //busDtoBusCFlow.PerUnitComplexPhasor = (busDVoltage.PerUnitComplexPhasor - busCVoltage.PerUnitComplexPhasor) / (new Complex(0.0, 0.06));
            //busDtoBusFFlow.PerUnitComplexPhasor = (busDVoltage.PerUnitComplexPhasor - busFVoltage.PerUnitComplexPhasor) / (new Complex(0.0, 0.01));
            //busAtoBusEFlow.PerUnitComplexPhasor = (busAVoltage.PerUnitComplexPhasor - busEVoltage.PerUnitComplexPhasor) / (new Complex(0.0, 0.005));
            //busFtoBusEFlow.PerUnitComplexPhasor = (busFVoltage.PerUnitComplexPhasor - busEVoltage.PerUnitComplexPhasor) / (new Complex(0.0, 0.005));
            //busAtoBusGFlow.PerUnitComplexPhasor = (busAVoltage.PerUnitComplexPhasor - busGVoltage.PerUnitComplexPhasor) / (new Complex(0.0, 0.005));
            //busHtoBusGFlow.PerUnitComplexPhasor = (busHVoltage.PerUnitComplexPhasor - busGVoltage.PerUnitComplexPhasor) / (new Complex(0.0, 0.01));
            //busDtoBusHFlow.PerUnitComplexPhasor = (busDVoltage.PerUnitComplexPhasor - busHVoltage.PerUnitComplexPhasor) / (new Complex(0.0, 0.01));


            //Console.WriteLine("BusB.BusA: " + busBtoBusAFlow.Magnitude.ToString() + " " + (busBtoBusAFlow.AngleInDegrees).ToString());
            //Console.WriteLine("BusB.BusC: " + busBtoBusCFlow.Magnitude.ToString() + " " + (busBtoBusCFlow.AngleInDegrees).ToString());
            //Console.WriteLine("BusD.BusC: " + busDtoBusCFlow.Magnitude.ToString() + " " + (busDtoBusCFlow.AngleInDegrees).ToString());
            //Console.WriteLine("BusD.BusF: " + busDtoBusFFlow.Magnitude.ToString() + " " + (busDtoBusFFlow.AngleInDegrees).ToString());
            //Console.WriteLine("BusA.BusE: " + busAtoBusEFlow.Magnitude.ToString() + " " + (busAtoBusEFlow.AngleInDegrees).ToString());
            //Console.WriteLine("BusF.BusE: " + busFtoBusEFlow.Magnitude.ToString() + " " + (busFtoBusEFlow.AngleInDegrees).ToString());
            //Console.WriteLine("BusA.BusG: " + busAtoBusGFlow.Magnitude.ToString() + " " + (busAtoBusGFlow.AngleInDegrees).ToString());
            //Console.WriteLine("BusH.BusG: " + busHtoBusGFlow.Magnitude.ToString() + " " + (busHtoBusGFlow.AngleInDegrees).ToString());
            //Console.WriteLine("BusD.BusH: " + busDtoBusHFlow.Magnitude.ToString() + " " + (busDtoBusHFlow.AngleInDegrees).ToString());


            //Network network = Network.DeserializeFromXml(@"\\psf\Home\Documents\mc2\Linear State Estimation\EPG\LinearStateEstimator.OfflineModule\x86\TransmissionLineGraphTestFull4.xml");
            //Network network = Network.DeserializeFromXml(@"\\psf\Home\Documents\mc2\Projects\EPG - WECC SDVCA\Data\July 20, 2014 Test Cases\shunt_test_model.xml");

            //RawMeasurements rawMeasurements = RawMeasurements.DeserializeFromXml(@"\\psf\Home\Documents\mc2\Projects\EPG - WECC SDVCA\Data\July 20, 2014 Test Cases\ShuntSeriesTestCase151.xml");
            //network.Initialize();

            //network.Model.InputKeyValuePairs.Clear();

            //for (int i = 0; i < rawMeasurements.Items.Count(); i++)
            //{
            //    network.Model.InputKeyValuePairs.Add(rawMeasurements.Items[i].Key, Convert.ToDouble(rawMeasurements.Items[i].Value));
            //}

            //network.Model.OnNewMeasurements();

            //Console.WriteLine(network.Model.ComponentList());

            //Dictionary<string, double> receivedMeasurements = network.Model.GetReceivedMeasurements();

            //foreach (KeyValuePair<string, double> keyValuePair in receivedMeasurements)
            //{
            //    Console.WriteLine(keyValuePair.Key + " " + keyValuePair.Value.ToString());
            //}

            //Console.WriteLine(rawMeasurements.Items.Count().ToString());
            //Console.WriteLine(receivedMeasurements.Count.ToString());
            //Console.WriteLine();

            //network.RunNetworkReconstructionCheck();

            //network.Model.DetermineActiveCurrentFlows();
            //network.Model.DetermineActiveCurrentInjections();

            //Console.WriteLine(network.Model.MeasurementInclusionStatusList());

            //network.Model.ResolveToObservedBusses();

            //Console.WriteLine(network.Model.ObservedBusses.Count);

            //foreach (Substation substation in network.Model.Substations)
            //{
            //    Console.WriteLine(substation.Graph.AdjacencyList.ToString());
            //}

            //network.Model.ResolveToSingleFlowBranches();

            //foreach (TransmissionLine transmissionLine in network.Model.TransmissionLines)
            //{
            //    Console.WriteLine();
            //    Console.WriteLine(transmissionLine.Name);
            //    Console.WriteLine("Has at least one flow path: " + transmissionLine.Graph.HasAtLeastOneFlowPath.ToString());
            //    Console.WriteLine(transmissionLine.Graph.DirectlyConnectedAdjacencyList.ToString());
            //    Console.WriteLine(transmissionLine.Graph.SeriesImpedanceConnectedAdjacencyList.ToString());
            //    Console.WriteLine(transmissionLine.Graph.RootNode.ToSubtreeString());
            //    List<SeriesBranchBase> seriesBranches = transmissionLine.Graph.SingleFlowPathBranches;
            //    foreach (SeriesBranchBase seriesBranch in seriesBranches)
            //    {
            //        seriesBranch.ToVerboseString();
            //    }
            //}

            //network.ComputeSystemState();
            //network.Model.ComputeEstimatedCurrentFlows();
            //network.Model.ComputeEstimatedCurrentInjections();

            //TransmissionLine transmissionLine = network.Model.Companies[0].Divisions[0].TransmissionLines[0];

            //foreach (Switch bypassSwitch in transmissionLine.Switches)
            //{
            //    bypassSwitch.IsInDefaultMode = false;
            //    bypassSwitch.ActualState = SwitchingDeviceActualState.Closed;
            //    if (bypassSwitch.InternalID == 1) { bypassSwitch.ActualState = SwitchingDeviceActualState.Closed; }
            //    Console.WriteLine(String.Format("ID:{0} Normally:{1} Actually:{2}", bypassSwitch.InternalID, bypassSwitch.NormalState, bypassSwitch.ActualState));
            //}

            //TransmissionLineGraph graph = new TransmissionLineGraph(transmissionLine);
            //graph.InitializeAdjacencyLists();
            //Console.WriteLine(graph.DireclyConnectedAdjacencyList.ToString());
            //graph.ResolveConnectedAdjacencies();
            //Console.WriteLine(graph.DireclyConnectedAdjacencyList.ToString());
            //Console.WriteLine(graph.SeriesImpedanceConnectedAdjacencyList.ToString());
            //if (graph.HasAtLeastOneFlowPath)
            //{
            //    Console.WriteLine(graph.SeriesImpedanceConnectedAdjacencyList.ToString());
            //    graph.InitializeTree();
            //    Console.WriteLine(graph.RootNode.ToSubtreeString());
            //    Console.WriteLine("Number of series branches: " + graph.SingleFlowPathBranches.Count);
            //    Console.WriteLine(graph.ResolveToSingleSeriesBranch().RawImpedanceParameters.ToString());
            //}
            //else
            //{
            //    Console.WriteLine("Graph does not have at least one flow path -> tree would be invalid!");
            //}
            //SequencedMeasurementSnapshotPathSet sequencedMeasurementSnapshotPathSet = new SequencedMeasurementSnapshotPathSet();
            //sequencedMeasurementSnapshotPathSet.MeasurementSnapshotPaths.Add(new MeasurementSnapshotPath("value"));

            //sequencedMeasurementSnapshotPathSet.SerializeToXml("\\\\psf\\Home\\Documents\\mc2\\Projects\\EPG - WECC SDVCA\\Data\\TestCases.xml");
            CsvFileWithHeader coFile = new CsvFileWithHeader("U:\\Documents\\Projects\\02 Linear State Estimator\\EMS to LSE\\lse_co.out");
            CsvFileWithHeader dvFile = new CsvFileWithHeader("U:\\Documents\\Projects\\02 Linear State Estimator\\EMS to LSE\\lse_dv.out");
            CsvFileWithHeader stFile = new CsvFileWithHeader("U:\\Documents\\Projects\\02 Linear State Estimator\\EMS to LSE\\lse_st.out");
            CsvFileWithHeader ndFile = new CsvFileWithHeader("U:\\Documents\\Projects\\02 Linear State Estimator\\EMS to LSE\\lse_nd.out");

            List <double> nodeBaseKvs  = new List <double>();
            NetworkModel  networkModel = new NetworkModel();


            foreach (Dictionary <string, string> node in ndFile.StructuredData)
            {
                if (!nodeBaseKvs.Contains(Convert.ToDouble(node["id_kv"].TrimEnd('\'').TrimStart('\''))))
                {
                    nodeBaseKvs.Add(Convert.ToDouble(node["id_kv"].TrimEnd('\'').TrimStart('\'')));
                }
            }
            nodeBaseKvs.Sort();
            for (int i = 0; i < nodeBaseKvs.Count; i++)
            {
                networkModel.VoltageLevels.Add(new VoltageLevel(i + 1, nodeBaseKvs[i]));
            }

            foreach (Dictionary <string, string> row in coFile.StructuredData)
            {
                Company company = new Company()
                {
                    InternalID = Convert.ToInt32(row["%SUBSCRIPT"]),
                    Number     = Convert.ToInt32(row["%SUBSCRIPT"]),
                    Name       = row["id_area"],
                    Acronym    = row["id_area"],
                };
                networkModel.Companies.Add(company);

                foreach (Dictionary <string, string> divisionRecord in dvFile.StructuredData)
                {
                    if (company.Number == Convert.ToInt32(divisionRecord["i$area_dv"]))
                    {
                        Division division = new Division()
                        {
                            InternalID = Convert.ToInt32(divisionRecord["%SUBSCRIPT"]),
                            Number     = Convert.ToInt32(divisionRecord["%SUBSCRIPT"]),
                            Name       = divisionRecord["id_dv"],
                            Acronym    = divisionRecord["id_dv"],
                        };
                        company.Divisions.Add(division);

                        foreach (Dictionary <string, string> substationRecord in stFile.StructuredData)
                        {
                            if (division.Name == substationRecord["id_dv"])
                            {
                                Substation substation = new Substation()
                                {
                                    InternalID = Convert.ToInt32(substationRecord["%SUBSCRIPT"]),
                                    Number     = Convert.ToInt32(substationRecord["%SUBSCRIPT"]),
                                    Acronym    = substationRecord["id_st"],
                                    Name       = substationRecord["id_st"]
                                };
                                division.Substations.Add(substation);

                                foreach (Dictionary <string, string> nodeRecord in ndFile.StructuredData)
                                {
                                    if (substation.Name == nodeRecord["id_st"])
                                    {
                                        double       baseKvValue = Convert.ToDouble(nodeRecord["id_kv"].TrimEnd('\'').TrimStart('\''));
                                        VoltageLevel baseKv      = new VoltageLevel(1, 999);
                                        foreach (VoltageLevel voltageLevel in networkModel.VoltageLevels)
                                        {
                                            if (voltageLevel.Value == baseKv.Value)
                                            {
                                                baseKv = voltageLevel;
                                            }
                                        }
                                        Node node = new Node()
                                        {
                                            InternalID  = Convert.ToInt32(nodeRecord["%SUBSCRIPT"]),
                                            Number      = Convert.ToInt32(nodeRecord["%SUBSCRIPT"]),
                                            Acronym     = nodeRecord["id_nd"],
                                            Name        = nodeRecord["id_st"] + "_" + nodeRecord["id_nd"],
                                            Description = nodeRecord["id_st"] + " " + nodeRecord["id_kv"] + "kV Node " + nodeRecord["id_nd"],
                                            BaseKV      = baseKv
                                        };

                                        VoltagePhasorGroup voltage = new VoltagePhasorGroup()
                                        {
                                            InternalID  = node.InternalID,
                                            Number      = node.Number,
                                            Acronym     = "V " + node.InternalID.ToString(),
                                            Name        = "Phasor Name",
                                            Description = "Voltage Phasor Group Description",
                                            IsEnabled   = true,
                                            UseStatusFlagForRemovingMeasurements = true,
                                            MeasuredNode = node
                                        };

                                        voltage.ZeroSequence.Measurement.BaseKV     = node.BaseKV;
                                        voltage.ZeroSequence.Estimate.BaseKV        = node.BaseKV;
                                        voltage.NegativeSequence.Measurement.BaseKV = node.BaseKV;
                                        voltage.NegativeSequence.Estimate.BaseKV    = node.BaseKV;
                                        voltage.PositiveSequence.Measurement.BaseKV = node.BaseKV;
                                        voltage.PositiveSequence.Estimate.BaseKV    = node.BaseKV;
                                        voltage.PhaseA.Measurement.BaseKV           = node.BaseKV;
                                        voltage.PhaseA.Estimate.BaseKV    = node.BaseKV;
                                        voltage.PhaseB.Measurement.BaseKV = node.BaseKV;
                                        voltage.PhaseB.Estimate.BaseKV    = node.BaseKV;
                                        voltage.PhaseC.Measurement.BaseKV = node.BaseKV;
                                        voltage.PhaseC.Estimate.BaseKV    = node.BaseKV;

                                        node.Voltage = voltage;

                                        substation.Nodes.Add(node);
                                    }
                                }
                            }
                        }
                    }
                }
            }



            Network network = new Network(networkModel);

            network.SerializeToXml("U:\\ems.xml");

            Console.ReadLine();
        }
示例#20
0
 private static void DeleteVoltageLevel(VoltageLevel voltageLevel, List <VoltageLevel> parent)
 {
     parent.Remove(voltageLevel);
 }
示例#21
0
 /// <summary>
 /// The designated constructor for the <see cref="LinearStateEstimator.Measurements.PhasorEstimate"/> class.
 /// </summary>
 /// <param name="magnitudeKey">The openPDC input measurement key for the <see cref="LinearStateEstimator.Measurements.PhasorBase.Magnitude"/> of the <see cref="LinearStateEstimator.Measurements.PhasorEstimate"/>.</param>
 /// <param name="angleKey">The openPDC input measurement key for the <see cref="LinearStateEstimator.Measurements.PhasorBase.Magnitude"/> of the <see cref="LinearStateEstimator.Measurements.PhasorEstimate"/>.</param>
 /// <param name="type">Specifies whether the phasor measurement is a current phasor or a voltage phasor  or complex power with the <see cref="LinearStateEstimator.Measurements.PhasorType"/> enumeration, either <see cref="LinearStateEstimator.Measurements.PhasorType.VoltagePhasor"/>, <see cref="LinearStateEstimator.Measurements.PhasorType.CurrentPhasor"/>, or <see cref="LinearStateEstimator.Measurements.PhasorType.ComplexPower"/>.</param>
 /// <param name="baseKV">The <see cref="LinearStateEstimator.Modeling.VoltageLevel"/> of the phasor measurement.</param>
 public PhasorEstimate(string magnitudeKey, string angleKey, PhasorType type, VoltageLevel baseKV)
     : base(magnitudeKey, angleKey, type, baseKV)
 {
 }
示例#22
0
 /// <summary>
 /// The designated constructor for the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/> class.
 /// </summary>
 /// <param name="magnitudeKey">The openPDC input measurement key for the <see cref="LinearStateEstimator.Measurements.PhasorBase.Magnitude"/> of the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/>.</param>
 /// <param name="angleKey">The openPDC input measurement key for the <see cref="LinearStateEstimator.Measurements.PhasorBase.AngleInDegrees"/> of the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/>.</param>
 /// <param name="type">Specifies whether the phasor measurement is a current phasor or a
 /// voltage phasor  or complex power with the <see cref="LinearStateEstimator.Measurements.PhasorType"/> enumeration, either <see cref="LinearStateEstimator.Measurements.PhasorType.VoltagePhasor"/>,
 /// <see cref="LinearStateEstimator.Measurements.PhasorType.CurrentPhasor"/>, or <see cref="LinearStateEstimator.Measurements.PhasorType.ComplexPower"/>.</param>
 /// <param name="baseKV">The <see cref="LinearStateEstimator.Modeling.VoltageLevel"/> of the phasor measurement.</param>
 /// <param name="variance">The measurement variance in per unit.</param>
 /// <param name="rcf">The <b>Ratio Correction Factor (RCF)</b> for the measurement.</param>
 /// <param name="pacf">The <b>Phase Angle Correction Factor (PACF)</b> for the measurement in degrees.</param>
 /// <param name="calibrationSetting">The <see cref="LinearStateEstimator.Calibration.CalibrationSetting"/> type for the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/>. Determines how the measurement is included in the calibration algorithm.</param>
 public PhasorMeasurement(string magnitudeKey, string angleKey, PhasorType type, VoltageLevel baseKV, double variance, double rcf, double pacf, CalibrationSetting calibrationSetting)
     : base(magnitudeKey, angleKey, type, baseKV)
 {
     m_measurementVariance = variance;
     m_rcf  = rcf;
     m_pacf = pacf;
     m_calibrationSetting = calibrationSetting;
 }
示例#23
0
 /// <summary>
 /// A constructor for the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/> which specifies the measurement keys, phasor type, base KV, measurement variance as well as RCF and PACF.
 /// </summary>
 /// <param name="magnitudeKey">The openPDC input measurement key for the <see cref="LinearStateEstimator.Measurements.PhasorBase.Magnitude"/> of the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/>.</param>
 /// <param name="angleKey">The openPDC input measurement key for the <see cref="LinearStateEstimator.Measurements.PhasorBase.AngleInDegrees"/> of the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/>.</param>
 /// <param name="type">Specifies whether the phasor measurement is a current phasor or a
 /// voltage phasor  or complex power with the <see cref="LinearStateEstimator.Measurements.PhasorType"/> enumeration, either <see cref="LinearStateEstimator.Measurements.PhasorType.VoltagePhasor"/>,
 /// <see cref="LinearStateEstimator.Measurements.PhasorType.CurrentPhasor"/>, or <see cref="LinearStateEstimator.Measurements.PhasorType.ComplexPower"/>.</param>
 /// <param name="baseKV">The <see cref="LinearStateEstimator.Modeling.VoltageLevel"/> of the phasor measurement.</param>
 /// <param name="variance">The measurement variance in per unit.</param>
 /// <param name="rcf">The <b>Ratio Correction Factor (RCF)</b> for the measurement.</param>
 /// <param name="pacf">The <b>Phase Angle Correction Factor (PACF)</b> for the measurementin degrees</param>
 public PhasorMeasurement(string magnitudeKey, string angleKey, PhasorType type, VoltageLevel baseKV, double variance, double rcf, double pacf)
     : this(magnitudeKey, angleKey, type, baseKV, variance, rcf, pacf, CalibrationSetting.Inactive)
 {
 }
示例#24
0
 /// <summary>
 /// A constructor for the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/> which only specifies the measurement keys, phasor type, base KV and measurement variance.
 /// </summary>
 /// <param name="magnitudeKey">The openPDC input measurement key for the <see cref="LinearStateEstimator.Measurements.PhasorBase.Magnitude"/> of the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/>.</param>
 /// <param name="angleKey">The openPDC input measurement key for the <see cref="LinearStateEstimator.Measurements.PhasorBase.AngleInDegrees"/> of the <see cref="LinearStateEstimator.Measurements.PhasorMeasurement"/>.</param>
 /// <param name="type">Specifies whether the phasor measurement is a current phasor or a voltage phasor  or complex power with the <see cref="LinearStateEstimator.Measurements.PhasorType"/> enumeration, either <see cref="LinearStateEstimator.Measurements.PhasorType.VoltagePhasor"/>, <see cref="LinearStateEstimator.Measurements.PhasorType.CurrentPhasor"/>, or <see cref="LinearStateEstimator.Measurements.PhasorType.ComplexPower"/>.</param>
 /// <param name="baseKV">The <see cref="LinearStateEstimator.Modeling.VoltageLevel"/> of the phasor measurement.</param>
 /// <param name="variance">The measurement variance in per unit.</param>
 public PhasorMeasurement(string magnitudeKey, string angleKey, PhasorType type, VoltageLevel baseKV, double variance)
     : this(magnitudeKey, angleKey, type, baseKV, variance, 1, 0)
 {
 }
示例#25
0
 /// <summary>
 /// A constructor for the <see cref="SynchrophasorAnalytics.Measurements.PhasorMeasurement"/> which only specifies the measurement keys, phasor type, and base KV.
 /// </summary>
 /// <param name="magnitudeKey">The openPDC input measurement key for the <see cref="SynchrophasorAnalytics.Measurements.PhasorBase.Magnitude"/> of the <see cref="SynchrophasorAnalytics.Measurements.PhasorMeasurement"/>.</param>
 /// <param name="angleKey">The openPDC input measurement key for the <see cref="SynchrophasorAnalytics.Measurements.PhasorBase.AngleInDegrees"/> of the <see cref="SynchrophasorAnalytics.Measurements.PhasorMeasurement"/>.</param>
 /// <param name="type">Specifies whether the phasor measurement is a current phasor or a
 /// voltage phasor  or complex power with the <see cref="SynchrophasorAnalytics.Measurements.PhasorType"/> enumeration, either <see cref="SynchrophasorAnalytics.Measurements.PhasorType.VoltagePhasor"/>,
 /// <see cref="PhasorType.CurrentPhasor"/>, or <see cref="SynchrophasorAnalytics.Measurements.PhasorType.ComplexPower"/>.</param>
 /// <param name="baseKV">The <see cref="SynchrophasorAnalytics.Modeling.VoltageLevel"/> of the phasor measurement.</param>
 public PhasorMeasurement(string magnitudeKey, string angleKey, PhasorType type, VoltageLevel baseKV)
     : base(magnitudeKey, angleKey, type, baseKV)
 {
 }
 public void transistorWrite(TransistorPort port, VoltageLevel level)
 {
 }
示例#27
0
 public DynamicTopologicalNode(ConnectivityNode firstConnectivityNode,VoltageLevel parent, DateTime time)
 {
     nodes.ConnectivityNodes.Add(firstConnectivityNode.Name, firstConnectivityNode);
     name = parent.name + "d" + parent.DynamicTopoNodeCount.ToString();
     parentStaticNode = parent;
     timeIndex = time;
 }
 public void digitalWrite(ArduinoPort port, VoltageLevel level)
 {
 }