NICTA / SmartGridToolbox

Smart Grid Simulation Library (C++14)
http://nicta.github.io/SmartGridToolbox
24 stars 10 forks source link

Refactor for Zips and Gens #42

Open dexterurbane opened 7 years ago

dexterurbane commented 7 years ago
  1. Zips and Gens should derive from a common class, e.g. PowerFlow. (Would need to rename the existing PowerFlow.h to e.g. PowerFlowUtils.h.

  2. PowerFlow has following:

    ComponentPtr<Bus> bus0;
    ComponentPtr<Bus> bus1;
    const Phases& phases0(); // Which phases & in what order at bus0
    const Phases& phases1(); // Ditto bus1
    Mat<Complex> S() const

    0 is the source of the power flow, and 1 is the destination. The sign of (real) S designates whether power is added or removed from the network between the source and the destination; positive = power expended / load. Note that this is not a potential type function - e.g. for a real load between two buses, positive = energy being removed from the network and expended as e.g. heat, no matter whether we move from side 0 to 1 or vice versa. Thus, by convention, S can be set to an upper triangular matrix. We enforce this convention.

For loads and generations to ground, the matrix is n x 1, phase1 should be set to Phase::G and bus1 should be set to nullptr.