Commit 544bce25 authored by Jan Dinkelbach's avatar Jan Dinkelbach
Browse files

improve averaged inverter header for dp1ph

parent cd626e66
......@@ -42,30 +42,28 @@ namespace Ph1 {
/// Optional connection transformer
std::shared_ptr<DP::Ph1::Transformer> mConnectionTransformer;
// ### inputs ###
// ### Inverter Variables ###
// Control inputs
///
Matrix mVcdq = Matrix::Zero(2, 1);
///
Matrix mIrcdq = Matrix::Zero(2, 1);
// ### outputs ###
/// Control Output before Transformation Interface
// Control outputs
/// Control output before transformation interface
Matrix mVsdq = Matrix::Zero(2, 1);
/// Control Output before Transformation Interface
/// Control output before transformation interface
MatrixComp mControllerOutput = MatrixComp::Zero(1,1);
/// instantaneous omega
Real mOmegaInst=0;
/// instantaneous frequency
Real mFreqInst=0;
///
Bool mIsLoad=false;
///
Bool mWithConnectionTransformer=false;
/// in case variable time step simulation should be developed in the future
Real mTimeStep;
///
std::vector<Real>* mGenProfile = nullptr;
///
......@@ -88,12 +86,19 @@ namespace Ph1 {
///
std::vector<PQData> mLoadProfile;
///
/// Defines name amd logging level
AvVoltageSourceInverterDQ(String name, Logger::Level logLevel = Logger::Level::off)
: AvVoltageSourceInverterDQ(name, name, logLevel) {}
///
/// Defines UID, name, logging level and connection trafo existence
AvVoltageSourceInverterDQ(String uid, String name, Logger::Level logLevel = Logger::Level::off, Bool withTrafo = false);
// #### General ####
/// Initializes component from power flow data
void initializeFromPowerflow(Real frequency);
///
void initialize(Matrix frequencies);
///
SimPowerComp<Complex>::Ptr clone(String copySuffix);
///
void setParameters(Real sysOmega, Real sysVoltNom, Real Pref, Real Qref);
///
......@@ -105,34 +110,6 @@ namespace Ph1 {
void setInitialStateValues(Real thetaPLLInit, Real phiPLLInit, Real pInit, Real qInit,
Real phi_dInit, Real phi_qInit, Real gamma_dInit, Real gamma_qInit);
///
SimPowerComp<Complex>::Ptr clone(String copySuffix);
///
void initializeStateSpaceModel(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector);
///
void updateInputStateSpaceModel(const Matrix& leftVector, Real time);
///
void updateStates();
///
void updateBMatrixStateSpaceModel();
/// convert between two rotating frames
Complex rotatingFrame2to1(Complex f, Real theta1, Real theta2);
///
void step(Real time, Int timeStepCount);
///
void updatePowerGeneration();
// #### General ####
///
void addGenProfile(std::vector<Real>* genProfile);
///
void addAggregatedGenProfile(std::vector<Real>* genProfile, Real customerNumber);
///
void initialize(Matrix frequencies);
///
void initializeFromPowerflow(Real frequency);
// #### MNA section ####
/// Initializes internal variables of the component
void mnaInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector);
......@@ -144,29 +121,52 @@ namespace Ph1 {
void mnaUpdateCurrent(const Matrix& leftVector);
/// Updates voltage across component
void mnaUpdateVoltage(const Matrix& leftVector);
/// MNA pre and post step operations
/// MNA pre step operations
void mnaPreStep(Real time, Int timeStepCount);
/// MNA post step operations
void mnaPostStep(Real time, Int timeStepCount, Attribute<Matrix>::Ptr &leftVector);
/// add MNA pre and post step dependencies
/// Add MNA pre step dependencies
void mnaAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes);
/// Add MNA post step dependencies
void mnaAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute<Matrix>::Ptr &leftVector);
// #### Control section ####
///
void initializeStateSpaceModel(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector);
///
void updateInputStateSpaceModel(Real time);
///
void updateStates();
///
void updateBMatrixStateSpaceModel();
/// convert between two rotating frames
Complex rotatingFrame2to1(Complex f, Real theta1, Real theta2);
///
void step(Real time, Int timeStepCount);
/// Perform step of controller
void controlStep(Real time, Int timeStepCount);
void controlStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes);
/// Add control step dependencies
void addControlStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes);
// #### Profile handling ####
///
void addGenProfile(std::vector<Real>* genProfile);
///
void addAggregatedGenProfile(std::vector<Real>* genProfile, Real customerNumber);
///
void makeLoad(Bool isLoad){mIsLoad=isLoad;};
///
Bool isLoad(){return mIsLoad;};
///
void setProfileUpdateRate(UInt rate){mProfileUndateRate=rate;};
///
void updatePowerGeneration();
class ControlStep : public CPS::Task {
public:
ControlStep(AvVoltageSourceInverterDQ& AvVoltageSourceInverterDQ) :
Task(AvVoltageSourceInverterDQ.mName + ".ControlStep"), mAvVoltageSourceInverterDQ(AvVoltageSourceInverterDQ) {
mAvVoltageSourceInverterDQ.controlStepDependencies(mPrevStepDependencies, mAttributeDependencies, mModifiedAttributes);
mAvVoltageSourceInverterDQ.addControlStepDependencies(mPrevStepDependencies, mAttributeDependencies, mModifiedAttributes);
}
void execute(Real time, Int timeStepCount) { mAvVoltageSourceInverterDQ.controlStep(time, timeStepCount); };
......
......@@ -398,7 +398,7 @@ void DP::Ph1::AvVoltageSourceInverterDQ::mnaApplyRightSideVectorStamp(Matrix& ri
rightVector += *stamp;
}
void DP::Ph1::AvVoltageSourceInverterDQ::controlStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) {
void DP::Ph1::AvVoltageSourceInverterDQ::addControlStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) {
prevStepDependencies.push_back(this->attribute("i_intf"));
prevStepDependencies.push_back(this->attribute("v_intf"));
modifiedAttributes.push_back(this->attribute("controller_output"));
......
Supports Markdown
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