diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-09-04 20:05:30 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-04 20:05:30 -0300 |
commit | 926af7f34aaf5aebdbac0cbc550ed75647874258 (patch) | |
tree | 4df26f8c631aeeeed6e5c9e8aab87c4c663bd30f /Project/Electromechanical.h | |
parent | 17d1dd82ec065eff08546ef1fd2a188ce77471b2 (diff) | |
parent | 6f3421c4150e49af026432a2a2be0171d741ad03 (diff) | |
download | PSP.git-926af7f34aaf5aebdbac0cbc550ed75647874258.tar.gz PSP.git-926af7f34aaf5aebdbac0cbc550ed75647874258.tar.xz PSP.git-926af7f34aaf5aebdbac0cbc550ed75647874258.zip |
Merge pull request #33 from Thales1330/wip/electromechanical-calc
Wip electromechanical calc
Diffstat (limited to 'Project/Electromechanical.h')
-rw-r--r-- | Project/Electromechanical.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h new file mode 100644 index 0000000..b25a53b --- /dev/null +++ b/Project/Electromechanical.h @@ -0,0 +1,78 @@ +#ifndef ELECTROMECHANICAL_H +#define ELECTROMECHANICAL_H + +#include "ElectricCalculation.h" + +#include <wx/progdlg.h> + +class ControlElementSolver; + +class Electromechanical : public ElectricCalculation +{ + public: + Electromechanical(wxWindow* parent, std::vector<Element*> elementList, SimulationData data); + ~Electromechanical(); + + bool RunStabilityCalculation(); + wxString GetErrorMessage() const { return m_errorMsg; } + std::vector<double> GetTimeVector() const { return m_timeVector; } + std::vector<double> m_wErrorVector; + std::vector<double> m_deltaErrorVector; + std::vector<double> m_transEdErrorVector; + std::vector<double> m_transEqErrorVector; + std::vector<double> m_numItVector; + + protected: + void SetEventTimeList(); + bool HasEvent(double currentTime); + void SetEvent(double currentTime); + inline bool EventTrigger(double eventTime, double currentTime); + + double GetPowerValue(double value, ElectricalUnit unit); + + void InsertSyncMachinesOnYBus(); + std::complex<double> GetSyncMachineAdmittance(SyncGenerator* generator); + bool InitializeDynamicElements(); + void CalculateMachinesCurrents(); + void CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq, double k = 1.0); + bool SolveSynchronousMachines(); + void SetSyncMachinesModel(); + double CalculateSyncMachineIntVariables(SyncGenerator* syncGenerator, double id, double iq, double pe, double k = 1.0); + void CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator, double& id, double& iq, double& pe, double k = 1.0); + void CalculateReferenceSpeed(); + + void SaveData(); + + wxWindow* m_parent = NULL; + wxString m_errorMsg = _("Unknown error"); + + double m_systemFreq = 60.0; + double m_refSpeed = 2.0 * M_PI * 60.0; + bool m_useCOI = false; + + std::vector<std::vector<std::complex<double> > > m_yBus; + std::vector<std::vector<std::complex<double> > > m_yBusU; + std::vector<std::vector<std::complex<double> > > m_yBusL; + + std::vector<std::complex<double> > m_vBus; + std::vector<std::complex<double> > m_iBus; + + double m_powerSystemBase = 100e6; + double m_simTime = 10.0; + double m_plotTime = 1e-2; + double m_timeStep = 1e-2; + double m_ctrlTimeStepMultiplier = 0.1; + double m_tolerance = 1e-8; + int m_maxIterations = 100; + + std::vector<double> m_eventTimeList; + std::vector<bool> m_eventOccurrenceList; + + std::vector<double> m_timeVector; + + // tests + double m_wError = 0.0; + double m_numIt = 0; +}; + +#endif // ELECTROMECHANICAL_H |