ltbams 0.9.8__tar.gz → 0.9.10__tar.gz
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.
- {ltbams-0.9.8/ltbams.egg-info → ltbams-0.9.10}/PKG-INFO +5 -3
- {ltbams-0.9.8 → ltbams-0.9.10}/README.md +4 -2
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/_version.py +3 -3
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cli.py +1 -1
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/core/matprocessor.py +34 -13
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/interop/andes.py +10 -9
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/io/matpower.py +5 -5
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/main.py +4 -4
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/opt/omodel.py +11 -7
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/core/pips.py +39 -37
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/core/ppoption.py +3 -1
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/core/solver.py +50 -48
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/make/matrices.py +10 -9
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/make/pdv.py +2 -2
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/routines/cpf.py +18 -16
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/routines/opf.py +8 -6
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/routines/opffcns.py +11 -9
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/routines/pflow.py +27 -25
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/toggle.py +13 -12
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/shared.py +6 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/conf.py +9 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/release-notes.rst +19 -0
- {ltbams-0.9.8 → ltbams-0.9.10/ltbams.egg-info}/PKG-INFO +5 -3
- {ltbams-0.9.8 → ltbams-0.9.10}/ltbams.egg-info/requires.txt +1 -1
- {ltbams-0.9.8 → ltbams-0.9.10}/requirements.txt +1 -1
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_known_good.py +8 -7
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_routine.py +80 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/CONTRIBUTING.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/LICENSE +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/MANIFEST.in +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/__main__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/5bus/pjm5bus_demo.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/5bus/pjm5bus_uced.json +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/5bus/pjm5bus_uced.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/5bus/pjm5bus_uced_esd1.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/5bus/pjm5bus_uced_ev.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee123/ieee123.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee123/ieee123_regcv1.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee14/ieee14.json +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee14/ieee14.raw +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee14/ieee14_uced.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee39/ieee39.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee39/ieee39_uced.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee39/ieee39_uced_esd1.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee39/ieee39_uced_pvd1.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/ieee39/ieee39_uced_vis.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/matpower/benchmark.json +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/matpower/case118.m +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/matpower/case14.m +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/matpower/case300.m +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/matpower/case39.m +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/matpower/case5.m +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/matpower/case_ACTIVSg2000.m +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/npcc/npcc.m +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/npcc/npcc_uced.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/pglib/pglib_opf_case39_epri__api.m +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/wecc/wecc.m +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/cases/wecc/wecc_uced.xlsx +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/core/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/core/documenter.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/core/model.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/core/param.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/core/service.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/core/symprocessor.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/core/var.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/extension/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/extension/eva.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/interop/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/io/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/io/json.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/io/psse.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/io/pypower.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/io/xlsx.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/area.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/bus.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/cost.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/distributed/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/distributed/esd1.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/distributed/ev.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/distributed/pvd1.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/group.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/info.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/line.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/region.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/renewable/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/renewable/regc.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/reserve.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/shunt.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/static/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/static/gen.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/static/pq.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/models/timeslot.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/opt/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/_compat.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/core/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/core/ppver.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/eps.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/idx.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/io.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/make/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/routines/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/routines/cpf_callbacks.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/pypower/utils.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/report.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/acopf.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/cpf.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/dcopf.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/dcpf.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/dopf.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/ed.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/pflow.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/routine.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/rted.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/type.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/routines/uc.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/system.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/utils/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ams/utils/paths.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/Makefile +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/make.bat +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/_templates/autosummary/base.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/_templates/autosummary/class.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/_templates/autosummary/module.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/_templates/autosummary/module_toctree.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/api.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/examples/index.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/copyright.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/formats/index.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/formats/matpower.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/formats/psse.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/formats/pypower.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/formats/xlsx.png +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/formats/xlsx.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/index.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/install.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/overview.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/testcase.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/getting_started/verification.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/images/dcopf_time.png +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/images/sponsors/CURENT_Logo_NameOnTrans.png +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/images/sponsors/CURENT_Logo_Transparent.png +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/images/sponsors/CURENT_Logo_Transparent_Name.png +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/images/sponsors/doe.png +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/index.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/modeling/example.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/modeling/index.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/modeling/model.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/modeling/routine.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/docs/source/modeling/system.rst +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ltbams.egg-info/SOURCES.txt +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ltbams.egg-info/dependency_links.txt +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ltbams.egg-info/entry_points.txt +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/ltbams.egg-info/top_level.txt +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/requirements-extra.txt +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/setup.cfg +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/setup.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/__init__.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_1st_system.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_addressing.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_andes.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_case.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_cli.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_dctypes.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_export_csv.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_group.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_mats.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_model.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_paths.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_report.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_repr.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/tests/test_service.py +0 -0
- {ltbams-0.9.8 → ltbams-0.9.10}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ltbams
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.10
|
4
4
|
Summary: Python software for scheduling modeling and co-simulation with dynanics.
|
5
5
|
Home-page: https://github.com/CURENT/ams
|
6
6
|
Author: Jinning Wang
|
@@ -41,7 +41,6 @@ Python Software for Power System Scheduling Modeling and Co-Simulation with Dyna
|
|
41
41
|

