diff --git a/.gitignore b/.gitignore index 304aea9a..7e7605bd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .vscode/ build/ +*.DS_Store \ No newline at end of file diff --git a/ComponentLib/CMakeLists.txt b/ComponentLib/CMakeLists.txt index a97c9734..1d14a5ed 100644 --- a/ComponentLib/CMakeLists.txt +++ b/ComponentLib/CMakeLists.txt @@ -60,6 +60,7 @@ # - Cameron Rutherford #]] +add_subdirectory(PhasorDynamics) add_subdirectory(PowerFlow) add_subdirectory(PowerElectronics) diff --git a/ComponentLib/PhasorDynamics/Branch/Branch.cpp b/ComponentLib/PhasorDynamics/Branch/Branch.cpp new file mode 100644 index 00000000..b6005d40 --- /dev/null +++ b/ComponentLib/PhasorDynamics/Branch/Branch.cpp @@ -0,0 +1,224 @@ +/* + * + * Copyright (c) 2017, Lawrence Livermore National Security, LLC. + * Produced at the Lawrence Livermore National Laboratory. + * Written by Slaven Peles and Duan Nan . + * LLNL-CODE-718378. + * All rights reserved. + * + * This file is part of GridKit™. For details, see github.com/LLNL/GridKit + * Please also read the LICENSE file. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the disclaimer (as noted below) in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the LLNS/LLNL nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL + * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * Lawrence Livermore National Laboratory is operated by Lawrence Livermore + * National Security, LLC, for the U.S. Department of Energy, National + * Nuclear Security Administration under Contract DE-AC52-07NA27344. + * + * This document was prepared as an account of work sponsored by an agency + * of the United States government. Neither the United States government nor + * Lawrence Livermore National Security, LLC, nor any of their employees + * makes any warranty, expressed or implied, or assumes any legal liability + * or responsibility for the accuracy, completeness, or usefulness of any + * information, apparatus, product, or process disclosed, or represents that + * its use would not infringe privately owned rights. Reference herein to + * any specific commercial product, process, or service by trade name, + * trademark, manufacturer, or otherwise does not necessarily constitute or + * imply its endorsement, recommendation, or favoring by the United States + * government or Lawrence Livermore National Security, LLC. The views and + * opinions of authors expressed herein do not necessarily state or reflect + * those of the United States government or Lawrence Livermore National + * Security, LLC, and shall not be used for advertising or product + * endorsement purposes. + * + */ + +#include +#include +#include +#include + +#include "Branch.hpp" + +namespace ModelLib { // change to GridKit +namespace PhasorDynamics { + +/*! + * @brief Constructor for a pi-model branch + * + * Arguments passed to ModelEvaluatorImpl: + * - Number of equations = 0 + * - Number of independent variables = 0 + * - Number of quadratures = 0 + * - Number of optimization parameters = 0 + */ + +template +Branch::Branch(bus_type* bus1, bus_type* bus2) + : R_(0.0), + X_(0.01), + G_(0.0), + B_(0.0), + bus1ID_(0), + bus2ID_(0), + bus1_(bus1), + bus2_(bus2) +{ + size_ = 0; +} + +template +Branch::Branch(real_type R, + real_type X, + real_type G, + real_type B, + bus_type* bus1, + bus_type* bus2) + : R_(R), + X_(X), + G_(G), + B_(B), + bus1ID_(0), + bus2ID_(0), + bus1_(bus1), + bus2_(bus2) +{ +} + +template +Branch::Branch(bus_type* bus1, bus_type* bus2, BranchData& data) + : R_(data.r), + X_(data.x), + G_(0.0), + B_(data.b), + bus1ID_(data.fbus), + bus2ID_(data.tbus), + bus1_(bus1), + bus2_(bus2) +{ + size_ = 0; +} + + +template +Branch::~Branch() +{ + //std::cout << "Destroy Branch..." << std::endl; +} + +/*! + * @brief allocate method computes sparsity pattern of the Jacobian. + */ +template +int Branch::allocate() +{ + //std::cout << "Allocate Branch..." << std::endl; + return 0; +} + +/** + * Initialization of the branch model + * + */ +template +int Branch::initialize() +{ + return 0; +} + +/** + * \brief Identify differential variables. + */ +template +int Branch::tagDifferentiable() +{ + return 0; +} + +/** + * \brief Residual contribution of the branch is pushed to the + * two terminal buses. + * + * @todo Add and verify conductance to ground (B and G) + */ +template +int Branch::evaluateResidual() +{ + // std::cout << "Evaluating branch residual ...\n"; + real_type b = -X_/(R_*R_ + X_*X_); + real_type g = R_/(R_*R_ + X_*X_); + + Ir1() += -(g + 0.5*G_)*Vr1() + (b + 0.5*B_)*Vi1() + g*Vr2() - b*Vi2(); + Ii1() += -(b + 0.5*B_)*Vr1() - (g + 0.5*G_)*Vi1() + b*Vr2() + g*Vi2(); + Ir2() += g*Vr1() - b*Vi1() - (g + 0.5*G_)*Vr2() + (b + 0.5*B_)*Vi2(); + Ii2() += b*Vr1() + g*Vi1() - (b + 0.5*B_)*Vr2() - (g + 0.5*G_)*Vi2(); + + return 0; +} + +template +int Branch::evaluateJacobian() +{ + std::cout << "Evaluate Jacobian for Branch..." << std::endl; + std::cout << "Jacobian evaluation not implemented!" << std::endl; + return 0; +} + +template +int Branch::evaluateIntegrand() +{ + // std::cout << "Evaluate Integrand for Branch..." << std::endl; + return 0; +} + +template +int Branch::initializeAdjoint() +{ + //std::cout << "Initialize adjoint for Branch..." << std::endl; + return 0; +} + +template +int Branch::evaluateAdjointResidual() +{ + // std::cout << "Evaluate adjoint residual for Branch..." << std::endl; + return 0; +} + +template +int Branch::evaluateAdjointIntegrand() +{ + // std::cout << "Evaluate adjoint Integrand for Branch..." << std::endl; + return 0; +} + +// Available template instantiations +template class Branch; +template class Branch; + +} //namespace PhasorDynamics +} //namespace GridKit diff --git a/ComponentLib/PhasorDynamics/Branch/Branch.hpp b/ComponentLib/PhasorDynamics/Branch/Branch.hpp new file mode 100644 index 00000000..e8aa3df0 --- /dev/null +++ b/ComponentLib/PhasorDynamics/Branch/Branch.hpp @@ -0,0 +1,208 @@ +/* + * + * Copyright (c) 2017, Lawrence Livermore National Security, LLC. + * Produced at the Lawrence Livermore National Laboratory. + * Written by Slaven Peles and Duan Nan . + * LLNL-CODE-718378. + * All rights reserved. + * + * This file is part of GridKit™. For details, see github.com/LLNL/GridKit + * Please also read the LICENSE file. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the disclaimer (as noted below) in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the LLNS/LLNL nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL + * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * Lawrence Livermore National Laboratory is operated by Lawrence Livermore + * National Security, LLC, for the U.S. Department of Energy, National + * Nuclear Security Administration under Contract DE-AC52-07NA27344. + * + * This document was prepared as an account of work sponsored by an agency + * of the United States government. Neither the United States government nor + * Lawrence Livermore National Security, LLC, nor any of their employees + * makes any warranty, expressed or implied, or assumes any legal liability + * or responsibility for the accuracy, completeness, or usefulness of any + * information, apparatus, product, or process disclosed, or represents that + * its use would not infringe privately owned rights. Reference herein to + * any specific commercial product, process, or service by trade name, + * trademark, manufacturer, or otherwise does not necessarily constitute or + * imply its endorsement, recommendation, or favoring by the United States + * government or Lawrence Livermore National Security, LLC. The views and + * opinions of authors expressed herein do not necessarily state or reflect + * those of the United States government or Lawrence Livermore National + * Security, LLC, and shall not be used for advertising or product + * endorsement purposes. + * + */ + +#pragma once + +#include + +// Forward declarations. +namespace GridKit +{ +namespace PowerSystemData +{ + template struct BranchData; +} +} + +namespace ModelLib +{ +namespace PhasorDynamics +{ + template class Bus; +} +} + +namespace ModelLib +{ +namespace PhasorDynamics +{ + /*! + * @brief Implementation of a pi-model branch between two buses. + * + */ + template + class Branch : public ModelEvaluatorImpl + { + using ModelEvaluatorImpl::size_; + using ModelEvaluatorImpl::nnz_; + using ModelEvaluatorImpl::time_; + using ModelEvaluatorImpl::alpha_; + using ModelEvaluatorImpl::y_; + using ModelEvaluatorImpl::yp_; + using ModelEvaluatorImpl::tag_; + using ModelEvaluatorImpl::f_; + using ModelEvaluatorImpl::g_; + using ModelEvaluatorImpl::yB_; + using ModelEvaluatorImpl::ypB_; + using ModelEvaluatorImpl::fB_; + using ModelEvaluatorImpl::gB_; + using ModelEvaluatorImpl::param_; + + using bus_type = Bus; + using real_type = typename ModelEvaluatorImpl::real_type; + using BranchData = GridKit::PowerSystemData::BranchData; + + public: + Branch(bus_type* bus1, bus_type* bus2); + Branch(real_type R, real_type X, real_type G, real_type B, bus_type* bus1, bus_type* bus2); + Branch(bus_type* bus1, bus_type* bus2, BranchData& data); + virtual ~Branch(); + + int allocate(); + int initialize(); + int tagDifferentiable(); + int evaluateResidual(); + int evaluateJacobian(); + int evaluateIntegrand(); + + int initializeAdjoint(); + int evaluateAdjointResidual(); + //int evaluateAdjointJacobian(); + int evaluateAdjointIntegrand(); + + void updateTime(real_type t, real_type a) + { + } + + public: + void setR(real_type R) + { + R_ = R; + } + + void setX(real_type X) + { + // std::cout << "Setting X ...\n"; + X_ = X; + } + + void setG(real_type G) + { + G_ = G; + } + + void setB(real_type B) + { + B_ = B; + } + + private: + ScalarT& Vr1() + { + return bus1_->Vr(); + } + + ScalarT& Vi1() + { + return bus1_->Vi(); + } + + ScalarT& Ir1() + { + return bus1_->Ir(); + } + + ScalarT& Ii1() + { + return bus1_->Ii(); + } + + ScalarT& Vr2() + { + return bus2_->Vr(); + } + + ScalarT& Vi2() + { + return bus2_->Vi(); + } + + ScalarT& Ir2() + { + return bus2_->Ir(); + } + + ScalarT& Ii2() + { + return bus2_->Ii(); + } + + private: + real_type R_; + real_type X_; + real_type G_; + real_type B_; + const IdxT bus1ID_; + const IdxT bus2ID_; + bus_type* bus1_; + bus_type* bus2_; + }; + +} // namespace PhasorDynamics +} // namespace GridKit diff --git a/ComponentLib/PhasorDynamics/Branch/CMakeLists.txt b/ComponentLib/PhasorDynamics/Branch/CMakeLists.txt new file mode 100644 index 00000000..ba05a10a --- /dev/null +++ b/ComponentLib/PhasorDynamics/Branch/CMakeLists.txt @@ -0,0 +1,68 @@ +# +# Copyright (c) 2017, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# Written by Slaven Peles . +# LLNL-CODE-718378. +# All rights reserved. +# +# This file is part of GridKit™. For details, see github.com/LLNL/GridKit +# Please also read the LICENSE file. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# - Redistributions of source code must retain the above copyright notice, +# this list of conditions and the disclaimer below. +# - Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the disclaimer (as noted below) in the +# documentation and/or other materials provided with the distribution. +# - Neither the name of the LLNS/LLNL nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL +# SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY +# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. +# +# Lawrence Livermore National Laboratory is operated by Lawrence Livermore +# National Security, LLC, for the U.S. Department of Energy, National +# Nuclear Security Administration under Contract DE-AC52-07NA27344. +# +# This document was prepared as an account of work sponsored by an agency +# of the United States government. Neither the United States government nor +# Lawrence Livermore National Security, LLC, nor any of their employees +# makes any warranty, expressed or implied, or assumes any legal liability +# or responsibility for the accuracy, completeness, or usefulness of any +# information, apparatus, product, or process disclosed, or represents that +# its use would not infringe privately owned rights. Reference herein to +# any specific commercial product, process, or service by trade name, +# trademark, manufacturer, or otherwise does not necessarily constitute or +# imply its endorsement, recommendation, or favoring by the United States +# government or Lawrence Livermore National Security, LLC. The views and +# opinions of authors expressed herein do not necessarily state or reflect +# those of the United States government or Lawrence Livermore National +# Security, LLC, and shall not be used for advertising or product +# endorsement purposes. +# + +# [[ +# Author(s): +# - Cameron Rutherford +# ]] + +gridkit_add_library(phasor_dynamics_branch + SOURCES + Branch.cpp + OUTPUT_NAME + gridkit_phasor_dynamics_branch) + diff --git a/ComponentLib/PhasorDynamics/Branch/README.md b/ComponentLib/PhasorDynamics/Branch/README.md new file mode 100644 index 00000000..364bb6a9 --- /dev/null +++ b/ComponentLib/PhasorDynamics/Branch/README.md @@ -0,0 +1,120 @@ +# Branch Model + +Transmission lines and different types of transformers (traditional, Load +Tap-Changing transformers (LTC) and Phase Angle Regulators (PARs)) can be +modeled with a common branch model. + +## Transmission Line Model + +The most common circuit that is used to represent the transmission line model +is $`\pi`$ circuit as shown in Figure 1. The positive flow direction is into +buses. Commonly used convention is to define positive direction to be from +sending to receiving bus. We decide to use this symmetric convention because it +provides more flexibility for modeling. + +
+ + + Figure 1: Transmission line $`\pi`$ equivalent circuit +
+ +Here +``` math +Z = R + jX +``` +and +``` math +Y = G + jB, +``` +where $`R`$ is line series resistance, $`X`$ is line series reactance, $`B`$ is +line shunt charging, and $`G`$ is line shunt conductance. As can be seen from +Figure 1 total $`B`$ and $`G`$ are separated between two buses. The current +entering bus 1 can be obtained from Kirchhoff's current law as +```math +I_1 = y(V_2 - V_1) - \frac{Y}{2} V_1, +``` +where $`V_1`$ and $`V_2`$ are respective bus voltages and +```math +y = \frac{1}{Z} = \frac{R}{R^2+X^2} + j\frac{-X}{R^2+X^2} = g + jb. +``` +Similarly, current entering bus 2 is given as +```math +I_2 = y(V_1 - V_2) + \frac{Y}{2} V_2. +``` +These equations can be written in a compact form as: +```math +\begin{bmatrix} +I_{1}\\ +I_{2} +\end{bmatrix} += \mathbf{Y} +\begin{bmatrix} +V_{1}\\ +V_{2} +\end{bmatrix} +``` +where: +```math +\mathbf{Y}_{TL}=\begin{bmatrix} +-(g + jb) - \dfrac{G+jB}{2} & g + jb \\ + g + jb & -(g + jb) - \dfrac{G+jB}{2} +\end{bmatrix} +``` + +### Branch contributions to residuals at adjacent buses + +After some algebra, one obtains expressions for real and imaginary components +for the currents entering adjacent buses: +```math +I_{r1} = -\left(g + \frac{G}{2}\right) V_{r1} + \left(b + \frac{B}{2} \right) V_{i1} + + g V_{r2} - b V_{i2} +``` + +```math +I_{i1} = -\left(b + \frac{B}{2} \right) V_{r1} - \left(g + \frac{G}{2}\right) V_{i1} + + b V_{r2} + g V_{i2} +``` + +```math +I_{r2} = g V_{r1} - b V_{i1} + - \left(g + \frac{G}{2}\right) V_{r2} + \left(b + \frac{B}{2} \right) V_{i2} +``` + +```math +I_{i1} = b V_{r1} + g V_{i1} + - \left(b + \frac{B}{2} \right) V_{r2} - \left(g + \frac{G}{2}\right) V_{i2} +``` + + +## Transformer Branch Model + +**Note: Transformer model not yet implemented** + +The branch model can be created by adding the ideal transformer in series with +the $`\pi`$ circuit as shown in Figure 2 where $`\tau`$ is a tap ratio +magnitude and $`\theta`$ is the phase shift angle and +$`N = \tau e^{j \theta}`$. + +
+ + + + Figure 2: Branch equivalent circuit +
+ + +The branch admitance matrix is then: + +```math +\mathbf{Y}_{BR}= +\begin{bmatrix} + -\left(g + jb + \dfrac{G+jB}{2} \right) \dfrac{1}{\tau^2} & (g + jb)\dfrac{1}{\tau e^{-j\theta}}\\ + & \\ + (g + jb)\dfrac{1}{\tau e^{j\theta}} & -\left(g + jb + \dfrac{G+jB}{2}\right) +\end{bmatrix} +``` + +### Branch contribution to residuals at adjacent busses + +The currents entering adjacent buses are obtained in a similar manner as for +the $`\pi`$-model. diff --git a/ComponentLib/PhasorDynamics/Bus/Bus.cpp b/ComponentLib/PhasorDynamics/Bus/Bus.cpp new file mode 100644 index 00000000..e7e4e14c --- /dev/null +++ b/ComponentLib/PhasorDynamics/Bus/Bus.cpp @@ -0,0 +1,227 @@ +/* + * + * Copyright (c) 2017, Lawrence Livermore National Security, LLC. + * Produced at the Lawrence Livermore National Laboratory. + * Written by Slaven Peles . + * LLNL-CODE-718378. + * All rights reserved. + * + * This file is part of GridKit™. For details, see github.com/LLNL/GridKit + * Please also read the LICENSE file. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the disclaimer (as noted below) in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the LLNS/LLNL nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL + * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * Lawrence Livermore National Laboratory is operated by Lawrence Livermore + * National Security, LLC, for the U.S. Department of Energy, National + * Nuclear Security Administration under Contract DE-AC52-07NA27344. + * + * This document was prepared as an account of work sponsored by an agency + * of the United States government. Neither the United States government nor + * Lawrence Livermore National Security, LLC, nor any of their employees + * makes any warranty, expressed or implied, or assumes any legal liability + * or responsibility for the accuracy, completeness, or usefulness of any + * information, apparatus, product, or process disclosed, or represents that + * its use would not infringe privately owned rights. Reference herein to + * any specific commercial product, process, or service by trade name, + * trademark, manufacturer, or otherwise does not necessarily constitute or + * imply its endorsement, recommendation, or favoring by the United States + * government or Lawrence Livermore National Security, LLC. The views and + * opinions of authors expressed herein do not necessarily state or reflect + * those of the United States government or Lawrence Livermore National + * Security, LLC, and shall not be used for advertising or product + * endorsement purposes. + * + */ + +#include +#include + +#include +#include "Bus.hpp" + +namespace ModelLib // change to GridKit +{ +namespace PhasorDynamics +{ + +/*! + * @brief Constructor for a phasor dynamics bus. + * + * The model is using current balance in Cartesian coordinates. + * + * @todo Arguments that should be passed to ModelEvaluatorImpl constructor: + * - Number of equations = 2 (size_) + * - Number of variables = 2 (size_) + * - Number of quadratures = 0 + * - Number of optimization parameters = 0 + */ +template +Bus::Bus() + : Vr0_(0.0), Vi0_(0.0) +{ + //std::cout << "Create Bus..." << std::endl; + //std::cout << "Number of equations is " << size_ << std::endl; + + size_ = 2; +} + +/*! + * @brief Bus constructor. + * + * This constructor sets initial values for active and reactive voltage. + * + * @todo Arguments that should be passed to ModelEvaluatorImpl constructor: + * - Number of equations = 2 (size_) + * - Number of variables = 2 (size_) + * - Number of quadratures = 0 + * - Number of optimization parameters = 0 + */ +template +Bus::Bus(ScalarT Vr, ScalarT Vi) + : Vr0_(Vr), Vi0_(Vi) +{ + //std::cout << "Create Bus..." << std::endl; + //std::cout << "Number of equations is " << size_ << std::endl; + + size_ = 2; +} + +/** + * @brief Construct a new Bus + * + * @tparam ScalarT - type of scalar variables + * @tparam IdxT - type for vector/matrix indices + * @param[in] data - structure with bus data + */ +template +Bus::Bus(BusData& data) + : Vr0_(data.Vm * cos(data.Va)), Vi0_(data.Vm * sin(data.Va)) +{ + //std::cout << "Create Bus..." << std::endl; + //std::cout << "Number of equations is " << size_ << std::endl; + + size_ = 2; +} + +template +Bus::~Bus() +{ + //std::cout << "Destroy PQ bus ..." << std::endl; +} + +/*! + * @brief allocate method resizes local solution and residual vectors. + */ +template +int Bus::allocate() +{ + //std::cout << "Allocate PQ bus ..." << std::endl; + f_.resize(size_); + y_.resize(size_); + yp_.resize(size_); + tag_.resize(size_); + + fB_.resize(size_); + yB_.resize(size_); + ypB_.resize(size_); + + return 0; +} + + +template +int Bus::tagDifferentiable() +{ + tag_[0] = false; + tag_[1] = false; + return 0; +} + + +/*! + * @brief initialize method sets bus variables to stored initial values. + */ +template +int Bus::initialize() +{ + // std::cout << "Initialize Bus..." << std::endl; + y_[0] = Vr0_; + y_[1] = Vi0_; + yp_[0] = 0.0; + yp_[1] = 0.0; + + return 0; +} + +/*! + * @brief PQ bus does not compute residuals, so here we just reset residual values. + * + * @warning This implementation assumes bus residuals are always evaluated + * _before_ component model residuals. + * + */ +template +int Bus::evaluateResidual() +{ + // std::cout << "Evaluating residual of a PQ bus ...\n"; + f_[0] = 0.0; + f_[1] = 0.0; + return 0; +} + + +/*! + * @brief initialize method sets bus variables to stored initial values. + */ +template +int Bus::initializeAdjoint() +{ + // std::cout << "Initialize Bus..." << std::endl; + yB_[0] = 0.0; + yB_[1] = 0.0; + ypB_[0] = 0.0; + ypB_[1] = 0.0; + + return 0; +} + +template +int Bus::evaluateAdjointResidual() +{ + fB_[0] = 0.0; + fB_[1] = 0.0; + + return 0; +} + +// Available template instantiations +template class Bus; +template class Bus; + +} // namespace PhasorDynamic +} // namespace ModelLib + diff --git a/ComponentLib/PhasorDynamics/Bus/Bus.hpp b/ComponentLib/PhasorDynamics/Bus/Bus.hpp new file mode 100644 index 00000000..f3a9e5cd --- /dev/null +++ b/ComponentLib/PhasorDynamics/Bus/Bus.hpp @@ -0,0 +1,208 @@ +/* + * + * Copyright (c) 2017, Lawrence Livermore National Security, LLC. + * Produced at the Lawrence Livermore National Laboratory. + * Written by Slaven Peles . + * LLNL-CODE-718378. + * All rights reserved. + * + * This file is part of GridKit™. For details, see github.com/LLNL/GridKit + * Please also read the LICENSE file. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the disclaimer (as noted below) in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of the LLNS/LLNL nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL + * SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * Lawrence Livermore National Laboratory is operated by Lawrence Livermore + * National Security, LLC, for the U.S. Department of Energy, National + * Nuclear Security Administration under Contract DE-AC52-07NA27344. + * + * This document was prepared as an account of work sponsored by an agency + * of the United States government. Neither the United States government nor + * Lawrence Livermore National Security, LLC, nor any of their employees + * makes any warranty, expressed or implied, or assumes any legal liability + * or responsibility for the accuracy, completeness, or usefulness of any + * information, apparatus, product, or process disclosed, or represents that + * its use would not infringe privately owned rights. Reference herein to + * any specific commercial product, process, or service by trade name, + * trademark, manufacturer, or otherwise does not necessarily constitute or + * imply its endorsement, recommendation, or favoring by the United States + * government or Lawrence Livermore National Security, LLC. The views and + * opinions of authors expressed herein do not necessarily state or reflect + * those of the United States government or Lawrence Livermore National + * Security, LLC, and shall not be used for advertising or product + * endorsement purposes. + * + */ + +#pragma once + +#include + + +// Forward declaration of BusData structure +namespace GridKit +{ +namespace PowerSystemData +{ + template + struct BusData; +} +} + +namespace ModelLib // change to GridKit +{ +namespace PhasorDynamics +{ + /*! + * @brief Implementation of a PQ bus. + * + * Voltage _V_ and phase _theta_ are variables in PQ bus model. + * Active and reactive power, _P_ and _Q_, are residual components. + * + * + */ + template + class Bus : public ModelEvaluatorImpl + { + using ModelEvaluatorImpl::size_; + using ModelEvaluatorImpl::y_; + using ModelEvaluatorImpl::yp_; + using ModelEvaluatorImpl::yB_; + using ModelEvaluatorImpl::ypB_; + using ModelEvaluatorImpl::f_; + using ModelEvaluatorImpl::fB_; + using ModelEvaluatorImpl::tag_; + + public: + using real_type = typename ModelEvaluatorImpl::real_type; + using BusData = GridKit::PowerSystemData::BusData; + + Bus(); + Bus(ScalarT Vr, ScalarT Vi); + Bus(BusData& data); + virtual ~Bus(); + + virtual int allocate(); + virtual int tagDifferentiable(); + virtual int initialize(); + virtual int evaluateResidual(); + virtual int initializeAdjoint(); + virtual int evaluateAdjointResidual(); + + virtual ScalarT& Vr() + { + return y_[0]; + } + + virtual const ScalarT& Vr() const + { + return y_[0]; + } + + virtual ScalarT& Vi() + { + return y_[1]; + } + + virtual const ScalarT& Vi() const + { + return y_[1]; + } + + virtual ScalarT& Ir() + { + return f_[0]; + } + + virtual const ScalarT& Ir() const + { + return f_[0]; + } + + virtual ScalarT& Ii() + { + return f_[1]; + } + + virtual const ScalarT& Ii() const + { + return f_[1]; + } + + virtual ScalarT& lambdaIr() + { + return yB_[0]; + } + + virtual const ScalarT& lambdaIr() const + { + return yB_[0]; + } + + virtual ScalarT& lambdaIi() + { + return yB_[1]; + } + + virtual const ScalarT& lambdaIi() const + { + return yB_[1]; + } + + virtual ScalarT& IrB() + { + return fB_[0]; + } + + virtual const ScalarT& IrB() const + { + return fB_[0]; + } + + virtual ScalarT& IiB() + { + return fB_[1]; + } + + virtual const ScalarT& IiB() const + { + return fB_[1]; + } + + // virtual const int BusType() const + // { + // return BaseBus::BusType::PQ; + // } + + private: + // Default initial values for voltage and phase on PQ bus + ScalarT Vr0_{0.0}; + ScalarT Vi0_{0.0}; + + }; + +} // PhasorDynamics +} // namespace GridKit diff --git a/ComponentLib/PhasorDynamics/Bus/CMakeLists.txt b/ComponentLib/PhasorDynamics/Bus/CMakeLists.txt new file mode 100644 index 00000000..356b7f51 --- /dev/null +++ b/ComponentLib/PhasorDynamics/Bus/CMakeLists.txt @@ -0,0 +1,68 @@ +# +# Copyright (c) 2017, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# Written by Slaven Peles . +# LLNL-CODE-718378. +# All rights reserved. +# +# This file is part of GridKit™. For details, see github.com/LLNL/GridKit +# Please also read the LICENSE file. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# - Redistributions of source code must retain the above copyright notice, +# this list of conditions and the disclaimer below. +# - Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the disclaimer (as noted below) in the +# documentation and/or other materials provided with the distribution. +# - Neither the name of the LLNS/LLNL nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL +# SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY +# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. +# +# Lawrence Livermore National Laboratory is operated by Lawrence Livermore +# National Security, LLC, for the U.S. Department of Energy, National +# Nuclear Security Administration under Contract DE-AC52-07NA27344. +# +# This document was prepared as an account of work sponsored by an agency +# of the United States government. Neither the United States government nor +# Lawrence Livermore National Security, LLC, nor any of their employees +# makes any warranty, expressed or implied, or assumes any legal liability +# or responsibility for the accuracy, completeness, or usefulness of any +# information, apparatus, product, or process disclosed, or represents that +# its use would not infringe privately owned rights. Reference herein to +# any specific commercial product, process, or service by trade name, +# trademark, manufacturer, or otherwise does not necessarily constitute or +# imply its endorsement, recommendation, or favoring by the United States +# government or Lawrence Livermore National Security, LLC. The views and +# opinions of authors expressed herein do not necessarily state or reflect +# those of the United States government or Lawrence Livermore National +# Security, LLC, and shall not be used for advertising or product +# endorsement purposes. +# + +# [[ +# Author(s): +# - Cameron Rutherford +#]] + +gridkit_add_library(phasor_dynamics_bus + SOURCES + Bus.cpp + OUTPUT_NAME + gridkit_phasor_dynamics_bus) + diff --git a/ComponentLib/PhasorDynamics/Bus/README.md b/ComponentLib/PhasorDynamics/Bus/README.md new file mode 100644 index 00000000..4a9df7d2 --- /dev/null +++ b/ComponentLib/PhasorDynamics/Bus/README.md @@ -0,0 +1,30 @@ +# Bus Model + +A bus is a point of interconnection of electrical devices. Bus component model +also plays a key role in coupling system components. Each bus $`k`$ owns two +variables -- real and imaginary voltage $`V_{rk}`$ and $`V_{ik}`$, +respectively. The bus also owns current balance residual equations for real +and imaginary currents coming into the bus $`I_{rk}`$ and $`I_{ik}`$, +respectively. While th bus model owns current residuals, it _does not compute_ +them. Instead, each component connected to the bus is adding its contribution +to the residual. The bus will merely initialize the residual to zero each time +numerical integrator requests residual evaluation. + +**Sign Convention** + +Current entering the bus has positive and current exiting the bus negative +sign. + +
+ + + Figure 1: Needs to be changed to represent current balance instead of power + balance. +
+ + + + +**Other Parameters** +Buses are uniquely defined by their ID (number or name). Besides, each bus +should have associated Nominal Voltage value. \ No newline at end of file diff --git a/ComponentLib/PhasorDynamics/CMakeLists.txt b/ComponentLib/PhasorDynamics/CMakeLists.txt new file mode 100644 index 00000000..d8823310 --- /dev/null +++ b/ComponentLib/PhasorDynamics/CMakeLists.txt @@ -0,0 +1,64 @@ +# +# Copyright (c) 2017, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# Written by Slaven Peles . +# LLNL-CODE-718378. +# All rights reserved. +# +# This file is part of GridKit™. For details, see github.com/LLNL/GridKit +# Please also read the LICENSE file. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# - Redistributions of source code must retain the above copyright notice, +# this list of conditions and the disclaimer below. +# - Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the disclaimer (as noted below) in the +# documentation and/or other materials provided with the distribution. +# - Neither the name of the LLNS/LLNL nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL +# SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY +# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. +# +# Lawrence Livermore National Laboratory is operated by Lawrence Livermore +# National Security, LLC, for the U.S. Department of Energy, National +# Nuclear Security Administration under Contract DE-AC52-07NA27344. +# +# This document was prepared as an account of work sponsored by an agency +# of the United States government. Neither the United States government nor +# Lawrence Livermore National Security, LLC, nor any of their employees +# makes any warranty, expressed or implied, or assumes any legal liability +# or responsibility for the accuracy, completeness, or usefulness of any +# information, apparatus, product, or process disclosed, or represents that +# its use would not infringe privately owned rights. Reference herein to +# any specific commercial product, process, or service by trade name, +# trademark, manufacturer, or otherwise does not necessarily constitute or +# imply its endorsement, recommendation, or favoring by the United States +# government or Lawrence Livermore National Security, LLC. The views and +# opinions of authors expressed herein do not necessarily state or reflect +# those of the United States government or Lawrence Livermore National +# Security, LLC, and shall not be used for advertising or product +# endorsement purposes. +# + +# [[ +# Author(s): +# - Cameron Rutherford +#]] + +add_subdirectory(Branch) +add_subdirectory(Bus) diff --git a/ComponentLib/DynamicPhasor/Exciter/README.md b/ComponentLib/PhasorDynamics/Exciter/README.md similarity index 97% rename from ComponentLib/DynamicPhasor/Exciter/README.md rename to ComponentLib/PhasorDynamics/Exciter/README.md index e32003df..de04b75f 100644 --- a/ComponentLib/DynamicPhasor/Exciter/README.md +++ b/ComponentLib/PhasorDynamics/Exciter/README.md @@ -4,7 +4,7 @@ **Note: Exciter model not yet implemented**
- + Figure 1: Exciter EXDC1 model. Fifure courtesy of [PoweWorld](https://www.powerworld.com/WebHelp/). diff --git a/ComponentLib/DynamicPhasor/Governor/README.md b/ComponentLib/PhasorDynamics/Governor/README.md similarity index 95% rename from ComponentLib/DynamicPhasor/Governor/README.md rename to ComponentLib/PhasorDynamics/Governor/README.md index be6be49c..0447ca41 100644 --- a/ComponentLib/DynamicPhasor/Governor/README.md +++ b/ComponentLib/PhasorDynamics/Governor/README.md @@ -8,7 +8,7 @@ Standard model of the stream turbine
- + Figure 1: Governor TGOV1 model. Figure courtesy of [PowerWorld](https://www.powerworld.com/WebHelp/) diff --git a/ComponentLib/DynamicPhasor/Stabilizer/README.md b/ComponentLib/PhasorDynamics/Stabilizer/README.md similarity index 96% rename from ComponentLib/DynamicPhasor/Stabilizer/README.md rename to ComponentLib/PhasorDynamics/Stabilizer/README.md index 722741dd..39c50843 100644 --- a/ComponentLib/DynamicPhasor/Stabilizer/README.md +++ b/ComponentLib/PhasorDynamics/Stabilizer/README.md @@ -4,7 +4,7 @@
- + Figure 1: Power system stabilizer PSS1A model. Figure courtesy of [PowerWorld](https://www.powerworld.com/WebHelp/) diff --git a/ComponentLib/DynamicPhasor/SynchronousMachine/GENROUwS/README.md b/ComponentLib/PhasorDynamics/SynchronousMachine/GENROUwS/README.md similarity index 97% rename from ComponentLib/DynamicPhasor/SynchronousMachine/GENROUwS/README.md rename to ComponentLib/PhasorDynamics/SynchronousMachine/GENROUwS/README.md index ea9a20da..b24b5a25 100644 --- a/ComponentLib/DynamicPhasor/SynchronousMachine/GENROUwS/README.md +++ b/ComponentLib/PhasorDynamics/SynchronousMachine/GENROUwS/README.md @@ -6,7 +6,7 @@ - same relative amount of saturation occurs on both $`d`$ and $`q`$ axis
- + Figure 2: GENROU. Figure courtesy of [PowerWorld](https://www.powerworld.com/WebHelp/) diff --git a/ComponentLib/DynamicPhasor/SynchronousMachine/GENSALwS/README.md b/ComponentLib/PhasorDynamics/SynchronousMachine/GENSALwS/README.md similarity index 95% rename from ComponentLib/DynamicPhasor/SynchronousMachine/GENSALwS/README.md rename to ComponentLib/PhasorDynamics/SynchronousMachine/GENSALwS/README.md index 9c5b8978..159377de 100644 --- a/ComponentLib/DynamicPhasor/SynchronousMachine/GENSALwS/README.md +++ b/ComponentLib/PhasorDynamics/SynchronousMachine/GENSALwS/README.md @@ -8,7 +8,7 @@ - $`T'_{q0}`$ is neglected
- + Figure 2: GENSAL. Figure courtesy of [PowerWorld](https://www.powerworld.com/WebHelp/) diff --git a/ComponentLib/DynamicPhasor/SynchronousMachine/README.md b/ComponentLib/PhasorDynamics/SynchronousMachine/README.md similarity index 95% rename from ComponentLib/DynamicPhasor/SynchronousMachine/README.md rename to ComponentLib/PhasorDynamics/SynchronousMachine/README.md index 66c5ccb0..037e6303 100644 --- a/ComponentLib/DynamicPhasor/SynchronousMachine/README.md +++ b/ComponentLib/PhasorDynamics/SynchronousMachine/README.md @@ -9,7 +9,7 @@
- + Figure 1: Synchronous Machine. Figure courtesy of [PowerWorld](https://www.powerworld.com/files/Synchronous-Machines.pdf) @@ -107,7 +107,7 @@ T'_{q0}\dfrac{dE'_{d}}{dt}= -E'_{d}+(X_{q}-X'_{q})(I_{q}-\dfrac{X'_{q}-X''_{q}}{ ``` Previos equations can be used to model any machine, however ***SATURATION*** is missing. -Saturation means increasingly large amounts of current are needed to increase the flux density. There are various methods to include the saturation (it is not standardized yet). We are going to use the approach implemented in PTI PSSS/E and PowerWorld Simulator (scaled quadratic). +Saturation means increasingly large amounts of current are needed to increase the flux density. There are various methods to include the saturation (it is not standardized yet). We are going to use the approach implemented in PTI PSS/E and PowerWorld Simulator (scaled quadratic). ```math Sat(x) = \begin{cases} @@ -117,6 +117,6 @@ Sat(x) = \begin{cases} ``` There are two solutions, and one where $`A<1`$ should be chosen. -Hint! +#### Hint Negative values are not allowed. diff --git a/ComponentLib/PowerFlow/Branch/README.md b/ComponentLib/PowerFlow/Branch/README.md index ecfc61a3..ed8724ba 100644 --- a/ComponentLib/PowerFlow/Branch/README.md +++ b/ComponentLib/PowerFlow/Branch/README.md @@ -7,7 +7,7 @@ Transmission lines and different types of transformers (traditional, Load Tap-Ch The most common circuit that is used to represent the transmission line model is $`\pi`$ circuit as shown in Figure 1. The nominal flow direction is from sending bus _s_ to receiving bus _r_.
- + Figure 1: Transmission line $`\pi`$ equivalent circuit @@ -108,7 +108,7 @@ These quantities are treated as _loads_ and are substracted from $`P`$ and $`Q`$ The branch model can be created by adding the ideal transformer in series with the $`\pi`$ circuit as shown in Figure 2 where $`\tau`$ is a tap ratio magnitude and $`\theta_{shift}`$is the phase shift angle.
- + Figure 2: Branch equivalent circuit diff --git a/ComponentLib/PowerFlow/Bus/README.md b/ComponentLib/PowerFlow/Bus/README.md index 0e48e518..9daf786c 100644 --- a/ComponentLib/PowerFlow/Bus/README.md +++ b/ComponentLib/PowerFlow/Bus/README.md @@ -28,7 +28,7 @@ There exist two:
- + Figure 1: Sign convention for the power flow at the bus $`i`$ diff --git a/Documentation/Figures/branch_phasor_dynamics.png b/Documentation/Figures/branch_phasor_dynamics.png new file mode 100644 index 00000000..2d13c9ab Binary files /dev/null and b/Documentation/Figures/branch_phasor_dynamics.png differ diff --git a/Documentation/Figures/transformer-branch.png b/Documentation/Figures/transformer-branch.png new file mode 100644 index 00000000..084cf0ab Binary files /dev/null and b/Documentation/Figures/transformer-branch.png differ