#ifndef ELECTRICCALCULATION_H #define ELECTRICCALCULATION_H #include #include #include "Element.h" #include "Bus.h" #include "Capacitor.h" #include "IndMotor.h" #include "Inductor.h" #include "Line.h" #include "Load.h" #include "SyncGenerator.h" #include "SyncMotor.h" #include "Transformer.h" 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 }; enum YBusSequence { POSITIVE_SEQ = 0, NEGATIVE_SEQ, ZERO_SEQ }; struct ReactiveLimits { double maxLimit = 0.0; double minLimit = 0.0; ReactiveLimitsType maxLimitType = RL_UNLIMITED; ReactiveLimitsType minLimitType = RL_UNLIMITED; ReactiveLimitsType limitReached = RL_NONE_REACHED; }; /** * @class ElectricCalculation * @author Thales Lima Oliveira * @date 09/01/2017 * @file ElectricCalculation.h * @brief Base class of electric calculations, with general methods. */ class ElectricCalculation { public: /** * @brief Constructor. */ ElectricCalculation(); /** * @brief Destructor. */ ~ElectricCalculation(); /** * @brief Separate the elements from a generic list. * @param elementList List of generic elements. */ virtual void GetElementsFromList(std::vector elementList); /** * @brief Get the admittance matrix from the list of elements (use GetElementsFromList first). * @param yBus Admittance matrix. The previous content will be erased. * @param systemPowerBase Base power of the system. * @param sequence Sequence of admittance matrix (positive, negative and zero). * @param includeSyncMachines Include the synchronous machines on calculation. * @return Return true if was possible to build the admittance matrix. */ virtual bool GetYBus(std::vector > >& yBus, double systemPowerBase, YBusSequence sequence = POSITIVE_SEQ, bool includeSyncMachines = false); /** * @brief Invert a matrix. * @param matrix Matrix to invert. * @param inverse Inverted matrix. The previous content will be erased. * @return Return true if was possible to invert the matrix. */ virtual bool InvertMatrix(std::vector > > matrix, std::vector > >& inverse); /** * @brief Update the elements after the power flow calculation. * @param voltage Array with the buses voltages. * @param power Array with the buses injected power. * @param busType Array with the buses type. * @param reactiveLimit Array with the reactive limit data. * @param systemPowerBase Base power of the system. */ virtual void UpdateElementsPowerFlow(std::vector > voltage, std::vector > power, std::vector busType, std::vector reactiveLimit, double systemPowerBase); /** * @brief Get the buses of the system (use GetElementsFromList first). * @return A list of bus elements. */ const std::vector GetBusList() const { return m_busList; } /** * @brief Get the capacitors of the system (use GetElementsFromList first). * @return A list of capacitor elements. */ const std::vector 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 GetIndMotorList() const { return m_indMotorList; } /** * @brief Get the inductors of the system (use GetElementsFromList first). * @return A list of inductor elements. */ const std::vector GetInductorList() const { return m_inductorList; } /** * @brief Get the lines of the system (use GetElementsFromList first). * @return A list of line elements. */ const std::vector GetLineList() const { return m_lineList; } /** * @brief Get the loads of the system (use GetElementsFromList first). * @return A list of load elements. */ const std::vector 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 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 GetSyncMotorList() const { return m_syncMotorList; } /** * @brief Get the transformers of the system (use GetElementsFromList first). * @return A list of transformer elements. */ const std::vector GetTransformerList() const { return m_transformerList; } protected: std::vector m_busList; std::vector m_capacitorList; std::vector m_indMotorList; std::vector m_inductorList; std::vector m_lineList; std::vector m_loadList; std::vector m_syncGeneratorList; std::vector m_syncMotorList; std::vector m_transformerList; }; #endif // ELECTRICCALCULATION_H