Skip to content

Commit

Permalink
Merge pull request #41 from CURENT/revert-40-doc
Browse files Browse the repository at this point in the history
Revert "Doc" to "master"
  • Loading branch information
jinningwang authored Feb 20, 2024
2 parents b2f0287 + 284ff38 commit fb78dc4
Show file tree
Hide file tree
Showing 21 changed files with 176 additions and 828 deletions.
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ cli:
pycoverage:
report_type: "xml"

codecov:
token: 5fc2d41f-bcba-455d-a843-f85beb76d28f
ignore:
- "ams/_version.py"
- "ams/pypower/**"
50 changes: 0 additions & 50 deletions .github/workflows/codecov.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ jobs:
name: Test notebooks.
run: |
pytest --nbmake examples --ignore=examples/demonstration
- shell: bash -el {0}
name: Test with pytest and collect coverage
run: |
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Codacy
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
- name: Build a distribution if tagged
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
run: |
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,4 @@ icebar
~$*.xlsx

# conda
.conda/*

# coverage
.coverage
coverage.xml
.conda/*
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Python Software for Power System Dispatch Modeling and Co-Simulation with Dynani
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Downloads | [![PyPI Version](https://img.shields.io/pypi/v/ltbams.svg)](https://pypi.python.org/pypi/ltbams)
| Try on Binder | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/curent/ams/master) | |
| Code Quality |[![Codacy Badge](https://app.codacy.com/project/badge/Grade/69456da1b8634f2f984bd769e35f0050)](https://app.codacy.com/gh/CURENT/ams/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)| [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/69456da1b8634f2f984bd769e35f0050)](https://app.codacy.com/gh/CURENT/ams/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage) |
| Code Quality |[![Codacy Badge](https://app.codacy.com/project/badge/Grade/69456da1b8634f2f984bd769e35f0050)](https://app.codacy.com/gh/CURENT/ams/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)| [![codecov](https://codecov.io/gh/CURENT/ams/graph/badge.svg?token=RZI5GLLBQH)](https://codecov.io/gh/CURENT/ams) |
| Build Status | [![GitHub Action Status](https://github.com/CURENT/ams/workflows/Python%20application/badge.svg)](https://github.com/curent/ams/actions) |
| Structure | [![Structure](https://img.shields.io/badge/code_base-visualize-blue)](https://mango-dune-07a8b7110.1.azurestaticapps.net/?repo=CURENT%2Fams)

Expand Down Expand Up @@ -48,14 +48,6 @@ Use the following resources to get involved.
- Try in Jupyter Notebook on [Binder][Binder]
<!-- + Check out and and cite our [paper][arxiv paper] -->

# Installation

AMS is released as ``ltbams`` on PyPI. To install the latest release, use pip as follows:

```bash
pip install ltbams
```

# Sponsors and Contributors
AMS is the dispatch simulation engine for the CURENT Largescale Testbed (LTB).
More information about CURENT LTB can be found at the [LTB Repository][LTB Repository].
Expand All @@ -71,9 +63,12 @@ See [GitHub contributors][GitHub contributors] for the contributor list.
AMS is licensed under the [GPL v3 License](./LICENSE).

# Related Projects
- [Popular Open Source Libraries for Power System Analysis](https://github.com/jinningwang/best-of-ps)
- [G-PST Tools Portal](https://g-pst.github.io/tools/): An open tools portal with a classification approach
- [Open Source Software (OSS) for Electricity Market Research, Teaching, and Training](https://www2.econ.iastate.edu/tesfatsi/ElectricOSS.htm)
- [CVXPY](https://github.com/cvxpy/cvxpy)
- [Visualizations of Mittelmann benchmarks](https://mattmilten.github.io/mittelmann-plots/)
- [CBC Solver](https://github.com/coin-or/Cbc)
- [MATPOWER](https://github.com/MATPOWER/matpower)
- [PYPOWER](https://github.com/rwl/PYPOWER)
- [pandapower](https://github.com/e2nIEE/pandapower)

Some commercial solvers provide academic licenses, such as COPT, GUROBI, CPLEX, and MOSEK.

Expand Down
8 changes: 4 additions & 4 deletions ams/interop/andes.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def to_andes(system, setup=False, addfile=None,
--------
>>> import ams
>>> import andes
>>> sp = ams.load(ams.get_case('ieee14/ieee14_uced.xlsx'), setup=True)
>>> sp = ams.load(ams.get_case('ieee14/ieee14_rted.xlsx'), setup=True)
>>> sa = sp.to_andes(setup=False,
... addfile=andes.get_case('ieee14/ieee14_full.xlsx'),
... addfile=andes.get_case('ieee14/ieee14_wt3.xlsx'),
... overwrite=True, no_output=True)
Notes
Expand Down Expand Up @@ -279,10 +279,9 @@ def parse_addfile(adsys, amsys, addfile):
# add dynamic models
for name, df in df_models.items():
# drop rows that all nan
df.replace(['', ' '], np.NaN, inplace=True) # replace empty string with nan
df.dropna(axis=0, how='all', inplace=True)
# if the dynamic model also exists in AMS, use AMS parameters for overlap
if (name in amsys.models.keys()) and amsys.models[name].n > 0:
if name in amsys.models.keys():
if df.shape[0] != amsys.models[name].n:
msg = f'<{name}> has different number of rows in addfile.'
logger.warning(msg)
Expand Down Expand Up @@ -904,6 +903,7 @@ def make_link_table(adsys):
ssa_key0 = pd.merge(left=ssa_key0, how='left', on='stg_idx',
right=ssa_rg[['stg_idx', 'rg_idx']])

pd.set_option('future.no_silent_downcasting', True)
ssa_key0 = ssa_key0.fillna(value=False)
dyr = ssa_key0['syg_idx'].astype(bool) + ssa_key0['dg_idx'].astype(bool) + ssa_key0['rg_idx'].astype(bool)
non_dyr = np.logical_not(dyr)
Expand Down
10 changes: 2 additions & 8 deletions ams/routines/routine.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,14 +693,9 @@ def _post_add_check(self):
"""
Post-addition check.
"""
# --- reset routine status ---
self.initialized = False
self.exec_time = 0.0
self.exit_code = 0
# --- reset symprocessor status ---
self._syms = False
# --- reset optimization model status ---
self.om.initialized = False

def addRParam(self,
name: str,
Expand Down Expand Up @@ -791,9 +786,8 @@ def addService(self,
model : str, optional
Model name.
"""
item = ValueService(name=name, tex_name=tex_name,
unit=unit, info=info,
vtype=vtype, value=value)
item = ValueService(name=name, value=value, tex_name=tex_name, unit=unit,
info=info, vtype=vtype, model=model)
# add the service as an routine attribute
setattr(self, name, item)

Expand Down
1 change: 0 additions & 1 deletion docs/source/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ folder of the repository
../_examples/ex5.ipynb
../_examples/ex6.ipynb
../_examples/ex7.ipynb
../_examples/ex8.ipynb
Binary file removed docs/source/getting_started/formats/xlsx.png
Binary file not shown.
19 changes: 5 additions & 14 deletions docs/source/getting_started/formats/xlsx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,14 @@
AMS xlsx
----------

AMS sticks to the same XLSX format as ANDES, where each workbook represents a
model and each row represents a device instance.
The AMS xlsx format allows one to use Excel for convenient viewing and
editing. If you do not use Excel, there are alternatives such as the free and
open-source `LibreOffice <https://www.libreoffice.org>`_.

Format definition
.................

As indicated in the image below, the AMS xlsx format contains multiple workbooks
(also known as "sheets") shown as tabs at the bottom.
The name of a workbook is a *model* name, and each
The AMS xlsx format contains multiple workbooks (also known as "sheets") shown
as tabs at the bottom. The name of a workbook is a *model* name, and each
workbook contains the parameters of all *devices* that are *instances* of the
model.

.. image:: xlsx.png
:width: 600
:alt: Example workbook for Bus

.. note:: Power Flow Data are the bridge between AMS and ANDES cases.
More discussion can be found in the Examples - Interoperation with ANDES.

For more XLSX format details, please refer to the `ANDES XLSX format <https://docs.andes.app/en/latest/>`_.
6 changes: 3 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ AMS documentation
**Useful Links**: `Source Repository`_ | `Report Issues`_ | `Q&A`_ | `LTB Repository`_
| `ANDES Repository`_
.. _`Source Repository`: https://github.com/CURENT/ams
.. _`Report Issues`: https://github.com/CURENT/ams/issues
.. _`Q&A`: https://github.com/CURENT/ams/discussions
.. _`Source Repository`: https://github.com/jinningwang/ams
.. _`Report Issues`: https://github.com/jinningwang/ams/issues
.. _`Q&A`: https://github.com/jinningwang/ams/discussions
.. _`ANDES Repository`: https://github.com/CURENT/andes
.. _`LTB Repository`: https://github.com/CURENT/

Expand Down
9 changes: 7 additions & 2 deletions docs/source/modeling/routine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ Further, to facilitate the routine definition, AMS developed a class
.. autoclass:: ams.core.param.RParam
:noindex:

.. autoclass:: ams.routines.RoutineModel
:noindex:
.. currentmodule:: ams.routines
.. autosummary::
:recursive:
:toctree: _generated

RoutineData
RoutineModel

Optimization model
------------------
Expand Down
6 changes: 0 additions & 6 deletions docs/source/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ The APIs before v3.0.0 are in beta and may change without prior notice.
Pre-v1.0.0
==========

v0.8.6 (2024-02-xx)

- Add ex8 to demonstrate how to customize existing formulations
- Fix ``addService``
- Fix ANDES file converter issue

v0.8.5 (2024-01-31)

- Improve quality of coverage and format
Expand Down
Loading

0 comments on commit fb78dc4

Please sign in to comment.