1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """Updates values of generator limit shadow prices.
18 """
19
20 from pypower.idx_gen import MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN
21
22
24 """Updates values of generator limit shadow prices.
25
26 Updates the values of C{MU_PMIN}, C{MU_PMAX}, C{MU_QMIN}, C{MU_QMAX} based
27 on any shadow prices on the sloped portions of the generator
28 capability curve constraints.
29
30 @param mu_PQh: shadow prices on upper sloped portion of capability curves
31 @param mu_PQl: shadow prices on lower sloped portion of capability curves
32 @param data: "data" dict returned by L{makeApq}
33
34 @see: C{makeApq}.
35
36 @author: Ray Zimmerman (PSERC Cornell)
37 @author: Carlos E. Murillo-Sanchez (PSERC Cornell & Universidad
38 Autonoma de Manizales)
39 @author: Richard Lincoln
40 """
41 ipqh, ipql, Apqhdata, Apqldata = \
42 data['ipqh'], data['ipql'], data['h'], data['l']
43
44
45
46
47
48
49
50
51
52 muPmax = gen[:, MU_PMAX]
53 muPmin = gen[:, MU_PMIN]
54 if len(mu_PQh) > 0:
55
56 k = 0
57 for i in ipqh:
58 if muPmax[i] > 0:
59 gen[i, MU_PMAX] = gen[i, MU_PMAX] - mu_PQh[k] * Apqhdata[k, 0] / baseMVA
60 elif muPmin[i] > 0:
61 gen[i, MU_PMIN] = gen[i, MU_PMIN] + mu_PQh[k] * Apqhdata[k, 0] / baseMVA
62 else:
63 if Apqhdata[k, 0] >= 0:
64 gen[i, MU_PMAX] = gen[i, MU_PMAX] - mu_PQh[k] * Apqhdata[k, 0] / baseMVA
65 else:
66 gen[i, MU_PMIN] = gen[i, MU_PMIN] + mu_PQh[k] * Apqhdata[k, 0] / baseMVA
67
68 gen[i, MU_QMAX] = gen[i, MU_QMAX] - mu_PQh[k] * Apqhdata[k, 1] / baseMVA
69 k = k + 1
70
71
72 if len(mu_PQl) > 0:
73
74 k = 0
75 for i in ipql:
76 if muPmax[i] > 0:
77 gen[i, MU_PMAX] = gen[i, MU_PMAX] - mu_PQl[k] * Apqldata[k, 0] / baseMVA
78 elif muPmin[i] > 0:
79 gen[i, MU_PMIN] = gen[i, MU_PMIN] + mu_PQl[k] * Apqldata[k, 0] / baseMVA
80 else:
81 if Apqldata[k, 0] >= 0:
82 gen[i, MU_PMAX] = gen[i, MU_PMAX] - mu_PQl[k] * Apqldata[k, 0] / baseMVA
83 else:
84 gen[i, MU_PMIN] = gen[i, MU_PMIN] + mu_PQl[k] * Apqldata[k, 0] / baseMVA
85
86 gen[i, MU_QMIN] = gen[i, MU_QMIN] + mu_PQl[k] * Apqldata[k, 1] / baseMVA
87 k = k + 1
88
89
90
91
92
93
94 return gen
95