Commit 3e2482b7 authored by Markus Mirz's avatar Markus Mirz
Browse files

add vsi model and examples

parent 88c68f63
/**
* @file
* @author Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
/**
*
* @file
* @author Jan Dinkelbach <jdinkelbach@eonerc.rwth-aachen.de>
* Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
......@@ -45,6 +45,7 @@
#include <cps/SP/SP_Ph3_Resistor.h>
#include <cps/SP/SP_Ph3_VoltageSource.h>
#include <cps/SP/SP_Ph3_ControlledVoltageSource.h>
#include <cps/SP/SP_Ph3_Transformer.h>
#include <cps/DP/DP_Ph1_Capacitor.h>
#include <cps/DP/DP_Ph1_CurrentSource.h>
......@@ -71,6 +72,7 @@
#include <cps/DP/DP_Ph3_Inductor.h>
#include <cps/DP/DP_Ph3_VoltageSource.h>
#include <cps/DP/DP_Ph3_SeriesResistor.h>
#include <cps/DP/DP_Ph3_Resistor.h>
#include <cps/DP/DP_Ph3_SeriesSwitch.h>
#include <cps/DP/DP_Ph3_SynchronGeneratorDQTrapez.h>
#ifdef WITH_SUNDIALS
......
/**
* @file
* @Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
/**
* @file
* @author Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
/**
* @file
* @author Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
/**
* @file
* @Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......@@ -24,7 +22,7 @@
#include <cps/PowerComponent.h>
#include <cps/Solver/MNAInterface.h>
#include <cps/Definitions.h>
#include <cps/DP/DP_Ph3_SeriesResistor.h>
#include <cps/DP/DP_Ph3_Resistor.h>
#include <cps/DP/DP_Ph3_Inductor.h>
#include <cps/DP/DP_Ph3_Capacitor.h>
#include <cps/DP/DP_Ph3_ControlledVoltageSource.h>
......@@ -51,7 +49,7 @@ namespace CPS {
/// Inner voltage source that represents the AvVoltageSourceInverterDQ
std::shared_ptr<ControlledVoltageSource> mSubCtrledVoltageSource;
/// get "measurements" from other components
std::shared_ptr<SeriesResistor> mSubResistorF;
std::shared_ptr<Resistor> mSubResistorF;
std::shared_ptr<Capacitor> mCapacitorF;
std::shared_ptr<Inductor> mInductorF;
......@@ -60,11 +58,10 @@ namespace CPS {
Real mQref;
/// filter paramter
Real mLf;
Real mCf;
Real mRf;
Real mRc;
Matrix mLf;
Matrix mCf;
Matrix mRf;
Matrix mRc;
/// PLL
Real mOmegaN;
......@@ -136,8 +133,8 @@ namespace CPS {
void updateStates();
void setParameters(Real sysOmega, Complex sysVoltNom, Real Pref, Real Qref, Real Kp_pll, Real Ki_pll,
Real Kp_powerCtrl, Real Ki_powerCtrl, Real Kp_currCtrl, Real Ki_currCtrl, Real Lf, Real Cf,
Real Rf, Real Rc);
Real Kp_powerCtrl, Real Ki_powerCtrl, Real Kp_currCtrl, Real Ki_currCtrl, Matrix Lf, Matrix Cf,
Matrix Rf, Matrix Rc);
void setControllerParameters(Real Kp_pll, Real Ki_pll,
Real Kp_powerCtrl, Real Ki_powerCtrl, Real Kp_currCtrl, Real Ki_currCtrl);
......
/**
* @file
* @author Markus Mirz <mmirz@eonerc.rwth-aachen.de>
* Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
/**
* @file
* @author Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
......@@ -23,7 +23,7 @@
#include <cps/PowerComponent.h>
#include <cps/Solver/MNATearInterface.h>
#include <cps/Base/Base_Ph1_Inductor.h>
#include <cps/Base/Base_Ph3_Inductor.h>
namespace CPS {
namespace DP {
......@@ -36,7 +36,7 @@ namespace Ph3 {
/// The resistance is constant for a defined time step and system
/// frequency and the current source changes for each iteration.
class Inductor :
public Base::Ph1::Inductor,
public Base::Ph3::Inductor,
public MNATearInterface,
public PowerComponent<Complex>,
public SharedFactory<Inductor> {
......@@ -46,7 +46,7 @@ namespace Ph3 {
/// Equivalent conductance [S]
MatrixComp mEquivCond;
/// Coefficient in front of previous current value
MatrixComp mPrevCurrFac;
Complex mPrevCurrFac;
void initVars(Real omega, Real timeStep);
public:
......
/**
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#pragma once
#include <cps/PowerComponent.h>
#include <cps/Solver/MNAInterface.h>
#include <cps/Definitions.h>
#include <cps/Logger.h>
#include <cps/Base/Base_Ph3_Resistor.h>
namespace CPS {
namespace DP {
namespace Ph3 {
///
class Resistor :
public Base::Ph3::Resistor,
public MNAInterface,
public PowerComponent<Complex>,
public SharedFactory<Resistor> {
public:
/// Defines UID, name and logging level
Resistor(String uid, String name, Logger::Level logLevel = Logger::Level::off);
/// Defines name and logging level
Resistor(String name, Logger::Level logLevel = Logger::Level::off)
: Resistor(name, name, logLevel) { }
PowerComponent<Complex>::Ptr clone(String name);
// #### General ####
///
void initialize(Matrix frequencies);
/// Initializes component from power flow data
void initializeFromPowerflow(Real frequency);
// #### MNA section ####
///
void mnaInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector);
/// Stamps system matrix
void mnaApplySystemMatrixStamp(Matrix& systemMatrix);
///
void mnaUpdateVoltage(const Matrix& leftVector);
///
void mnaUpdateCurrent(const Matrix& leftVector);
class MnaPostStep : public Task {
public:
MnaPostStep(Resistor& resistor, Attribute<Matrix>::Ptr leftSideVector) :
Task(resistor.mName + ".MnaPostStep"), mResistor(resistor), mLeftVector(leftSideVector)
{
mAttributeDependencies.push_back(mLeftVector);
mModifiedAttributes.push_back(mResistor.attribute("v_intf"));
mModifiedAttributes.push_back(mResistor.attribute("i_intf"));
}
void execute(Real time, Int timeStepCount);
private:
Resistor& mResistor;
Attribute<Matrix>::Ptr mLeftVector;
};
};
}
}
}
......@@ -51,7 +51,6 @@ namespace Ph3 {
void initialize(Matrix frequencies);
/// Initializes component from power flow data
void initializeFromPowerflow(Real frequency);
// #### MNA section ####
///
void mnaInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector);
......
/**
* @file
* @Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2018, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
/**
* @file
* @author Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
/**
* @file
* @author Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
/**
* @file
* @author Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2019, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
/**
* @file
* @author Markus Mirz <mmirz@eonerc.rwth-aachen.de>
* Junjie Zhang <junjie.zhang@eonerc.rwth-aachen.de>
* @copyright 2017-2018, Institute for Automation of Complex Power Systems, EONERC
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*
* CPowerSystems
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment