ltbams 1.0.7__py3-none-any.whl → 1.0.9__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.
ams/models/static/gen.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from collections import OrderedDict
2
2
 
3
- from andes.core.param import NumParam, ExtParam
3
+ from andes.core.param import NumParam, ExtParam, DataParam
4
4
  from andes.models.static.pv import PVData
5
5
  from andes.models.static.slack import SlackData
6
6
 
@@ -81,6 +81,14 @@ class GenParam:
81
81
  tex_name=r't_{d2}',
82
82
  unit='h',
83
83
  )
84
+ self.gentype = DataParam(default=None,
85
+ info='generator type',
86
+ tex_name=r'g_{type}',
87
+ )
88
+ self.genfuel = DataParam(default=None,
89
+ info='generator fuel type',
90
+ tex_name=r'g_{fuel}',
91
+ )
84
92
 
85
93
 
86
94
  class PVModel(Model):
ams/report.py CHANGED
@@ -3,7 +3,6 @@ Module for report generation.
3
3
  """
4
4
  import logging
5
5
  from collections import OrderedDict
6
- from time import strftime
7
6
  from typing import List, Dict, Optional
8
7
 
9
8
  from andes.io.txt import dump_data
@@ -11,7 +10,7 @@ from andes.shared import np
11
10
  from andes.utils.misc import elapsed
12
11
 
13
12
  from ams import __version__ as version
14
- from ams.shared import copyright_msg
13
+ from ams.shared import copyright_msg, nowarranty_msg, report_time
15
14
 
16
15
  logger = logging.getLogger(__name__)
17
16
 
@@ -23,9 +22,9 @@ def report_info(system) -> list:
23
22
  info = list()
24
23
  info.append('AMS' + ' ' + version + '\n')
25
24
  info.append(f'{copyright_msg}\n\n')
26
- info.append('AMS comes with ABSOLUTELY NO WARRANTY\n')
25
+ info.append(f"{nowarranty_msg}\n")
27
26
  info.append('Case file: ' + str(system.files.case) + '\n')
28
- info.append('Report time: ' + strftime("%m/%d/%Y %I:%M:%S %p") + '\n\n')
27
+ info.append(f'Report time: {report_time}\n\n')
29
28
  return info
30
29
 
31
30
 
ams/routines/dcpf0.py CHANGED
@@ -168,7 +168,7 @@ class DCPF0(RoutineBase):
168
168
  if self.exit_code == 0:
169
169
  msg = f"<{self.class_name}> solved in {s}, converged in "
170
170
  msg += n_iter_str + f"with {sstats['solver_name']}."
171
- logger.info(msg)
171
+ logger.warning(msg)
172
172
  try:
173
173
  self.unpack(res)
174
174
  except Exception as e:
ams/shared.py CHANGED
@@ -7,6 +7,7 @@ import logging
7
7
  import unittest
8
8
  from functools import wraps
9
9
  from collections import OrderedDict
10
+ from time import strftime
10
11
 
11
12
  import cvxpy as cp
12
13
 
@@ -35,7 +36,9 @@ _prefix = r" - --------------> | " # NOQA
35
36
  _max_length = 80 # NOQA
36
37
 
37
38
  # NOTE: copyright
38
- copyright_msg = 'Copyright (C) 2023-2025 Jinning Wang'
39
+ copyright_msg = "Copyright (C) 2023-2025 Jinning Wang"
40
+ nowarranty_msg = "AMS comes with ABSOLUTELY NO WARRANTY"
41
+ report_time = strftime("%m/%d/%Y %I:%M:%S %p")
39
42
 
40
43
  # NOTE: copied from CVXPY documentation, last checked on 2024/10/30, v1.5
41
44
  mip_solvers = ['CBC', 'COPT', 'GLPK_MI', 'CPLEX', 'GUROBI',
@@ -7,7 +7,7 @@ License
7
7
 
8
8
  GNU Public License v3
9
9
  *********************
10
- | Copyright :raw-html:`&copy;` 2023-2024 Jinning Wang.
10
+ | Copyright :raw-html:`&copy;` 2023-2025 Jinning Wang.
11
11
 
12
12
  AMS is free software; you can redistribute it and/or modify it under the terms
13
13
  of the `GNU General Public License <http://www.gnu.org/licenses/gpl-3.0.html>`_
@@ -181,3 +181,138 @@ Generator Cost Data
181
181
 
182
182
  #. Not currently used by any Matpower functions.
183
183
  #. MODEL = 1, :math:`f(p)` is defined by the coordinates :math:`(p_1, f_1), (p_2, f_2), . . . , (p_N , f_N)`; MODEL = 2, :math:`f(p) = c_{n}p^{n} + ... + c_{1}p^{1} + c_{0}`.
184
+
185
+
186
+ Generator Types
187
+ ~~~~~~~~~~~~~~~~~~~~
188
+ +------+---------------------------------------------------------------+
189
+ | code | description |
190
+ +------+---------------------------------------------------------------+
191
+ | BA | Energy Storage, Battery |
192
+ +------+---------------------------------------------------------------+
193
+ | CE | Energy Storage, Compressed Air |
194
+ +------+---------------------------------------------------------------+
195
+ | CP | Energy Storage, Concentrated Solar Power |
196
+ +------+---------------------------------------------------------------+
197
+ | FW | Energy Storage, Flywheel |
198
+ +------+---------------------------------------------------------------+
199
+ | PS | Hydraulic Turbine, Reversible (pumped storage) |
200
+ +------+---------------------------------------------------------------+
201
+ | ES | Energy Storage, Other |
202
+ +------+---------------------------------------------------------------+
203
+ | ST | Steam Turbine (includes nuclear, geothermal, and solar steam) |
204
+ +------+---------------------------------------------------------------+
205
+ | GT | Combustion (Gas) Turbine |
206
+ +------+---------------------------------------------------------------+
207
+ | IC | Internal Combustion Engine (diesel, piston, reciprocating) |
208
+ +------+---------------------------------------------------------------+
209
+ | CA | Combined Cycle Steam Part |
210
+ +------+---------------------------------------------------------------+
211
+ | CT | Combined Cycle Combustion Turbine Part |
212
+ +------+---------------------------------------------------------------+
213
+ | CS | Combined Cycle Single Shaft |
214
+ +------+---------------------------------------------------------------+
215
+ | CC | Combined Cycle Total Unit |
216
+ +------+---------------------------------------------------------------+
217
+ | HA | Hydrokinetic, Axial Flow Turbine |
218
+ +------+---------------------------------------------------------------+
219
+ | HB | Hydrokinetic, Wave Buoy |
220
+ +------+---------------------------------------------------------------+
221
+ | HK | Hydrokinetic, Other |
222
+ +------+---------------------------------------------------------------+
223
+ | HY | Hydroelectric Turbine |
224
+ +------+---------------------------------------------------------------+
225
+ | BT | Turbines Used in a Binary Cycle |
226
+ +------+---------------------------------------------------------------+
227
+ | PV | Photovoltaic |
228
+ +------+---------------------------------------------------------------+
229
+ | WT | Wind Turbine, Onshore |
230
+ +------+---------------------------------------------------------------+
231
+ | WS | Wind Turbine, Offshore |
232
+ +------+---------------------------------------------------------------+
233
+ | FC | Fuel Cell |
234
+ +------+---------------------------------------------------------------+
235
+ | OT | Other |
236
+ +------+---------------------------------------------------------------+
237
+ | UN | Unknown |
238
+ +------+---------------------------------------------------------------+
239
+ | JE | Jet Engine |
240
+ +------+---------------------------------------------------------------+
241
+ | NB | ST - Boiling Water Nuclear Reactor |
242
+ +------+---------------------------------------------------------------+
243
+ | NG | ST - Graphite Nuclear Reactor |
244
+ +------+---------------------------------------------------------------+
245
+ | NH | ST - High Temperature Gas Nuclear Reactor |
246
+ +------+---------------------------------------------------------------+
247
+ | NP | ST - Pressurized Water Nuclear Reactor |
248
+ +------+---------------------------------------------------------------+
249
+ | IT | Internal Combustion Turbo Charged |
250
+ +------+---------------------------------------------------------------+
251
+ | SC | Synchronous Condenser |
252
+ +------+---------------------------------------------------------------+
253
+ | DC | DC ties |
254
+ +------+---------------------------------------------------------------+
255
+ | MP | Motor/Pump |
256
+ +------+---------------------------------------------------------------+
257
+ | W1 | Wind Turbine, Type 1 |
258
+ +------+---------------------------------------------------------------+
259
+ | W2 | Wind Turbine, Type 2 |
260
+ +------+---------------------------------------------------------------+
261
+ | W3 | Wind Turbine, Type 3 |
262
+ +------+---------------------------------------------------------------+
263
+ | W4 | Wind Turbine, Type 4 |
264
+ +------+---------------------------------------------------------------+
265
+ | SV | Static Var Compensator |
266
+ +------+---------------------------------------------------------------+
267
+ | DL | Dispatchable Load |
268
+ +------+---------------------------------------------------------------+
269
+
270
+ Fuel Types
271
+ ~~~~~~~~~~~~~~~~
272
+ +-------------+---------------------------------------+
273
+ | code | description |
274
+ +-------------+---------------------------------------+
275
+ | biomass | Biomass |
276
+ +-------------+---------------------------------------+
277
+ | coal | Coal |
278
+ +-------------+---------------------------------------+
279
+ | dfo | Distillate Fuel Oil |
280
+ +-------------+---------------------------------------+
281
+ | geothermal | Geothermal |
282
+ +-------------+---------------------------------------+
283
+ | hydro | Hydro |
284
+ +-------------+---------------------------------------+
285
+ | hydrops | Hydro Pumped Storage |
286
+ +-------------+---------------------------------------+
287
+ | jetfuel | Jet Fuel |
288
+ +-------------+---------------------------------------+
289
+ | lng | Liquefied Natural Gas |
290
+ +-------------+---------------------------------------+
291
+ | ng | Natural Gas |
292
+ +-------------+---------------------------------------+
293
+ | nuclear | Nuclear |
294
+ +-------------+---------------------------------------+
295
+ | oil | Unspecified Oil |
296
+ +-------------+---------------------------------------+
297
+ | refuse | Refuse, Municipal Solid Waste |
298
+ +-------------+---------------------------------------+
299
+ | rfo | Residual Fuel Oil |
300
+ +-------------+---------------------------------------+
301
+ | solar | Solar |
302
+ +-------------+---------------------------------------+
303
+ | syncgen | Synchronous Condenser |
304
+ +-------------+---------------------------------------+
305
+ | wasteheat | Waste Heat |
306
+ +-------------+---------------------------------------+
307
+ | wind | Wind |
308
+ +-------------+---------------------------------------+
309
+ | wood | Wood or Wood Waste |
310
+ +-------------+---------------------------------------+
311
+ | other | Other |
312
+ +-------------+---------------------------------------+
313
+ | unknown | Unknown |
314
+ +-------------+---------------------------------------+
315
+ | dl | Dispatchable Load |
316
+ +-------------+---------------------------------------+
317
+ | ess | Energy Storage System |
318
+ +-------------+---------------------------------------+
@@ -3,8 +3,7 @@
3
3
  PYPOWER
4
4
  --------
5
5
 
6
- AMS includes `PYPOWER cases <https://github.com/CURENT/ams/tree/develop/ams/cases/pypower>`_
7
- in version 2 for scheduling modeling and analysis. PYPOWER cases follow the same format as MATPOWER.
6
+ AMS supports PYPOWER PY case file. PYPOWER cases follow a similar format as MATPOWER.
8
7
 
9
8
  The PYPOWER case is defined as a Python dictionary that includes ``bus``, ``gen``, ``branch``,
10
9
  ``areas``, and ``gencost``.
@@ -9,6 +9,24 @@ The APIs before v3.0.0 are in beta and may change without prior notice.
9
9
  v1.0
10
10
  ==========
11
11
 
12
+ v1.0.9 (2024-04-23)
13
+ --------------------
14
+
15
+ Improve MATPOWER file converter:
16
+
17
+ - Add a M file case writer
18
+ - Include Area and Zone in both MATPOWER read and write
19
+
20
+ v1.0.8 (2024-04-20)
21
+ --------------------
22
+
23
+ - Run workflow "Publish" only on push tag event
24
+ - Include Hawaii synthetic case from
25
+ `Hawaii Synthetic Grid <https://electricgrids.engr.tamu.edu/hawaii40/>`_
26
+ - Remove matrices calculation functions in model ``Line``
27
+ - Include ``gentype`` and ``genfuel`` when parsing MATPOWER cases
28
+ - Fix logging level in ``ACOPF.run``
29
+
12
30
  v1.0.7 (2024-04-14)
13
31
  --------------------
14
32
 
@@ -19,6 +37,8 @@ v1.0.7 (2024-04-14)
19
37
  - Include module ``MatProcessor`` in the API documentation
20
38
  - Improve Line parameters correction in ``System.setup()``
21
39
  - Make func ``interface._to_andes_pflow`` public
40
+ - Discard ``sync_adsys`` step in func ``to_andes_pflow`` to fix mistake in
41
+ parameters conversion
22
42
  - Update case files
23
43
 
24
44
  v1.0.6 (2024-04-10)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ltbams
3
- Version: 1.0.7
3
+ Version: 1.0.9
4
4
  Summary: Python software for scheduling modeling and co-simulation with dynamics.
5
5
  Home-page: https://github.com/CURENT/ams
6
6
  Author: Jinning Wang
@@ -52,9 +52,9 @@ Python Software for Power System Scheduling Modeling and Co-Simulation with Dyna
52
52
 
53
53
  <img src="docs/source/images/sponsors/CURENT_Logo_NameOnTrans.png" alt="CURENT ERC Logo" width="300" height="auto">
54
54
 
55
- | | Stable | Latest |
55
+ | | Stable | Develop |
56
56
  |---------------|-----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
57
- | Documentation | [![Documentation Status](https://readthedocs.org/projects/ams/badge/?version=stable)](https://ams.readthedocs.io/en/stable/?badge=stable) | [![Latest Documentation](https://readthedocs.org/projects/ams/badge/?version=latest)](https://ams.readthedocs.io/en/latest/?badge=latest) |
57
+ | Documentation | [![Documentation Status](https://readthedocs.org/projects/ams/badge/?version=stable)](https://ams.readthedocs.io/en/stable/?badge=stable) | [![Develop Documentation](https://readthedocs.org/projects/ams/badge/?version=develop)](https://ams.readthedocs.io/en/develop/?badge=develop) |
58
58
 
59
59
 
60
60
  | Badges | | |
@@ -1,15 +1,16 @@
1
1
  ams/__init__.py,sha256=dKIwng8xES4NQHn6ZHy8RCKeXphN9z2wyfmbvniIEg0,351
2
2
  ams/__main__.py,sha256=EB4GfGiKgvnQ_psNr0QwPoziYvjmGvQ2yVsBwQtfrLw,170
3
- ams/_version.py,sha256=OAPUdjEgjrXQonMYZMpBIDd9aovta238shZS3_AbAQ8,497
3
+ ams/_version.py,sha256=avHr2UrN612DP9lqO_q6kLn0M8iYUo1YDjCAifHhA9k,497
4
4
  ams/cli.py,sha256=EyNFXn565gFCppTxpyTZviBdPgUuKtgAPZ4WE6xewRk,6164
5
5
  ams/interface.py,sha256=_aF2VrO_hmVrW56H_q4CYWJps63nWUswCd3AWUbPbE8,44880
6
6
  ams/main.py,sha256=wzKLe_BeQAUyFh-U1cxQIOwr-rAJM8ppB3EEi6_v2tw,23607
7
- ams/report.py,sha256=gUscOYpPjuPuruzIXAADaifIZv2BSjmP1oKCuHdD3Vw,11004
8
- ams/shared.py,sha256=yaO4RUD0T-zCcZeML20vORcaf_dXiwMAvjTriXz1xtg,4159
7
+ ams/report.py,sha256=ewcffopOzT5o45eJNmcV8pxeQqPIjKbarGN33-yHGA8,10961
8
+ ams/shared.py,sha256=YLbyba5TzHVNDzy8jJMh1W5yZOXmlMXQ9P-nDbIVs84,4289
9
9
  ams/system.py,sha256=AW2_rMH0wjTuxhha87hQuyUCAllzWTfEsVBaTIiSAOg,25956
10
10
  ams/cases/5bus/pjm5bus_demo.xlsx,sha256=OWIUprkg8_aQ_bTCaEFMl7Bhfa1R20zxAHXRQtXBix0,32607
11
11
  ams/cases/5bus/pjm5bus_ev.xlsx,sha256=vR8dJv5jIxib1pgcMonhzvraoqZVJWhBSJdVXDL0qsI,19498
12
12
  ams/cases/5bus/pjm5bus_jumper.xlsx,sha256=47QAol1RGz_aGvhV2emq9XCy_Db9Zca15_OMVAdFVR0,19332
13
+ ams/cases/hawaii40/Hawaii40.m,sha256=t6YZwncQrMhZg3yDXh38oqDMY3akrdvCPf97nNm1otw,20683
13
14
  ams/cases/ieee123/ieee123.xlsx,sha256=yWsEFN1BvcoBYX9hWdrenPC_qKQfXtZ4xhpwoIc2OSE,39223
14
15
  ams/cases/ieee123/ieee123_regcv1.xlsx,sha256=dIygkiNGzo_RE0moMPFu-9Bt0uPDuAL9zYWAs6e8VSk,41678
15
16
  ams/cases/ieee14/ieee14.json,sha256=bBy3i2jKqFNmnc_rmNOYvGm-SAW2T6wwvEQ-Hkj5Hkw,21400
@@ -26,7 +27,7 @@ ams/cases/matpower/case118.m,sha256=vC5vIrS553ZXKIXuS1Dk9Ksu4MVXfpEm6G2QbxTEtfc,
26
27
  ams/cases/matpower/case14.m,sha256=L_xOG3NK5sXpLb5otONgEO1pWku8xNBlx0xPvDn888E,4597
27
28
  ams/cases/matpower/case300.m,sha256=L3mWBAncy5pHy53nycEXPmmRh1Rl-ZtlsELXwQGX4S8,65678
28
29
  ams/cases/matpower/case39.m,sha256=RAgz-ZjR2HaMYgR32stq_U4D8l85S7DSAFJFE60_3Dw,9628
29
- ams/cases/matpower/case5.m,sha256=7ZByCJ0IDeveKqAp7YqVSRwxGwj_T0Wte_Bogthv4nk,1921
30
+ ams/cases/matpower/case5.m,sha256=5KbGGXoS5Abx2mHZqX-vmmNEQ5AhhG4qo6Q6YZz9Qxs,2169
30
31
  ams/cases/matpower/case_ACTIVSg2000.m,sha256=jQBhjej9EL81pZn1nS3uv-zQ2G4o_P9zIZrXxOurhgs,659546
31
32
  ams/cases/npcc/npcc.m,sha256=QrYcufKlHrXr5nFC2Z92X05_Q1Rn3Nf11HCCYenAaC0,26342
32
33
  ams/cases/npcc/npcc_uced.xlsx,sha256=zuaZEOBwdOHwK5hFgQSXownyH-MfKDZQ-iVFeaFVSyg,86557
@@ -43,19 +44,19 @@ ams/core/symprocessor.py,sha256=HegjU_UnvWEny9kitI1su9J0WeFDjQnM4gNoeUGJ7qU,8428
43
44
  ams/core/var.py,sha256=f48pzir4miBsB5sh6PwUsFe0LdNNEM-d3VufcjbUU0w,1591
44
45
  ams/extension/__init__.py,sha256=5IFTNirDL0uDaUsg05_oociVT9VCy2rhPx1ad4LGveM,65
45
46
  ams/extension/eva.py,sha256=wUF8RNxzwas2Q6_xD0k3EVWjmX4kxHmTSkv2inJzaUY,16342
46
- ams/io/__init__.py,sha256=HLE3aozzXEx-6IBy8WTQVdSCpAZrrR9nX6UqaZ7okTw,3774
47
+ ams/io/__init__.py,sha256=GIfF7X44olHaySL8EzOBU1eXUnunr1owzzdPfPvvHZU,3802
47
48
  ams/io/json.py,sha256=IurwcZDuKczSbRTpcbQZiIi0ARCrMK6kJ0E3wS8ENy8,2585
48
- ams/io/matpower.py,sha256=Oj3FW-eqcl3H5mnB0U5XG1mtCK0SaxVOkgRXaC6MIKA,14523
49
- ams/io/psse.py,sha256=w5VKNE6enX0lfKwPI857PRtdpwN39R6IFRIcdbPSpOg,151
50
- ams/io/pypower.py,sha256=E6_kSNfv1Yyv9oYfFebeNeKaQPlHyRZQpE8F6Y67g8Q,2583
49
+ ams/io/matpower.py,sha256=51PRXtxlN690MH9tbP-A9Iv--1cN8d4fT4WP7IuPK88,25608
50
+ ams/io/psse.py,sha256=TOLsGuoFWpgLRK_zZqjCLIjd9fHAlfgjbDm84okw3p0,145
51
+ ams/io/pypower.py,sha256=Fe0sxzC5DZegtYksTixadXk_LcfJ1GNetWu9EuHCkG8,2790
51
52
  ams/io/xlsx.py,sha256=7ATW1seyxsGn7d5p5IuSRFHcoCHVVjMu3E7mP1Mc74U,2460
52
53
  ams/models/__init__.py,sha256=EGkViLkVX_We9FAGuEkgfleMNmPw_vGp2Nq1OQimL7U,691
53
54
  ams/models/area.py,sha256=AKYU6aJQKsVWRZdvMO7yic-8wZ1GumSTQXgDg5L0THw,899
54
55
  ams/models/bus.py,sha256=U0vSegkm-9fqPQS9KMJQU6gpIMX_1GK5O_dvRc8-0P0,1585
55
56
  ams/models/cost.py,sha256=rmGNj9ztMbqA-OIJj8fNNBh8bdYJSY9hk10vffgxc6k,5916
56
- ams/models/group.py,sha256=EEB66FwLq6liC6lGHax3oXIFxlwdYb4JMeDLnbLg6j4,5618
57
+ ams/models/group.py,sha256=-91Z-vL5uRDi3Y_EGfGpVgVrCNZ80YMZUoqKZYA9wHo,5738
57
58
  ams/models/info.py,sha256=Oh0Xo5J4ZHBsNIkMOzIwv_DegsX1inyuv3Q5CpCfyQw,788
58
- ams/models/line.py,sha256=dltKgVZdXj_kchA9QhHeyorYQKm_7PQW9B2qC_PTsKs,8084
59
+ ams/models/line.py,sha256=ju5h1BcW4kgVWm_lgl8zWhSYqlsUjbdoUwzz2t0Vx1s,2770
59
60
  ams/models/reserve.py,sha256=3BjWCyKrPL4CwTvmzRxk25H8Nkxh-Rz0Ne17I9Y2TUA,2816
60
61
  ams/models/shunt.py,sha256=h5QV33EcCd86XRR0sMIzcO0PTeTirkWaxi8imPKzOi0,337
61
62
  ams/models/timeslot.py,sha256=XfXJukbQXTUawbsYI6BMLbytXNIe5VE2SQ5_t1Lc8_8,2001
@@ -67,7 +68,7 @@ ams/models/distributed/pvd1.py,sha256=KAOlXpZgT_w58xaGWjm5ht6ksac6eRhaqBFHK4EPRH
67
68
  ams/models/renewable/__init__.py,sha256=7dZyRXbvBAHbLJeJssJ1hsOHj9Bgeg77kB5gcX_mBtg,118
68
69
  ams/models/renewable/regc.py,sha256=3J9alIGUn_GkibQ3-dKTylAOpNPzd5zpancPc79q9T4,3448
69
70
  ams/models/static/__init__.py,sha256=lh5yR5Xb2unS4ndng-cLU1TAeoidu2s6VAVFLc3HUDU,96
70
- ams/models/static/gen.py,sha256=SAaQD5_oOGFWa8NY8hbhsNqMQGHlToHdngEt_Xy5S3E,6685
71
+ ams/models/static/gen.py,sha256=QXklOYlnU7QHWy-WFJwhxuNItUPqFsLJIjAO4sGMUbg,7087
71
72
  ams/models/static/pq.py,sha256=a-z7-1Vegr3mPguRAdLqfJlwk5OG_Zpp8usfOzRAR30,2583
72
73
  ams/opt/__init__.py,sha256=INsl8yxtOzTKqV9pzVxlL6RSGDRaUDwxpZMY1QROrF4,459
73
74
  ams/opt/constraint.py,sha256=ERT9zwjQyGkvDo465Yd0wBexlIhjVmw0MyWq4BWnWoI,5534
@@ -105,7 +106,7 @@ ams/routines/cpf.py,sha256=xsrUVjtGQ1b7UCXpwwYihqzTeEGJJKnO9LlX1Tz9Tks,1552
105
106
  ams/routines/dcopf.py,sha256=6ETgopvX9tSFF3kssHsBchAttcyo2DTG-eIqjvlk0WY,11087
106
107
  ams/routines/dcopf2.py,sha256=sDCP8zqYHDh7s7p9SX6G8QhMfIxCg3VPYJn6r3pRKyo,3620
107
108
  ams/routines/dcpf.py,sha256=SswIb7t37ulxe1rjroA7oSa6z01kYjO-x8P1WWOUutM,8237
108
- ams/routines/dcpf0.py,sha256=gPPfSUzzJbHz_gAEFVyZ3iriEHvLJ-OGpTzhza8FOkA,6811
109
+ ams/routines/dcpf0.py,sha256=V9zfBoV0cRMFLJdLrpvieyvwTybLTZADPoaKMJLKSkY,6814
109
110
  ams/routines/dopf.py,sha256=8D36-FkPORYGaMnwGTqwz8HxAXk5ywo3mk8NlGq327g,6289
110
111
  ams/routines/ed.py,sha256=i0Y3COlz4oAf8u8JxqfuQWn6WxjJzb59weLedow0Y_g,11777
111
112
  ams/routines/pflow.py,sha256=CZAiwnZYhEmSU7Exn9CK6rFxWvjpvv1Py-pLegWJ71s,9419
@@ -124,22 +125,22 @@ docs/source/conf.py,sha256=UyoWogZTUNSJU7pQS_JaR28nKddW94zr01LYoIciZZw,6688
124
125
  docs/source/genmodelref.py,sha256=IhmF7bDw8BXPvLD8V3WjQNrfc-H07r5iS-_4DHbbp-8,1420
125
126
  docs/source/genroutineref.py,sha256=0JyMc2kV5bWrWbSoO6d7o4QgDgG8mVy3JGGQWacJypw,1064
126
127
  docs/source/index.rst,sha256=N5phQS5RIyYs-NZo_5yYB8LjvHzOKLeXzRA-M8i-g3Q,2688
127
- docs/source/release-notes.rst,sha256=KHsxEcYBAKMF19k9sl6FyO5Et4ecRutohZvkC6vr1PA,13787
128
+ docs/source/release-notes.rst,sha256=mufS_IYNBuypDaifuF69eRexgAibOyINgj9A-k1y6Jc,14410
128
129
  docs/source/_templates/autosummary/base.rst,sha256=zl3U4baR4a6YjsHyT-x9zCOrHwKZOVUdWn1NPX2u3bc,106
129
130
  docs/source/_templates/autosummary/class.rst,sha256=Hv_igCsLsUpM62_zN0nqj6FSfKnS5xLyu8ZldMbfOAk,668
130
131
  docs/source/_templates/autosummary/module.rst,sha256=YdbpCudOrEU-JbuSlzGvcOI2hn_KrCM6FW5HcGqkaEE,1113
131
132
  docs/source/_templates/autosummary/module_toctree.rst,sha256=sg30OdqFDLyo8Y3hl9V-s2BXb1bzcjjqqWaWi-C3qFM,1126
132
133
  docs/source/examples/index.rst,sha256=6VT3wVeKk8BWf6pJQtZrmcumW_3jI8esdlzja8scUCA,742
133
- docs/source/getting_started/copyright.rst,sha256=XBfWvLm7T8p-zh1jkDy1kODvTDcH73AEV_vkiN32A2o,715
134
+ docs/source/getting_started/copyright.rst,sha256=d3S7FjrbysVqQd3pEBadrrkcQOZ7sYYeDTCOS4goPC8,715
134
135
  docs/source/getting_started/index.rst,sha256=mcp1NdUwbPoNzpn7Owf5Qzfd6J_--ToU52PjmrbwjBY,1512
135
136
  docs/source/getting_started/install.rst,sha256=gE4L0ApiC_mwbjbYtkGW4ilyIAu_Jn-VIeoYlgRiOIw,7268
136
137
  docs/source/getting_started/overview.rst,sha256=Zy890bDCUVW37NvjhQFUJUae1Zkghr72Az4Qd0PhP_I,1068
137
138
  docs/source/getting_started/testcase.rst,sha256=L3fGjfm7mGj7ChRovYw5Jx6OP8PU5pTerid0_Y4iKVM,2016
138
139
  docs/source/getting_started/verification.rst,sha256=Jxbgf-SmXYLSokylr1LKtGOjAWUc7a5D-uT_mQZ7i7c,243
139
140
  docs/source/getting_started/formats/index.rst,sha256=G3WO-A_B2abKNrxc6dEZ82AhQWSCDMGwQObFvOeKbGo,317
140
- docs/source/getting_started/formats/matpower.rst,sha256=kyvEoJGsTj1FfVnPoraljPENgiRa3fmB3KqZ_VSJg90,17425
141
+ docs/source/getting_started/formats/matpower.rst,sha256=05SEkuGeGCbns8Pd6Kqdo_y36cDP8Pwlbf_I3Kx0-sM,26038
141
142
  docs/source/getting_started/formats/psse.rst,sha256=zPHCnMa-M3k3aaDmzoZWXBaR3O0l0zupFlr_yaiB5eU,1570
142
- docs/source/getting_started/formats/pypower.rst,sha256=7RHy6iC6w37mUIRtHU0oa4fECdkQPEptflUxCwu3nD8,8986
143
+ docs/source/getting_started/formats/pypower.rst,sha256=8rpKdZkNcj1s-KK76XJAc3FZ24DiJ2gwAKqsKJdasLY,8878
143
144
  docs/source/getting_started/formats/xlsx.png,sha256=WX5x7ZG9hBu5Ft8gmA_u4XQewK_SDWw30WOaXsAS8LY,171220
144
145
  docs/source/getting_started/formats/xlsx.rst,sha256=utsE0AJirT_P7ZvCk63NhB-z19NdbS8OjWQyQ9juskM,761
145
146
  docs/source/images/curent.ico,sha256=pKetB19VTcdXTRH6iACq5YWHZYPcDesd9bfnT2KaaOM,36637
@@ -156,13 +157,12 @@ docs/source/modeling/system.rst,sha256=NMOPNMOKG1_dRyNPPx-MiCKbbpadxWJxGyU6geRUs
156
157
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
157
158
  tests/test_1st_system.py,sha256=BLlJsHnEBeLfiMJvIjyPguMikfDjqGSzfn8cZ-tqCVc,1900
158
159
  tests/test_addressing.py,sha256=MIT713KCqMg0h2o4rBDZsGUrpGadmMlXnrrdq-wB77E,1364
159
- tests/test_andes_mats.py,sha256=O4nCthteh7Y91KsWnq_EcplvsIN8DY-lgEGkH5a7iOc,1669
160
160
  tests/test_case.py,sha256=8Jn1hwrB72l6-rqbCWTGJOcxicu4GHVDzGsLLxjDFos,8833
161
161
  tests/test_cli.py,sha256=TtCGBy2e7Ll_2gJTFo9juZtzhaakho_MqkcqhG2w2dk,870
162
162
  tests/test_export_csv.py,sha256=rZCafNrVbwDo7ZNC4MrL1gIcrU0c6YVw2q-QGL3O4K4,2921
163
163
  tests/test_group.py,sha256=Tq0s9gtenqrv4ws5YNzWxbiF4WgyhtMEAXZfJtew6M4,2699
164
164
  tests/test_interface.py,sha256=lXKR8OAsGIg5dV2Uj0UwGAl69hKnc_7EtCYvpP_0rrU,8157
165
- tests/test_io.py,sha256=LaNkRXZaItAFHqqXs6CC5iaxTMXiDEFGbwYODcOHPWc,1416
165
+ tests/test_io.py,sha256=EhHJEXogtpAVYU8KvCoHlrwfNWY5IwQPq9AHBWRzpB0,4931
166
166
  tests/test_jumper.py,sha256=bdOknplEGnO_tiJc7p3xQvgTe2b6Dz53bOgbFaXKMAI,537
167
167
  tests/test_known_good.py,sha256=NBrlAxnVMxIHXR2cWps-Kwjh36fiU4Y-eupspZkM0ks,9670
168
168
  tests/test_matp.py,sha256=LkjhqxSFr6oY_ENpduDQ77rhLLBl6RzIHZ2d0m_8i-8,17262
@@ -180,8 +180,8 @@ tests/test_rtn_pflow.py,sha256=aDL5Ewm6lWqpdHqIIu-DTllhXzt4bMjsLJaKbJa8sXQ,6990
180
180
  tests/test_rtn_rted.py,sha256=1Vd4JCX3sfLnuXXzuUGFsEPTtqmdaDzDXpBcAQwnDf0,9785
181
181
  tests/test_rtn_uc.py,sha256=8KrqxOxW6tiN4Fxl417NyHJCgdZwXh2ioX0mQbHuEgU,8302
182
182
  tests/test_service.py,sha256=6IP6CAH2xHxGHZM4-R8LjZxVJ2L10LcGaPDyRIqKLmc,2438
183
- ltbams-1.0.7.dist-info/METADATA,sha256=Wd2Mlqkkwsqm2zA1DNsDL-RS55TJe8Ptod_oAWB55O8,14023
184
- ltbams-1.0.7.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
185
- ltbams-1.0.7.dist-info/entry_points.txt,sha256=FA56FlhO_yVNeEf810SrorVQb7_Xsmo3_EW-W-ijUfA,37
186
- ltbams-1.0.7.dist-info/top_level.txt,sha256=pyKDqG2kj13F9-BYd_wkruRdBSqLXw8Nwc-cmljqrxg,15
187
- ltbams-1.0.7.dist-info/RECORD,,
183
+ ltbams-1.0.9.dist-info/METADATA,sha256=6L6zS-1f1_ft__1AiTAh0EhMpEFCd2y5lEhif5fBDpM,14027
184
+ ltbams-1.0.9.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
185
+ ltbams-1.0.9.dist-info/entry_points.txt,sha256=FA56FlhO_yVNeEf810SrorVQb7_Xsmo3_EW-W-ijUfA,37
186
+ ltbams-1.0.9.dist-info/top_level.txt,sha256=pyKDqG2kj13F9-BYd_wkruRdBSqLXw8Nwc-cmljqrxg,15
187
+ ltbams-1.0.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (79.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
tests/test_io.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """
2
2
  Test file input/output.
