PowerFlowCore 0.14.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package PowerFlowCore --version 0.14.0                
NuGet\Install-Package PowerFlowCore -Version 0.14.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PowerFlowCore" Version="0.14.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PowerFlowCore --version 0.14.0                
#r "nuget: PowerFlowCore, 0.14.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PowerFlowCore as a Cake Addin
#addin nuget:?package=PowerFlowCore&version=0.14.0

// Install PowerFlowCore as a Cake Tool
#tool nuget:?package=PowerFlowCore&version=0.14.0                

PowerFlowCore

What's new:

  • 0.14.0 - S_calc bug fix (calculated with load model). Add async parallel calculation api. Reduce memory allocation.
  • 0.13.6 - Minor memory optimisations.
  • 0.13.5 - GS performance improvement. Minor optimisations.
  • 0.13.4 - Fix bugs. U initial assumption usage. Grid islands. Stabilizing.
    • Fix voltage default initial value on grid initialization. Add Calculate() methods with Uinit assumption
    • Fix bug on LoadModel usage
    • Fix bug on power flows and currents calculations
    • Rebuild validation scheme
    • Add islands check and method for grid islands representing
  • 0.13.3 - Major performance improvement. Step 2.
    • Improve performance again
    • Eliminate SolvableGrid class (move solvers list to Grid class)
  • 0.13.2 - Major performance improvement.
  • 0.13.1 - Sparse algebra. Performance improvement.
  • 0.12.1 - Samples. Stabilizing. Cleanup.

Features:

  • Three-phase AC mode grids calculations
  • Flexible system to set up configuration of calculations
  • Newton-Raphson and Gauss-Seidel solvers
  • Load models with variant structure
  • Algorithms on graphs (connectivity etc.)
  • Network operational limits control
  • Parallel calculations from box

Available on NuGet.

Samples are presented in PowerFlowCore.Samples project. Library benchmarking is presented in PowerFlowCore.Benchmark project.

Quick example

Next example assumes that Node and Branch classes inherits INode and IBranch interfaces respectively. More examples can be found in PowerFlowCore.Samples project.

Create grid:

using PowerFlowCore;
using PowerFlowCore.Data;
using PowerFlowCore.Solvers;

var nodes = new List<INode>()        // Create collection of Nodes
{
    new Node(){Num = 1, Type = NodeType.PQ,    Unom=115,  Vpre = 0,     S_load = new Complex(10, 15)},
    new Node(){Num = 2, Type = NodeType.PQ,    Unom=230,  Vpre = 0,     S_load = new Complex(10, 40)},
    new Node(){Num = 3, Type = NodeType.PV,    Unom=10.5, Vpre = 10.6,  S_load = new Complex(10, 25),   S_gen = new Complex(50, 0), Q_min=-15, Q_max=60},
    new Node(){Num = 4, Type = NodeType.Slack, Unom=115,  Vpre = 115}
};

var branches = new List<IBranch>()   // Create collection of Branches
{
    new Branch(){Start=2, End=1, Y=1/(new Complex(0.5, 10)), Ktr=Complex.FromPolarCoordinates(0.495,    15 * Math.PI/180), Ysh = new Complex(0, -55.06e-6)},
    new Branch(){Start=2, End=3, Y=1/(new Complex(10,  20)), Ktr=Complex.FromPolarCoordinates(0.045652, 0 * Math.PI/180), Ysh = new Complex(0, 0)},
    new Branch(){Start=1, End=4, Y=1/(new Complex(8,   15)), Ktr=1},
    new Branch(){Start=1, End=4, Y=1/(new Complex(20,  40)), Ktr=1}
};

var grid = new Grid(nodes, branches);   // Create Grid object

Inspect connectivity:

bool connected = grid.IsConnected();

Get islands (ienumerable):

var islands = grid.GetGridIslands();

Calculate grid (for more details look Calculate() methods):

bool success = false; // To save calculation result

grid = grid.Calculate(); // Default calculation
// or
(grid, success) = grid.Calculate(options:new CalculationOptions() { IterationsCount = 5 });  // Calculation with options
// or
grid = grid.Calculate(uinit: grid.Ucalc).Grid; // Calculation initial voltage from previous successfull calculation (taking back Grid)
// or
grid = grid.Calculate(out success); // Calculate with result short saving 
// or
grid = grid.ApplySolver(SolverType.GaussSeidel, new CalculationOptions() { IterationsCount = 3 }) // Apply multiple solvers
           .ApplySolver(SolverType.NewtonRaphson)
           .Calculate(out success);

Basic concepts

Namespaces

Provided tools are located in several namespaces:

using PowerFlowCore;
using PowerFlowCore.Data;
using PowerFlowCore.Solvers;
using PowerFlowCore.Algebra;

Components

INode, IBranch

INode and IBranch interfaces encapsulate properties to work with internal solver. These interfaces should be inherited by custom class or struct to use in solver. Being passed to the solver are converted to the original interface.

Grid

Central term is Grid object from PowerFlowCore.Data namespace. To create Grid object collections of INode and IBranch should be explicitly given to the constructor:

public Grid(IEnumerable<INode> nodes, IEnumerable<IBranch> branches) { ... }

Another way to create Grid is to use IConverter object that encapsulated collection of INode and IBranch:

public Grid(IConverter converter) { ... }

Besides collections of nodes and branches Grid contains:

  • Admittance matrix - Y
  • Vector of nodes nominal voltages - Unominal
  • Vector of nodes initial voltages (for calculations) - Uinit
  • Vector of nodes calculated voltages - Ucalc
  • Vector of nodes power injections (=generation-load) - S
  • Collection of load models - LoadModels
  • Description:
    • Load nodes count - PQ_Count
    • Generator nodes count - PV_Count
    • Slack bus nodes count - Slack_Count

License

Published under MIT license

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.14.1 122 5/29/2024
0.14.0 251 11/5/2023
0.13.6 179 6/29/2023
0.13.5 165 6/18/2023
0.13.4 182 6/13/2023
0.13.3 163 5/29/2023
0.13.2 161 5/27/2023
0.13.1 162 5/23/2023
0.13.0 146 5/23/2023
0.12.1 194 12/15/2022

S_calc bug fix (calculated with load model). Add async parallel calculation api. Reduce memory allocation