|
42
42
|
[](https://github.com/CURENT/ams/commits/master/)
|
43
43
|
[](https://github.com/CURENT/ams/commits/develop/)
|
44
|
-
[](https://hits.dwyl.com/CURENT/ams)
|
45
44
|
[](https://libraries.io/pypi/ltbams)
|
46
45
|
[](https://mango-dune-07a8b7110.1.azurestaticapps.net/?repo=CURENT%2Fams)
|
47
46
|
|
@@ -92,7 +91,10 @@ Use the following resources to get involved.
|
|
92
91
|
|
93
92
|
# Installation
|
94
93
|
|
95
|
-
***NOTE:***
|
94
|
+
***NOTE:***
|
95
|
+
- Version **0.9.9** has known issues. Please avoid using this version
|
96
|
+
- `kvxopt` is recommended to install via `conda` as sometimes ``pip`` struggles to set the correct path for compiled libraries
|
97
|
+
- `cvxpy` versions **below 1.5** are incompatible with `numpy` versions **2.0 and above**
|
96
98
|
|
97
99
|
AMS is released as ``ltbams`` on PyPI and conda-forge.
|
98
100
|
Install from PyPI using pip:
|
@@ -8,7 +8,6 @@ Python Software for Power System Scheduling Modeling and Co-Simulation with Dyna
|
|
8
8
|

|
9
9
|
[](https://github.com/CURENT/ams/commits/master/)
|
10
10
|
[](https://github.com/CURENT/ams/commits/develop/)
|
11
|
-
[](https://hits.dwyl.com/CURENT/ams)
|
12
11
|
[](https://libraries.io/pypi/ltbams)
|
13
12
|
[](https://mango-dune-07a8b7110.1.azurestaticapps.net/?repo=CURENT%2Fams)
|
14
13
|
|
@@ -59,7 +58,10 @@ Use the following resources to get involved.
|
|
59
58
|
|
60
59
|
# Installation
|
61
60
|
|
62
|
-
***NOTE:***
|
61
|
+
***NOTE:***
|
62
|
+
- Version **0.9.9** has known issues. Please avoid using this version
|
63
|
+
- `kvxopt` is recommended to install via `conda` as sometimes ``pip`` struggles to set the correct path for compiled libraries
|
64
|
+
- `cvxpy` versions **below 1.5** are incompatible with `numpy` versions **2.0 and above**
|
63
65
|
|
64
66
|
AMS is released as ``ltbams`` on PyPI and conda-forge.
|
65
67
|
Install from PyPI using pip:
|
@@ -8,11 +8,11 @@ import json
|
|
8
8
|
|
9
9
|
version_json = '''
|
10
10
|
{
|
11
|
-
"date": "2024-
|
11
|
+
"date": "2024-09-03T22:41:38-0400",
|
12
12
|
"dirty": false,
|
13
13
|
"error": null,
|
14
|
-
"full-revisionid": "
|
15
|
-
"version": "0.9.
|
14
|
+
"full-revisionid": "8bc9504a8281c16236c73decd8e7365b682c706c",
|
15
|
+
"version": "0.9.10"
|
16
16
|
}
|
17
17
|
''' # END VERSION_JSON
|
18
18
|
|
@@ -437,22 +437,37 @@ class MatProcessor:
|
|
437
437
|
return b
|
438
438
|
|
439
439
|
def build_ptdf(self, line=None, no_store=False,
|
440
|
-
incremental=False, step=1000, no_tqdm=False
|
440
|
+
incremental=False, step=1000, no_tqdm=False,
|
441
|
+
permc_spec=None, use_umfpack=True):
|
441
442
|
"""
|
442
|
-
Build the Power Transfer Distribution Factor (PTDF) matrix and store
|
443
|
-
it in the MParam `PTDF` by default.
|
443
|
+
Build the Power Transfer Distribution Factor (PTDF) matrix and optionally store it in `MParam.PTDF`.
|
444
444
|
|
445
|
-
|
446
|
-
|
447
|
-
Shift Factor (GSF).
|
445
|
+
PTDF[m, n] represents the increased line flow on line `m` for a 1 p.u. power injection at bus `n`.
|
446
|
+
It is similar to the Generation Shift Factor (GSF).
|
448
447
|
|
449
|
-
Note
|
450
|
-
DCOPF calcualted line flow. The gap is ignorable for small cases.
|
448
|
+
Note: There may be minor discrepancies between PTDF-based line flow and DCOPF-calculated line flow.
|
451
449
|
|
452
|
-
|
450
|
+
For large cases, use `incremental=True` to calculate the sparse PTDF in chunks, which will be stored
|
451
|
+
as a `scipy.sparse.lil_matrix`. In this mode, the PTDF is calculated in chunks, and a progress bar
|
452
|
+
will be shown unless `no_tqdm=True`.
|
453
453
|
|
454
|
-
|
455
|
-
|
454
|
+
Parameters
|
455
|
+
----------
|
456
|
+
line : int, str, list, optional
|
457
|
+
Line indices for which the PTDF is calculated. If specified, the PTDF will not be stored in `MParam`.
|
458
|
+
no_store : bool, optional
|
459
|
+
If False, store the PTDF in `MatProcessor.PTDF._v`. Default is False.
|
460
|
+
incremental : bool, optional
|
461
|
+
If True, calculate the sparse PTDF in chunks to save memory. Default is False.
|
462
|
+
step : int, optional
|
463
|
+
Step size for incremental calculation. Default is 1000.
|
464
|
+
no_tqdm : bool, optional
|
465
|
+
If True, disable the progress bar. Default is False.
|
466
|
+
permc_spec : str, optional
|
467
|
+
Column permutation strategy for sparsity preservation. Default is 'COLAMD'.
|
468
|
+
use_umfpack : bool, optional
|
469
|
+
If True, use UMFPACK as the solver. Effective only when (`incremental=True`)
|
470
|
+
& (`line` contains a single line or `step` is 1). Default is True.
|
456
471
|
|
457
472
|
Parameters
|
458
473
|
----------
|
@@ -468,6 +483,10 @@ class MatProcessor:
|
|
468
483
|
Step for incremental calculation.
|
469
484
|
no_tqdm : bool, optional
|
470
485
|
If True, the progress bar will be disabled.
|
486
|
+
permc_spec : str, optional
|
487
|
+
How to permute the columns of the matrix for sparsity preservation. (default: 'COLAMD')
|
488
|
+
use_umfpack : bool, optional
|
489
|
+
If True, use UMFPACK as the solver. (default: True)
|
471
490
|
|
472
491
|
Returns
|
473
492
|
-------
|
@@ -530,8 +549,10 @@ class MatProcessor:
|
|
530
549
|
# NOTE: for PTDF, we are building rows by rows
|
531
550
|
for start in range(0, nline, step):
|
532
551
|
end = min(start + step, nline)
|
533
|
-
sol = sps.linalg.spsolve(Bbus[np.ix_(noslack, noref)].T,
|
534
|
-
Bf[np.ix_(luid[start:end], noref)].T
|
552
|
+
sol = sps.linalg.spsolve(A=Bbus[np.ix_(noslack, noref)].T,
|
553
|
+
b=Bf[np.ix_(luid[start:end], noref)].T,
|
554
|
+
permc_spec=permc_spec,
|
555
|
+
use_umfpack=use_umfpack).T
|
535
556
|
H[start:end, noslack] = sol
|
536
557
|
|
537
558
|
# show progress in percentage
|
@@ -11,6 +11,7 @@ from andes.utils.misc import elapsed
|
|
11
11
|
from andes.system import System as andes_System
|
12
12
|
|
13
13
|
from ams.io import input_formats
|
14
|
+
from ams.shared import nan
|
14
15
|
|
15
16
|
logger = logging.getLogger(__name__)
|
16
17
|
|
@@ -260,7 +261,7 @@ def parse_addfile(adsys, amsys, addfile):
|
|
260
261
|
except KeyError: # set the most frequent string as the model name
|
261
262
|
split_list = []
|
262
263
|
for item in df[idxn].values:
|
263
|
-
if item is None or
|
264
|
+
if item is None or nan:
|
264
265
|
continue
|
265
266
|
try:
|
266
267
|
split_list.append(item.split('_'))
|
@@ -295,7 +296,7 @@ def parse_addfile(adsys, amsys, addfile):
|
|
295
296
|
# add dynamic models
|
296
297
|
for name, df in df_models.items():
|
297
298
|
# drop rows that all nan
|
298
|
-
df.replace(['', ' '],
|
299
|
+
df.replace(['', ' '], nan, inplace=True) # replace empty string with nan
|
299
300
|
df.dropna(axis=0, how='all', inplace=True)
|
300
301
|
# if the dynamic model also exists in AMS, use AMS parameters for overlap
|
301
302
|
if (name in amsys.models.keys()) and amsys.models[name].n > 0:
|
@@ -684,15 +685,15 @@ class Dynamic:
|
|
684
685
|
cond_ads_stg_u = (mname_ads in ['StaticGen', 'PV', 'Sclak']) and (pname_ads == 'u')
|
685
686
|
if cond_ads_stg_u and (self.is_tds):
|
686
687
|
# --- SynGen ---
|
687
|
-
u_sg = sa.SynGen.get(idx=link['syg_idx'].replace(
|
688
|
+
u_sg = sa.SynGen.get(idx=link['syg_idx'].replace(nan, None).to_list(),
|
688
689
|
src='u', attr='v',
|
689
690
|
allow_none=True, default=0,)
|
690
691
|
# --- DG ---
|
691
|
-
u_dg = sa.DG.get(idx=link['dg_idx'].replace(
|
692
|
+
u_dg = sa.DG.get(idx=link['dg_idx'].replace(nan, None).to_list(),
|
692
693
|
src='u', attr='v',
|
693
694
|
allow_none=True, default=0,)
|
694
695
|
# --- RenGen ---
|
695
|
-
u_rg = sa.RenGen.get(idx=link['rg_idx'].replace(
|
696
|
+
u_rg = sa.RenGen.get(idx=link['rg_idx'].replace(nan, None).to_list(),
|
696
697
|
src='u', attr='v',
|
697
698
|
allow_none=True, default=0,)
|
698
699
|
# --- output ---
|
@@ -722,19 +723,19 @@ class Dynamic:
|
|
722
723
|
cond_ads_stg_p = (mname_ads in ['StaticGen', 'PV', 'Sclak']) and (pname_ads == 'p')
|
723
724
|
if cond_ads_stg_p and (self.is_tds):
|
724
725
|
# --- SynGen ---
|
725
|
-
p_sg = sa.SynGen.get(idx=link['syg_idx'].replace(
|
726
|
+
p_sg = sa.SynGen.get(idx=link['syg_idx'].replace(nan, None).to_list(),
|
726
727
|
src='Pe', attr='v',
|
727
728
|
allow_none=True, default=0,)
|
728
729
|
# --- DG ---
|
729
|
-
Ie_dg = sa.DG.get(idx=link['dg_idx'].replace(
|
730
|
+
Ie_dg = sa.DG.get(idx=link['dg_idx'].replace(nan, None).to_list(),
|
730
731
|
src='Ipout_y', attr='v',
|
731
732
|
allow_none=True, default=0,)
|
732
|
-
v_dg = sa.DG.get(idx=link['dg_idx'].replace(
|
733
|
+
v_dg = sa.DG.get(idx=link['dg_idx'].replace(nan, None).to_list(),
|
733
734
|
src='v', attr='v',
|
734
735
|
allow_none=True, default=0,)
|
735
736
|
p_dg = Ie_dg * v_dg
|
736
737
|
# --- RenGen ---
|
737
|
-
p_rg = sa.RenGen.get(idx=link['rg_idx'].replace(
|
738
|
+
p_rg = sa.RenGen.get(idx=link['rg_idx'].replace(nan, None).to_list(),
|
738
739
|
src='Pe', attr='v',
|
739
740
|
allow_none=True, default=0,)
|
740
741
|
# --- output ---
|
@@ -226,7 +226,7 @@ def mpc2system(mpc: dict, system) -> bool:
|
|
226
226
|
system.add('GCost', gen=int(gen),
|
227
227
|
u=1, type=gctype,
|
228
228
|
idx=gcost_idx,
|
229
|
-
name=
|
229
|
+
name=None,
|
230
230
|
csu=startup, csd=shutdown,
|
231
231
|
c2=c2, c1=c1, c0=c0
|
232
232
|
)
|
@@ -235,7 +235,7 @@ def mpc2system(mpc: dict, system) -> bool:
|
|
235
235
|
zone_id = np.unique(system.Bus.zone.v).astype(int)
|
236
236
|
for zone in zone_id:
|
237
237
|
zone_idx = f'ZONE_{zone}'
|
238
|
-
system.add('Region', idx=zone_idx, name=
|
238
|
+
system.add('Region', idx=zone_idx, name=None)
|
239
239
|
bus_zone = system.Bus.zone.v
|
240
240
|
bus_zone = [f'ZONE_{int(zone)}' for zone in bus_zone]
|
241
241
|
system.Bus.zone.v = bus_zone
|
@@ -291,9 +291,11 @@ def system2mpc(system) -> dict:
|
|
291
291
|
gen=np.zeros((system.PV.n + system.Slack.n, 21), dtype=np.float64),
|
292
292
|
branch=np.zeros((system.Line.n, 17), dtype=np.float64),
|
293
293
|
gencost=np.zeros((system.GCost.n, 7), dtype=np.float64),
|
294
|
-
bus_name=np.zeros((system.Bus.n, ), dtype=object),
|
295
294
|
)
|
296
295
|
|
296
|
+
if system.Bus.name.v is not None:
|
297
|
+
mpc['bus_name'] = system.Bus.name.v
|
298
|
+
|
297
299
|
base_mva = system.config.mva
|
298
300
|
|
299
301
|
# --- bus ---
|
@@ -401,6 +403,4 @@ def system2mpc(system) -> dict:
|
|
401
403
|
else:
|
402
404
|
mpc.pop('gencost')
|
403
405
|
|
404
|
-
mpc['bus_name'] = np.array(system.Bus.name.v)
|
405
|
-
|
406
406
|
return mpc
|
@@ -308,7 +308,7 @@ def run(filename, input_path='', verbose=20, mp_verbose=30,
|
|
308
308
|
ncpu=NCPUS_PHYSICAL, pool=False,
|
309
309
|
cli=False, shell=False, **kwargs):
|
310
310
|
"""
|
311
|
-
Entry point to run
|
311
|
+
Entry point to run AMS routines.
|
312
312
|
|
313
313
|
Parameters
|
314
314
|
----------
|
@@ -511,7 +511,7 @@ def demo(**kwargs):
|
|
511
511
|
|
512
512
|
def versioninfo():
|
513
513
|
"""
|
514
|
-
Print version info for
|
514
|
+
Print version info for AMS and dependencies.
|
515
515
|
"""
|
516
516
|
|
517
517
|
import numpy as np
|
@@ -563,7 +563,7 @@ def print_license():
|
|
563
563
|
|
564
564
|
def edit_conf(edit_config: Optional[Union[str, bool]] = ''):
|
565
565
|
"""
|
566
|
-
Edit the
|
566
|
+
Edit the AMS config file which occurs first in the search path.
|
567
567
|
|
568
568
|
Parameters
|
569
569
|
----------
|
@@ -647,7 +647,7 @@ def save_conf(config_path=None, overwrite=None, **kwargs):
|
|
647
647
|
# TODO: list AMS output files here
|
648
648
|
def remove_output(recursive=False):
|
649
649
|
"""
|
650
|
-
Remove the outputs generated by
|
650
|
+
Remove the outputs generated by AMS, including power flow reports
|
651
651
|
``_out.txt``, time-domain list ``_out.lst`` and data ``_out.dat``,
|
652
652
|
eigenvalue analysis report ``_eig.txt``.
|
653
653
|
|
@@ -412,8 +412,10 @@ class Var(OptzBase):
|
|
412
412
|
|
413
413
|
@v.setter
|
414
414
|
def v(self, value):
|
415
|
-
|
416
|
-
|
415
|
+
if self.optz is None:
|
416
|
+
logger.info(f"Variable <{self.name}> is not initialized yet.")
|
417
|
+
else:
|
418
|
+
self.optz.value = value
|
417
419
|
|
418
420
|
def get_idx(self):
|
419
421
|
if self.is_group:
|
@@ -595,6 +597,10 @@ class Constraint(OptzBase):
|
|
595
597
|
else:
|
596
598
|
return self.optz._expr.value
|
597
599
|
|
600
|
+
@v.setter
|
601
|
+
def v(self, value):
|
602
|
+
raise AttributeError("Cannot set the value of the constraint.")
|
603
|
+
|
598
604
|
|
599
605
|
class Objective(OptzBase):
|
600
606
|
"""
|
@@ -634,7 +640,6 @@ class Objective(OptzBase):
|
|
634
640
|
OptzBase.__init__(self, name=name, info=info, unit=unit)
|
635
641
|
self.e_str = e_str
|
636
642
|
self.sense = sense
|
637
|
-
self._v = 0
|
638
643
|
self.code = None
|
639
644
|
|
640
645
|
@property
|
@@ -673,13 +678,12 @@ class Objective(OptzBase):
|
|
673
678
|
"""
|
674
679
|
if self.optz is None:
|
675
680
|
return None
|
676
|
-
|
677
|
-
|
678
|
-
return out
|
681
|
+
else:
|
682
|
+
return self.optz.value
|
679
683
|
|
680
684
|
@v.setter
|
681
685
|
def v(self, value):
|
682
|
-
|
686
|
+
raise AttributeError("Cannot set the value of the objective function.")
|
683
687
|
|
684
688
|
def parse(self, no_code=True):
|
685
689
|
"""
|
@@ -1,22 +1,24 @@
|
|
1
1
|
"""
|
2
2
|
Python Interior Point Solver (PIPS).
|
3
3
|
"""
|
4
|
-
import logging
|
4
|
+
import logging
|
5
5
|
|
6
|
-
import numpy as np
|
7
|
-
from numpy import flatnonzero as find
|
6
|
+
import numpy as np
|
7
|
+
from numpy import flatnonzero as find
|
8
8
|
|
9
|
-
import scipy.sparse as sp
|
10
|
-
from scipy.sparse import csr_matrix as c_sparse
|
9
|
+
import scipy.sparse as sp
|
10
|
+
from scipy.sparse import csr_matrix as c_sparse
|
11
11
|
|
12
|
-
from andes.shared import deg2rad, rad2deg
|
12
|
+
from andes.shared import deg2rad, rad2deg
|
13
13
|
|
14
|
-
from ams.
|
15
|
-
|
16
|
-
from ams.pypower.
|
17
|
-
from ams.pypower.
|
14
|
+
from ams.shared import inf
|
15
|
+
|
16
|
+
from ams.pypower.eps import EPS
|
17
|
+
from ams.pypower.idx import IDX
|
18
|
+
from ams.pypower.utils import sub2ind
|
19
|
+
from ams.pypower.make import makeYbus
|
18
20
|
from ams.pypower.routines.opffcns import (opf_costfcn, opf_consfcn,
|
19
|
-
opf_hessfcn,)
|
21
|
+
opf_hessfcn,)
|
20
22
|
|
21
23
|
|
22
24
|
logger = logging.getLogger(__name__)
|
@@ -205,13 +207,13 @@ def pips(f_fcn, x0=None, A=None, l=None, u=None, xmin=None, xmax=None,
|
|
205
207
|
|
206
208
|
# default argument values
|
207
209
|
if l is None or len(l) == 0:
|
208
|
-
l = -
|
210
|
+
l = -inf * np.ones(nA)
|
209
211
|
if u is None or len(u) == 0:
|
210
|
-
u =
|
212
|
+
u = inf * np.ones(nA)
|
211
213
|
if xmin is None or len(xmin) == 0:
|
212
|
-
xmin = -
|
214
|
+
xmin = -inf * np.ones(x0.shape[0])
|
213
215
|
if xmax is None or len(xmax) == 0:
|
214
|
-
xmax =
|
216
|
+
xmax = inf * np.ones(x0.shape[0])
|
215
217
|
if gh_fcn is None:
|
216
218
|
nonlinear = False
|
217
219
|
gn = np.array([])
|
@@ -343,15 +345,15 @@ def pips(f_fcn, x0=None, A=None, l=None, u=None, xmin=None, xmax=None,
|
|
343
345
|
|
344
346
|
maxh = np.zeros(1) if len(h) == 0 else max(h)
|
345
347
|
|
346
|
-
gnorm = np.linalg.norm(g,
|
347
|
-
lam_norm = np.linalg.norm(lam,
|
348
|
-
mu_norm = np.linalg.norm(mu,
|
349
|
-
znorm = np.linalg.norm(z,
|
348
|
+
gnorm = np.linalg.norm(g, inf) if len(g) else 0.0
|
349
|
+
lam_norm = np.linalg.norm(lam, inf) if len(lam) else 0.0
|
350
|
+
mu_norm = np.linalg.norm(mu, inf) if len(mu) else 0.0
|
351
|
+
znorm = np.linalg.norm(z, inf) if len(z) else 0.0
|
350
352
|
feascond = \
|
351
|
-
max([gnorm, maxh]) / (1 + max([np.linalg.norm(x,
|
353
|
+
max([gnorm, maxh]) / (1 + max([np.linalg.norm(x, inf), znorm]))
|
352
354
|
gradcond = \
|
353
|
-
np.linalg.norm(Lx,
|
354
|
-
compcond = np.dot(z, mu) / (1 + np.linalg.norm(x,
|
355
|
+
np.linalg.norm(Lx, inf) / (1 + max([lam_norm, mu_norm]))
|
356
|
+
compcond = np.dot(z, mu) / (1 + np.linalg.norm(x, inf))
|
355
357
|
costcond = np.abs(f - f0) / (1 + np.abs(f0))
|
356
358
|
|
357
359
|
# save history
|
@@ -467,14 +469,14 @@ def pips(f_fcn, x0=None, A=None, l=None, u=None, xmin=None, xmax=None,
|
|
467
469
|
|
468
470
|
maxh1 = np.zeros(1) if len(h1) == 0 else max(h1)
|
469
471
|
|
470
|
-
g1norm = np.linalg.norm(g1,
|
471
|
-
lam1_norm = np.linalg.norm(lam,
|
472
|
-
mu1_norm = np.linalg.norm(mu,
|
473
|
-
z1norm = np.linalg.norm(z,
|
472
|
+
g1norm = np.linalg.norm(g1, inf) if len(g1) else 0.0
|
473
|
+
lam1_norm = np.linalg.norm(lam, inf) if len(lam) else 0.0
|
474
|
+
mu1_norm = np.linalg.norm(mu, inf) if len(mu) else 0.0
|
475
|
+
z1norm = np.linalg.norm(z, inf) if len(z) else 0.0
|
474
476
|
|
475
477
|
feascond1 = max([g1norm, maxh1]) / \
|
476
|
-
(1 + max([np.linalg.norm(x1,
|
477
|
-
gradcond1 = np.linalg.norm(Lx1,
|
478
|
+
(1 + max([np.linalg.norm(x1, inf), z1norm]))
|
479
|
+
gradcond1 = np.linalg.norm(Lx1, inf) / (1 + max([lam1_norm, mu1_norm]))
|
478
480
|
|
479
481
|
if (feascond1 > feascond) and (gradcond1 > gradcond):
|
480
482
|
sc = True
|
@@ -560,15 +562,15 @@ def pips(f_fcn, x0=None, A=None, l=None, u=None, xmin=None, xmax=None,
|
|
560
562
|
else:
|
561
563
|
maxh = max(h)
|
562
564
|
|
563
|
-
gnorm = np.linalg.norm(g,
|
564
|
-
lam_norm = np.linalg.norm(lam,
|
565
|
-
mu_norm = np.linalg.norm(mu,
|
566
|
-
znorm = np.linalg.norm(z,
|
565
|
+
gnorm = np.linalg.norm(g, inf) if len(g) else 0.0
|
566
|
+
lam_norm = np.linalg.norm(lam, inf) if len(lam) else 0.0
|
567
|
+
mu_norm = np.linalg.norm(mu, inf) if len(mu) else 0.0
|
568
|
+
znorm = np.linalg.norm(z, inf) if len(z) else 0.0
|
567
569
|
feascond = \
|
568
|
-
max([gnorm, maxh]) / (1 + max([np.linalg.norm(x,
|
570
|
+
max([gnorm, maxh]) / (1 + max([np.linalg.norm(x, inf), znorm]))
|
569
571
|
gradcond = \
|
570
|
-
np.linalg.norm(Lx,
|
571
|
-
compcond = np.dot(z, mu) / (1 + np.linalg.norm(x,
|
572
|
+
np.linalg.norm(Lx, inf) / (1 + max([lam_norm, mu_norm]))
|
573
|
+
compcond = np.dot(z, mu) / (1 + np.linalg.norm(x, inf))
|
572
574
|
costcond = float(np.abs(f - f0) / (1 + np.abs(f0)))
|
573
575
|
|
574
576
|
hist.append({'feascond': feascond, 'gradcond': gradcond,
|
@@ -775,8 +777,8 @@ def pipsopf_solver(om, ppopt, out_opt=None):
|
|
775
777
|
|
776
778
|
# try to select an interior initial point
|
777
779
|
ll, uu = xmin.copy(), xmax.copy()
|
778
|
-
ll[xmin == -
|
779
|
-
uu[xmax ==
|
780
|
+
ll[xmin == -inf] = -1e10 # replace Inf with numerical proxies
|
781
|
+
uu[xmax == inf] = 1e10
|
780
782
|
x0 = (ll + uu) / 2
|
781
783
|
Varefs = bus[bus[:, IDX.bus.BUS_TYPE] == IDX.bus.REF, IDX.bus.VA] * deg2rad
|
782
784
|
# angles set to first reference angle
|
@@ -7,6 +7,8 @@
|
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
|
10
|
+
from ams.shared import inf
|
11
|
+
|
10
12
|
|
11
13
|
PF_OPTIONS = [
|
12
14
|
('pf_alg', 1, '''power flow algorithm:
|
@@ -184,7 +186,7 @@ GUROBI_OPTIONS = [
|
|
184
186
|
3 - concurrent (LP only)
|
185
187
|
4 - deterministic concurrent (LP only)
|
186
188
|
'''),
|
187
|
-
('grb_timelimit',
|
189
|
+
('grb_timelimit', inf, 'maximum time allowed for solver (TimeLimit)'),
|
188
190
|
('grb_threads', 0, '(auto) maximum number of threads to use (Threads)'),
|
189
191
|
('grb_opt', 0, 'See gurobi_options() for details')
|
190
192
|
]
|