diff --git a/src/OPF/opfdata.jl b/src/OPF/opfdata.jl index 027c68c..d2e8251 100644 --- a/src/OPF/opfdata.jl +++ b/src/OPF/opfdata.jl @@ -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 @@ -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 @@ -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 diff --git a/src/OPF/opfmodel.jl b/src/OPF/opfmodel.jl index 1545f7c..bbbddca 100644 --- a/src/OPF/opfmodel.jl +++ b/src/OPF/opfmodel.jl @@ -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) @@ -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) diff --git a/src/backends.jl b/src/backends.jl index 8a53682..1f05e9a 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -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)