Skip to content

Commit

Permalink
bug fix in time_horizon_start
Browse files Browse the repository at this point in the history
  • Loading branch information
Anirudh Subramanyam authored and michel2323 committed Jun 13, 2022
1 parent edc97e5 commit 68c16ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/OPF/opfdata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Loads the multi-period ACOPF instance data from `raw`
with the time horizon defined to be
[`time_horizon_start`, `time_horizon_end`].
Note that `time_horizon_end = 0` indicates as many
as possible (the number of columns in `raw.pd_arr`).
as possible (the number of columns in `raw.pd_arr` minus `time_horizon_start - 1`).
All loads in all time periods will be multiplied by `load_scale`.
The `ramp_scale` is the factor which multiplies the ramp rate
Expand Down Expand Up @@ -427,6 +427,9 @@ function opf_loaddata(raw::RawData;
end
Pd = Pd[:,time_horizon_start:time_horizon_end] .* load_scale
Qd = Qd[:,time_horizon_start:time_horizon_end] .* load_scale
else
Pd = Pd[:,time_horizon_start:end] .* load_scale
Qd = Qd[:,time_horizon_start:end] .* load_scale
end

# Pgmax for multiperiod renewable data
Expand All @@ -441,7 +444,7 @@ function opf_loaddata(raw::RawData;
end
else
for (i, git) in enumerate(gens_on)
Pgmax[i, :] .= raw.pgmax_arr[git, :] ./ baseMVA
Pgmax[i, :] .= raw.pgmax_arr[git, time_horizon_start:end] ./ baseMVA
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions src/OPF/opfmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ function opf_model_add_block_constraints(opfmodel::JuMP.Model, opfdata::OPFData,
opfdata_c = (k == 1) ? opfdata :
opf_loaddata(rawdata;
lineOff = opfdata.lines[rawdata.ctgs_arr[k - 1]],
time_horizon_start = t,
time_horizon_end = t,
time_horizon_start = modelinfo.time_horizon_start + t - 1,
time_horizon_end = modelinfo.time_horizon_start + t - 1,
load_scale = modelinfo.load_scale,
ramp_scale = modelinfo.ramp_scale,
corr_scale = modelinfo.corr_scale)
Expand All @@ -131,8 +131,8 @@ function opf_model_add_block_constraints(opfmodel::JuMP.Model, opfdata::OPFData,
opfdata_c = (k == 1) ? opfdata :
opf_loaddata(rawdata;
lineOff = opfdata.lines[rawdata.ctgs_arr[k - 1]],
time_horizon_start = t,
time_horizon_end = t,
time_horizon_start = modelinfo.time_horizon_start + t - 1,
time_horizon_end = modelinfo.time_horizon_start + t - 1,
load_scale = modelinfo.load_scale,
ramp_scale = modelinfo.ramp_scale,
corr_scale = modelinfo.corr_scale)
Expand Down
4 changes: 2 additions & 2 deletions src/backends.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ function init!(block::JuMPBlockBackend, algparams::AlgParams)
opfdata_c = (j == 1) ? opfdata :
opf_loaddata(block.rawdata;
lineOff = opfdata.lines[block.rawdata.ctgs_arr[j - 1]],
time_horizon_start = t,
time_horizon_end = t,
time_horizon_start = modelinfo.time_horizon_start + t - 1,
time_horizon_end = modelinfo.time_horizon_start + t - 1,
load_scale = modelinfo.load_scale,
ramp_scale = modelinfo.ramp_scale,
corr_scale = modelinfo.corr_scale)
Expand Down

0 comments on commit 68c16ae

Please sign in to comment.