ltbams 0.9.9__py3-none-any.whl → 1.0.2a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. ams/__init__.py +4 -11
  2. ams/_version.py +3 -3
  3. ams/cases/5bus/pjm5bus_demo.xlsx +0 -0
  4. ams/cases/5bus/pjm5bus_jumper.xlsx +0 -0
  5. ams/cases/5bus/pjm5bus_uced.json +1062 -0
  6. ams/cases/5bus/pjm5bus_uced.xlsx +0 -0
  7. ams/cases/5bus/pjm5bus_uced_esd1.xlsx +0 -0
  8. ams/cases/5bus/pjm5bus_uced_ev.xlsx +0 -0
  9. ams/cases/ieee123/ieee123.xlsx +0 -0
  10. ams/cases/ieee123/ieee123_regcv1.xlsx +0 -0
  11. ams/cases/ieee14/ieee14.json +1166 -0
  12. ams/cases/ieee14/ieee14.raw +92 -0
  13. ams/cases/ieee14/ieee14_conn.xlsx +0 -0
  14. ams/cases/ieee14/ieee14_uced.xlsx +0 -0
  15. ams/cases/ieee39/ieee39.xlsx +0 -0
  16. ams/cases/ieee39/ieee39_uced.xlsx +0 -0
  17. ams/cases/ieee39/ieee39_uced_esd1.xlsx +0 -0
  18. ams/cases/ieee39/ieee39_uced_pvd1.xlsx +0 -0
  19. ams/cases/ieee39/ieee39_uced_vis.xlsx +0 -0
  20. ams/cases/matpower/benchmark.json +1594 -0
  21. ams/cases/matpower/case118.m +787 -0
  22. ams/cases/matpower/case14.m +129 -0
  23. ams/cases/matpower/case300.m +1315 -0
  24. ams/cases/matpower/case39.m +205 -0
  25. ams/cases/matpower/case5.m +62 -0
  26. ams/cases/matpower/case_ACTIVSg2000.m +9460 -0
  27. ams/cases/npcc/npcc.m +644 -0
  28. ams/cases/npcc/npcc_uced.xlsx +0 -0
  29. ams/cases/pglib/pglib_opf_case39_epri__api.m +243 -0
  30. ams/cases/wecc/wecc.m +714 -0
  31. ams/cases/wecc/wecc_uced.xlsx +0 -0
  32. ams/cli.py +6 -0
  33. ams/core/__init__.py +2 -0
  34. ams/core/documenter.py +652 -0
  35. ams/core/matprocessor.py +782 -0
  36. ams/core/model.py +330 -0
  37. ams/core/param.py +322 -0
  38. ams/core/service.py +918 -0
  39. ams/core/symprocessor.py +224 -0
  40. ams/core/var.py +59 -0
  41. ams/extension/__init__.py +5 -0
  42. ams/extension/eva.py +401 -0
  43. ams/interface.py +1085 -0
  44. ams/io/__init__.py +133 -0
  45. ams/io/json.py +82 -0
  46. ams/io/matpower.py +406 -0
  47. ams/io/psse.py +6 -0
  48. ams/io/pypower.py +103 -0
  49. ams/io/xlsx.py +80 -0
  50. ams/main.py +81 -4
  51. ams/models/__init__.py +24 -0
  52. ams/models/area.py +40 -0
  53. ams/models/bus.py +52 -0
  54. ams/models/cost.py +169 -0
  55. ams/models/distributed/__init__.py +3 -0
  56. ams/models/distributed/esd1.py +71 -0
  57. ams/models/distributed/ev.py +60 -0
  58. ams/models/distributed/pvd1.py +67 -0
  59. ams/models/group.py +231 -0
  60. ams/models/info.py +26 -0
  61. ams/models/line.py +238 -0
  62. ams/models/renewable/__init__.py +5 -0
  63. ams/models/renewable/regc.py +119 -0
  64. ams/models/reserve.py +94 -0
  65. ams/models/shunt.py +14 -0
  66. ams/models/static/__init__.py +2 -0
  67. ams/models/static/gen.py +165 -0
  68. ams/models/static/pq.py +61 -0
  69. ams/models/timeslot.py +69 -0
  70. ams/models/zone.py +49 -0
  71. ams/opt/__init__.py +12 -0
  72. ams/opt/constraint.py +175 -0
  73. ams/opt/exprcalc.py +127 -0
  74. ams/opt/expression.py +188 -0
  75. ams/opt/objective.py +174 -0
  76. ams/opt/omodel.py +432 -0
  77. ams/opt/optzbase.py +192 -0
  78. ams/opt/param.py +156 -0
  79. ams/opt/var.py +233 -0
  80. ams/pypower/__init__.py +8 -0
  81. ams/pypower/_compat.py +9 -0
  82. ams/pypower/core/__init__.py +8 -0
  83. ams/pypower/core/pips.py +894 -0
  84. ams/pypower/core/ppoption.py +244 -0
  85. ams/pypower/core/ppver.py +18 -0
  86. ams/pypower/core/solver.py +2451 -0
  87. ams/pypower/eps.py +6 -0
  88. ams/pypower/idx.py +174 -0
  89. ams/pypower/io.py +604 -0
  90. ams/pypower/make/__init__.py +11 -0
  91. ams/pypower/make/matrices.py +665 -0
  92. ams/pypower/make/pdv.py +506 -0
  93. ams/pypower/routines/__init__.py +7 -0
  94. ams/pypower/routines/cpf.py +513 -0
  95. ams/pypower/routines/cpf_callbacks.py +114 -0
  96. ams/pypower/routines/opf.py +1803 -0
  97. ams/pypower/routines/opffcns.py +1946 -0
  98. ams/pypower/routines/pflow.py +852 -0
  99. ams/pypower/toggle.py +1098 -0
  100. ams/pypower/utils.py +293 -0
  101. ams/report.py +212 -50
  102. ams/routines/__init__.py +23 -0
  103. ams/routines/acopf.py +117 -0
  104. ams/routines/cpf.py +65 -0
  105. ams/routines/dcopf.py +241 -0
  106. ams/routines/dcpf.py +209 -0
  107. ams/routines/dcpf0.py +196 -0
  108. ams/routines/dopf.py +150 -0
  109. ams/routines/ed.py +312 -0
  110. ams/routines/pflow.py +255 -0
  111. ams/routines/pflow0.py +113 -0
  112. ams/routines/routine.py +1033 -0
  113. ams/routines/rted.py +519 -0
  114. ams/routines/type.py +160 -0
  115. ams/routines/uc.py +376 -0
  116. ams/shared.py +63 -9
  117. ams/system.py +61 -22
  118. ams/utils/__init__.py +3 -0
  119. ams/utils/misc.py +77 -0
  120. ams/utils/paths.py +257 -0
  121. docs/Makefile +21 -0
  122. docs/make.bat +35 -0
  123. docs/source/_templates/autosummary/base.rst +5 -0
  124. docs/source/_templates/autosummary/class.rst +35 -0
  125. docs/source/_templates/autosummary/module.rst +65 -0
  126. docs/source/_templates/autosummary/module_toctree.rst +66 -0
  127. docs/source/api.rst +102 -0
  128. docs/source/conf.py +203 -0
  129. docs/source/examples/index.rst +34 -0
  130. docs/source/genmodelref.py +61 -0
  131. docs/source/genroutineref.py +47 -0
  132. docs/source/getting_started/copyright.rst +20 -0
  133. docs/source/getting_started/formats/index.rst +20 -0
  134. docs/source/getting_started/formats/matpower.rst +183 -0
  135. docs/source/getting_started/formats/psse.rst +46 -0
  136. docs/source/getting_started/formats/pypower.rst +223 -0
  137. docs/source/getting_started/formats/xlsx.png +0 -0
  138. docs/source/getting_started/formats/xlsx.rst +23 -0
  139. docs/source/getting_started/index.rst +76 -0
  140. docs/source/getting_started/install.rst +234 -0
  141. docs/source/getting_started/overview.rst +26 -0
  142. docs/source/getting_started/testcase.rst +45 -0
  143. docs/source/getting_started/verification.rst +13 -0
  144. docs/source/images/curent.ico +0 -0
  145. docs/source/images/dcopf_time.png +0 -0
  146. docs/source/images/sponsors/CURENT_Logo_NameOnTrans.png +0 -0
  147. docs/source/images/sponsors/CURENT_Logo_Transparent.png +0 -0
  148. docs/source/images/sponsors/CURENT_Logo_Transparent_Name.png +0 -0
  149. docs/source/images/sponsors/doe.png +0 -0
  150. docs/source/index.rst +108 -0
  151. docs/source/modeling/example.rst +159 -0
  152. docs/source/modeling/index.rst +17 -0
  153. docs/source/modeling/model.rst +210 -0
  154. docs/source/modeling/routine.rst +122 -0
  155. docs/source/modeling/system.rst +51 -0
  156. docs/source/release-notes.rst +398 -0
  157. ltbams-1.0.2a1.dist-info/METADATA +210 -0
  158. ltbams-1.0.2a1.dist-info/RECORD +188 -0
  159. {ltbams-0.9.9.dist-info → ltbams-1.0.2a1.dist-info}/WHEEL +1 -1
  160. ltbams-1.0.2a1.dist-info/top_level.txt +3 -0
  161. tests/__init__.py +0 -0
  162. tests/test_1st_system.py +33 -0
  163. tests/test_addressing.py +40 -0
  164. tests/test_andes_mats.py +61 -0
  165. tests/test_case.py +266 -0
  166. tests/test_cli.py +34 -0
  167. tests/test_export_csv.py +89 -0
  168. tests/test_group.py +83 -0
  169. tests/test_interface.py +216 -0
  170. tests/test_io.py +32 -0
  171. tests/test_jumper.py +27 -0
  172. tests/test_known_good.py +267 -0
  173. tests/test_matp.py +437 -0
  174. tests/test_model.py +54 -0
  175. tests/test_omodel.py +119 -0
  176. tests/test_paths.py +22 -0
  177. tests/test_report.py +251 -0
  178. tests/test_repr.py +21 -0
  179. tests/test_routine.py +178 -0
  180. tests/test_rtn_dcopf.py +101 -0
  181. tests/test_rtn_dcpf.py +77 -0
  182. tests/test_rtn_ed.py +279 -0
  183. tests/test_rtn_pflow.py +219 -0
  184. tests/test_rtn_rted.py +273 -0
  185. tests/test_rtn_uc.py +248 -0
  186. tests/test_service.py +73 -0
  187. ltbams-0.9.9.dist-info/LICENSE +0 -692
  188. ltbams-0.9.9.dist-info/METADATA +0 -859
  189. ltbams-0.9.9.dist-info/RECORD +0 -14
  190. ltbams-0.9.9.dist-info/top_level.txt +0 -1
  191. {ltbams-0.9.9.dist-info → ltbams-1.0.2a1.dist-info}/entry_points.txt +0 -0
