PowerFlowCore 0.14.1
dotnet add package PowerFlowCore --version 0.14.1
NuGet\Install-Package PowerFlowCore -Version 0.14.1
<PackageReference Include="PowerFlowCore" Version="0.14.1" />
paket add PowerFlowCore --version 0.14.1
#r "nuget: PowerFlowCore, 0.14.1"
// Install PowerFlowCore as a Cake Addin #addin nuget:?package=PowerFlowCore&version=0.14.1 // Install PowerFlowCore as a Cake Tool #tool nuget:?package=PowerFlowCore&version=0.14.1
PowerFlowCore
What's new:
- 0.14.1 - Add net 8.0 support.
- 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
andGauss-Seidel
solversLoad 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), LoadModelNum = 1},
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}
};
// Add load models
var SLM = new Dictionary<int, CompositeLoadModel>()
{
[1] = CompositeLoadModel.ComplexLoadNode_110kV(),
[2] = CompositeLoadModel.ComplexLoadNode_35kV(),
[3] = CompositeLoadModel.Initialize(P: ZIP.Initialize("Parent model P", a0: 0.6, a1: 0.2, a2: 0.2),
Q: ZIP.Initialize("Parent model Q", a0: 0.6, a1: 0.2, a2: 0.2),
umin: 0.965, umax: 0.974)
.AddModel(CompositeLoadModel.Initialize
(P: ZIP.Initialize("Child - 1 model P", a0: 0.7, a1: 0.15, a2: 0.15),
Q: ZIP.Initialize("Child - 1 model Q", a0: 0.7, a1: 0.15, a2: 0.15),
umin: 0.975, umax: 0.987))
.AddModel(CompositeLoadModel.Initialize
(P: ZIP.Initialize("Child - 2 model P", a0: 0.8, a1: 0.1, a2: 0.1),
Q: ZIP.Initialize("Child - 2 model Q", a0: 0.8, a1: 0.1, a2: 0.1),
umin: 0.988, umax: 1.1))
};
var grid = new Grid(nodes, branches); // Create Grid object
grid.LoadModels = SLM; //Include load models
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 | Versions 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 is compatible. 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. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.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.
Add net 8.0 support