From 30181ca0ae73f5f7f1856ac289db8fcf849c9a84 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Sat, 20 May 2017 17:22:47 -0300 Subject: Electromechanical class and several methods implemented --- Project/Electromechanical.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Project/Electromechanical.h (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h new file mode 100644 index 0000000..c8555b7 --- /dev/null +++ b/Project/Electromechanical.h @@ -0,0 +1,32 @@ +#ifndef ELECTROMECHANICAL_H +#define ELECTROMECHANICAL_H + +#include "ElectricCalculation.h" + +class Electromechanical : public ElectricCalculation +{ +public: + Electromechanical(std::vector elementList); + ~Electromechanical(); + + bool RunStabilityCalculation(); + wxString GetErrorMessage() const { return m_errorMsg; } + +protected: + void SetEventTimeList(); + bool HasEvent(double currentTime); + void SetEvent(double currentTime); + + void Insert + + wxString m_errorMsg = _("Unknown error"); + + std::vector > > m_yBus; + + double m_timeStep = 1e-3; + + std::vector m_eventTimeList; + std::vector m_eventOccurrenceList; +}; + +#endif // ELECTROMECHANICAL_H -- cgit From f995850b38916b38718b84f4b82948479a81855a Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Mon, 22 May 2017 20:17:41 -0300 Subject: Events implemented Effects on adimittance matrix and elements: ->Fault on bus; ->Generation/Load switching; ->Branch switching. --- Project/Electromechanical.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index c8555b7..172428f 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -16,12 +16,15 @@ protected: void SetEventTimeList(); bool HasEvent(double currentTime); void SetEvent(double currentTime); + inline bool EventTrigger(double eventTime, double currentTime); - void Insert + void InsertSyncMachinesOnYBus(); + std::complex GetSyncMachineAdmittance(SyncGenerator* generator); wxString m_errorMsg = _("Unknown error"); std::vector > > m_yBus; + double m_powerSystemBase = 100e6; double m_timeStep = 1e-3; -- cgit From c91e58bb903adeff1e8c0fff1868e80783010e58 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Wed, 24 May 2017 17:50:36 -0300 Subject: Dynamic elements initialization implemented --- Project/Electromechanical.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 172428f..1dadcce 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -3,10 +3,12 @@ #include "ElectricCalculation.h" +class ControlElementSolver; + class Electromechanical : public ElectricCalculation { public: - Electromechanical(std::vector elementList); + Electromechanical(wxWindow* parent, std::vector elementList); ~Electromechanical(); bool RunStabilityCalculation(); @@ -20,7 +22,9 @@ protected: void InsertSyncMachinesOnYBus(); std::complex GetSyncMachineAdmittance(SyncGenerator* generator); + bool InitializeDynamicElements(); + wxWindow* m_parent = NULL; wxString m_errorMsg = _("Unknown error"); std::vector > > m_yBus; -- cgit From 993288a099a4ba08c40cfb5ff79620257193131c Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Thu, 25 May 2017 18:50:28 -0300 Subject: Sync machines solver almost finished --- Project/Electromechanical.h | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 1dadcce..21c747c 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -7,33 +7,50 @@ class ControlElementSolver; class Electromechanical : public ElectricCalculation { -public: + public: Electromechanical(wxWindow* parent, std::vector elementList); ~Electromechanical(); - + bool RunStabilityCalculation(); wxString GetErrorMessage() const { return m_errorMsg; } -protected: + std::vector GetTimeVector() const { return m_timeVector; } + + protected: void SetEventTimeList(); bool HasEvent(double currentTime); void SetEvent(double currentTime); inline bool EventTrigger(double eventTime, double currentTime); - + void InsertSyncMachinesOnYBus(); std::complex GetSyncMachineAdmittance(SyncGenerator* generator); bool InitializeDynamicElements(); - + void CalculateMachinesCurrents(); + void CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq); + bool SolveSynchronousMachines(); + wxWindow* m_parent = NULL; wxString m_errorMsg = _("Unknown error"); + double m_systemFreq = 60.0; + std::vector > > m_yBus; - double m_powerSystemBase = 100e6; + std::vector > > m_yBusU; + std::vector > > m_yBusL; - double m_timeStep = 1e-3; + std::vector > m_vBus; + std::vector > m_iBus; + double m_powerSystemBase = 100e6; + + double m_timeStep = 1e-3; + double m_tolerance = 1e-3; + int m_maxIterations = 100; + std::vector m_eventTimeList; std::vector m_eventOccurrenceList; + + std::vector m_timeVector; }; -#endif // ELECTROMECHANICAL_H +#endif // ELECTROMECHANICAL_H -- cgit From 734476bea0a2b85b131f5a4d2c9e2b219af7be41 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Fri, 26 May 2017 02:21:15 -0300 Subject: Sync generator plot implemented Electromechanical calc not working --- Project/Electromechanical.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 21c747c..694dbca 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -21,13 +21,15 @@ class Electromechanical : public ElectricCalculation 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 GetSyncMachineAdmittance(SyncGenerator* generator); bool InitializeDynamicElements(); void CalculateMachinesCurrents(); void CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq); - bool SolveSynchronousMachines(); + bool SolveSynchronousMachines(bool saveValues = false); wxWindow* m_parent = NULL; wxString m_errorMsg = _("Unknown error"); -- cgit From ec288f99d922ad81b560137c1e561ce02139690a Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Fri, 26 May 2017 17:05:54 -0300 Subject: Some bugs fixed --- Project/Electromechanical.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 694dbca..5b535a9 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -29,7 +29,9 @@ class Electromechanical : public ElectricCalculation bool InitializeDynamicElements(); void CalculateMachinesCurrents(); void CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq); - bool SolveSynchronousMachines(bool saveValues = false); + bool SolveSynchronousMachines(); + + void SaveData(); wxWindow* m_parent = NULL; wxString m_errorMsg = _("Unknown error"); @@ -46,7 +48,7 @@ class Electromechanical : public ElectricCalculation double m_powerSystemBase = 100e6; double m_timeStep = 1e-3; - double m_tolerance = 1e-3; + double m_tolerance = 1e-5; int m_maxIterations = 100; std::vector m_eventTimeList; -- cgit From 5df0b53a01acfa3e41b0e106426fa874f6af81f7 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Sat, 27 May 2017 01:32:26 -0300 Subject: Some minor changes --- Project/Electromechanical.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 5b535a9..f8d2e99 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -47,8 +47,8 @@ class Electromechanical : public ElectricCalculation double m_powerSystemBase = 100e6; - double m_timeStep = 1e-3; - double m_tolerance = 1e-5; + double m_timeStep = 1e-2; + double m_tolerance = 1e-6; int m_maxIterations = 100; std::vector m_eventTimeList; -- cgit From e1a11643e0245676b04d6c9fce5eb35d68163121 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Sun, 28 May 2017 02:37:17 -0300 Subject: Type 3 machine working properly now --- Project/Electromechanical.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index f8d2e99..808b936 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -3,6 +3,8 @@ #include "ElectricCalculation.h" +#include + class ControlElementSolver; class Electromechanical : public ElectricCalculation @@ -47,7 +49,7 @@ class Electromechanical : public ElectricCalculation double m_powerSystemBase = 100e6; - double m_timeStep = 1e-2; + double m_timeStep = 1e-3; double m_tolerance = 1e-6; int m_maxIterations = 100; -- cgit From 41c6ab0cac47046db7b7a3faf360c60944fd39b5 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Mon, 29 May 2017 00:40:46 -0300 Subject: Removing sync generator is now working, bus plot implemented --- Project/Electromechanical.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 808b936..8dabe05 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -18,6 +18,12 @@ class Electromechanical : public ElectricCalculation std::vector GetTimeVector() const { return m_timeVector; } + std::vector m_wErrorVector; + std::vector m_deltaErrorVector; + std::vector m_transEdErrorVector; + std::vector m_transEqErrorVector; + std::vector m_numItVector; + protected: void SetEventTimeList(); bool HasEvent(double currentTime); @@ -57,6 +63,13 @@ class Electromechanical : public ElectricCalculation std::vector m_eventOccurrenceList; std::vector m_timeVector; + + //tests + double m_wError = 0.0; + double m_deltaError = 0.0; + double m_transEdError = 0.0; + double m_transEqError = 0.0; + double m_numIt = 0; }; #endif // ELECTROMECHANICAL_H -- cgit From 862fdf461da424da5db53b6eb8d9dd393092b4b2 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Tue, 30 May 2017 00:27:38 -0300 Subject: Decrease default step size --- Project/Electromechanical.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 8dabe05..a023f91 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -55,7 +55,7 @@ class Electromechanical : public ElectricCalculation double m_powerSystemBase = 100e6; - double m_timeStep = 1e-3; + double m_timeStep = 1e-2; double m_tolerance = 1e-6; int m_maxIterations = 100; -- cgit From 0e0a956edd98d71b22d5be2c85b0fc2049a77c4a Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Tue, 30 May 2017 17:56:04 -0300 Subject: Control step different from machines implemented --- Project/Electromechanical.h | 1 + 1 file changed, 1 insertion(+) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index a023f91..d8889e6 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -56,6 +56,7 @@ class Electromechanical : public ElectricCalculation double m_powerSystemBase = 100e6; double m_timeStep = 1e-2; + double m_ctrlTimeStepMultiplier = 0.1; double m_tolerance = 1e-6; int m_maxIterations = 100; -- cgit From 49ac4c4fcedb03ef09f8faab176159f48896dc7e Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Wed, 26 Jul 2017 21:32:35 -0300 Subject: 5 machine models implemented --- Project/Electromechanical.h | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index d8889e6..facfa0f 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -15,57 +15,58 @@ class Electromechanical : public ElectricCalculation bool RunStabilityCalculation(); wxString GetErrorMessage() const { return m_errorMsg; } - std::vector GetTimeVector() const { return m_timeVector; } - std::vector m_wErrorVector; std::vector m_deltaErrorVector; std::vector m_transEdErrorVector; std::vector m_transEqErrorVector; std::vector 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 GetSyncMachineAdmittance(SyncGenerator* generator); bool InitializeDynamicElements(); void CalculateMachinesCurrents(); - void CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq); + 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 SaveData(); wxWindow* m_parent = NULL; wxString m_errorMsg = _("Unknown error"); - + double m_systemFreq = 60.0; - + std::vector > > m_yBus; std::vector > > m_yBusU; std::vector > > m_yBusL; - + std::vector > m_vBus; std::vector > m_iBus; - + double m_powerSystemBase = 100e6; double m_timeStep = 1e-2; double m_ctrlTimeStepMultiplier = 0.1; - double m_tolerance = 1e-6; + double m_tolerance = 1e-8; int m_maxIterations = 100; std::vector m_eventTimeList; std::vector m_eventOccurrenceList; - + std::vector m_timeVector; - - //tests + + // tests double m_wError = 0.0; double m_deltaError = 0.0; double m_transEdError = 0.0; -- cgit From 8a1ffbc01135a1466ad7400518e4c56a4bdc3af5 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Wed, 9 Aug 2017 21:01:41 -0300 Subject: Stability properties implemented --- Project/Electromechanical.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index facfa0f..7400944 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -10,7 +10,7 @@ class ControlElementSolver; class Electromechanical : public ElectricCalculation { public: - Electromechanical(wxWindow* parent, std::vector elementList); + Electromechanical(wxWindow* parent, std::vector elementList, SimulationData data); ~Electromechanical(); bool RunStabilityCalculation(); @@ -55,7 +55,8 @@ class Electromechanical : public ElectricCalculation std::vector > 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; -- cgit From 516cdb72d3ff99a1ee786d3ea24c9b579272fe76 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Wed, 30 Aug 2017 20:42:27 -0300 Subject: COI (center of inertia) implemented See Milano's book p. 342 --- Project/Electromechanical.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 7400944..f981353 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -39,6 +39,7 @@ class Electromechanical : public ElectricCalculation 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(); @@ -46,6 +47,8 @@ class Electromechanical : public ElectricCalculation 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 > > m_yBus; std::vector > > m_yBusU; -- cgit From 6f3421c4150e49af026432a2a2be0171d741ad03 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Mon, 4 Sep 2017 20:04:42 -0300 Subject: Some bugfixes --- Project/Electromechanical.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index f981353..b25a53b 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -72,9 +72,6 @@ class Electromechanical : public ElectricCalculation // tests double m_wError = 0.0; - double m_deltaError = 0.0; - double m_transEdError = 0.0; - double m_transEqError = 0.0; double m_numIt = 0; }; -- cgit