Skip to content

Commit

Permalink
Add File | Save network (#14)
Browse files Browse the repository at this point in the history
Signed-off-by: Damien Jeandemange <damien.jeandemange@gmail.com>
  • Loading branch information
jeandemanged authored Nov 17, 2024
1 parent 75bc62e commit 1100401
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@

YAGAT provides a graphical user interface built on top of the [PowSyBl](https://www.powsybl.org) open source grid analysis libraries.

With YAGAT no computer science skill is required: just download the application and run it.
With YAGAT, no programming skills are required: just download, unzip, and run – you're all set!

Today with YAGAT you can:
- Load grid models from the various formats supported by [PowSyBl](https://www.powsybl.org):
- PowSyBl native iIDM format
- CIM/CGMES
- UCTE-DEF
- IEEE-CDF
Expand All @@ -25,13 +26,20 @@ Today with YAGAT you can:

## Installation

### Binary releases

Binary releases are provided for Windows, Linux and macOS on the [releases page](https://github.com/jeandemanged/yagat/releases).
No additional software is required for installation.
Download and extract the zip archive for your platform, then run YAGAT.

### Building from source
## Quick Start

- **Open a sample network**: Go to `File` | `Open Sample network` | `IEEE 9 Bus` to load a sample grid model.
- **Navigate the grid**: Use the tree view on the left to browse through the network model and its elements.
- **Run the Load Flow**: Select `Run` | `Load Flow` to execute the analysis.
- Once completed, review the solved bus voltages and branch flows.

![yagat quickstart](https://github.com/user-attachments/assets/a5ef2a20-13a8-44f5-b927-8d090d173d73)

## Building from source

With Python 3.12 and e.g. using a Virtual Environment and `pip`.

Expand All @@ -55,15 +63,6 @@ pyinstaller -y yagat.spec

YAGAT is then available for your platform in the `dist` directory.

## Quick Start

- **Open a sample network**: Go to `File` | `Open Sample network` | `IEEE 9 Bus` to load a sample grid model.
- **Navigate the grid**: Use the tree view on the left to browse through the network model and its elements.
- **Run the Load Flow**: Select `Run` | `Load Flow` to execute the analysis.
- Once completed, view the solved bus voltages and branch flows for insights into the grid's state.

![yagat quickstart](https://github.com/user-attachments/assets/57aad269-4e02-4a34-aba7-2c7906ab0e26)

## Roadmap

YAGAT today lacks many features, but you may already find it useful. What is planned for the future is:
Expand Down
17 changes: 14 additions & 3 deletions yagat/menus/impl/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from yagat.app_context import AppContext



class FileMenu(tk.Menu):
def __init__(self, parent, context: AppContext, *args, **kwargs):
tk.Menu.__init__(self, parent, *args, **kwargs)
Expand Down Expand Up @@ -43,7 +42,6 @@ def load_be_nl():
context.network = be
context.status_text = 'Network CGMES MicroGrid BE+NL loaded'


self.sample_networks_menu.add_command(label='IEEE 9 Bus',
command=lambda: load_sample_network(pn.create_ieee9()))
self.sample_networks_menu.add_command(label='IEEE 14 Bus',
Expand Down Expand Up @@ -76,6 +74,8 @@ def load_be_nl():
command=lambda: load_sample_network(
pn.create_four_substations_node_breaker_network_with_extensions()))

self.add_separator()
self.add_command(label='Save...', command=self.save_network)
self.add_separator()
self.add_command(
label='Exit',
Expand All @@ -90,4 +90,15 @@ def open_network(self):
else:
self.context.status_text = 'Opening ' + filename
self.context.network = pp.network.load(filename)
self.context.status_text = 'Network ' + self.context.network.name + ' loaded'
self.context.status_text = f'Network {self.context.network.name} loaded'

def save_network(self):
if not self.context.network:
return
filename = fd.asksaveasfilename()
if not filename:
self.context.status_text = 'File save cancelled by user'
else:
self.context.status_text = 'Saving ' + filename
self.context.network.save(filename)
self.context.status_text = f'Network {self.context.network.name} saved to {filename}'

0 comments on commit 1100401

Please sign in to comment.