ltbams 0.9.9__py3-none-any.whl → 1.0.2__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 +206 -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 +231 -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.2.dist-info/METADATA +215 -0
  158. ltbams-1.0.2.dist-info/RECORD +188 -0
  159. {ltbams-0.9.9.dist-info → ltbams-1.0.2.dist-info}/WHEEL +1 -1
  160. ltbams-1.0.2.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.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,244 @@
1
+ # Copyright (c) 1996-2015 PSERC. All rights reserved.
2
+ # Use of this source code is governed by a BSD-style
3
+ # license that can be found in the LICENSE file.
4
+
5
+ """Used to set and retrieve a PYPOWER options vector.
6
+ """
7
+
8
+ import numpy as np
9
+
10
+ from ams.shared import inf
11
+
12
+
13
+ PF_OPTIONS = [
14
+ ('pf_alg', 1, '''power flow algorithm:
15
+ 1 - Newton's method,
16
+ 2 - Fast-Decoupled (XB version),
17
+ 3 - Fast-Decoupled (BX version),
18
+ 4 - Gauss Seidel'''),
19
+
20
+ ('pf_tol', 1e-8, 'termination tolerance on per unit P & Q mismatch'),
21
+
22
+ ('pf_max_it', 10, 'maximum number of iterations for Newton\'s method'),
23
+
24
+ ('pf_max_it_fd', 30, 'maximum number of iterations for fast '
25
+ 'decoupled method'),
26
+
27
+ ('pf_max_it_gs', 1000, 'maximum number of iterations for '
28
+ 'Gauss-Seidel method'),
29
+
30
+ ('enforce_q_lims', False, 'enforce gen reactive power limits, at '
31
+ 'expense of |V|'),
32
+
33
+ ('pf_dc', False, '''use DC power flow formulation, for power flow and OPF:
34
+ False - use AC formulation & corresponding algorithm opts,
35
+ True - use DC formulation, ignore AC algorithm options''')
36
+ ]
37
+
38
+ CPF_OPTIONS = [
39
+ ('cpf_parameterization', 3, '''choice of parameterization:
40
+ 1 - natural,
41
+ 2 - arc length,
42
+ 3 - pseudo arc length'''),
43
+
44
+ ('cpf_stop_at', 'NOSE', '''determins stopping criterion:
45
+ 'NOSE' - stop when nose point is reached,
46
+ 'FULL' - trace full nose curve,
47
+ <lam_stop> - stop upon reaching specified target lambda value'''),
48
+
49
+ ('cpf_step', 0.05, 'continuation power flow step size'),
50
+
51
+ ('cpf_adapt_step', False, '''toggle adaptive step size feature:
52
+ False - adaptive step size disabled,
53
+ True - adaptive step size enabled'''),
54
+
55
+ ('cpf_error_tol', 1e-3, 'tolerance for adaptive step control'),
56
+
57
+ ('cpf_step_min', 1e-4, 'minimum allowed step size'),
58
+
59
+ ('cpf_step_max', 0.2, 'maximum allowed step size'),
60
+
61
+ ('cpf_plot_level', 0, '''control plotting of noze curve:
62
+ 0 - do not plot nose curve,
63
+ 1 - plot when completed,
64
+ 2 - plot incrementally at each iteration,
65
+ 3 - same as 2, with 'pause' at each iteration'''),
66
+
67
+ ('cpf_plot_bus', '', 'index of bus whose voltage is to be plotted'),
68
+
69
+ ('cpf_user_callback', '', """string or cell array of strings
70
+ with names of user callback functions see 'help cpf_default_callback'"""),
71
+
72
+ ('cpf_user_callback_args', '', 'struct passed to user-defined callback functions')
73
+ ]
74
+
75
+ OPF_OPTIONS = [
76
+ ('opf_alg', 0, '''algorithm to use for OPF:
77
+ 0 - choose best default solver available in the
78
+ following order, 500, 540, 520 then 100/200
79
+ Otherwise the first digit specifies the problem
80
+ formulation and the second specifies the solver,
81
+ as follows, (see the User's Manual for more details)
82
+ 500 - generalized formulation, MINOS,
83
+ 540 - generalized formulation, MIPS
84
+ primal/dual interior point method,
85
+ 545 - generalized formulation (except CCV), SC-MIPS
86
+ step-controlled primal/dual interior point method'''),
87
+
88
+ # ('opf_poly2pwl_pts', 10, 'number of evaluation points to use when '
89
+ # 'converting from polynomial to piece-wise linear costs)'),
90
+
91
+ ('opf_violation', 5e-6, 'constraint violation tolerance'),
92
+
93
+ ('opf_flow_lim', 0, '''qty to limit for branch flow constraints:
94
+ 0 - apparent power flow (limit in MVA),
95
+ 1 - active power flow (limit in MW),
96
+ 2 - current magnitude (limit in MVA at 1 p.u. voltage'''),
97
+
98
+ ('opf_ignore_ang_lim', False, 'ignore angle difference limits for '
99
+ 'branches even if specified'),
100
+
101
+ ('opf_alg_dc', 0, '''solver to use for DC OPF:
102
+ 0 - choose default solver based on availability in the
103
+ following order, 600, 500, 200.
104
+ 200 - PIPS, Python Interior Point Solver
105
+ primal/dual interior point method,
106
+ 250 - PIPS-sc, step-controlled variant of PIPS
107
+ 400 - IPOPT, requires pyipopt interface to IPOPT solver
108
+ available from: https://projects.coin-or.org/Ipopt/
109
+ 500 - CPLEX, requires Python interface to CPLEX solver
110
+ 600 - MOSEK, requires Python interface to MOSEK solver
111
+ available from: http://www.mosek.com/
112
+ 700 - GUROBI, requires Python interface to Gurobi optimizer
113
+ available from: http://www.gurobi.com/''')
114
+ ]
115
+
116
+ OUTPUT_OPTIONS = [
117
+ ('verbose', 1, '''amount of progress info printed:
118
+ 0 - print no progress info,
119
+ 1 - print a little progress info,
120
+ 2 - print a lot of progress info,
121
+ 3 - print all progress info'''),
122
+
123
+ ('out_all', -1, '''controls printing of results:
124
+ -1 - individual flags control what prints,
125
+ 0 - don't print anything
126
+ (overrides individual flags),
127
+ 1 - print everything
128
+ (overrides individual flags)'''),
129
+
130
+ ('out_sys_sum', True, 'print system summary'),
131
+
132
+ ('out_area_sum', False, 'print area summaries'),
133
+
134
+ ('out_bus', True, 'print bus detail'),
135
+
136
+ ('out_branch', True, 'print branch detail'),
137
+
138
+ ('out_gen', False, '''print generator detail
139
+ (OUT_BUS also includes gen info)'''),
140
+
141
+ ('out_all_lim', -1, '''control constraint info output:
142
+ -1 - individual flags control what constraint info prints,
143
+ 0 - no constraint info (overrides individual flags),
144
+ 1 - binding constraint info (overrides individual flags),
145
+ 2 - all constraint info (overrides individual flags)'''),
146
+
147
+ ('out_v_lim', 1, '''control output of voltage limit info:
148
+ 0 - don't print,
149
+ 1 - print binding constraints only,
150
+ 2 - print all constraints
151
+ (same options for OUT_LINE_LIM, OUT_PG_LIM, OUT_QG_LIM)'''),
152
+
153
+ ('out_line_lim', 1, 'control output of line limit info'),
154
+
155
+ ('out_pg_lim', 1, 'control output of gen P limit info'),
156
+
157
+ ('out_qg_lim', 1, 'control output of gen Q limit info'),
158
+
159
+ # ('out_raw', False, 'print raw data'),
160
+
161
+ ('return_raw_der', 0, '''return constraint and derivative info
162
+ in results['raw'] (in keys g, dg, df, d2f))''')
163
+ ]
164
+
165
+ PDIPM_OPTIONS = [
166
+ ('pdipm_feastol', 0, '''feasibility (equality) tolerance
167
+ for Primal-Dual Interior Points Methods, set
168
+ to value of OPF_VIOLATION by default'''),
169
+ ('pdipm_gradtol', 1e-6, '''gradient tolerance for
170
+ Primal-Dual Interior Points Methods'''),
171
+ ('pdipm_comptol', 1e-6, '''complementary condition (inequality)
172
+ tolerance for Primal-Dual Interior Points Methods'''),
173
+ ('pdipm_costtol', 1e-6, '''optimality tolerance for
174
+ Primal-Dual Interior Points Methods'''),
175
+ ('pdipm_max_it', 150, '''maximum number of iterations for
176
+ Primal-Dual Interior Points Methods'''),
177
+ ('scpdipm_red_it', 20, '''maximum number of reductions per iteration
178
+ for Step-Control Primal-Dual Interior Points Methods''')
179
+ ]
180
+
181
+ GUROBI_OPTIONS = [
182
+ ('grb_method', 1, '''solution algorithm (Method)
183
+ 0 - primal simplex
184
+ 1 - dual simplex
185
+ 2 - barrier
186
+ 3 - concurrent (LP only)
187
+ 4 - deterministic concurrent (LP only)
188
+ '''),
189
+ ('grb_timelimit', inf, 'maximum time allowed for solver (TimeLimit)'),
190
+ ('grb_threads', 0, '(auto) maximum number of threads to use (Threads)'),
191
+ ('grb_opt', 0, 'See gurobi_options() for details')
192
+ ]
193
+
194
+
195
+ def ppoption(ppopt=None, **kwargs):
196
+ """
197
+ Set and retrieve a PYPOWER options vector.
198
+
199
+ Parameters
200
+ ----------
201
+ ppopt: dict, optional
202
+ The base options vector. If not provided, the default options vector is used.
203
+ **kwargs: keyword arguments, optional
204
+ New values for the specified options. Each keyword argument represents an option name,
205
+ and its value represents the new value for that option.
206
+
207
+ Returns
208
+ -------
209
+ ppopt: dict
210
+ The options vector with the updated values.
211
+
212
+ Examples
213
+ --------
214
+ >>> opt = ppoption(PF_ALG=2, PF_TOL=1e-4)
215
+ >>> opt = ppoption(opt, OPF_ALG=565, VERBOSE=2)
216
+
217
+ Notes
218
+ -----
219
+ This function is used to set and retrieve PYPOWER options vector.
220
+ The options vector contains various settings and configurations that affect the behavior
221
+ of the PYPOWER routines.
222
+
223
+ The `ppopt` parameter, if provided, serves as the base options vector.
224
+ If not provided, the function uses the default options vector.
225
+
226
+ Additional options can be specified using keyword arguments, where each keyword
227
+ represents an option name, and its corresponding value represents the new value
228
+ for that option.
229
+
230
+ The function returns the options vector with the updated values.
231
+ """
232
+
233
+ default_ppopt = {}
234
+
235
+ options = PF_OPTIONS + CPF_OPTIONS + OPF_OPTIONS + OUTPUT_OPTIONS + PDIPM_OPTIONS
236
+
237
+ for name, default, _ in options:
238
+ default_ppopt[name.upper()] = default
239
+
240
+ ppopt = default_ppopt if ppopt == None else ppopt.copy()
241
+
242
+ ppopt.update(kwargs)
243
+
244
+ return ppopt
@@ -0,0 +1,18 @@
1
+ """
2
+ PYPOWER version.
3
+ """
4
+
5
+
6
+ def ppver(*args):
7
+ """
8
+ Returns PYPOWER version info for current installation.
9
+
10
+ @author: Ray Zimmerman (PSERC Cornell)
11
+ """
12
+
13
+ ver = {'Name': 'PYPOWER',
14
+ 'Version': '5.1.4',
15
+ 'Release': '',
16
+ 'Date': '27-June-2018'}
17
+
18
+ return ver