3
3
  """
4
-
4
+ import os
5
5
  import unittest
6
6
  import numpy as np
7
7
 
@@ -9,28 +9,81 @@ import ams
9
9
 
10
10
 
11
11
  class TestMATPOWER(unittest.TestCase):
12
+ """
13
+ Test IO functions for MATPOWER and PYPOWER.
14
+ """
12
15
 
13
16
  def setUp(self):
14
17
  self.mpc5 = ams.io.matpower.m2mpc(ams.get_case('matpower/case5.m'))
15
18
  self.mpc14 = ams.io.matpower.m2mpc(ams.get_case('matpower/case14.m'))
16
19
 
17
20
  def test_m2mpc(self):
21
+ """Test conversion from M file to mpc dict."""
22
+ # NOTE: when the keys are there, read them
18
23
  self.assertTupleEqual(self.mpc5['gencost'].shape, (5, 6))
24
+ self.assertTupleEqual(self.mpc5['gentype'].shape, (5,))
25
+ self.assertTupleEqual(self.mpc5['genfuel'].shape, (5,))
26
+
27
+ # NOTE: when the keys are not there, the read mpc will not complete them
19
28
  self.assertTupleEqual(self.mpc14['gencost'].shape, (5, 7))
29
+ self.assertNotIn('gentype', self.mpc14)
30
+ self.assertNotIn('genfuel', self.mpc14)
20
31
 
21
32
  def test_mpc2system(self):
33
+ """Test conversion from MPC to AMS System."""
22
34
  system5 = ams.system.System()
23
35
  ams.io.matpower.mpc2system(self.mpc5, system5)
24
36
  # In case5.m, the gencost has type 2 cost model, with 2 parameters.
25
37
  np.testing.assert_array_equal(system5.GCost.c2.v,
26
38
  np.zeros(system5.StaticGen.n))
27
39
 
40
+ # Check if Area is added
41
+ self.assertGreater(system5.Area.n, 0)
42
+
43
+ # Check if Zone is added
44
+ self.assertGreater(system5.Zone.n, 0)
45
+
28
46
  system14 = ams.system.System()
47
+ # Test gentype length check
48
+ mpc14 = self.mpc14.copy()
49
+ mpc14['gentype'] = np.array(['WT'] * 6)
50
+ with self.assertRaises(ValueError, msg='gentype length check failed!'):
51
+ ams.io.matpower.mpc2system(mpc14, system14)
52
+
29
53
  ams.io.matpower.mpc2system(self.mpc14, system14)
30
54
  # In case14.m, the gencost has type 2 cost model, with 3 parameters.
31
55
  np.testing.assert_array_less(np.zeros(system14.StaticGen.n),
32
56
  system14.GCost.c2.v,)
33
57
 
58
+ def test_system2mpc(self):
59
+ """Test conversion from AMS System to MPC."""
60
+ system5 = ams.system.System()
61
+ ams.io.matpower.mpc2system(self.mpc5, system5)
62
+ mpc5 = ams.io.matpower.system2mpc(system5)
63
+
64
+ self.assertEqual(mpc5['baseMVA'], self.mpc5['baseMVA'])
65
+
66
+ # Bus
67
+ # type, PD, QD, GS,BS, VM, VA. BASE_KV, VMAX, VMIN
68
+ bus_cols = [1, 2, 3, 4, 5, 7, 8, 9, 11, 12]
69
+ np.testing.assert_array_equal(mpc5['bus'][:, bus_cols],
70
+ self.mpc5['bus'][:, bus_cols])
71
+
72
+ # Branch, Gen, Gencost, can have minor differences but is okay
73
+
74
+ # String type data
75
+ np.testing.assert_array_equal(mpc5['gentype'], self.mpc5['gentype'])
76
+ np.testing.assert_array_equal(mpc5['genfuel'], self.mpc5['genfuel'])
77
+ np.testing.assert_array_equal(mpc5['bus_name'], self.mpc5['bus_name'])
78
+
79
+ # Area quantity
80
+ self.assertEqual(np.unique(mpc5['bus'][:, 6]).shape[0],
81
+ np.unique(self.mpc5['bus'][:, 6]).shape[0])
82
+
83
+ # Zone quantity
84
+ self.assertEqual(np.unique(mpc5['bus'][:, 10]).shape[0],
85
+ np.unique(self.mpc5['bus'][:, 10]).shape[0])
86
+
34
87
  def test_gencost1(self):
35
88
  """Test when gencost is type 1."""
36
89
  mpcgc1 = self.mpc14.copy()
@@ -39,3 +92,39 @@ class TestMATPOWER(unittest.TestCase):
39
92
  system = ams.system.System()
40
93
  ams.io.matpower.mpc2system(mpcgc1, system)
41
94
  self.assertEqual(system.GCost.n, 5)
95
+
96
+ def test_mpc2m(self):
97
+ """Test conversion from MPC to M file."""
98
+ mpc5 = ams.io.matpower.m2mpc(ams.get_case('matpower/case5.m'))
99
+ mpc14 = ams.io.matpower.m2mpc(ams.get_case('matpower/case14.m'))
100
+
101
+ # Test conversion to M file
102
+ mfile5 = ams.io.matpower.mpc2m(mpc5, './case5out.m')
103
+ mfile14 = ams.io.matpower.mpc2m(mpc14, './case14out.m')
104
+
105
+ # Check if the files exist
106
+ self.assertTrue(os.path.exists(mfile5))
107
+ self.assertTrue(os.path.exists(mfile14))
108
+
109
+ mpc5read = ams.io.matpower.m2mpc(mfile5)
110
+ mpc14read = ams.io.matpower.m2mpc(mfile14)
111
+
112
+ # Check if the numerical values are the same
113
+ for key in mpc5:
114
+ if key in ['bus_name', 'gentype', 'genfuel']:
115
+ continue
116
+ np.testing.assert_array_almost_equal(
117
+ mpc5[key], mpc5read[key], decimal=5,
118
+ err_msg=f"Mismatch in {key} when converting case5.m"
119
+ )
120
+ for key in mpc14:
121
+ if key in ['bus_name', 'gentype', 'genfuel']:
122
+ continue
123
+ np.testing.assert_array_almost_equal(
124
+ mpc14[key], mpc14read[key], decimal=5,
125
+ err_msg=f"Mismatch in {key} when converting case14.m"
126
+ )
127
+
128
+ # Clean up the generated files
129
+ os.remove(mfile5)
130
+ os.remove(mfile14)
tests/test_andes_mats.py DELETED
@@ -1,61 +0,0 @@
1
- """
2
- Test ANDES matrices.
3
- """
4
-
5
- import unittest
6
- import numpy as np
7
- import importlib.metadata
8
- from packaging.version import parse as parse_version
9
-
10
- import ams
11
-
12
-
13
- class TestMatrices(unittest.TestCase):
14
- """
15
- Tests for system matrices consistency.
16
- """
17
-
18
- andes_version = importlib.metadata.version("andes")
19
- if parse_version(andes_version) < parse_version('1.9.2'):
20
- raise unittest.SkipTest("Requires ANDES version >= 1.9.2")
21
-
22
- sp = ams.load(ams.get_case('matpower/case14.m'),
23
- setup=True, no_output=True, default_config=True,)
24
- sa = sp.to_andes(setup=True, no_output=True, default_config=True,)
25
-
26
- def setUp(self) -> None:
27
- """
28
- Test setup.
29
- """
30
-
31
- def test_build_y(self):
32
- """
33
- Test build_y consistency.
34
- """
35
- ysp = self.sp.Line.build_y()
36
- ysa = self.sa.Line.build_y()
37
- np.testing.assert_equal(np.array(ysp.V), np.array(ysa.V))
38
-
39
- def test_build_Bp(self):
40
- """
41
- Test build_Bp consistency.
42
- """
43
- Bp_sp = self.sp.Line.build_Bp()
44
- Bp_sa = self.sa.Line.build_Bp()
45
- np.testing.assert_equal(np.array(Bp_sp.V), np.array(Bp_sa.V))
46
-
47
- def test_build_Bpp(self):
48
- """
49
- Test build_Bpp consistency.
50
- """
51
- Bpp_sp = self.sp.Line.build_Bpp()
52
- Bpp_sa = self.sa.Line.build_Bpp()
53
- np.testing.assert_equal(np.array(Bpp_sp.V), np.array(Bpp_sa.V))
54
-
55
- def test_build_Bdc(self):
56
- """
57
- Test build_Bdc consistency.
58
- """
59
- Bdc_sp = self.sp.Line.build_Bdc()
60
- Bdc_sa = self.sa.Line.build_Bdc()
61
- np.testing.assert_equal(np.array(Bdc_sp.V), np.array(Bdc_sa.V))