Skip to content

Commit e4d0bee

Browse files
authored
Merge pull request #58 from lanl-ansi/pm-data-rev
Reworking Data Processing
2 parents 34227bf + 2943b15 commit e4d0bee

40 files changed

+907
-5351
lines changed

.codecov.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
status:
2+
project: # measuring the overall project coverage
3+
default: # context, you can create multiple ones with custom titles
4+
enabled: yes # must be yes|true to enable this status
5+
target: 80%
6+
branches: # -> see "branch patterns" below
7+
threshold: 10% # allowed to drop X% and still result in a "success" commit status

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
PowerModels.jl Change Log
22
=================
33

4-
### staged
4+
### Staged
55
- Updated to JuMP v0.15 syntax
6+
- Replaced PowerModels set data types with "ref" dictionary
7+
- Refactored Matpower data processing to simplify editing data after parsing
8+
- Replaced JSON test files with Matpower test files
9+
- Added documentation on internal JSON data format to DATA.md
10+
- Updated TNEP models to work with Matpower parsing extensions
611

712
### v0.2.3
813
- Multiple improvements to Matlab file parsing

DATA.md

+22-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# PowerModels Data Format
22

3-
## Network Data Dictionary
3+
## The Network Data Dictionary
44

55
Internally PowerModels utilizes a dictionary to store network data.
6-
The dictionary uses strings as key values so this data structure can be serialized to JSON for algorithmic data exchange.
6+
The dictionary uses strings as key values so it can be serialized to JSON for algorithmic data exchange.
77
The data dictionary organization and key names are designed to be consistent with the [Matpower](http://www.pserc.cornell.edu/matpower/) file format and should be familiar to power system researchers.
88

99
The network data dictionary structure is roughly as follows,
@@ -41,26 +41,32 @@ The network data dictionary structure is roughly as follows,
4141
...
4242
},
4343
...
44-
],
45-
"gencost":[
46-
{
47-
"index":<int>,
48-
"model":<int>,
49-
"startup":<float>,
50-
"shutdown":<float>,
51-
...
52-
},
53-
...
5444
]
5545
}
5646
```
5747

58-
For a detailed list of all possible parameters please refer to the specification document provided with [Matpower](http://www.pserc.cornell.edu/matpower/). In addition to the traditional Matpower parameters every network component in the PowerModels dictionary has an `index` parameter, which can be used to uniquely identify that network element.
48+
The following commands can be used to explore the network data dictionary generated by a given Matpower data file,
49+
```
50+
network_data = PowerModels.parse_file("$(Pkg.dir("PowerModels"))/test/data/case14.m")
51+
display(network_data)
52+
```
53+
54+
For a detailed list of all possible parameters refer to the specification document provided with [Matpower](http://www.pserc.cornell.edu/matpower/).
55+
56+
### Noteworthy Differences from Matpower Data Files
57+
58+
The PowerModels network data dictionary differs from the Matpower format in the following ways,
5959

60-
It is also important to note that although the Matpower format contains values in mixed units, during PowerModels data setup phase all of the data values are converted to per-unit and radian values.
60+
- All PowerModels components have an `index` parameter, which can be used to uniquely identify that network element.
61+
- All network parameters are in per-unit and angles are in radians.
62+
- All non-transformer branches are given nominal transformer values (i.e. a tap of 1.0 and a shift of 0).
63+
- When present, the `gencost` data is incorporated into the `gen` data, the column names remain the same.
64+
- Only quadratic active power generation cost functions are supported at this time.
65+
- Some additional derived values are added to branches, such as line admittance values (see `update_derived_values` in `src/core/data.jl` for details).
66+
- Special treatment is given to the optional `ne_branch` matrix to support the TNEP problem.
6167

6268

63-
## Matpower Data Files
69+
## Working with Matpower Data Files
6470

6571
The data exchange via JSON files is ideal for building algorithms, however it is hard to for humans to read and process.
6672
To that end PowerModels also has extensive support for parsing Matpower network files in the `.m` format.
@@ -135,7 +141,7 @@ becomes,
135141
}
136142
```
137143

138-
#### Standard Matrix Extentions
144+
#### Standard Matrix Extensions
139145
Finally, if a nonstandard matrix's name extends a current Matpower matrix name with an underscore, then its values will be merged with the original Matpower component data. Note that this feature requires that the nonstandard matrix has column names and has the same number of rows as the original matrix (similar to the `gencost` matrix in the Matpower format). For example,
140146
```
141147
%column_names% rate_i rate_p

README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ For the current development version, "checkout" this package with,
3737

3838
`Pkg.checkout("PowerModels")`
3939

40-
At least one solver is required for running PowerModels. The open-source solver Ipopt is recommended, as it is extremely fast, and can be used to solve a wide variety of the problems and network formulations provided in PowerModels. The Ipopt solver can be installed via tha package manager with,
40+
At least one solver is required for running PowerModels. The open-source solver Ipopt is recommended, as it is extremely fast, and can be used to solve a wide variety of the problems and network formulations provided in PowerModels. The Ipopt solver can be installed via the package manager with,
4141

4242
`Pkg.add("Ipopt")`
4343

@@ -71,6 +71,23 @@ run_opf("nesta_case3_lmbd.m", SOCWRPowerModel, IpoptSolver())
7171
Extending PowerModels with new problems and formulations will be covered in a another tutorial, that is not yet available.
7272

7373

74+
### Modifying Network Data
75+
76+
The follow example demonstrates how to perform multiple PowerModels solves while modify the network data in Julia,
77+
78+
```
79+
network_data = PowerModels.parse_file("nesta_case3_lmbd.m")
80+
run_opf(network_data, ACPPowerModel, IpoptSolver())
81+
82+
network_data["bus"][3]["pd"] = 0.0
83+
network_data["bus"][3]["qd"] = 0.0
84+
85+
run_opf(network_data, ACPPowerModel, IpoptSolver())
86+
```
87+
88+
For additional details about the PowerModels network data structure see the DATA.md file.
89+
90+
7491
## Comparison to Other Tools
7592

7693
Forthcoming.

src/PowerModels.jl

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ include("io/json.jl")
1212
include("io/common.jl")
1313

1414
include("core/base.jl")
15+
include("core/data.jl")
1516
include("core/variable.jl")
1617
include("core/constraint.jl")
1718
include("core/relaxation_scheme.jl")

0 commit comments

Comments
 (0)