Skip to content

Commit

Permalink
Merge branch 'master' into Sigproc
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosmc committed Dec 17, 2024
2 parents 74644c6 + c405ea6 commit 6205f88
Show file tree
Hide file tree
Showing 858 changed files with 202,886 additions and 494,806 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ extend-ignore =

# flake-quote settings: Set this to match black style:
inline-quotes = double

57 changes: 57 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Dev CI

on:
pull_request:

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip build setuptools wheel
python -m pip install --upgrade flake8 pytest pytest-cov
- name: Build package
run: python -m build --wheel

- name: Install wheel
run: pip install dist/*.whl

# Pending to be added in the near future:
# * flake8 src --count --exit-zero --max-complexity=10
- name: Linting with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 src --count --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 99 chars wide
flake8 src --count --exit-zero --statistics
# - name: Run tests
# run: pytest

- name: Generate coverage
run: pytest --cov=. --cov-report=xml

#- name: Sonar analysis
# uses: sonarsource/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# with:
# args: |
# -Dsonar.python.coverage.reportPaths=coverage.xml

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/

# VS Code
.vscode
.vs/

# Exclude package build artifacts:
dist/
Expand All @@ -17,6 +18,9 @@ build/
# Exclude the recommended virtual env:
dgcv_venv/

# Exclude windows installer output:
installers/Output

# Exclude default results (for those cases when we run the tool in the src tree, which we shouldn't)
Results/

Expand Down
162 changes: 155 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Developed by Grupo AIA
#### Table of Contents

1. [Overview](#overview)
2. [Installation](#installation)
2. [DGCV Installation](#dgcv-installation)
3. [Quick start](#quick-start)
4. [Running examples](#running-examples)
5. [Configuration](#configuration)
Expand Down Expand Up @@ -78,12 +78,11 @@ In the case of _Electric Performance_ testing, the user has also the option of
providing test curves, either to be used _instead of_ Dynaωo simulations, or to
be used along Dynaωo simulations (just for plotting both and comparing them).

# DGCV installation

## Linux installation


# Installation

## System requirements
### System requirements

The requirements at the OS-level are rather minimal: one just needs a recent
Linux distribution in which you should install
Expand Down Expand Up @@ -116,7 +115,7 @@ all of its dependencies (NumPy, etc.) will get installed at the user-level, i.e.
inside the user's `$HOME` directory, under a _Python virtual environment_.


## Installation
### Installation

1. Choose a base directory of your choice and run the following command:

Expand Down Expand Up @@ -152,6 +151,78 @@ inside the user's `$HOME` directory, under a _Python virtual environment_.

The dgcv application is now ready to use.

## Windows installation

### System requirements

The requirements at the OS-level are rather minimal: one just needs a recent Windows
distribution in which you should install a few packages, **LaTeX**, and **Python**. If
you do not have any strong preference, we would recommend Windows 10 or higher.

To be more specific, we explicitly list here the packages to be installed:

* Install Dynawo (v1.7.0 or later) and its required packages:
Dynawo is a simulation platform required by this tool. Follow the steps outlined in the official Dynawo installation guide at [Dynawo Installation Guide](https://dynawo.github.io/install/).
- **Nightly Version**: Download the **Nightly version** of Dynawo from the repository to ensure you have the latest features and updates.
- During installation, you will also need the following tools:
- **CMake**: CMake is used to configure the build process for Dynawo. Download it from [cmake.org](https://cmake.org/download/).
- **Visual Studio 2019**: Visual Studio is required to compile the code. You can download the free **Community Edition** from [here](https://visualstudio.microsoft.com/vs/older-downloads/). During the installation, select the "Desktop development with C++" workload.

* Install these LaTeX packages:
LaTeX is used for document processing. You can choose between two LaTeX distributions:
- **MiKTeX**: Download it from [MiKTeX Download](https://miktex.org/download).
- **TeX Live**: Download it from [TeX Live Download](https://www.tug.org/texlive/).

* Install a basic Python installation (version 3.9 or higher), containing at least `pip` and the `venv` module:
- Go to the [official Python website](https://www.python.org/downloads/).
- Download the latest version of Python 3 (ensure that you select the option to add Python to the system PATH during installation).
- To verify the installation, open a terminal and run:

Note that the tool itself is also a Python package. However, this package and
all of its dependencies (NumPy, etc.) will get installed under a
*Python virtual environment*.

### Installation

1. Download the [DGCV's Windows Installer](https://github.com/dynawo/dyn-grid-compliance-verification/releases/download/v0.5.2/DGCV_win_Installer.exe).


2. Next, execute the downloaded installer:

This executable will install the DGCV tool, together with a matching version of Dynawo,
under the selected directory (default installation path: `c:/dgcv`). It will do this
by copying the latest stable version and compiling and installing the application (and
all its dependencies, such as NumPy, etc.) into a Python virtual environment. The
installer will also install any third-party applications required for the proper
functioning of the tool.

The MikTex installer allows you to select the configuration that you want to apply.
For the tool to work correctly, you must select the "Yes" or "Ask me first" option on the
following screen:
![MikTex Installer Settings](./docs/manual/source/usage/figs_installation/miktex_settings.png)


3. Next, you must activate the virtual environment that has just been created by double-clicking on the DGCV.bat file that has been created on the desktop.

This action will open a new Command Prompt with the virtual environment activated where the tool can be used.
To finish using the tool, you only need to close the Command Prompt.

4. The tool is used via a single command `dgcv` having several subcommands. Quickly
check that your installation is working by running the help option, which will show
you all available subcommands:
```winbatch
dgcv -h
```

5. Upon the first use, the tool will automatically compile the Modelica models
internally defined by the tool. You can also run this command explicitly, as follows:
```winbatch
dgcv compile
```
(Note: this command is also used to compile any new Modelica models custom-defined by the
user; see the section below on [Compiling Modelica models](#compiling-modelica-models).)

The dgcv application is now ready to use.

# Quick start

Expand Down Expand Up @@ -452,7 +523,7 @@ options:

# For developers

## Build and install
## Build and install on Linux

1. Clone the repository via:
```bash
Expand Down Expand Up @@ -487,6 +558,83 @@ options:

The dgcv application is now ready to use.

## Build and install on Windows

1. Clone the Repository
The first step is to clone the repository to your local machine. Using GitHub Desktop:
- Open GitHub Desktop and click **File** > **Clone repository**.
- Enter the following URL to clone the repository:

```winbatch
git clone https://github.com/dynawo/dyn-grid-compliance-verification dgcv_repo
```
(you may of course use any name for the top-level directory, here `"dgcv_repo"`.)

- Choose a local directory where you want to save the repository and click **Clone**.

2. Set Up Virtual Environment
A virtual environment is recommended to manage dependencies for the project. This ensures that the package uses the correct Python version and dependencies without affecting other projects on your system.
- Open a **CMD terminal** (Command Prompt) as administrator.
- Navigate to the root folder of the cloned repository using the `cd` command:

```winbatch
cd dgcv_repo
```

- Create a new virtual environment with:

```winbatch
python.exe -m venv dgcv_venv
```
- This will create a directory `dgcv_venv` in your repository folder.

3. Build the Package
The next step is to compile the package into a distributable format:

```winbatch
python.exe -m build
```

- This command will create the necessary build files in the `dist` folder of the repository. The build process might take a few minutes to complete.

4. Activate the Virtual Environment
Now that the virtual environment is created, activate it to use the isolated environment:

```winbatch
dgcv_venv\Scripts\activate
```

- Once activated, your terminal prompt should change to indicate that the virtual environment is active (e.g., `(dgcv_venv)` at the beginning of the prompt).

5. Install the Package
Once the package is built, you can install it using pip. Use the following command to install the `.whl` (Wheel) file generated during the build:

```winbatch
python.exe -m pip install dist\dgcv....whl
```

- This will install the package into your active virtual environment.

6. Verify Installation
After installation, verify that the tool was installed correctly by running the following command:

```winbatch
dgcv -h
```

- This should display the help message for the `dyn-grid-compliance-verification` tool, confirming that the installation was successful.

7. Pre-Execution Compilation
Before running the tool for the first time, it's recommended to compile the tool's resources:

```winbatch
dgcv compile
```

- This step ensures that all necessary files are generated and compiled for optimal performance.

The dgcv application is now ready to use.

Finally, if you want to further _develop_ the source code of this tool, consult
the [Developer Manual](docs/manual_dev).
Expand Down
2 changes: 1 addition & 1 deletion attic/curves_creation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# (c) 2023/24 RTE
# (c) 2023/24 RTE
# Developed by Grupo AIA
# [email protected]
# [email protected]
Expand Down
2 changes: 1 addition & 1 deletion attic/steady_state.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# (c) 2023/24 RTE
# (c) 2023/24 RTE
# Developed by Grupo AIA
# [email protected]
# [email protected]
Expand Down
2 changes: 1 addition & 1 deletion build_and_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ echo
if [ $DEVELOPER = "y" ]; then
echo
colormsg "Installing additional Python packages for developers... "
pip install --upgrade-strategy eager -U pipdeptree black isort flake8 pytest sphinx jupyter
pip install --upgrade-strategy eager -U pipdeptree black isort flake8 pytest pytest-cov sphinx jupyter
colormsg "OK."
echo
fi
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/helps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def write_output(file, text):
for line in text.splitlines():
file.write(f"\t{line}\n")
file.write(f"\n")
file.write("\n")


def generate_help_files():
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions docs/manual/source/usage/inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ Currently supported models:
current source as interface with the grid
* WTG4BWeccCurrentSource
WECC Wind Turbine model with a current source as interface with the grid
* WTU4AWeccCurrentSource
* WT4AWeccCurrentSource
WECC Wind Turbine model with a simplified drive train model (dual-mass model), without the
plant controller and with a current source as interface with the grid
* WTU4BWeccCurrentSource
* WT4BWeccCurrentSource
WECC Wind Turbine model without the plant controller and with a current source as interface
with the grid
* IEC Wind models:
Expand Down Expand Up @@ -398,7 +398,6 @@ are correct.
BusPDR_BUS_ReactivePower =
StepUp_Xfmr_XFMR_Tap =
Synch_Gen_GEN_RotorSpeedPu =
Synch_Gen_GEN_RotorAngle =
Synch_Gen_GEN_InternalAngle =
Synch_Gen_GEN_AVRSetpointPu =
Synch_Gen_GEN_MagnitudeControlledByAVRP =
Expand Down
Loading

0 comments on commit 6205f88

Please sign in to comment.