Skip to content

Behavior Description & Usage

Hayden Rinn edited this page Mar 17, 2021 · 5 revisions

This page describes the application's behavior and provides instructions on how to use the app.

Here is a short video demoing much of the functionality described in this page.

Table of Contents

Components

Components are the building blocks of power grids. There are 3 different types of components: devices, sources, and wires. Currently 9 components are implemented:

  • Devices: Switch, 70KV Breaker, 12KV Breaker, Transformer, Jumper, and Cutout
  • Sources: Power Source and Turbine
  • Wire

Each type of device has unique functionality and behavior.

Wires

Wires are the connecting components. Devices and Sources can only be connected to wires. Wires are drawn as black lines, or small black circles when they are a point. Since all devices and sources can only be connected to wires, they place with a point wire connected to both terminals by default.

Line wire and point wire.

Devices

Devices are the gateway components. They control how energy flows through the grid. For most devices, they can be toggled open or closed. When open, they do not allow energy to pass. When closed, energy passed through the device. The exception is the transformer device, which is cannot be toggled and always allows energy to pass.

Default states are important for toggleable devices. In the real grid that is being modeled, devices should be in their default state most of the time. When a device is not in its default state, it means that power is being routed through a different path than usual. Devices that have a default state of closed show N/C (normally closed) when open. Devices that have a default state of open show N/O (normally open) when closed.

Sources

Sources provide power to the grid. Sources can be toggled either on (providing energy) or off (not providing energy). The only difference between the two current sources: power sources and turbines, is that power sources only have 1 terminal while turbines have 2.

Building Grids

Grids can be built by placing components from the build menu onto the canvas. A ghost shows where the component will be placed. Components can be placed at unit positions, displayed as a faint background grid (graph paper style). Further components can be connected to any wire or placed separately from the rest of the grid. Components can also be rotated [R], named, or have their default state changed [E] through the properties menu.

Ghost component hovering over the grid.

Editing Grids

Several tools are provided to making editing grids easier. Tools exist at the top of the build menu. The select tool allows you to select components. To select components, you can either click a component to select one, click and drag to select every component under the drag area, or [CTRL] click to add another component to the selected group. Clicking anywhere on the background of the canvas or pressing [ESC] will deselect all components. Every component in the grid can be selected at once by pressing Edit > Select All.

While selected, a component is outlined in blue and its properties show in the properties window. Changing any field of the properties window and pressing apply will update the selected component. Pressing [DELETE] will delete all selected components.

Gridflow also supports undo and redo functionality. The application will save your 5 previous actions, and allows you to undo an action by pressing [CTRL+Z] or redo an action by pressing [CTRL+SHIFT+Z].

Interacting with Grids

The interact tool allows you to change the state of components. A left-click with the interact tool will toggle sources on/off and devices open/closed. A right-click with the interact tool will lock toggleable devices. In the locked state, the device is open, and toggles will not change the device's state. Right-click a locked device to unlock it. Press [ESC] at any time to leave the current tool and return to the interact tool.

Saving and Loading Grids

Grids can be saved to and loaded from a JSON file. These functions are accessible through the File menu.

Associations

Associations can also be placed over components to visually organize the grid. Associations have a name and are displayed as rectangles that surround components. While in the Association Tool, the name and border rectangle can be repositioned by clicking and dragging. The association name can be changed in the properties window.

Placing Wires

Placing a wire across other wires creates a bridge by default. A bridge means that the two wires are not connected, and a small gap is displayed where the wires cross to indicate this. To connect crossing wires instead of bridging them, hold [CTRL] while placing the wire.

Tandem Devices

Devices can be put in tandem with other devices of the same type. While in tandem, only one of the devices can be in the closed state at the same time. When one device is closed, the other device is put in the locked state. To put two devices in tandem, select two devices of the same type, and then press the Link button in the properties window. Selecting either device in tandem and pressing Clear will unlink the two devices.

Simulating Energy Flow

Energy is simulated instantaneously and automatically as changes are made. Energized components have a yellow outline.

Energy is calculated by treating the grid as a graph of components. In this graph, components are vertices are connections are edges. To calculate the energy state of the grid, a depth first search is performed. This depth first search begins from the grid's sources, and continues until every branch is explored. The depth first search ends when it encounters open devices, leaving the components on the other side of the device de-energized.

An energized grid.

In this image, the normally closed switches prevented the middle breaker from being energized, but energy was routed through the normally open right switch to continue providing power to the rest of the grid.

Accounts

Gridflow is secured by user accounts. This accounts have permission levels that determine what the user can do in the application. There are 3 permission levels (ordered from lowest permissions to highest):

  1. VIEWER - Can only interact with the grid and load files
  2. BUILDER - Can build/edit the grid and save files (and above permissions).
  3. GOD - Can create and delete user accounts (and above permissions).

Accounts can be managed in File > Account Manager. Here, new accounts can be issued and existing accounts can be deleted. Users can switch accounts in File > Switch Account. A fail-safe is built into the credentials system to prevent lockout. On launch, if no GOD level accounts exist, a default one is created. The default GOD account credentials are:

Username: lefty

Password: powerball

It is recommended that the user deletes the default account and makes their own GOD account after logging in.

Hotkeys

This is a list of hotkeys and their functionality

  • [ESC] -> Pick interact tool
  • [S] -> Pick select tool
  • [A] -> Pick association tool
  • [DEL] -> Deleted selected components
  • [R]/[MIDDLE MOUSE] -> Rotate current component clockwise
  • [CTRL+R] -> Rotate current component counter-clockwise
  • [E] -> Toggle default state of current component
  • [CTRL+Z] -> Undo last action
  • [CTRL+SHIFT+Z] -> Redo last action