Commit 811f480b authored by Markus Mirz's avatar Markus Mirz

Merge branch 'merge-jzh-comps' into 'master'

Merge jzh comps

See merge request !72
parents 6ac46f08 d9fa8e8e
......@@ -31,6 +31,7 @@
\include{content/introduction}
\include{content/dynamic_phasors}
\include{content/nodal_analysis}
\include{content/powerflow}
\chapter{Models}
\include{content/branches}
......
\chapter{Appendix}
\section{Implementatory Aspects}
\begin{itemize}
\item Pre-Step
\begin{itemize}
\item To calculate from the solutions of $k$ (e.g. $V_L(k)$ and $I_L(k)$), values required for $k+1$ (e.g. $A_L(k+1)$)
\end{itemize}
\item Step
\begin{itemize}
\item Calculate the system solution for $k+1$
\end{itemize}
\item Post-Step
\begin{itemize}
\item To deduce from the $k+1$ solution (e.g. $V_L(k+1)$) further $k+1$ quantities (e.g. $I_L(k+1)$)
\item Note: no update of $A_L$ yet, as it remains set to the value on which the $k+1$ solution is based
\end{itemize}
\end{itemize}
\section{Per Unit System}
The per unit system is defined by the power rating $S_{base}$, voltage $V_{base}$ and nominal frequency $f_{base}$. It should be noted that the power rating could be defined for three-phase or single-phase and the voltage could be peak or RMS and phase-to-neutral or phase-to-phase.
......
This diff is collapsed.
......@@ -69,7 +69,7 @@ int main(int argc, char *argv[]) {
Reader reader("cimviz", Logger::Level::info);
std::list<fs::path> filenames;
std::list<std::experimental::filesystem::path> filenames;
for (i = 0; gvc->input_filenames[i]; i++) {
filenames.emplace_back(gvc->input_filenames[i]);
}
......
......@@ -404,6 +404,24 @@ namespace Flags {
};
return Attribute<Real>::make(get, mFlags, shared_from_this());
}
Attribute<Real>::Ptr coeffMag(Index row, Index col) {
Attribute<Real>::Getter get = [this, row, col]() -> Real {
return Math::abs(this->get()(row,col));
};
return Attribute<Real>::make(get, mFlags, shared_from_this());
//Complex *ptr = &mValue->data()[mValue->cols() * row + col]; // Column major
//Real *realPart = &reinterpret_cast<Real*>(ptr)[0];
//return Attribute<Real>::make(&realPart, mFlags, shared_from_this());
}
Attribute<Real>::Ptr coeffPhase(Index row, Index col) {
Attribute<Real>::Getter get = [this, row, col]() -> Real {
return Math::phase(this->get()(row,col));
};
return Attribute<Real>::make(get, mFlags, shared_from_this());
}
};
template<>
......
/**
* @file
* @author Markus Mirz <mmirz@eonerc.rwth-aachen.de>
* @copyright 2017-2018, 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/Definitions.h>
namespace CPS {
namespace Base {
namespace Ph3 {
class PiLine {
protected:
/// Resistance along the line [ohms]
Matrix mSeriesRes;
/// Conductance along the line [S]
Matrix mSeriesCond;
/// Inductance along the line [H]
Matrix mSeriesInd;
/// Resistance in parallel to the line [ohms]
Matrix mParallelRes;
/// Conductance in parallel to the line [S]
Matrix mParallelCond;
/// Capacitance in parallel to the line [F]
Matrix mParallelCap;
public:
///
void setParameters(Matrix seriesResistance, Matrix seriesInductance,
Matrix parallelCapacitance = Matrix::Zero(3,3), Matrix parallelConductance = Matrix::Zero(3,3)) {
mSeriesRes = seriesResistance;
mSeriesCond = mSeriesRes.inverse();
mSeriesInd = seriesInductance;
mParallelCond = parallelConductance;
mParallelRes = mParallelCond.inverse();
mParallelCap = parallelCapacitance;
}
};
}
}
}
......@@ -40,7 +40,7 @@ namespace Ph3 {
void setParameters(Matrix openResistance, Matrix closedResistance, Bool closed = false) {
mOpenResistance = openResistance;
mClosedResistance = closedResistance;
mIsClosed = closed;
mSwitchClosed = closed;
}
void closeSwitch() { mSwitchClosed = true; }
void openSwitch() { mSwitchClosed = false; }
......
/**
* @file
* @author Markus Mirz <mmirz@eonerc.rwth-aachen.de>
* @copyright 2017-2018, 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/Definitions.h>
namespace CPS {
namespace Base {
namespace Ph3 {
class Transformer {
protected:
/// Transformer ratio
Complex mRatio;
/// Resistance [Ohm]
Matrix mResistance;
/// Inductance [H]
Matrix mInductance;
public:
///
void setParameters(Real ratioAbs, Real ratioPhase, Matrix resistance, Matrix inductance) {
mRatio = std::polar<Real>(ratioAbs, ratioPhase);
mResistance = resistance;
mInductance = inductance;
}
};
}
}
}
......@@ -24,8 +24,6 @@
#include <map>
#include <list>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#include <cps/Definitions.h>
#include <cps/PowerComponent.h>
#include <cps/Components.h>
......@@ -63,6 +61,9 @@ namespace IEC61970 {
class EnergyConsumer;
class PowerTransformer;
};
namespace Equivalents {
class EquivalentShunt;
}
namespace Topology {
class TopologicalNode;
};
......@@ -107,6 +108,8 @@ namespace CIM {
/// Resolves unit multipliers.
static Real unitValue(Real value, IEC61970::Base::Domain::UnitMultiplier mult);
///
Matrix singlePhaseParameterToThreePhase(Real parameter);
///
void processSvVoltage(IEC61970::Base::StateVariables::SvVoltage* volt);
///
void processSvPowerFlow(IEC61970::Base::StateVariables::SvPowerFlow* flow);
......@@ -114,9 +117,9 @@ namespace CIM {
template<typename VarType>
void processTopologicalNode(IEC61970::Base::Topology::TopologicalNode* topNode);
///
void addFiles(const fs::path &filename);
void addFiles(const std::experimental::filesystem::path &filename);
/// Adds CIM files to list of files to be parsed.
void addFiles(const std::list<fs::path> &filenames);
void addFiles(const std::list<std::experimental::filesystem::path> &filenames);
/// First, go through all topological nodes and collect them in a list.
/// Since all nodes have references to the equipment connected to them (via Terminals), but not
/// the other way around (which we need for instantiating the components), we collect that information here as well.
......@@ -148,6 +151,8 @@ namespace CIM {
/// Returns an external grid injection.
Component::Ptr mapExternalNetworkInjection(IEC61970::Base::Wires::ExternalNetworkInjection* extnet);
/// Returns a shunt
Component::Ptr mapEquivalentShunt(IEC61970::Base::Equivalents::EquivalentShunt *shunt);
public:
///
enum GeneratorType{Static, Transient};
......@@ -161,9 +166,9 @@ namespace CIM {
///
virtual ~Reader();
/// Parses data from CIM files into the CPS data structure
SystemTopology loadCIM(Real systemFrequency, const fs::path &filename, Domain domain = Domain::DP, PhaseType phase = PhaseType::Single);
SystemTopology loadCIM(Real systemFrequency, const std::experimental::filesystem::path &filename, Domain domain = Domain::DP, PhaseType phase = PhaseType::Single);
/// Parses data from CIM files into the CPS data structure
SystemTopology loadCIM(Real systemFrequency, const std::list<fs::path> &filenames, Domain domain = Domain::DP, PhaseType phase = PhaseType::Single);
SystemTopology loadCIM(Real systemFrequency, const std::list<std::experimental::filesystem::path> &filenames, Domain domain = Domain::DP, PhaseType phase = PhaseType::Single);
/// writing state variable voltage of nodes from the another SystemTopology, which has the same topology but modeled in different domain
void writeSvVoltageFromStaticSysTopology(SystemTopology& sysStatic, SystemTopology& sysDynamic);
};
......
/**
*
* @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
*
* 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 <fstream>
#include <iostream>
#include <iterator>
#include <sstream>
#include <string>
#include <vector>
#include <experimental/filesystem>
#include <cps/Logger.h>
#include <cps/SystemTopology.h>
#include <cps/SP/SP_Ph1_Load.h>
#include <cps/DP/DP_Ph1_PQLoadCS.h>
#include <cps/DP/DP_Ph1_AvVoltageSourceInverterDQ.h>
#include <cps/SP/SP_Ph1_AvVoltageSourceInverterDQ.h>
namespace CPS {
/// reads load profiles (csv files only) and assign them to the corresponding load object
class CSVReader {
private:
/// Logger
Logger::Log mSLog;
/// path of load profile files (csv file)
String mPath;
/// list of load profile files with path
std::list<std::experimental::filesystem::path> mFileList;
/// assign pattern, used when the MANUAL mode is selected
std::map <String, String> mAssignPattern;
public:
/// set load profile assigning pattern. AUTO for assigning load profile name (csv file name) to load object with the same name (mName)
/// MANUAL for providing an assign pattern manually. see power flow example: CIM/CIGRE_MV_PowerFlowTest_LoadProfiles.cpp
enum class Mode { AUTO, MANUAL };
/*
Time Stamp Format.
HHMMSS: Hours : Minutes : Seconds, it be casted to the corresponding SECONDS.
SECONDS: profiles recorded with total seconds.
PVGEN: format comply with https://www.fein-aachen.org/projects/PVgenerator/
*/
enum class DataFormat { HHMMSS, SECONDS, HOURS, MINUTES };
CSVReader(String name, std::list<std::experimental::filesystem::path> path, Logger::Level logLevel);
CSVReader(String name, String path, Logger::Level logLevel);
CSVReader(String name, std::list<std::experimental::filesystem::path> path, std::map<String, String>& assignList, Logger::Level logLevel);
CSVReader(String name, String path, std::map<String, String>& assignList, Logger::Level logLevel);
/// convert HH:MM:SS format timestamp into total seconds.
/// e.g.: 00 : 01 : 00 -- > 60.
Real time_format_convert(const String& time);
std::vector<PQData> readLoadProfileDP(std::experimental::filesystem::path file,
Real start_time = -1, Real time_step = 1, Real end_time = -1, Real scale_factor= 1,
CSVReader::DataFormat format = CSVReader::DataFormat::SECONDS);
// void assignLoadProfilePF(std::vector<std::shared_ptr<CPS::SP::Ph1::AvVoltageSourceInverterDQ>>& loads,
// Real start_time = -1, Real time_step = 1, Real end_time = -1, Real scale_factor= 1,
// CSVReader::Mode mode = CSVReader::Mode::AUTO,
// CSVReader::DataFormat format = CSVReader::DataFormat::SECONDS);
void assignLoadProfileSP(std::vector<std::shared_ptr<CPS::SP::Ph1::AvVoltageSourceInverterDQ>>& loads,
Real start_time = -1, Real time_step = 1, Real end_time = -1, Real scale_factor= 1,
CSVReader::Mode mode = CSVReader::Mode::AUTO,
CSVReader::DataFormat format = CSVReader::DataFormat::SECONDS);
void assignLoadProfileDP(std::vector<std::shared_ptr<CPS::DP::Ph1::AvVoltageSourceInverterDQ>>& loads,
Real start_time = -1, Real time_step = 1, Real end_time = -1, Real scale_factor= 1,
CSVReader::Mode mode = CSVReader::Mode::AUTO,
CSVReader::DataFormat format = CSVReader::DataFormat::SECONDS);
/// TODO : deprecate in the future
/// read in load profile with time stamp format specified
LoadProfile readLoadProfile(std::experimental::filesystem::path file,
Real start_time = -1, Real time_step = 1, Real end_time = -1,
CSVReader::DataFormat format = CSVReader::DataFormat::SECONDS);
///
std::vector<Real> readPQData (std::experimental::filesystem::path file,
Real start_time = -1, Real time_step = 1, Real end_time = -1,
CSVReader::DataFormat format = CSVReader::DataFormat::SECONDS);
/// assign load profile to corresponding load object
void assignLoadProfile(SystemTopology& sys,
Real start_time = -1, Real time_step = 1, Real end_time = -1,
CSVReader::Mode mode = CSVReader::Mode::AUTO,
CSVReader::DataFormat format = CSVReader::DataFormat::SECONDS);
///
void assignPVGeneration(SystemTopology& sys,
Real start_time = -1, Real time_step = 1, Real end_time = -1,
CSVReader::Mode mode = CSVReader::Mode::AUTO);
/// interpolation for PQ data points
PQData interpol_linear(std::map<Real, PQData>& data_PQ, Real x);
/// interpolation for weighting factor data points
Real interpol_linear(std::map<Real, Real>& data_wf, Real x);
};
// #### csv reader section
class CSVRow {
public:
///
String const& get(std::size_t index) const { return m_data[index]; }
///
Int size() const;
///
void readNextRow(std::istream& str);
private:
///
std::vector<String> m_data;
};
class CSVReaderIterator {
public:
CSVReaderIterator(std::istream& str);
CSVReaderIterator();
CSVReaderIterator& next();
CSVReaderIterator next(Int);
CSVReaderIterator& step(Int time_step);
CSVRow const& operator*() const { return m_row; };
Bool operator==(CSVReaderIterator const& rhs) {
return ((this == & rhs) || ((this->m_str == NULL) && (rhs.m_str == NULL)));
}
Bool operator!=(CSVReaderIterator const&rhs) {
return !((*this) == rhs);
}
private:
std::istream* m_str;
CSVRow m_row;
};
}
......@@ -24,7 +24,8 @@
#include <cps/Config.h>
#include <cps/SP/SP_Ph1_Filter_LC.h>
#include <cps/SP/SP_Ph1_ControlledVoltageSource.h>
#include <cps/SP/SP_Ph1_AvVoltageSourceInverterDQ.h>
#include <cps/SP/SP_Ph1_RXLine.h>
#include <cps/SP/SP_Ph1_VoltageSourceInverter.h>
#include <cps/SP/SP_Ph1_PiLine.h>
......@@ -36,6 +37,7 @@
#include <cps/SP/SP_Ph1_PVNode.h>
#include <cps/SP/SP_Ph1_VDNode.h>
#include <cps/SP/SP_Ph1_NetworkInjection.h>
#include <cps/SP/SP_Ph1_VoltageSource.h>
#include <cps/SP/SP_Ph3_AvVoltageSourceInverterDQ.h>
#include <cps/SP/SP_Ph3_Capacitor.h>
......@@ -100,6 +102,14 @@
#include <cps/EMT/EMT_Ph3_SynchronGeneratorDQODE.h>
#endif
#include <cps/EMT/EMT_Ph3_SynchronGeneratorVBR.h>
#include <cps/EMT/EMT_Ph3_SynchronGeneratorVBRSmpl.h>
#include <cps/EMT/EMT_Ph3_SynchronGeneratorVBRStandalone.h>
#include <cps/EMT/EMT_Ph3_PiLine.h>
#include <cps/EMT/EMT_Ph3_RXLoad.h>
#include <cps/EMT/EMT_Ph3_RxLine.h>
#include <cps/EMT/EMT_Ph3_Transformer.h>
#include <cps/EMT/EMT_Ph3_NetworkInjection.h>
#include <cps/EMT/EMT_Ph3_Switch.h>
#include <cps/Signal/DecouplingLine.h>
#include <cps/Signal/Exciter.h>
......
......@@ -28,24 +28,27 @@
#include <cps/DP/DP_Ph1_Inductor.h>
#include <cps/DP/DP_Ph1_Capacitor.h>
#include <cps/DP/DP_Ph1_ControlledVoltageSource.h>
#include <cps/PowerProfile.h>
namespace CPS {
namespace DP {
namespace Ph1 {
/*
an Average Voltage Source Inverter model with
- controller modeled in state space
- filter stamped into the global admittance matrix
Average voltage source inverter
- modelled in dq
- with interface to DP grid
*/
class AvVoltageSourceInverterDQ :
public PowerComponent<Complex>,
public MNAInterface,
public SharedFactory<AvVoltageSourceInverterDQ> {
protected:
/// nominal voltage of the component
Complex mVoltNom;
/// in case variable time step simulation should be developed in the future
Real mTimeStep;
/// if SteadyStateInit is enabled, the system's sychronous frame will start from a certain angle
Real mThetaSInit = 0;
/// Inner voltage source that represents the AvVoltageSourceInverterDQ
std::shared_ptr<DP::Ph1::ControlledVoltageSource> mSubCtrledVoltageSource;
/// LC filter as sub-components
......@@ -56,7 +59,22 @@ namespace Ph1 {
std::shared_ptr<DP::Ph1::Inductor> mSubInductorF;
///
std::shared_ptr<DP::Ph1::Resistor> mSubResistorC;
///
std::vector<Real>* mGenProfile = nullptr;
///
std::vector<Real>::iterator mCurrentPower;
///
std::vector<PQData>::iterator mCurrentLoad;
///
UInt mProfileUndateRate = 1000;
///
Attribute<Real>::Ptr mQRefInput;
///
Bool mCtrlOn = true;
///
Bool mCoveeCtrled=true;
///
Bool mIsLoad=false;
// ### parameters ###
Real mPref;
Real mQref;
......@@ -87,7 +105,7 @@ namespace Ph1 {
Real mKpCurrCtrlq;
/// states
Real mThetaPLL;
Real mThetaPLL = 0;
Real mPhiPLL;
Real mP;
Real mQ;
......@@ -97,9 +115,6 @@ namespace Ph1 {
Real mGamma_q;
/// measurements
Matrix mIgabc = Matrix::Zero(3, 1);
Matrix mVcabc = Matrix::Zero(3, 1);
Matrix mIfabc = Matrix::Zero(3, 1);
Matrix mVcdq = Matrix::Zero(2, 1);
Matrix mIgdq = Matrix::Zero(2, 1);
Matrix mIfdq = Matrix::Zero(2, 1);
......@@ -110,7 +125,6 @@ namespace Ph1 {
/// output
Matrix mVsdq = Matrix::Zero(2, 1);
MatrixComp Vsabc = MatrixComp::Zero(3, 1);
// #### Matrices ####
Matrix mStates;
......@@ -122,13 +136,16 @@ namespace Ph1 {
Matrix mC;
Matrix mD;
/// dq to dynamic phasor
void dqToDP(Real time);
MatrixComp dqToDP(Real time);
// #### solver ####
///
std::vector<const Matrix*> mRightVectorStamps;
public:
///
std::vector<PQData> mLoadProfile;
// #### constructors ####
///
AvVoltageSourceInverterDQ(String uid, String name, Logger::Level logLevel = Logger::Level::off);
......@@ -137,10 +154,12 @@ namespace Ph1 {
Logger::Level logLevel = Logger::Level::off) :AvVoltageSourceInverterDQ(name, name, logLevel) {}
///
PowerComponent<Complex>::Ptr clone(String copySuffix);
/// add measurements for Vcabc and Ifabc
//void addMonitoredNodes( std::shared_ptr<Capacitor> cap);
///
void updateMonitoredValues(const Matrix& leftVector, Real time);
///
void initializeStates(Real omega, Real timeStep,
void initializeModel(Real omega, Real timeStep,
Attribute<Matrix>::Ptr leftVector);
///
void updateStates();
......@@ -154,25 +173,25 @@ namespace Ph1 {
/// update B,C,D matrices with new theta_pll
void updateLinearizedModel();
/// convert between two rotating frames
Complex rotatingFrame2to1(Complex f, Real theta1, Real theta2);
///
Matrix getParkTransformMatrix(Real theta);
void step(Real time, Int timeStepCount);
///
Matrix getInverseParkTransformMatrix(Real theta);
void updatePowerGeneration();
// #### General ####
///
Matrix parkTransform(Real theta, Real fa, Real fb, Real fc);
void addGenProfile(std::vector<Real>* genProfile);
///
Matrix inverseParkTransform(Real theta, Real fd, Real fq, Real zero = 0.);
/// convert between two rotating frames
Complex rotatingFrame2to1(Complex f, Real theta1, Real theta2);
void addAggregatedGenProfile(std::vector<Real>* genProfile, Real customerNumber);
///
void step(Real time);
// #### General ####
void updateSetPoint(Real time);
///
void initialize(Matrix frequencies);
///
void initializeFromPowerflow(Real frequency);
// #### interface with villas node ####
void ctrlReceiver(Attribute<Real>::Ptr qref);
// #### MNA section ####
/// Initializes internal variables of the component
void mnaInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector);
......@@ -182,15 +201,22 @@ namespace Ph1 {
void mnaApplyRightSideVectorStamp(Matrix& rightVector);
/// Returns current through the component
void mnaUpdateCurrent(const Matrix& leftVector);
/// interface with power control service
void coveeCtrled(Bool ctrled){mCoveeCtrled=ctrled;};
///
void makeLoad(Bool isLoad){mIsLoad=isLoad;};
///
Bool isLoad(){return mIsLoad;};
///
void setProfileUpdateRate(UInt rate){mProfileUndateRate=rate;};
class MnaPreStep : public CPS::Task {
public:
MnaPreStep(AvVoltageSourceInverterDQ& AvVoltageSourceInverterDQ) :
Task(AvVoltageSourceInverterDQ.mName + ".MnaPreStep"), mAvVoltageSourceInverterDQ(AvVoltageSourceInverterDQ) {
mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.attribute("P_ref"));
mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.attribute("Q_ref"));
//mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.attribute("P_ref"));
mPrevStepDependencies.push_back(AvVoltageSourceInverterDQ.attribute("i_intf"));
mPrevStepDependencies.push_back(AvVoltageSourceInverterDQ.attribute("v_intf"));
mModifiedAttributes.push_back(AvVoltageSourceInverterDQ.mSubCtrledVoltageSource->attribute("v_intf"));
}
......@@ -216,6 +242,21 @@ namespace Ph1 {
AvVoltageSourceInverterDQ& mAvVoltageSourceInverterDQ;
};
class CtrlStep : public Task {
public:
CtrlStep(AvVoltageSourceInverterDQ& AvVoltageSourceInverterDQ) :
Task(AvVoltageSourceInverterDQ.mName + ".CtrlStep"), mAvVoltageSourceInverterDQ(AvVoltageSourceInverterDQ) {
mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.mQRefInput);
mModifiedAttributes.push_back(AvVoltageSourceInverterDQ.attribute("Q_ref"));
}
void execute(Real time, Int timeStepCount);
private:
AvVoltageSourceInverterDQ& mAvVoltageSourceInverterDQ;
};
class MnaPostStep : public CPS::Task {
public:
......@@ -223,10 +264,12 @@ namespace Ph1 {
Task(AvVoltageSourceInverterDQ.mName + ".MnaPostStep"), mAvVoltageSourceInverterDQ(AvVoltageSourceInverterDQ), mLeftVector(leftVector)
{
mAttributeDependencies.push_back(leftVector);
//mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.attribute("Q_ref"));
//mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.mQRefInput);
mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.mSubCtrledVoltageSource->attribute("i_intf"));
mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.mSubResistorF->attribute("i_intf"));
mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.mSubInductorF->attribute("i_intf"));
mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.mSubCapacitorF->attribute("i_intf"));
mAttributeDependencies.push_back(AvVoltageSourceInverterDQ.mSubResistorC->attribute("i_intf"));
mModifiedAttributes.push_back(AvVoltageSourceInverterDQ.attribute("i_intf"));
mModifiedAttributes.push_back(AvVoltageSourceInverterDQ.attribute("v_intf"));
}
......
......@@ -26,6 +26,7 @@
#include <cps/Solver/MNAInterface.h>
#include <cps/DP/DP_Ph1_CurrentSource.h>
#include <cps/Base/Base_Ph1_PQLoad.h>
#include <cps/PowerProfile.h>
namespace CPS {
namespace DP {
......
......@@ -148,8 +148,12 @@ namespace CPS {
Matrix getParkTransformMatrix(Real theta);
Matrix getInverseParkTransformMatrix(Real theta);
Matrix parkTransform(Real theta, Real fa, Real fb, Real fc);
Matrix inverseParkTransform(Real theta, Real fd, Real fq, Real zero = 0.);
Matrix inverseParkTransform(Real theta, Real fd, Real fq, Real Zero=0.);
Complex rotatingFrame2to1(Complex f, Real theta1, Real theta2);
// #### General ####
///
void initialize(Matrix frequencies);
///
void step(Real time);
///
......
......@@ -46,26 +46,44 @@ namespace CPS {
public SharedFactory<AvVoltageSourceInverterDQ> {
protected:
/// nominal voltage of the component
Complex mVoltNom;
/// in case variable time step simulation should be developed in the future
Real mTimeStep;
/// if SteadyStateInit is enabled, the system's sychronous frame will start from a certain angle
Real mThetaSInit = 0;
/// Inner voltage source that represents the AvVoltageSourceInverterDQ
std::shared_ptr<ControlledVoltageSource> mSubCtrledVoltageSource;
/// get "measurements" from other components
std::shared_ptr<Resistor> mResistorF;