Skip to content

Commit 77a0218

Browse files
ccoffrinrb004f
authored andcommitted
adding fix to refresh derived values when loading json data, closes #64 (#65)
* adding fix to refresh derived values when loading json data, closes #64 * added a note to the readme on calling update_derived_values
1 parent 682ac38 commit 77a0218

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ run_opf(network_data, ACPPowerModel, IpoptSolver())
8181
8282
network_data["bus"][3]["pd"] = 0.0
8383
network_data["bus"][3]["qd"] = 0.0
84+
update_derived_values(network_data)
8485
8586
run_opf(network_data, ACPPowerModel, IpoptSolver())
8687
```

src/core/data.jl

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# tools for working with PowerModels internal data format
22

3+
export update_derived_values
34

45
# adds values that are derived from other values in PM data structure, for the first time
56
function add_derived_values(data::Dict{AbstractString,Any})

src/io/common.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ function parse_file(file)
22
if endswith(file, ".m")
33
return PowerModels.parse_matpower(file)
44
else
5-
return PowerModels.parse_json(file)
5+
network_data = PowerModels.parse_json(file)
6+
update_derived_values(network_data)
7+
return network_data
68
end
79
end

0 commit comments

Comments
 (0)