Coder Social home page Coder Social logo

distflow's Introduction

Lossy DistFlow

This codebase implements the DistFlow Equations in both single and multiphase with a loss parameterization.

Single Phase Basic Use

The main function is distflow_lossy which takes a MATPOWER case and possible options structure as input. To run the lossless DistFlow simply use:

[v, pf, qf] = distflow_lossy(mpc);

Paramerization options are available via the opt function. For example,

opt = struct('alpha_method', 7, 'alpha', [0.483, 0.499]);
[v, pf, qf] = distflow_lossy(mpc, opt);

Multiphase Basic Use

The main function is distflow_multi, which takes structure arrays bus and branch as arguments as well as a possible opt structure. Description of the data format is available in the functions. To run DistFlow using the lossless approximation simply use:

[rbus, rbranch] = distflow_multi(bus, branch);

Parametrization options are available via the opt structure. For example,

opt = struct('alpha_method', 11, 'alpha', [0.492, 0.501]);
[rbus, rbranch] = distflow_multi(bus, branch, opt);

Some example data structures are available:

  • IEEE_13.mat
  • IEEE_34.mat
  • IEEE_37.mat
  • IEEE_123.mat

Multiphase Matrices For Multiple Solutions

It is also possible to export the system matrices from the disflow_lossy function. With the help of the getsigma function, multiple loadflows for various loading scenarios can be calculated with less redundancy. To do this, the mats_gen field of the options structure needs to be set to 1 (opt.mats_gen=1), and 6 output arguments specified. As an example:

opt = struct('alpha_method', 12, 'alpha', [0.498, 0.5], 'mats_gen', 1);
[Beta, K, zeta, eta, v0, conn] = distflow_multi(bus, branch,opt);

The constant power load vector can be generated as:

sigma = getsigma(bus);

And the voltage solution is:

nu = (Beta*conn.M - K)\(Beta*conn.M*v0 + zeta*sigma + eta*conj(sigma));
v  = sqrt(real(conn.U*nu));

A Few Notes On This Usage

  • The matrix Beta*conn.M - K can be factored in advance, in which case for new sigma vectors, this becomes a simple matrix multiplication. As an example:
[L,U] = lu(Beta*conn.M - K);
Linv = inv(L); %alternatively Linv = L\speye(size(L,1));
Uinv = inv(U); %alternatively Uinv = U\speye(size(U,1));
nu = Uinv*Linv*(Beta*conn.M*v0 + zeta*sigma + eta*conj(sigma));

Depending on the size of the matrices and sparsity patterns this version may be faster, or the original one with the backslash operator.

  • This method should generally be used with opt.alpha_method=12 or opt.alpha_method=1 as in both cases load is not included in the other matrices. Otherwise, much of the benefit is lost.
  • If any constant impedance loads change, the K matrix is impacted. If this happens very frequenly, again some of the benefits may be lost. For occasional changes however, the updateKmat function is available, which profides the new matrix by calling K = updateKmat(bus, branch, conn)
  • If for whatever reason the reference voltage changes, the v0 vector can be recreated using the function v0 = v0update(bus, branch)

distflow's People

Contributors

eranschweitzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

distflow's Issues

Distflow_lossy what is alpha method

Dear Eran,
I have a question about your distflow_lossy method. Does this powerflow method takes into account the quadratic loss term in voltage. Also, can you explain what is alpha method and how to choose alpha?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.