ltbams 1.0.6__py3-none-any.whl → 1.0.8__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/_version.py +3 -3
- ams/cases/5bus/pjm5bus_demo.xlsx +0 -0
- ams/cases/5bus/pjm5bus_ev.xlsx +0 -0
- ams/cases/5bus/pjm5bus_jumper.xlsx +0 -0
- ams/cases/hawaii40/Hawaii40.m +375 -0
- ams/cases/ieee14/ieee14_uced.xlsx +0 -0
- ams/cases/ieee39/ieee39_uced.xlsx +0 -0
- ams/cases/ieee39/ieee39_uced_esd1.xlsx +0 -0
- ams/cases/ieee39/ieee39_uced_pvd1.xlsx +0 -0
- ams/cases/ieee39/ieee39_uced_vis.xlsx +0 -0
- ams/cases/matpower/case5.m +25 -0
- ams/core/matprocessor.py +7 -16
- ams/core/service.py +4 -3
- ams/interface.py +17 -4
- ams/io/__init__.py +1 -0
- ams/io/matpower.py +165 -7
- ams/io/psse.py +1 -1
- ams/models/__init__.py +1 -1
- ams/models/group.py +77 -6
- ams/models/line.py +3 -164
- ams/models/renewable/regc.py +1 -5
- ams/models/reserve.py +2 -2
- ams/models/static/gen.py +11 -3
- ams/models/static/pq.py +2 -2
- ams/models/timeslot.py +1 -1
- ams/routines/dcopf.py +1 -1
- ams/routines/dcpf0.py +1 -1
- ams/routines/dopf.py +10 -10
- ams/routines/ed.py +3 -4
- ams/routines/pflow.py +9 -10
- ams/routines/rted.py +20 -29
- ams/routines/uc.py +1 -1
- ams/system.py +11 -18
- docs/source/api.rst +2 -0
- docs/source/getting_started/copyright.rst +1 -1
- docs/source/release-notes.rst +24 -0
- {ltbams-1.0.6.dist-info → ltbams-1.0.8.dist-info}/METADATA +1 -1
- {ltbams-1.0.6.dist-info → ltbams-1.0.8.dist-info}/RECORD +48 -51
- {ltbams-1.0.6.dist-info → ltbams-1.0.8.dist-info}/WHEEL +1 -1
- tests/test_1st_system.py +31 -0
- tests/test_case.py +27 -19
- tests/test_io.py +15 -0
- tests/test_rtn_ed.py +4 -4
- tests/test_rtn_rted.py +4 -4
- tests/test_rtn_uc.py +4 -4
- tests/test_service.py +2 -2
- ams/cases/5bus/pjm5bus_uced.json +0 -1062
- ams/cases/5bus/pjm5bus_uced.xlsx +0 -0
- ams/cases/5bus/pjm5bus_uced_esd1.xlsx +0 -0
- ams/cases/5bus/pjm5bus_uced_ev.xlsx +0 -0
- tests/test_andes_mats.py +0 -61
- {ltbams-1.0.6.dist-info → ltbams-1.0.8.dist-info}/entry_points.txt +0 -0
- {ltbams-1.0.6.dist-info → ltbams-1.0.8.dist-info}/top_level.txt +0 -0
ams/routines/ed.py
CHANGED
@@ -109,8 +109,7 @@ class MPBase:
|
|
109
109
|
class ED(RTED, MPBase, SRBase):
|
110
110
|
"""
|
111
111
|
DC-based multi-period economic dispatch (ED).
|
112
|
-
|
113
|
-
|
112
|
+
Dispatch interval ``config.t`` ($T_{cfg}$) is introduced, 1 [Hour] by default.
|
114
113
|
ED extends DCOPF as follows:
|
115
114
|
|
116
115
|
- Vars ``pg``, ``pru``, ``prd`` are extended to 2D
|
@@ -120,10 +119,10 @@ class ED(RTED, MPBase, SRBase):
|
|
120
119
|
Notes
|
121
120
|
-----
|
122
121
|
1. Formulations has been adjusted with interval ``config.t``
|
123
|
-
|
124
122
|
2. The tie-line flow is not implemented in this model.
|
125
|
-
|
126
123
|
3. ``EDTSlot.ug`` is used instead of ``StaticGen.u`` for generator commitment.
|
124
|
+
4. Following reserves are balanced for each "Area": RegUp reserve ``rbu``,
|
125
|
+
RegDn reserve ``rbd``, and Spinning reserve ``rsr``.
|
127
126
|
"""
|
128
127
|
|
129
128
|
def __init__(self, system, config):
|
ams/routines/pflow.py
CHANGED
@@ -12,7 +12,7 @@ from andes.utils.misc import elapsed
|
|
12
12
|
from ams.core.param import RParam
|
13
13
|
from ams.routines.routine import RoutineBase
|
14
14
|
from ams.opt import Var, Expression, Objective
|
15
|
-
from ams.interface import
|
15
|
+
from ams.interface import to_andes_pflow, sync_adsys
|
16
16
|
|
17
17
|
logger = logging.getLogger(__name__)
|
18
18
|
|
@@ -28,10 +28,9 @@ class PFlow(RoutineBase):
|
|
28
28
|
|
29
29
|
References
|
30
30
|
----------
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
https://docs.andes.app/en/latest/_examples/ex1.html
|
31
|
+
1. M. L. Crow, Computational methods for electric power systems. 2015.
|
32
|
+
2. ANDES Documentation - Simulation and Plot.
|
33
|
+
https://docs.andes.app/en/latest/_examples/ex1.html
|
35
34
|
"""
|
36
35
|
|
37
36
|
def __init__(self, system, config):
|
@@ -102,10 +101,10 @@ class PFlow(RoutineBase):
|
|
102
101
|
|
103
102
|
kwargs go to andes.system.System().
|
104
103
|
"""
|
105
|
-
self._adsys =
|
106
|
-
|
107
|
-
|
108
|
-
|
104
|
+
self._adsys = to_andes_pflow(self.system,
|
105
|
+
no_output=self.system.files.no_output,
|
106
|
+
config=self.config.as_dict(),
|
107
|
+
**kwargs)
|
109
108
|
self._adsys.setup()
|
110
109
|
self.om.init()
|
111
110
|
self.initialized = True
|
@@ -132,7 +131,7 @@ class PFlow(RoutineBase):
|
|
132
131
|
self.exec_time = float(s.split(" ")[0])
|
133
132
|
|
134
133
|
self.unpack()
|
135
|
-
return
|
134
|
+
return self.converged
|
136
135
|
|
137
136
|
def _post_solve(self):
|
138
137
|
"""
|
ams/routines/rted.py
CHANGED
@@ -20,22 +20,22 @@ class RTEDBase:
|
|
20
20
|
"""
|
21
21
|
|
22
22
|
def __init__(self):
|
23
|
-
# ---
|
24
|
-
self.zg = RParam(info='Gen
|
23
|
+
# --- area ---
|
24
|
+
self.zg = RParam(info='Gen area',
|
25
25
|
name='zg', tex_name='z_{one,g}',
|
26
|
-
model='StaticGen', src='
|
26
|
+
model='StaticGen', src='area',
|
27
27
|
no_parse=True)
|
28
|
-
self.zd = RParam(info='Load
|
28
|
+
self.zd = RParam(info='Load area',
|
29
29
|
name='zd', tex_name='z_{one,d}',
|
30
|
-
model='StaticLoad', src='
|
30
|
+
model='StaticLoad', src='area',
|
31
31
|
no_parse=True)
|
32
|
-
self.gs = ZonalSum(u=self.zg, zone='
|
32
|
+
self.gs = ZonalSum(u=self.zg, zone='Area',
|
33
33
|
name='gs', tex_name=r'S_{g}',
|
34
|
-
info='Sum Gen vars vector in shape of
|
34
|
+
info='Sum Gen vars vector in shape of area',
|
35
35
|
no_parse=True, sparse=True)
|
36
|
-
self.ds = ZonalSum(u=self.zd, zone='
|
36
|
+
self.ds = ZonalSum(u=self.zd, zone='Area',
|
37
37
|
name='ds', tex_name=r'S_{d}',
|
38
|
-
info='Sum pd vector in shape of
|
38
|
+
info='Sum pd vector in shape of area',
|
39
39
|
no_parse=True,)
|
40
40
|
self.pdz = NumOpDual(u=self.ds, u2=self.pd,
|
41
41
|
fun=np.multiply,
|
@@ -110,10 +110,9 @@ class SFRBase:
|
|
110
110
|
class RTED(DCOPF, RTEDBase, SFRBase):
|
111
111
|
"""
|
112
112
|
DC-based real-time economic dispatch (RTED).
|
113
|
+
|
113
114
|
RTED extends DCOPF with:
|
114
115
|
|
115
|
-
- Mapping dicts to interface with ANDES
|
116
|
-
- Function ``dc2ac`` to do the AC conversion
|
117
116
|
- Vars for SFR reserve: ``pru`` and ``prd``
|
118
117
|
- Param for linear SFR cost: ``cru`` and ``crd``
|
119
118
|
- Param for SFR requirement: ``du`` and ``dd``
|
@@ -127,8 +126,9 @@ class RTED(DCOPF, RTEDBase, SFRBase):
|
|
127
126
|
Notes
|
128
127
|
-----
|
129
128
|
1. Formulations has been adjusted with interval ``config.t``, 5/60 [Hour] by default.
|
130
|
-
|
131
|
-
|
129
|
+
2. The tie-line flow related constraints are ommited in this formulation.
|
130
|
+
3. The power balance is solved for the entire system.
|
131
|
+
4. The SFR is solved for each area.
|
132
132
|
"""
|
133
133
|
|
134
134
|
def __init__(self, system, config):
|
@@ -176,14 +176,6 @@ class RTED(DCOPF, RTEDBase, SFRBase):
|
|
176
176
|
self.obj.e_str = cost
|
177
177
|
|
178
178
|
def dc2ac(self, kloss=1.0, **kwargs):
|
179
|
-
"""
|
180
|
-
Convert the RTED results with ACOPF.
|
181
|
-
|
182
|
-
Parameters
|
183
|
-
----------
|
184
|
-
kloss : float, optional
|
185
|
-
The loss factor for the conversion. Defaults to 1.2.
|
186
|
-
"""
|
187
179
|
exec_time = self.exec_time
|
188
180
|
if self.exec_time == 0 or self.exit_code != 0:
|
189
181
|
logger.warning(f'{self.class_name} is not executed successfully, quit conversion.')
|
@@ -467,9 +459,9 @@ class VISBase:
|
|
467
459
|
model='VSG', src='D',
|
468
460
|
nonneg=True,)
|
469
461
|
|
470
|
-
self.gvsg = ZonalSum(u=self.zvsg, zone='
|
462
|
+
self.gvsg = ZonalSum(u=self.zvsg, zone='Area',
|
471
463
|
name='gvsg', tex_name=r'S_{g}',
|
472
|
-
info='Sum VSG vars vector in shape of
|
464
|
+
info='Sum VSG vars vector in shape of area',
|
473
465
|
no_parse=True)
|
474
466
|
self.Mub = Constraint(name='Mub', is_eq=False,
|
475
467
|
info='M upper bound',
|
@@ -494,12 +486,11 @@ class RTEDVIS(RTED, VISBase):
|
|
494
486
|
This class implements real-time economic dispatch with virtual inertia scheduling.
|
495
487
|
Please ensure that the parameters `dvm` and `dvd` are set according to the system base.
|
496
488
|
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
Sustainable Energy, doi: 10.1109/TSTE.2023.3319307.
|
489
|
+
References
|
490
|
+
-----------------
|
491
|
+
1. B. She, F. Li, H. Cui, J. Wang, Q. Zhang and R. Bo, "Virtual Inertia Scheduling (VIS) for
|
492
|
+
Real-Time Economic Dispatch of IBR-Penetrated Power Systems," in IEEE Transactions on
|
493
|
+
Sustainable Energy, vol. 15, no. 2, pp. 938-951, April 2024, doi: 10.1109/TSTE.2023.3319307.
|
503
494
|
"""
|
504
495
|
|
505
496
|
def __init__(self, system, config):
|
ams/routines/uc.py
CHANGED
@@ -288,7 +288,7 @@ class UC(DCOPF, RTEDBase, MPBase, SRBase, NSRBase):
|
|
288
288
|
gen['idx'] = self.system.PV.idx.v
|
289
289
|
gen['pmax'] = self.system.PV.get(src='pmax', attr='v', idx=gen['idx'])
|
290
290
|
gen['bus'] = self.system.PV.get(src='bus', attr='v', idx=gen['idx'])
|
291
|
-
gen['
|
291
|
+
gen['area'] = self.system.PV.get(src='area', attr='v', idx=gen['idx'])
|
292
292
|
gcost_idx = self.system.GCost.find_idx(keys='gen', values=gen['idx'])
|
293
293
|
gen['c2'] = self.system.GCost.get(src='c2', attr='v', idx=gcost_idx)
|
294
294
|
gen['c1'] = self.system.GCost.get(src='c1', attr='v', idx=gcost_idx)
|
ams/system.py
CHANGED
@@ -410,25 +410,18 @@ class System(andes_System):
|
|
410
410
|
|
411
411
|
# --- model parameters range check ---
|
412
412
|
# TODO: there might be other parameters check?
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
if np.any(
|
418
|
-
|
419
|
-
|
420
|
-
if
|
421
|
-
|
422
|
-
msg = f"Zero
|
423
|
-
msg += f"adjusted to {default_rate}."
|
413
|
+
adjusted_params = []
|
414
|
+
param_to_check = ['rate_a', 'rate_b', 'rate_c', 'amax', 'amin']
|
415
|
+
for pname in param_to_check:
|
416
|
+
param = self.Line.params[pname]
|
417
|
+
if np.any(param.v == 0):
|
418
|
+
adjusted_params.append(pname)
|
419
|
+
param.v[param.v == 0] = param.default
|
420
|
+
if adjusted_params:
|
421
|
+
adjusted_params_str = ', '.join(adjusted_params)
|
422
|
+
msg = f"Zero Line parameters detected, adjusted to default values: {adjusted_params_str}."
|
424
423
|
logger.info(msg)
|
425
|
-
|
426
|
-
if np.any(self.Line.amax.v == 0):
|
427
|
-
self.Line.amax.v[self.Line.amax.v == 0] = 2 * np.pi
|
428
|
-
logger.info("Zero line amax detected, adjusted to 2*pi.")
|
429
|
-
if np.any(self.Line.amin.v == 0):
|
430
|
-
self.Line.amin.v[self.Line.amin.v == 0] = -2 * np.pi
|
431
|
-
logger.info("Zero line amin detected, adjusted to -2*pi.")
|
424
|
+
|
432
425
|
# === no device addition or removal after this point ===
|
433
426
|
self.calc_pu_coeff() # calculate parameters in system per units
|
434
427
|
|
docs/source/api.rst
CHANGED
@@ -7,7 +7,7 @@ License
|
|
7
7
|
|
8
8
|
GNU Public License v3
|
9
9
|
*********************
|
10
|
-
| Copyright :raw-html:`©` 2023-
|
10
|
+
| Copyright :raw-html:`©` 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>`_
|
docs/source/release-notes.rst
CHANGED
@@ -9,6 +9,30 @@ 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.8 (2024-04-20)
|
13
|
+
--------------------
|
14
|
+
|
15
|
+
- Run workflow "Publish" only on push tag event
|
16
|
+
- Include Hawaii synthetic case from
|
17
|
+
`Hawaii Synthetic Grid <https://electricgrids.engr.tamu.edu/hawaii40/>`_
|
18
|
+
- Remove matrices calculation functions in model ``Line``
|
19
|
+
- Include ``gentype`` and ``genfuel`` when parsing MATPOWER cases
|
20
|
+
- Fix logging level in ``ACOPF.run``
|
21
|
+
|
22
|
+
v1.0.7 (2024-04-14)
|
23
|
+
--------------------
|
24
|
+
|
25
|
+
- Address several wording issues in the documentation
|
26
|
+
- Switch to ``Area`` from ``Zone`` for zonal calculation
|
27
|
+
- Extend common parameters in groups ``StaticGen`` and ``StaticLoad`` with ``area``
|
28
|
+
- Set case ``pjm5bus_demo.xlsx`` as a all-inclusive case
|
29
|
+
- Include module ``MatProcessor`` in the API documentation
|
30
|
+
- Improve Line parameters correction in ``System.setup()``
|
31
|
+
- Make func ``interface._to_andes_pflow`` public
|
32
|
+
- Discard ``sync_adsys`` step in func ``to_andes_pflow`` to fix mistake in
|
33
|
+
parameters conversion
|
34
|
+
- Update case files
|
35
|
+
|
12
36
|
v1.0.6 (2024-04-10)
|
13
37
|
--------------------
|
14
38
|
|
@@ -1,35 +1,33 @@
|
|
1
1
|
ams/__init__.py,sha256=dKIwng8xES4NQHn6ZHy8RCKeXphN9z2wyfmbvniIEg0,351
|
2
2
|
ams/__main__.py,sha256=EB4GfGiKgvnQ_psNr0QwPoziYvjmGvQ2yVsBwQtfrLw,170
|
3
|
-
ams/_version.py,sha256=
|
3
|
+
ams/_version.py,sha256=l75Msd6bSTQ0CAX_Sc-wAbTvXkpOZ2xKEDedkXIFFlY,497
|
4
4
|
ams/cli.py,sha256=EyNFXn565gFCppTxpyTZviBdPgUuKtgAPZ4WE6xewRk,6164
|
5
|
-
ams/interface.py,sha256=
|
5
|
+
ams/interface.py,sha256=_aF2VrO_hmVrW56H_q4CYWJps63nWUswCd3AWUbPbE8,44880
|
6
6
|
ams/main.py,sha256=wzKLe_BeQAUyFh-U1cxQIOwr-rAJM8ppB3EEi6_v2tw,23607
|
7
7
|
ams/report.py,sha256=gUscOYpPjuPuruzIXAADaifIZv2BSjmP1oKCuHdD3Vw,11004
|
8
8
|
ams/shared.py,sha256=yaO4RUD0T-zCcZeML20vORcaf_dXiwMAvjTriXz1xtg,4159
|
9
|
-
ams/system.py,sha256=
|
10
|
-
ams/cases/5bus/pjm5bus_demo.xlsx,sha256=
|
11
|
-
ams/cases/5bus/
|
12
|
-
ams/cases/5bus/
|
13
|
-
ams/cases/
|
14
|
-
ams/cases/5bus/pjm5bus_uced_esd1.xlsx,sha256=I5_GsOBn2wTNSnv7hS1GTJfMqRjYyWCO37WA7GnX0V4,28063
|
15
|
-
ams/cases/5bus/pjm5bus_uced_ev.xlsx,sha256=onDf3fMOjVSBGhVOSZtv0FJ3cqMAEUCwxu4sqmr2AQg,29702
|
9
|
+
ams/system.py,sha256=AW2_rMH0wjTuxhha87hQuyUCAllzWTfEsVBaTIiSAOg,25956
|
10
|
+
ams/cases/5bus/pjm5bus_demo.xlsx,sha256=OWIUprkg8_aQ_bTCaEFMl7Bhfa1R20zxAHXRQtXBix0,32607
|
11
|
+
ams/cases/5bus/pjm5bus_ev.xlsx,sha256=vR8dJv5jIxib1pgcMonhzvraoqZVJWhBSJdVXDL0qsI,19498
|
12
|
+
ams/cases/5bus/pjm5bus_jumper.xlsx,sha256=47QAol1RGz_aGvhV2emq9XCy_Db9Zca15_OMVAdFVR0,19332
|
13
|
+
ams/cases/hawaii40/Hawaii40.m,sha256=t6YZwncQrMhZg3yDXh38oqDMY3akrdvCPf97nNm1otw,20683
|
16
14
|
ams/cases/ieee123/ieee123.xlsx,sha256=yWsEFN1BvcoBYX9hWdrenPC_qKQfXtZ4xhpwoIc2OSE,39223
|
17
15
|
ams/cases/ieee123/ieee123_regcv1.xlsx,sha256=dIygkiNGzo_RE0moMPFu-9Bt0uPDuAL9zYWAs6e8VSk,41678
|
18
16
|
ams/cases/ieee14/ieee14.json,sha256=bBy3i2jKqFNmnc_rmNOYvGm-SAW2T6wwvEQ-Hkj5Hkw,21400
|
19
17
|
ams/cases/ieee14/ieee14.raw,sha256=3occlj5Qw42YBVLxONVDIKLTQqHMizHrAfD7Xwzmyec,7935
|
20
18
|
ams/cases/ieee14/ieee14_conn.xlsx,sha256=GaaiIsrnS1aX0SRWL2EeCJgRMW9FW1qNoyo4pMZQsw8,19291
|
21
|
-
ams/cases/ieee14/ieee14_uced.xlsx,sha256=
|
19
|
+
ams/cases/ieee14/ieee14_uced.xlsx,sha256=Y2fUDF-pVOeB2m_raysXbkAEj11UgsXXss6NFF51JuE,33025
|
22
20
|
ams/cases/ieee39/ieee39.xlsx,sha256=Riz43xQSXi1L-Y9rJbQjuw8oXTnw4W6bGhm--45d-3Q,29465
|
23
|
-
ams/cases/ieee39/ieee39_uced.xlsx,sha256=
|
24
|
-
ams/cases/ieee39/ieee39_uced_esd1.xlsx,sha256=
|
25
|
-
ams/cases/ieee39/ieee39_uced_pvd1.xlsx,sha256=
|
26
|
-
ams/cases/ieee39/ieee39_uced_vis.xlsx,sha256=
|
21
|
+
ams/cases/ieee39/ieee39_uced.xlsx,sha256=1m-_8haVAIAcbZX0_aYgvI98XL8FAp871heeP6GNF1U,41696
|
22
|
+
ams/cases/ieee39/ieee39_uced_esd1.xlsx,sha256=Gftp12pPEFeDjM_wNcOmKDacUsNP6AAlklzXynyvx9o,40810
|
23
|
+
ams/cases/ieee39/ieee39_uced_pvd1.xlsx,sha256=b5GWo-daAaXy5Lc_qpwldDTtE1z554oCUMk-SsOrYx8,40750
|
24
|
+
ams/cases/ieee39/ieee39_uced_vis.xlsx,sha256=dS-Nz02spNlOpqvzHgVmZl3iDpn548g21X2qRSVTe_8,44924
|
27
25
|
ams/cases/matpower/benchmark.json,sha256=dAWT8wZZEZpMPj_tIsssubcYIlsE6vTHfXQQKQtKjNo,1205789
|
28
26
|
ams/cases/matpower/case118.m,sha256=vC5vIrS553ZXKIXuS1Dk9Ksu4MVXfpEm6G2QbxTEtfc,33696
|
29
27
|
ams/cases/matpower/case14.m,sha256=L_xOG3NK5sXpLb5otONgEO1pWku8xNBlx0xPvDn888E,4597
|
30
28
|
ams/cases/matpower/case300.m,sha256=L3mWBAncy5pHy53nycEXPmmRh1Rl-ZtlsELXwQGX4S8,65678
|
31
29
|
ams/cases/matpower/case39.m,sha256=RAgz-ZjR2HaMYgR32stq_U4D8l85S7DSAFJFE60_3Dw,9628
|
32
|
-
ams/cases/matpower/case5.m,sha256=
|
30
|
+
ams/cases/matpower/case5.m,sha256=5KbGGXoS5Abx2mHZqX-vmmNEQ5AhhG4qo6Q6YZz9Qxs,2169
|
33
31
|
ams/cases/matpower/case_ACTIVSg2000.m,sha256=jQBhjej9EL81pZn1nS3uv-zQ2G4o_P9zIZrXxOurhgs,659546
|
34
32
|
ams/cases/npcc/npcc.m,sha256=QrYcufKlHrXr5nFC2Z92X05_Q1Rn3Nf11HCCYenAaC0,26342
|
35
33
|
ams/cases/npcc/npcc_uced.xlsx,sha256=zuaZEOBwdOHwK5hFgQSXownyH-MfKDZQ-iVFeaFVSyg,86557
|
@@ -38,40 +36,40 @@ ams/cases/wecc/wecc.m,sha256=8Wqal6H5r1wNxLLQBCXo2V3v3JZY5IJDEkyrEGCrCWE,30498
|
|
38
36
|
ams/cases/wecc/wecc_uced.xlsx,sha256=R3tZgxEqz_ctKcjA1wwFecxn-QZXutvf7NzgnCg_078,94767
|
39
37
|
ams/core/__init__.py,sha256=OUJFLACc9Ggjvzi6DZfmfxrzciRcGtpLTsBfdbOUxGg,80
|
40
38
|
ams/core/documenter.py,sha256=FNkpiP65iO809B4Bgmp5C1QeJTQHi-sS9vTP7Wd9D8Q,23131
|
41
|
-
ams/core/matprocessor.py,sha256=
|
39
|
+
ams/core/matprocessor.py,sha256=3eEij-ul8Rx25ZwNbv66YEOKyUXB-fYO-ZQs5BpqmIU,26610
|
42
40
|
ams/core/model.py,sha256=vXLActAi9tLXRCNd5RrEMVWvF0Wt4mwltiRY5CjgrP4,10928
|
43
41
|
ams/core/param.py,sha256=LPH48xUHyqWqODD6IsiamUtkJDDSgGCEMAo6vroFoHE,11130
|
44
|
-
ams/core/service.py,sha256=
|
42
|
+
ams/core/service.py,sha256=Q4aeaYFWycIEH7I8DSO8Itah2CJxc3oAW46dtKCQEyA,28041
|
45
43
|
ams/core/symprocessor.py,sha256=HegjU_UnvWEny9kitI1su9J0WeFDjQnM4gNoeUGJ7qU,8428
|
46
44
|
ams/core/var.py,sha256=f48pzir4miBsB5sh6PwUsFe0LdNNEM-d3VufcjbUU0w,1591
|
47
45
|
ams/extension/__init__.py,sha256=5IFTNirDL0uDaUsg05_oociVT9VCy2rhPx1ad4LGveM,65
|
48
46
|
ams/extension/eva.py,sha256=wUF8RNxzwas2Q6_xD0k3EVWjmX4kxHmTSkv2inJzaUY,16342
|
49
|
-
ams/io/__init__.py,sha256=
|
47
|
+
ams/io/__init__.py,sha256=GIfF7X44olHaySL8EzOBU1eXUnunr1owzzdPfPvvHZU,3802
|
50
48
|
ams/io/json.py,sha256=IurwcZDuKczSbRTpcbQZiIi0ARCrMK6kJ0E3wS8ENy8,2585
|
51
|
-
ams/io/matpower.py,sha256=
|
52
|
-
ams/io/psse.py,sha256=
|
49
|
+
ams/io/matpower.py,sha256=SNYvCO0Be9rdM4PPPFuK6H2JuOLflFpWQloFtG59uIM,20174
|
50
|
+
ams/io/psse.py,sha256=TOLsGuoFWpgLRK_zZqjCLIjd9fHAlfgjbDm84okw3p0,145
|
53
51
|
ams/io/pypower.py,sha256=E6_kSNfv1Yyv9oYfFebeNeKaQPlHyRZQpE8F6Y67g8Q,2583
|
54
52
|
ams/io/xlsx.py,sha256=7ATW1seyxsGn7d5p5IuSRFHcoCHVVjMu3E7mP1Mc74U,2460
|
55
|
-
ams/models/__init__.py,sha256=
|
53
|
+
ams/models/__init__.py,sha256=EGkViLkVX_We9FAGuEkgfleMNmPw_vGp2Nq1OQimL7U,691
|
56
54
|
ams/models/area.py,sha256=AKYU6aJQKsVWRZdvMO7yic-8wZ1GumSTQXgDg5L0THw,899
|
57
55
|
ams/models/bus.py,sha256=U0vSegkm-9fqPQS9KMJQU6gpIMX_1GK5O_dvRc8-0P0,1585
|
58
56
|
ams/models/cost.py,sha256=rmGNj9ztMbqA-OIJj8fNNBh8bdYJSY9hk10vffgxc6k,5916
|
59
|
-
ams/models/group.py,sha256=
|
57
|
+
ams/models/group.py,sha256=AS3kAK7vsRAKpqd-_tS953PFDttnV45ujg6i4QKk_xQ,8399
|
60
58
|
ams/models/info.py,sha256=Oh0Xo5J4ZHBsNIkMOzIwv_DegsX1inyuv3Q5CpCfyQw,788
|
61
|
-
ams/models/line.py,sha256=
|
62
|
-
ams/models/reserve.py,sha256=
|
59
|
+
ams/models/line.py,sha256=ju5h1BcW4kgVWm_lgl8zWhSYqlsUjbdoUwzz2t0Vx1s,2770
|
60
|
+
ams/models/reserve.py,sha256=3BjWCyKrPL4CwTvmzRxk25H8Nkxh-Rz0Ne17I9Y2TUA,2816
|
63
61
|
ams/models/shunt.py,sha256=h5QV33EcCd86XRR0sMIzcO0PTeTirkWaxi8imPKzOi0,337
|
64
|
-
ams/models/timeslot.py,sha256=
|
62
|
+
ams/models/timeslot.py,sha256=XfXJukbQXTUawbsYI6BMLbytXNIe5VE2SQ5_t1Lc8_8,2001
|
65
63
|
ams/models/zone.py,sha256=b9DsXOsD9Dny-lCMAWwRpRpl7rYVa0ev180YwqFTaiA,1076
|
66
64
|
ams/models/distributed/__init__.py,sha256=3uiMHT2YRq79DXIB1jni6wP7dNoQMjU1bMTUpr4P6Rc,161
|
67
65
|
ams/models/distributed/esd1.py,sha256=A1qCLzaDtJVI-YoXJd6IRYtP_wp_Ajz2lfjFHvzqHkk,2130
|
68
66
|
ams/models/distributed/ev.py,sha256=mpEIGyG9jV1bXkRIXOkCck4hl5np3bfBKvs4ysxukdM,1978
|
69
67
|
ams/models/distributed/pvd1.py,sha256=KAOlXpZgT_w58xaGWjm5ht6ksac6eRhaqBFHK4EPRH8,1960
|
70
68
|
ams/models/renewable/__init__.py,sha256=7dZyRXbvBAHbLJeJssJ1hsOHj9Bgeg77kB5gcX_mBtg,118
|
71
|
-
ams/models/renewable/regc.py,sha256=
|
69
|
+
ams/models/renewable/regc.py,sha256=3J9alIGUn_GkibQ3-dKTylAOpNPzd5zpancPc79q9T4,3448
|
72
70
|
ams/models/static/__init__.py,sha256=lh5yR5Xb2unS4ndng-cLU1TAeoidu2s6VAVFLc3HUDU,96
|
73
|
-
ams/models/static/gen.py,sha256=
|
74
|
-
ams/models/static/pq.py,sha256=
|
71
|
+
ams/models/static/gen.py,sha256=QXklOYlnU7QHWy-WFJwhxuNItUPqFsLJIjAO4sGMUbg,7087
|
72
|
+
ams/models/static/pq.py,sha256=a-z7-1Vegr3mPguRAdLqfJlwk5OG_Zpp8usfOzRAR30,2583
|
75
73
|
ams/opt/__init__.py,sha256=INsl8yxtOzTKqV9pzVxlL6RSGDRaUDwxpZMY1QROrF4,459
|
76
74
|
ams/opt/constraint.py,sha256=ERT9zwjQyGkvDo465Yd0wBexlIhjVmw0MyWq4BWnWoI,5534
|
77
75
|
ams/opt/exprcalc.py,sha256=oVtjNHzdWvYHV-8PdRehAxjledsQxpxatdNgMLeWS5o,3935
|
@@ -105,35 +103,35 @@ ams/pypower/routines/pflow.py,sha256=q5RFZ5XuB5YQZk1jpJ5aTUB3DfgPJEGsvWyLDNo5PJo
|
|
105
103
|
ams/routines/__init__.py,sha256=idfPyMhFr0hkUZjcAEQw14JA5zPHeFe3Vl3p4DCJ5d0,640
|
106
104
|
ams/routines/acopf.py,sha256=VZC3qs1G7zE--6XxE_wXv432nj3SV5hcrR8967ogYlg,3835
|
107
105
|
ams/routines/cpf.py,sha256=xsrUVjtGQ1b7UCXpwwYihqzTeEGJJKnO9LlX1Tz9Tks,1552
|
108
|
-
ams/routines/dcopf.py,sha256=
|
106
|
+
ams/routines/dcopf.py,sha256=6ETgopvX9tSFF3kssHsBchAttcyo2DTG-eIqjvlk0WY,11087
|
109
107
|
ams/routines/dcopf2.py,sha256=sDCP8zqYHDh7s7p9SX6G8QhMfIxCg3VPYJn6r3pRKyo,3620
|
110
108
|
ams/routines/dcpf.py,sha256=SswIb7t37ulxe1rjroA7oSa6z01kYjO-x8P1WWOUutM,8237
|
111
|
-
ams/routines/dcpf0.py,sha256=
|
112
|
-
ams/routines/dopf.py,sha256=
|
113
|
-
ams/routines/ed.py,sha256=
|
114
|
-
ams/routines/pflow.py,sha256=
|
109
|
+
ams/routines/dcpf0.py,sha256=V9zfBoV0cRMFLJdLrpvieyvwTybLTZADPoaKMJLKSkY,6814
|
110
|
+
ams/routines/dopf.py,sha256=8D36-FkPORYGaMnwGTqwz8HxAXk5ywo3mk8NlGq327g,6289
|
111
|
+
ams/routines/ed.py,sha256=i0Y3COlz4oAf8u8JxqfuQWn6WxjJzb59weLedow0Y_g,11777
|
112
|
+
ams/routines/pflow.py,sha256=CZAiwnZYhEmSU7Exn9CK6rFxWvjpvv1Py-pLegWJ71s,9419
|
115
113
|
ams/routines/pflow0.py,sha256=xocLw94jcl2hh3WwnS_mdUW6dsm3EVjvZptVb814GdE,3521
|
116
114
|
ams/routines/routine.py,sha256=I98uMg6QCt6bipNYwdgtNMbdw_gWCSNVGokS4UmvkSk,35932
|
117
|
-
ams/routines/rted.py,sha256=
|
115
|
+
ams/routines/rted.py,sha256=GOHRxo0-HS5HhwQg8lv7-2VcGr_M_TdUvvomgJ31fDQ,22070
|
118
116
|
ams/routines/type.py,sha256=lvTWSnCYIbRJXIm3HX6jA0Hv-WWYusTOUPfoW8DITlU,3877
|
119
|
-
ams/routines/uc.py,sha256=
|
117
|
+
ams/routines/uc.py,sha256=yPi16FDXugT7Jb7ZwXPSP7NpGyGZ3jvQtCWDI9hAnis,15632
|
120
118
|
ams/utils/__init__.py,sha256=2hAQmWRgmnE-bCGT9cJoW9FkPDMGRiGkbBcUgj-bgjI,122
|
121
119
|
ams/utils/misc.py,sha256=Y6tPKpUKJa7bL9alroJuG2UNW9vdQjnfAmKb2EbIls8,2027
|
122
120
|
ams/utils/paths.py,sha256=D9VNUwtJtHy-8PFzMnxtQ9HpkOXT6vdVOjfOTuoKGKw,6699
|
123
121
|
docs/Makefile,sha256=UKXBFAbKGPt1Xw9J84343v0Mh8ylAZ-tE0uCd74DrQU,725
|
124
122
|
docs/make.bat,sha256=9UgKGb4SdP006622fJiFxeFT1BeycYAs6hDbV1xwPy8,804
|
125
|
-
docs/source/api.rst,sha256=
|
123
|
+
docs/source/api.rst,sha256=UR7nboMuNl6XDbdozIf7oo_Il1XntogFk66pHSzTFug,1443
|
126
124
|
docs/source/conf.py,sha256=UyoWogZTUNSJU7pQS_JaR28nKddW94zr01LYoIciZZw,6688
|
127
125
|
docs/source/genmodelref.py,sha256=IhmF7bDw8BXPvLD8V3WjQNrfc-H07r5iS-_4DHbbp-8,1420
|
128
126
|
docs/source/genroutineref.py,sha256=0JyMc2kV5bWrWbSoO6d7o4QgDgG8mVy3JGGQWacJypw,1064
|
129
127
|
docs/source/index.rst,sha256=N5phQS5RIyYs-NZo_5yYB8LjvHzOKLeXzRA-M8i-g3Q,2688
|
130
|
-
docs/source/release-notes.rst,sha256=
|
128
|
+
docs/source/release-notes.rst,sha256=8655hUeA11Fxd-fTIUUtTrsfhwi9nnEbwCduTTiIzmc,14250
|
131
129
|
docs/source/_templates/autosummary/base.rst,sha256=zl3U4baR4a6YjsHyT-x9zCOrHwKZOVUdWn1NPX2u3bc,106
|
132
130
|
docs/source/_templates/autosummary/class.rst,sha256=Hv_igCsLsUpM62_zN0nqj6FSfKnS5xLyu8ZldMbfOAk,668
|
133
131
|
docs/source/_templates/autosummary/module.rst,sha256=YdbpCudOrEU-JbuSlzGvcOI2hn_KrCM6FW5HcGqkaEE,1113
|
134
132
|
docs/source/_templates/autosummary/module_toctree.rst,sha256=sg30OdqFDLyo8Y3hl9V-s2BXb1bzcjjqqWaWi-C3qFM,1126
|
135
133
|
docs/source/examples/index.rst,sha256=6VT3wVeKk8BWf6pJQtZrmcumW_3jI8esdlzja8scUCA,742
|
136
|
-
docs/source/getting_started/copyright.rst,sha256=
|
134
|
+
docs/source/getting_started/copyright.rst,sha256=d3S7FjrbysVqQd3pEBadrrkcQOZ7sYYeDTCOS4goPC8,715
|
137
135
|
docs/source/getting_started/index.rst,sha256=mcp1NdUwbPoNzpn7Owf5Qzfd6J_--ToU52PjmrbwjBY,1512
|
138
136
|
docs/source/getting_started/install.rst,sha256=gE4L0ApiC_mwbjbYtkGW4ilyIAu_Jn-VIeoYlgRiOIw,7268
|
139
137
|
docs/source/getting_started/overview.rst,sha256=Zy890bDCUVW37NvjhQFUJUae1Zkghr72Az4Qd0PhP_I,1068
|
@@ -157,15 +155,14 @@ docs/source/modeling/model.rst,sha256=j7OSvoXnDht6rGpgwPiJklsCWrebfx4DxIN-G8r6iF
|
|
157
155
|
docs/source/modeling/routine.rst,sha256=BkUE3y5L1lA7LP9Nyzc4zzY-tF3t4k7egBE188kybHY,4286
|
158
156
|
docs/source/modeling/system.rst,sha256=NMOPNMOKG1_dRyNPPx-MiCKbbpadxWJxGyU6geRUsvQ,1374
|
159
157
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
160
|
-
tests/test_1st_system.py,sha256=
|
158
|
+
tests/test_1st_system.py,sha256=BLlJsHnEBeLfiMJvIjyPguMikfDjqGSzfn8cZ-tqCVc,1900
|
161
159
|
tests/test_addressing.py,sha256=MIT713KCqMg0h2o4rBDZsGUrpGadmMlXnrrdq-wB77E,1364
|
162
|
-
tests/
|
163
|
-
tests/test_case.py,sha256=zkf5jT314e97Rx_PJXCwmuvaeQDTjJ42zYR6WwJetxE,8606
|
160
|
+
tests/test_case.py,sha256=8Jn1hwrB72l6-rqbCWTGJOcxicu4GHVDzGsLLxjDFos,8833
|
164
161
|
tests/test_cli.py,sha256=TtCGBy2e7Ll_2gJTFo9juZtzhaakho_MqkcqhG2w2dk,870
|
165
162
|
tests/test_export_csv.py,sha256=rZCafNrVbwDo7ZNC4MrL1gIcrU0c6YVw2q-QGL3O4K4,2921
|
166
163
|
tests/test_group.py,sha256=Tq0s9gtenqrv4ws5YNzWxbiF4WgyhtMEAXZfJtew6M4,2699
|
167
164
|
tests/test_interface.py,sha256=lXKR8OAsGIg5dV2Uj0UwGAl69hKnc_7EtCYvpP_0rrU,8157
|
168
|
-
tests/test_io.py,sha256=
|
165
|
+
tests/test_io.py,sha256=epa2f7gnZPAd-bX8MRmYn53ohk0H_SzGABuKOO5zn6g,2137
|
169
166
|
tests/test_jumper.py,sha256=bdOknplEGnO_tiJc7p3xQvgTe2b6Dz53bOgbFaXKMAI,537
|
170
167
|
tests/test_known_good.py,sha256=NBrlAxnVMxIHXR2cWps-Kwjh36fiU4Y-eupspZkM0ks,9670
|
171
168
|
tests/test_matp.py,sha256=LkjhqxSFr6oY_ENpduDQ77rhLLBl6RzIHZ2d0m_8i-8,17262
|
@@ -178,13 +175,13 @@ tests/test_routine.py,sha256=gblLHBQ3DJgYiSGsqGdIGnn-CuEZAEnq9CqhqN5m608,6234
|
|
178
175
|
tests/test_rtn_dcopf.py,sha256=LOfAVFzl2t6oTqTmWhmstu1j9FnpzHxdrplbmb3Y6Mc,3660
|
179
176
|
tests/test_rtn_dcopf2.py,sha256=g0MOW8J6WPJPQAV3Xwufa3dWEEeH-cQDErzvb-cq8lE,3747
|
180
177
|
tests/test_rtn_dcpf.py,sha256=QC6F_4LOZ7mrWOEM3s6a6j-eUDM_n49MQouPIR6fzR0,2555
|
181
|
-
tests/test_rtn_ed.py,sha256=
|
178
|
+
tests/test_rtn_ed.py,sha256=xTtCe_yepvtk1yINq01vmGMhEE8E5ORk7yPZvaydUWA,10189
|
182
179
|
tests/test_rtn_pflow.py,sha256=aDL5Ewm6lWqpdHqIIu-DTllhXzt4bMjsLJaKbJa8sXQ,6990
|
183
|
-
tests/test_rtn_rted.py,sha256=
|
184
|
-
tests/test_rtn_uc.py,sha256=
|
185
|
-
tests/test_service.py,sha256=
|
186
|
-
ltbams-1.0.
|
187
|
-
ltbams-1.0.
|
188
|
-
ltbams-1.0.
|
189
|
-
ltbams-1.0.
|
190
|
-
ltbams-1.0.
|
180
|
+
tests/test_rtn_rted.py,sha256=1Vd4JCX3sfLnuXXzuUGFsEPTtqmdaDzDXpBcAQwnDf0,9785
|
181
|
+
tests/test_rtn_uc.py,sha256=8KrqxOxW6tiN4Fxl417NyHJCgdZwXh2ioX0mQbHuEgU,8302
|
182
|
+
tests/test_service.py,sha256=6IP6CAH2xHxGHZM4-R8LjZxVJ2L10LcGaPDyRIqKLmc,2438
|
183
|
+
ltbams-1.0.8.dist-info/METADATA,sha256=Ui__dkyfMC9bk9tO-Bur2iMVqnieYJVZygg08Z26Q7w,14023
|
184
|
+
ltbams-1.0.8.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
185
|
+
ltbams-1.0.8.dist-info/entry_points.txt,sha256=FA56FlhO_yVNeEf810SrorVQb7_Xsmo3_EW-W-ijUfA,37
|
186
|
+
ltbams-1.0.8.dist-info/top_level.txt,sha256=pyKDqG2kj13F9-BYd_wkruRdBSqLXw8Nwc-cmljqrxg,15
|
187
|
+
ltbams-1.0.8.dist-info/RECORD,,
|
tests/test_1st_system.py
CHANGED
@@ -31,3 +31,34 @@ class TestCodegen(unittest.TestCase):
|
|
31
31
|
docum._service_doc(max_width=78, export=export)
|
32
32
|
docum._param_doc(max_width=78, export=export)
|
33
33
|
docum.config.doc(max_width=78, export=export)
|
34
|
+
|
35
|
+
|
36
|
+
class TestParamCorrection(unittest.TestCase):
|
37
|
+
"""
|
38
|
+
Test parameter correction.
|
39
|
+
"""
|
40
|
+
|
41
|
+
def setUp(self) -> None:
|
42
|
+
"""
|
43
|
+
Test setup.
|
44
|
+
"""
|
45
|
+
self.ss = ams.load(ams.get_case('matpower/case14.m'),
|
46
|
+
setup=False, no_output=True, default_config=True,)
|
47
|
+
|
48
|
+
def test_line_correction(self):
|
49
|
+
"""
|
50
|
+
Test line correction.
|
51
|
+
"""
|
52
|
+
self.ss.Line.rate_a.v[5] = 0.0
|
53
|
+
self.ss.Line.rate_b.v[6] = 0.0
|
54
|
+
self.ss.Line.rate_c.v[7] = 0.0
|
55
|
+
self.ss.Line.amax.v[8] = 0.0
|
56
|
+
self.ss.Line.amin.v[9] = 0.0
|
57
|
+
|
58
|
+
self.ss.setup()
|
59
|
+
|
60
|
+
self.assertIsNot(self.ss.Line.rate_a.v[5], 0.0)
|
61
|
+
self.assertIsNot(self.ss.Line.rate_b.v[6], 0.0)
|
62
|
+
self.assertIsNot(self.ss.Line.rate_c.v[7], 0.0)
|
63
|
+
self.assertIsNot(self.ss.Line.amax.v[8], 0.0)
|
64
|
+
self.assertIsNot(self.ss.Line.amin.v[9], 0.0)
|
tests/test_case.py
CHANGED
@@ -14,7 +14,7 @@ class Test5Bus(unittest.TestCase):
|
|
14
14
|
|
15
15
|
def setUp(self) -> None:
|
16
16
|
self.ss = ams.main.load(
|
17
|
-
get_case("5bus/
|
17
|
+
get_case("5bus/pjm5bus_demo.xlsx"),
|
18
18
|
default_config=True,
|
19
19
|
no_output=True,
|
20
20
|
)
|
@@ -28,25 +28,33 @@ class Test5Bus(unittest.TestCase):
|
|
28
28
|
self.assertTrue("Bus" in self.ss.models)
|
29
29
|
self.assertTrue("PQ" in self.ss.models)
|
30
30
|
|
31
|
+
nBus = 5
|
32
|
+
nGen = 5
|
33
|
+
nPQ = 3
|
34
|
+
nArea = 3
|
35
|
+
nZone = 5
|
36
|
+
nDT = 24
|
31
37
|
# --- test device counts
|
32
|
-
self.assertEqual(self.ss.Bus.n,
|
33
|
-
self.assertEqual(self.ss.PQ.n,
|
34
|
-
self.assertEqual(self.ss.PV.n,
|
38
|
+
self.assertEqual(self.ss.Bus.n, nBus)
|
39
|
+
self.assertEqual(self.ss.PQ.n, nPQ)
|
40
|
+
self.assertEqual(self.ss.PV.n, 4)
|
35
41
|
self.assertEqual(self.ss.Slack.n, 1)
|
36
42
|
self.assertEqual(self.ss.Line.n, 7)
|
37
|
-
self.assertEqual(self.ss.Zone.n,
|
38
|
-
self.assertEqual(self.ss.
|
39
|
-
self.assertEqual(self.ss.
|
40
|
-
self.assertEqual(self.ss.
|
41
|
-
self.assertEqual(self.ss.
|
42
|
-
self.assertEqual(self.ss.
|
43
|
-
self.assertEqual(self.ss.
|
44
|
-
self.assertEqual(self.ss.
|
45
|
-
self.assertEqual(self.ss.
|
46
|
-
self.assertEqual(self.ss.
|
43
|
+
self.assertEqual(self.ss.Zone.n, nZone)
|
44
|
+
self.assertEqual(self.ss.Area.n, nArea)
|
45
|
+
self.assertEqual(self.ss.SFR.n, nArea)
|
46
|
+
self.assertEqual(self.ss.SR.n, nArea)
|
47
|
+
self.assertEqual(self.ss.NSR.n, nArea)
|
48
|
+
self.assertEqual(self.ss.GCost.n, nGen)
|
49
|
+
self.assertEqual(self.ss.DCost.n, nPQ)
|
50
|
+
self.assertEqual(self.ss.SFRCost.n, nGen)
|
51
|
+
self.assertEqual(self.ss.SRCost.n, nGen)
|
52
|
+
self.assertEqual(self.ss.NSRCost.n, nGen)
|
53
|
+
self.assertEqual(self.ss.EDTSlot.n, nDT)
|
54
|
+
self.assertEqual(self.ss.UCTSlot.n, nDT)
|
47
55
|
|
48
56
|
# test idx values
|
49
|
-
self.assertSequenceEqual(self.ss.Bus.idx.v, [
|
57
|
+
self.assertSequenceEqual(self.ss.Bus.idx.v, [0, 1, 2, 3, 4])
|
50
58
|
self.assertSequenceEqual(self.ss.Area.idx.v, [1, 2, 3])
|
51
59
|
|
52
60
|
# test cache refreshing
|
@@ -87,9 +95,9 @@ class Test5Bus(unittest.TestCase):
|
|
87
95
|
"""
|
88
96
|
|
89
97
|
self.ss.GCost.alter("c1", ['GCost_1', 'GCost_2'], [1500., 3100.])
|
90
|
-
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1])
|
98
|
+
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1, 0.01])
|
91
99
|
self.ss.ACOPF.run()
|
92
|
-
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1])
|
100
|
+
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1, 0.01])
|
93
101
|
|
94
102
|
def test_alter_param_after_routine(self):
|
95
103
|
"""
|
@@ -98,9 +106,9 @@ class Test5Bus(unittest.TestCase):
|
|
98
106
|
|
99
107
|
self.ss.ACOPF.run()
|
100
108
|
self.ss.GCost.alter("c1", ['GCost_1', 'GCost_2'], [1500., 3100.])
|
101
|
-
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1])
|
109
|
+
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1, 0.01])
|
102
110
|
self.ss.ACOPF.run()
|
103
|
-
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1])
|
111
|
+
np.testing.assert_array_equal(self.ss.GCost.c1.v, [1500., 3100., 0.4, 0.1, 0.01])
|
104
112
|
|
105
113
|
def test_multiple_disconnected_line(self):
|
106
114
|
"""
|
tests/test_io.py
CHANGED
@@ -15,10 +15,19 @@ class TestMATPOWER(unittest.TestCase):
|
|
15
15
|
self.mpc14 = ams.io.matpower.m2mpc(ams.get_case('matpower/case14.m'))
|
16
16
|
|
17
17
|
def test_m2mpc(self):
|
18
|
+
"""Test conversion from M file to mpc dict."""
|
19
|
+
# NOTE: when the keys are there, read them
|
18
20
|
self.assertTupleEqual(self.mpc5['gencost'].shape, (5, 6))
|
21
|
+
self.assertTupleEqual(self.mpc5['gentype'].shape, (5,))
|
22
|
+
self.assertTupleEqual(self.mpc5['genfuel'].shape, (5,))
|
23
|
+
|
24
|
+
# NOTE: when the keys are not there, the read mpc will not complete them
|
19
25
|
self.assertTupleEqual(self.mpc14['gencost'].shape, (5, 7))
|
26
|
+
self.assertNotIn('gentype', self.mpc14)
|
27
|
+
self.assertNotIn('genfuel', self.mpc14)
|
20
28
|
|
21
29
|
def test_mpc2system(self):
|
30
|
+
"""Test conversion from MPC to AMS System."""
|
22
31
|
system5 = ams.system.System()
|
23
32
|
ams.io.matpower.mpc2system(self.mpc5, system5)
|
24
33
|
# In case5.m, the gencost has type 2 cost model, with 2 parameters.
|
@@ -26,6 +35,12 @@ class TestMATPOWER(unittest.TestCase):
|
|
26
35
|
np.zeros(system5.StaticGen.n))
|
27
36
|
|
28
37
|
system14 = ams.system.System()
|
38
|
+
# Test gentype length check
|
39
|
+
mpc14 = self.mpc14.copy()
|
40
|
+
mpc14['gentype'] = np.array(['WT'] * 6)
|
41
|
+
with self.assertRaises(ValueError, msg='gentype length check failed!'):
|
42
|
+
ams.io.matpower.mpc2system(mpc14, system14)
|
43
|
+
|
29
44
|
ams.io.matpower.mpc2system(self.mpc14, system14)
|
30
45
|
# In case14.m, the gencost has type 2 cost model, with 3 parameters.
|
31
46
|
np.testing.assert_array_less(np.zeros(system14.StaticGen.n),
|