Skip to content

Commit

Permalink
Merge pull request #97 from CURENT/misc
Browse files Browse the repository at this point in the history
Misc
  • Loading branch information
jinningwang authored Nov 14, 2024
2 parents 2d13dc2 + b61b075 commit 987ff5a
Show file tree
Hide file tree
Showing 73 changed files with 2,670 additions and 818 deletions.
3 changes: 2 additions & 1 deletion .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ exclude_paths:
- "ams/_version.py"
- ".github/**"
- "README.md"
- "CODE_OF_CONDUCT.md"
- "cases/README.md"
- "CODE_OF_CONDUCT.md"`
- "tests/**"
- "docs/**"
- "examples/**"
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[flake8]
exclude = .git,__pycache__,build,dist,demos,cases,dev,ams/solver/pypower/,cards,versioneer.py,ams/_version.py,docs/source/conf.py,docs/source/_build,benchmarks,andes/pycode,scripts,.history,ams/pypower,
exclude = .git,__pycache__,build,dist,demos,cases,dev,ams/solver/pypower/,cards,versioneer.py,ams/_version.py,docs/source/conf.py,docs/source/_build,benchmarks,andes/pycode,scripts,.history,ams/pypower,icebar/*
max-line-length=115
1 change: 1 addition & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
run: |
mamba install -y nbmake pytest-xdist line_profiler # add'l packages for notebook tests.
mamba install --file requirements.txt --file requirements-extra.txt
python -m pip install pyscipopt
python -m pip install -e .
- shell: bash -el {0}
name: Test with pytest and collect coverage
Expand Down
52 changes: 46 additions & 6 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,49 @@ name: Python application
on: [push, pull_request]

jobs:
pretest:
name: AMS Pretest

runs-on: ubuntu-latest

if: ${{ github.ref != 'refs/heads/misc' }}

steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.11
mamba-version: "*"
miniforge-version: "latest"
channels: conda-forge,defaults
channel-priority: true
activate-environment: anaconda-client-env
- shell: bash -el {0}
name: Install dependencies
run: |
mamba install -y nbmake pytest-xdist line_profiler # add'l packages for notebook tests.
mamba install --file requirements.txt --file requirements-extra.txt
python -m pip install pyscipopt
python -m pip install -e .
- shell: bash -el {0}
name: Run pip check
run: |
pip check || true # Allow pip check to fail without failing the job
- shell: bash -el {0}
name: Test with pytest
run: |
pytest
- shell: bash -el {0}
name: Test notebooks.
run: |
pytest --nbmake examples --ignore=examples/verification
build:
name: AMS Tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, 3.10, 3.11, 3.12]
python-version: [3.9, 3.10, 3.11, 3.12, 3.13]

runs-on: ubuntu-latest

Expand All @@ -29,13 +66,16 @@ jobs:
run: |
mamba install -y nbmake pytest-xdist line_profiler # add'l packages for notebook tests.
mamba install --file requirements.txt --file requirements-extra.txt
python -m pip install pyscipopt
python -m pip install -e .
- name: Lint with flake8 for pull requests
if: github.event_name == 'pull_request'
- shell: bash -el {0}
name: Run pip check
run: |
pip check || true # Allow pip check to fail without failing the job
- shell: bash -el {0}
name: Test with pytest
run: |
pip install flake8 # specify flake8 to avoid unknown error
# stop the build if there are Python syntax errors or undefined names
flake8 .
pytest
- shell: bash -el {0}
name: Test notebooks.
run: |
Expand Down
4 changes: 1 addition & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ python:
- method: pip
path: .
extra_requirements:
- doc
- method: setuptools
path: .
- doc
10 changes: 10 additions & 0 deletions CITATION.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@article{andes_2021,
author = {Cui, Hantao and Li, Fangxing and Tomsovic, Kevin},
journal = {IEEE Transactions on Power Systems},
title = {Hybrid Symbolic-Numeric Framework for Power System Modeling and Analysis},
year = {2021},
volume = {36},
number = {2},
pages = {1373-1384},
doi = {10.1109/TPWRS.2020.3017019}
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

AMS Copyright (C) 2023 Jinning Wang
AMS Copyright (C) 2023 - 2024 Jinning Wang
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ Install from GitHub source:
pip install git+https://github.com/CURENT/ams.git
```

# Example Usage

Using AMS to run a Real-Time Economic Dispatch (RTED) simulation:

```python
import ams

ss = ams.load(ams.get_case('ieee14_uced.xlsx'))
ss.RTED.run()

print(ss.RTED.pg.v)
```

# Sponsors and Contributors
AMS is the scheduling simulation engine for the CURENT Largescale Testbed (LTB).
More information about CURENT LTB can be found at the [LTB Repository][LTB Repository].
Expand Down
15 changes: 4 additions & 11 deletions ams/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
from . import _version
__version__ = _version.get_versions()['version']

from ams import io # NOQA
from ams import utils # NOQA
from ams import models # NOQA
from ams import system # NOQA
from ams import routines # NOQA
from ams import opt # NOQA
from ams import pypower # NOQA
from ams import report # NOQA
from ams import extension # NOQA
from ams import benchmarks # NOQA

from ams.main import config_logger, load, run # NOQA
from ams.utils.paths import get_case # NOQA
from ams.system import System # NOQA
from ams.utils.paths import get_case, list_cases # NOQA
from ams.shared import ppc2df # NOQA

__author__ = 'Jining Wang'

__all__ = ['io', 'utils', 'models', 'system', 'extension']
__all__ = ['System', 'get_case', 'System']
Loading

0 comments on commit 987ff5a

Please sign in to comment.