Electa-Git / PowerModelsDistributionStateEstimation.jl

A Julia Package for Power System State Estimation.
BSD 3-Clause "New" or "Revised" License
32 stars 12 forks source link

Parsing a .m file in State Estimation package #41

Closed gaadis closed 3 years ago

gaadis commented 3 years ago

I'm trying to parse a .m file to use for my state estimation. Is there a way to do it? I don't have access to the .dss files. I tried using data = PowerModels.parse_matpower("C:\Users\Gadis\Dropbox\NMPC\MatPower\data\case33bwMyEdit.m") but it doesn't put it in the right format with the mathematical model for me to add the measurements as well. Any suggestions will be appreciated

Below is the section of the code in State Estimation that I want to manipulate.

ntw_path = joinpath(BASE_DIR, "test/data/extra/networks/case3_unbalanced.dss") msr_path = joinpath(BASE_DIR, "test/data/extra/measurements/case3_meas.csv") datas = PowerModelsDistribution.parse_file(ntw_path; data_model=MATHEMATICAL) add_measurements!(datas, msr_path, actual_meas = true)

MartaVanin commented 3 years ago

Hi, the short answer is no, there is not really an automatic way to do this, you'd have to write your own parser. If you see your code above, you are using a PowerModels function to parse your .m file. This is because PowerModels has a matpower parser, while PowerModelsDistribution doesn't. Some reasons behind this are the following: 1) PowerModels is intended for single-line equivalent calculations, which is good for balanced systems, like the transmission system. The power flow formulations you find there are also best-suited for the transmission system. Thus, PowerModels has a parser for matpower files, which to the best of my knowledge are all single-phase equivalent models (although I might be wrong). 2) PowerModelsDistribution is intended for multi-conductor analysis, which is required in unbalanced systems, such as the distribution system. Therefore, there is not much interest for a parser for single-phase equivalent models in PMD.

Your options depend on what you want to do: 1) If you want to transform your matpower file in a three-phase network, you have to extend on PowerModels' parser or write your own from scratch 2) If your .m network is three-phase, i.e., if three-phase matpower cases exist, the PowerModelsDistribution.jl developers might be interested in developing a parser, perhaps with your help, so you might want to contact them 3) If your network is single-phase and you want to use it as such, it could in principle still work if you use PowerModelsDistribution and PowerModelsDistributionStateEstimation, but I never tested either with a single-phase network, so be aware that there might be bugs or it might not work. Also, my (unrequested, I know) opinion as a researcher is that studies on distribution networks should consider unbalance and therefore three phases, but this is just my opinion.

In general, if you have a network which is not in the supported PMD's opendss parser, what you can do is look at PMD's documentation, together with the data obtained as you did above: data = PowerModelsDistribution.parse_file(ntw_path; data_model=MATHEMATICAL) and write your own parser so that the format is the same.

MartaVanin commented 3 years ago

If you are still interested in this, I have just realized that PowerModelsDistribution does have some functionality to read .m files (using PowerModels') parser and then make it multiconductor. See here

MartaVanin commented 3 years ago

functionality now explained in docs and example can be seen in test/single_conductor_branches.jl