summaryrefslogtreecommitdiffstats
path: root/Project/ElectricCalculation.h
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-05-20 17:22:47 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-05-20 17:22:47 -0300
commit30181ca0ae73f5f7f1856ac289db8fcf849c9a84 (patch)
tree4b8de3270f4157e6dfbce05bc404cbc29333e969 /Project/ElectricCalculation.h
parent7a556cd67b60f70b9779d298ee687f66c859a529 (diff)
downloadPSP.git-30181ca0ae73f5f7f1856ac289db8fcf849c9a84.tar.gz
PSP.git-30181ca0ae73f5f7f1856ac289db8fcf849c9a84.tar.xz
PSP.git-30181ca0ae73f5f7f1856ac289db8fcf849c9a84.zip
Electromechanical class and several methods implemented
Diffstat (limited to 'Project/ElectricCalculation.h')
-rw-r--r--Project/ElectricCalculation.h69
1 files changed, 42 insertions, 27 deletions
diff --git a/Project/ElectricCalculation.h b/Project/ElectricCalculation.h
index 3eea5dd..be9aa89 100644
--- a/Project/ElectricCalculation.h
+++ b/Project/ElectricCalculation.h
@@ -5,6 +5,7 @@
#include <complex>
#include "Element.h"
+#include "PowerElement.h"
#include "Bus.h"
#include "Capacitor.h"
#include "IndMotor.h"
@@ -18,16 +19,18 @@
enum BusType { BUS_SLACK = 0, BUS_PV, BUS_PQ };
enum ReactiveLimitsType {
- RL_UNLIMITED = 0, // The bus can generate any ammount of reactive power.
- RL_LIMITED, // The bus reactive power generation is limited.
- RL_UNLIMITED_SOURCE, // The bus have at least one source of infinite reative power.
- RL_MAX_REACHED, // Max limit reached
- RL_MIN_REACHED, // Min limit reached
- RL_NONE_REACHED // No limits reached
+ RL_UNLIMITED = 0, // The bus can generate any ammount of reactive power.
+ RL_LIMITED, // The bus reactive power generation is limited.
+ RL_UNLIMITED_SOURCE, // The bus have at least one source of infinite reative power.
+ RL_MAX_REACHED, // Max limit reached
+ RL_MIN_REACHED, // Min limit reached
+ RL_NONE_REACHED // No limits reached
};
enum YBusSequence { POSITIVE_SEQ = 0, NEGATIVE_SEQ, ZERO_SEQ };
+enum SyncMachineModel { SM_MODEL_1 = 0, SM_MODEL_2, SM_MODEL_3, SM_MODEL_4, SM_MODEL_5 };
+
struct ReactiveLimits {
double maxLimit = 0.0;
double minLimit = 0.0;
@@ -45,7 +48,7 @@ struct ReactiveLimits {
*/
class ElectricCalculation
{
-public:
+ public:
/**
* @brief Constructor.
*/
@@ -57,7 +60,7 @@ public:
~ElectricCalculation();
/**
- * @brief Separate the elements from a generic list.
+ * @brief Separate the power elements from a generic list.
* @param elementList List of generic elements.
*/
virtual void GetElementsFromList(std::vector<Element*> elementList);
@@ -71,9 +74,10 @@ public:
* @return Return true if was possible to build the admittance matrix.
*/
virtual bool GetYBus(std::vector<std::vector<std::complex<double> > >& yBus,
- double systemPowerBase,
- YBusSequence sequence = POSITIVE_SEQ,
- bool includeSyncMachines = false);
+ double systemPowerBase,
+ YBusSequence sequence = POSITIVE_SEQ,
+ bool includeSyncMachines = false,
+ bool allLoadsAsImpedances = false);
/**
* @brief Invert a matrix.
@@ -82,7 +86,7 @@ public:
* @return Return true if was possible to invert the matrix.
*/
virtual bool InvertMatrix(std::vector<std::vector<std::complex<double> > > matrix,
- std::vector<std::vector<std::complex<double> > >& inverse);
+ std::vector<std::vector<std::complex<double> > >& inverse);
/**
* @brief Update the elements after the power flow calculation.
@@ -93,66 +97,77 @@ public:
* @param systemPowerBase Base power of the system.
*/
virtual void UpdateElementsPowerFlow(std::vector<std::complex<double> > voltage,
- std::vector<std::complex<double> > power,
- std::vector<BusType> busType,
- std::vector<ReactiveLimits> reactiveLimit,
- double systemPowerBase);
+ std::vector<std::complex<double> > power,
+ std::vector<BusType> busType,
+ std::vector<ReactiveLimits> reactiveLimit,
+ double systemPowerBase);
+
+ void ABCtoDQ0(std::complex<double> complexValue, double angle, double& dValue, double& qValue);
+ void DQ0toABC(double dValue, double qValue, double angle, std::complex<double>& complexValue);
+
+ std::vector<std::complex<double> > GaussianElimination(std::vector<std::vector<std::complex<double> > > matrix,
+ std::vector<std::complex<double> > array);
+
+ SyncMachineModel GetMachineModel(SyncGenerator* generator);
+
+ std::vector<std::complex<double> > ComplexMatrixTimesVector(std::vector<std::vector<std::complex<double> > > matrix,
+ std::vector<std::complex<double> > vector);
+
+ void GetLUDecomposition(std::vector<std::vector<std::complex<double> > > matrix,
+ std::vector<std::vector<std::complex<double> > >& matrixL,
+ std::vector<std::vector<std::complex<double> > >& matrixU);
+
+ std::vector<std::complex<double> > LUEvaluate(std::vector<std::vector<std::complex<double> > > u,
+ std::vector<std::vector<std::complex<double> > > l,
+ std::vector<std::complex<double> > b);
/**
* @brief Get the buses of the system (use GetElementsFromList first).
* @return A list of bus elements.
*/
const std::vector<Bus*> GetBusList() const { return m_busList; }
-
/**
* @brief Get the capacitors of the system (use GetElementsFromList first).
* @return A list of capacitor elements.
*/
const std::vector<Capacitor*> GetCapacitorList() const { return m_capacitorList; }
-
/**
* @brief Get the induction motors of the system (use GetElementsFromList first).
* @return A list of induction motor elements.
*/
const std::vector<IndMotor*> GetIndMotorList() const { return m_indMotorList; }
-
/**
* @brief Get the inductors of the system (use GetElementsFromList first).
* @return A list of inductor elements.
*/
const std::vector<Inductor*> GetInductorList() const { return m_inductorList; }
-
/**
* @brief Get the lines of the system (use GetElementsFromList first).
* @return A list of line elements.
*/
const std::vector<Line*> GetLineList() const { return m_lineList; }
-
/**
* @brief Get the loads of the system (use GetElementsFromList first).
* @return A list of load elements.
*/
const std::vector<Load*> GetLoadList() const { return m_loadList; }
-
/**
* @brief Get the synchronous generators of the system (use GetElementsFromList first).
* @return A list of synchronous generator elements.
*/
const std::vector<SyncGenerator*> GetSyncGeneratorList() const { return m_syncGeneratorList; }
-
/**
* @brief Get the synchronous motors of the system (use GetElementsFromList first).
* @return A list of synchronous motor elements.
*/
const std::vector<SyncMotor*> GetSyncMotorList() const { return m_syncMotorList; }
-
/**
* @brief Get the transformers of the system (use GetElementsFromList first).
* @return A list of transformer elements.
*/
const std::vector<Transformer*> GetTransformerList() const { return m_transformerList; }
-
-protected:
+ protected:
+ std::vector<PowerElement*> m_powerElementList;
std::vector<Bus*> m_busList;
std::vector<Capacitor*> m_capacitorList;
std::vector<IndMotor*> m_indMotorList;
@@ -164,4 +179,4 @@ protected:
std::vector<Transformer*> m_transformerList;
};
-#endif // ELECTRICCALCULATION_H
+#endif // ELECTRICCALCULATION_H