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/SyncGenerator.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/SyncGenerator.h')
-rw-r--r-- | Project/SyncGenerator.h | 68 |
1 files changed, 59 insertions, 9 deletions
diff --git a/Project/SyncGenerator.h b/Project/SyncGenerator.h index a672a4f..fb5ffdc 100644 --- a/Project/SyncGenerator.h +++ b/Project/SyncGenerator.h @@ -4,6 +4,8 @@ #include "Machines.h" class SyncMachineForm; +class ControlElementContainer; +class ControlElementSolver; struct SyncGeneratorElectricalData { // General @@ -22,7 +24,7 @@ struct SyncGeneratorElectricalData { bool haveMinReactive = false; double minReactive = -9999.0; ElectricalUnit minReactiveUnit = UNIT_MVAr; - bool useMachineBase = false; + bool useMachineBase = true; // Fault double positiveResistance = 0.0; @@ -35,12 +37,12 @@ struct SyncGeneratorElectricalData { double groundReactance = 0.0; bool groundNeutral = true; // p.u. fault data - std::complex<double> faultCurrent[3] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0), - std::complex<double>(0.0, 0.0) }; + std::complex<double> faultCurrent[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0), + std::complex<double>(0.0, 0.0)}; // Stability bool plotSyncMachine = false; - double inertia = 0.0; + double inertia = 1.0; double damping = 0.0; bool useAVR = false; bool useSpeedGovernor = false; @@ -59,16 +61,62 @@ struct SyncGeneratorElectricalData { double subXq = 0.0; double subTd0 = 0.0; double subTq0 = 0.0; + + // Machine state variables + std::complex<double> terminalVoltage; + std::vector<std::complex<double> > terminalVoltageVector; + std::complex<double> electricalPower; + std::vector<std::complex<double> > electricalPowerVector; + double pm; + std::vector<double> mechanicalPowerVector; + double speed; + std::vector<double> freqVector; + double fieldVoltage; + std::vector<double> fieldVoltageVector; + double delta; + std::vector<double> deltaVector; + + double initialFieldVoltage; + + // Internal machine variables + double tranEq; + double tranEd; + double subEq; + double subEd; + double pe; + + // Variables to extrapolate + double oldId; + double oldIq; + double oldPe; + + // Integration constants + IntegrationConstant icSpeed; + IntegrationConstant icDelta; + IntegrationConstant icTranEq; + IntegrationConstant icTranEd; + IntegrationConstant icSubEq; + IntegrationConstant icSubEd; + + // Control + ControlElementContainer* avr = NULL; + ControlElementContainer* speedGov = NULL; + + // Control solvers + ControlElementSolver* avrSolver = NULL; + ControlElementSolver* speedGovSolver = NULL; + + Machines::SyncMachineModel model = Machines::SM_MODEL_1; }; class SyncGenerator : public Machines { -public: + public: SyncGenerator(); SyncGenerator(wxString name); ~SyncGenerator(); - - virtual Element* GetCopy(); + + virtual Element* GetCopy(); virtual void Init(); virtual void DrawSymbol() const; virtual bool GetContextMenu(wxMenu& menu); @@ -78,10 +126,12 @@ public: virtual SyncGeneratorElectricalData GetPUElectricalData(double systemPowerBase); virtual void SetElectricalData(SyncGeneratorElectricalData electricalData) { m_electricalData = electricalData; } virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit); -protected: + virtual bool GetPlotData(ElementPlotData& plotData); + + protected: std::vector<wxPoint2DDouble> m_sinePts; SyncGeneratorElectricalData m_electricalData; }; -#endif // SYNCGENERATOR_H +#endif // SYNCGENERATOR_H |