Package pypower :: Module toggle_reserves
[hide private]
[frames] | no frames]

Module toggle_reserves

source code

Enable or disable fixed reserve requirements.

Functions [hide private]
 
toggle_reserves(ppc, on_off)
Enable or disable fixed reserve requirements.
source code
 
userfcn_reserves_ext2int(ppc, *args)
This is the 'ext2int' stage userfcn callback that prepares the input data for the formulation stage.
source code
 
userfcn_reserves_formulation(om, *args)
This is the 'formulation' stage userfcn callback that defines the user costs and constraints for fixed reserves.
source code
 
userfcn_reserves_int2ext(results, *args)
This is the 'int2ext' stage userfcn callback that converts everything back to external indexing and packages up the results.
source code
 
userfcn_reserves_printpf(results, fd, ppopt, *args)
This is the 'printpf' stage userfcn callback that pretty-prints the results.
source code
 
userfcn_reserves_savecase(ppc, fd, prefix, *args)
This is the 'savecase' stage userfcn callback that prints the Python file code to save the 'reserves' field in the case file.
source code
Variables [hide private]
  __package__ = 'pypower'
Function Details [hide private]

toggle_reserves(ppc, on_off)

source code 

Enable or disable fixed reserve requirements.

Enables or disables a set of OPF userfcn callbacks to implement co-optimization of reserves with fixed zonal reserve requirements.

These callbacks expect to find a 'reserves' field in the input ppc, where ppc['reserves'] is a dict with the following fields:

  • zones nrz x ng, zone(i, j) = 1, if gen j belongs to zone i 0, otherwise
  • req nrz x 1, zonal reserve requirement in MW
  • cost (ng or ngr) x 1, cost of reserves in $/MW
  • qty (ng or ngr) x 1, max quantity of reserves in MW (optional)

where nrz is the number of reserve zones and ngr is the number of generators belonging to at least one reserve zone and ng is the total number of generators.

The 'int2ext' callback also packages up results and stores them in the following output fields of results['reserves']:

  • R - ng x 1, reserves provided by each gen in MW
  • Rmin - ng x 1, lower limit on reserves provided by each gen, (MW)
  • Rmax - ng x 1, upper limit on reserves provided by each gen, (MW)
  • mu.l - ng x 1, shadow price on reserve lower limit, ($/MW)
  • mu.u - ng x 1, shadow price on reserve upper limit, ($/MW)
  • mu.Pmax - ng x 1, shadow price on Pg + R <= Pmax constraint, ($/MW)
  • prc - ng x 1, reserve price for each gen equal to maximum of the shadow prices on the zonal requirement constraint for each zone the generator belongs to

See Also: runopf_w_res, add_userfcn, remove_userfcn, run_userfcn, t.t_case30_userfcns

Authors:
Ray Zimmerman (PSERC Cornell), Richard Lincoln

userfcn_reserves_ext2int(ppc, *args)

source code 

This is the 'ext2int' stage userfcn callback that prepares the input data for the formulation stage. It expects to find a 'reserves' field in ppc as described above. The optional args are not currently used.

userfcn_reserves_formulation(om, *args)

source code 

This is the 'formulation' stage userfcn callback that defines the user costs and constraints for fixed reserves. It expects to find a 'reserves' field in the ppc stored in om, as described above. By the time it is passed to this callback, ppc['reserves'] should have two additional fields:

  • igr 1 x ngr, indices of generators available for reserves
  • rgens 1 x ng, 1 if gen avaiable for reserves, 0 otherwise

It is also assumed that if cost or qty were ngr x 1, they have been expanded to ng x 1 and that everything has been converted to internal indexing, i.e. all gens are on-line (by the 'ext2int' callback). The optional args are not currently used.

userfcn_reserves_int2ext(results, *args)

source code 

This is the 'int2ext' stage userfcn callback that converts everything back to external indexing and packages up the results. It expects to find a 'reserves' field in the results struct as described for ppc above, including the two additional fields 'igr' and 'rgens'. It also expects the results to contain a variable 'R' and linear constraints 'Pg_plus_R' and 'Rreq' which are used to populate output fields in results.reserves. The optional args are not currently used.

userfcn_reserves_printpf(results, fd, ppopt, *args)

source code 

This is the 'printpf' stage userfcn callback that pretty-prints the results. It expects a results dict, a file descriptor and a PYPOWER options vector. The optional args are not currently used.

userfcn_reserves_savecase(ppc, fd, prefix, *args)

source code 

This is the 'savecase' stage userfcn callback that prints the Python file code to save the 'reserves' field in the case file. It expects a PYPOWER case dict (ppc), a file descriptor and variable prefix (usually 'ppc'). The optional args are not currently used.