Sampling Functions

OPFLearn.sample_polytope_cprndFunction

Translated to Julia and modified based on: https://www.mathworks.com/matlabcentral/fileexchange/34208-uniform-distribution-over-a-convex-polytope Copyright (c) 2011-2012 Tim J. Benham, School of Mathematics and Physics, University of Queensland.

CPRND Draw from the uniform distribution over a convex polytope. X = cprnd(N,A,b) Returns an N-by-P matrix of random vectors drawn from the uniform distribution over the interior of the polytope defined by Ax <= b. A is a M-by-P matrix of constraint equation coefficients. b is a M-by-1 vector of constraint equation constants

...

  • 'method::String': 'gibbs': Gibbs sampler, 'hitandrun': Hit and Run, 'achr': Adaptive Centering Hit-and-Run
  • 'iso::Integer': Isotropic Transformation (0: no xfrm, 1: Xfrm during runup, 2: Xfrm throughout sampling
  • 'runup::Integer': # of initial iterations of the algorithm in the untransformed space for gibbs or hitandrun
  • 'discard::Integer': # of initial samples (post runup) to discard. Randomly selects nsamples from the
	discard + n_samples samples.

...

source
OPFLearn.sample_uniformMethod

Samples from a uniform distribution of the given percentage around the given base load, x0 = (pd\0 + qd_0). Power factors are held constant.

xil = U[0.8 xi0, 1.2 x_i0] for all i in load buses

source
OPFLearn.sample_uniform_w_pfMethod

Samples from a uniform distribution of the given percentage around the given base load real power, pd0. Then sample a power factor from the given pfrange to determine the reactive load of the sample. By default the pf_range refers to lagging power factors. If a value larger than 1.0 is given in the range, it will be converted to a leading power factor of pf = (1.0 - x).

  • p_il = U[(1-dist) * pi0, (1+dist) * p\i0] for all i in load buses
  • d_il = U[pf_range] for all i in load buses
  • q_il = tan(d_il) * p_il
source