ams/pypower/eps.py ADDED
@@ -0,0 +1,6 @@
1
+ """
2
+ EPS
3
+ """
4
+ import numpy as np # NOQA
5
+
6
+ EPS = np.finfo(float).eps
ams/pypower/idx.py ADDED
@@ -0,0 +1,174 @@
1
+ """
2
+ Column indices.
3
+ """
4
+
5
+ from collections import OrderedDict # NOQA
6
+
7
+
8
+ gen_src = OrderedDict([
9
+ ('GEN_BUS', 0), # bus number
10
+ ('PG', 1), # Pg, real power output (MW)
11
+ ('QG', 2), # Qg, reactive power output (MVAr)
12
+ ('QMAX', 3), # Qmax, maximum reactive power output at Pmin (MVAr)
13
+ ('QMIN', 4), # Qmin, minimum reactive power output at Pmin (MVAr)
14
+ ('VG', 5), # Vg, voltage magnitude setpoint (p.u.)
15
+ ('MBASE', 6), # mBase, total MVA base of this machine, defaults to baseMVA
16
+ ('GEN_STATUS', 7), # status, 1 - machine in service, 0 - machine out of service
17
+ ('PMAX', 8), # Pmax, maximum real power output (MW)
18
+ ('PMIN', 9), # Pmin, minimum real power output (MW)
19
+ ('PC1', 10), # Pc1, lower real power output of PQ capability curve (MW)
20
+ ('PC2', 11), # Pc2, upper real power output of PQ capability curve (MW)
21
+ ('QC1MIN', 12), # Qc1min, minimum reactive power output at Pc1 (MVAr)
22
+ ('QC1MAX', 13), # Qc1max, maximum reactive power output at Pc1 (MVAr)
23
+ ('QC2MIN', 14), # Qc2min, minimum reactive power output at Pc2 (MVAr)
24
+ ('QC2MAX', 15), # Qc2max, maximum reactive power output at Pc2 (MVAr)
25
+ ('RAMP_AGC', 16), # ramp rate for load following/AGC (MW/min)
26
+ ('RAMP_10', 17), # ramp rate for 10 minute reserves (MW)
27
+ ('RAMP_30', 18), # ramp rate for 30 minute reserves (MW)
28
+ ('RAMP_Q', 19), # ramp rate for reactive power (2 sec timescale) (MVAr/min)
29
+ ('APF', 20), # area participation factor
30
+ # ----- OPF Data -----
31
+ # NOTE: included in opf solution, not necessarily in input
32
+ # NOTE: assume objective function has units, u
33
+ ('MU_PMAX', 21), # Kuhn-Tucker multiplier on upper Pg limit (u/MW)
34
+ ('MU_PMIN', 22), # Kuhn-Tucker multiplier on lower Pg limit (u/MW)
35
+ ('MU_QMAX', 23), # Kuhn-Tucker multiplier on upper Qg limit (u/MVAr)
36
+ ('MU_QMIN', 24), # Kuhn-Tucker multiplier on lower Qg limit (u/MVAr)
37
+ ])
38
+
39
+ dcline_src = OrderedDict([
40
+ ('F_BUS', 0), # f, "from" bus number
41
+ ('T_BUS', 1), # t, "to" bus number
42
+ ('BR_STATUS', 2), # initial branch status, 1 - in service, 0 - out of service
43
+ ('PF', 3), # MW flow at "from" bus ("from" -> "to")
44
+ ('PT', 4), # MW flow at "to" bus ("from" -> "to")
45
+ ('QF', 5), # MVAr injection at "from" bus ("from" -> "to")
46
+ ('QT', 6), # MVAr injection at "to" bus ("from" -> "to")
47
+ ('VF', 7), # voltage setpoint at "from" bus (p.u.)
48
+ ('VT', 8), # voltage setpoint at "to" bus (p.u.)
49
+ ('PMIN', 9), # lower limit on PF (MW flow at "from" end)
50
+ ('PMAX', 10), # upper limit on PF (MW flow at "from" end)
51
+ ('QMINF', 11), # lower limit on MVAr injection at "from" bus
52
+ ('QMAXF', 12), # upper limit on MVAr injection at "from" bus
53
+ ('QMINT', 13), # lower limit on MVAr injection at "to" bus
54
+ ('QMAXT', 14), # upper limit on MVAr injection at "to" bus
55
+ ('LOSS0', 15), # constant term of linear loss function (MW)
56
+ ('LOSS1', 16), # linear term of linear loss function (MW)
57
+ ('MU_PMIN', 17), # Kuhn-Tucker multiplier on lower flow limit at "from" bus (u/MW)
58
+ ('MU_PMAX', 18), # Kuhn-Tucker multiplier on upper flow limit at "from" bus (u/MW)
59
+ ('MU_QMINF', 19), # Kuhn-Tucker multiplier on lower Q limit at "from" bus (u/MVAr)
60
+ ('MU_QMAXF', 20), # Kuhn-Tucker multiplier on upper Q limit at "from" bus (u/MVAr)
61
+ ('MU_QMINT', 21), # Kuhn-Tucker multiplier on lower Q limit at "to" bus (u/MVAr)
62
+ ('MU_QMAXT', 22), # Kuhn-Tucker multiplier on upper Q limit at "to" bus (u/MVAr)
63
+ ])
64
+
65
+ cost_src = OrderedDict([
66
+ ('PW_LINEAR', 1), # cost model, 1 - piecewise linear, 2 - polynomial
67
+ ('POLYNOMIAL', 2), # cost model, 1 - piecewise linear, 2 - polynomial
68
+ ('MODEL', 0), # cost model, 1 - piecewise linear, 2 - polynomial
69
+ ('STARTUP', 1), # startup cost in US dollars
70
+ ('SHUTDOWN', 2), # shutdown cost in US dollars
71
+ ('NCOST', 3), # number of cost coefficients to follow
72
+ ('COST', 4), # cost coefficients, see below
73
+ ])
74
+
75
+ bus_src = OrderedDict([
76
+ # --- bus types ---
77
+ ('PQ', 1), # PQ bus
78
+ ('PV', 2), # PV bus
79
+ ('REF', 3), # reference bus
80
+ ('NONE', 4), # isolated bus
81
+ # --- indices ---
82
+ ('BUS_I', 0), # bus number (1 to 29997)
83
+ ('BUS_TYPE', 1), # bus type
84
+ ('PD', 2), # Pd, real power demand (MW)
85
+ ('QD', 3), # Qd, reactive power demand (MVAr)
86
+ ('GS', 4), # Gs, shunt conductance (MW at V = 1.0 p.u.)
87
+ ('BS', 5), # Bs, shunt susceptance (MVAr at V = 1.0 p.u.)
88
+ ('BUS_AREA', 6), # area number, 1-100
89
+ ('VM', 7), # Vm, voltage magnitude (p.u.)
90
+ ('VA', 8), # Va, voltage angle (degrees)
91
+ ('BASE_KV', 9), # baseKV, base voltage (kV)
92
+ ('ZONE', 10), # zone, loss zone (1-999)
93
+ ('VMAX', 11), # maxVm, maximum voltage magnitude (p.u.)
94
+ ('VMIN', 12), # minVm, minimum voltage magnitude (p.u.)
95
+ # NOTE: included in opf solution, not necessarily in input
96
+ # NOTE: assume objective function has units, u
97
+ ('LAM_P', 13), # Lagrange multiplier on real power mismatch (u/MW)
98
+ ('LAM_Q', 14), # Lagrange multiplier on reactive power mismatch (u/MVAr)
99
+ ('MU_VMAX', 15), # Kuhn-Tucker multiplier on upper voltage limit (u/p.u.)
100
+ ('MU_VMIN', 16), # Kuhn-Tucker multiplier on lower voltage limit (u/p.u.)
101
+ ])
102
+
103
+ branch_src = OrderedDict([
104
+ ('F_BUS', 0), # f, from bus number
105
+ ('T_BUS', 1), # t, to bus number
106
+ ('BR_R', 2), # r, resistance (p.u.)
107
+ ('BR_X', 3), # x, reactance (p.u.)
108
+ ('BR_B', 4), # b, total line charging susceptance (p.u.)
109
+ ('RATE_A', 5), # rateA, MVA rating A (long term rating)
110
+ ('RATE_B', 6), # rateB, MVA rating B (short term rating)
111
+ ('RATE_C', 7), # rateC, MVA rating C (emergency rating)
112
+ ('TAP', 8), # ratio, transformer off nominal turns ratio
113
+ ('SHIFT', 9), # angle, transformer phase shift angle (degrees)
114
+ ('BR_STATUS', 10), # initial branch status, 1 - in service, 0 - out of service
115
+ ('ANGMIN', 11), # minimum angle difference, angle(Vf) - angle(Vt) (degrees)
116
+ ('ANGMAX', 12), # maximum angle difference, angle(Vf) - angle(Vt) (degrees)
117
+ # NOTE: included in opf solution, not necessarily in input
118
+ ('PF', 13), # real power injected at "from" bus (MW)
119
+ ('QF', 14), # reactive power injected at "from" bus (MVAr)
120
+ ('PT', 15), # real power injected at "to" bus (MW)
121
+ ('QT', 16), # reactive power injected at "to" bus (MVAr)
122
+ # NOTE: included in opf solution, not necessarily in input
123
+ # NOTE: assume objective function has units, u
124
+ ('MU_SF', 17), # Kuhn-Tucker multiplier on MVA limit at "from" bus (u/MVA)
125
+ ('MU_ST', 18), # Kuhn-Tucker multiplier on MVA limit at "to" bus (u/MVA)
126
+ ('MU_ANGMIN', 19), # Kuhn-Tucker multiplier on lower angle difference limit (u/degree)
127
+ ('MU_ANGMAX', 20), # Kuhn-Tucker multiplier on upper angle difference limit (u/degree)
128
+ ])
129
+
130
+ area_src = OrderedDict([
131
+ ('AREA_I', 0), # area number
132
+ ('PRICE_REF_BUS', 1), # price reference bus for this area
133
+ ])
134
+
135
+
136
+ class Consts:
137
+ """
138
+ Base class for constants collection.
139
+ """
140
+
141
+ def __init__(self, source):
142
+ """
143
+ Parameters
144
+ ----------
145
+ source : OrderedDict
146
+ Dictionary of constants.
147
+ """
148
+ self.init(source)
149
+
150
+ def init(self, source):
151
+ for key, value in source.items():
152
+ setattr(self, key, value)
153
+
154
+
155
+ class IDXClass:
156
+ """
157
+ Column indices for named columns.
158
+ """
159
+
160
+ def __init__(self):
161
+ """
162
+ Parameters
163
+ ----------
164
+ source : OrderedDict
165
+ Dictionary of column indices.
166
+ """
167
+ self.gen = Consts(gen_src)
168
+ self.dcline = Consts(dcline_src)
169
+ self.cost = Consts(cost_src)
170
+ self.bus = Consts(bus_src)
171
+ self.branch = Consts(branch_src)
172
+ self.area = Consts(area_src)
173
+
174
+ IDX = IDXClass()