From 54cf77fe93d3862d8718c6c85c83cf8f8317e68d Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Sat, 23 Sep 2017 22:10:08 -0300 Subject: Saturation Implemented Finally! The calculations are converging! Need to be tested. --- Project/Electromechanical.h | 46 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index b25a53b..37ea4f2 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -7,6 +7,29 @@ class ControlElementSolver; +/** + * @brief Synchronous machine data for different models + * + * This struct have the parameters and calculated data that depends on each machine model. + */ +struct SyncMachineModelData { + /** Direct-axis reactance (transient for models 1, 2 and 3; subtransient for models 4 and 5) */ + double xd; + /** Quadrature-axis reactance (transient for models 1, 2 and 3; subtransient for models 4 and 5) */ + double xq; + /** Direct-axis internal voltage (transient for models 1, 2 and 3; subtransient for models 4 and 5) */ + double ed; + /** Quadrature-axis internal voltage (transient for models 1, 2 and 3; subtransient for models 4 and 5) */ + double eq; +}; + +/** + * @class Electromechanical + * @author Thales Lima Oliveira + * @date 23/09/2017 + * @file Electromechanical.h + * @brief Calculates the electromechanical transient based on disturbances (e.g. system fault). + */ class Electromechanical : public ElectricCalculation { public: @@ -28,18 +51,32 @@ class Electromechanical : public ElectricCalculation void SetEvent(double currentTime); inline bool EventTrigger(double eventTime, double currentTime); - double GetPowerValue(double value, ElectricalUnit unit); + // double GetPowerValue(double value, ElectricalUnit unit); void InsertSyncMachinesOnYBus(); std::complex GetSyncMachineAdmittance(SyncGenerator* generator); bool InitializeDynamicElements(); - void CalculateMachinesCurrents(); + bool 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); + SyncMachineModelData GetSyncMachineModelData(SyncGenerator* syncMachine); + double CalculateSyncMachineIntVariables(SyncGenerator* syncGenerator, + double id, + double iq, + double sd, + double sq, + double pe, + double k = 1.0); + void CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator, + double& id, + double& iq, + double& sd, + double& sq, + double& pe, + double k = 1.0); void CalculateReferenceSpeed(); + bool CalculateSyncMachineSaturation(SyncGenerator* syncMachine, double k = 1.0); void SaveData(); @@ -64,6 +101,7 @@ class Electromechanical : public ElectricCalculation double m_ctrlTimeStepMultiplier = 0.1; double m_tolerance = 1e-8; int m_maxIterations = 100; + double m_saturationTolerance = 1e-4; std::vector m_eventTimeList; std::vector m_eventOccurrenceList; -- cgit From 5e99db91624cea9308cb296544d81ce1fa4951e5 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Mon, 25 Sep 2017 01:50:23 -0300 Subject: Zero xd bug fixed, some parameters showed The calculation is wrong --- Project/Electromechanical.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 37ea4f2..9de4171 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -44,6 +44,8 @@ class Electromechanical : public ElectricCalculation std::vector m_transEdErrorVector; std::vector m_transEqErrorVector; std::vector m_numItVector; + std::vector m_sdCVector; + std::vector m_sqCVector; protected: void SetEventTimeList(); @@ -110,6 +112,8 @@ class Electromechanical : public ElectricCalculation // tests double m_wError = 0.0; + double m_sdC = 0.0; + double m_sqC = 0.0; double m_numIt = 0; }; -- cgit From 4f2e475b8de0f19c0cda560c3213809cb9c8cfca Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Mon, 25 Sep 2017 19:56:07 -0300 Subject: Saturation calculated by Newton raphson implmeneted Not working yet --- 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 9de4171..4259c0b6 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -70,7 +70,7 @@ class Electromechanical : public ElectricCalculation double sq, double pe, double k = 1.0); - void CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator, + bool CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator, double& id, double& iq, double& sd, @@ -78,7 +78,7 @@ class Electromechanical : public ElectricCalculation double& pe, double k = 1.0); void CalculateReferenceSpeed(); - bool CalculateSyncMachineSaturation(SyncGenerator* syncMachine, double k = 1.0); + bool CalculateSyncMachineSaturation(SyncGenerator* syncMachine, bool updateCurrents = true, double k = 1.0); void SaveData(); -- cgit From 3cd92c1acb9a6fed1067b49cb079e96d98ac35fa Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Thu, 28 Sep 2017 20:11:12 -0300 Subject: Some saturation bugs fixed --- Project/Electromechanical.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index 4259c0b6..3dd239a 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -4,6 +4,7 @@ #include "ElectricCalculation.h" #include +#include class ControlElementSolver; @@ -78,7 +79,13 @@ class Electromechanical : public ElectricCalculation double& pe, double k = 1.0); void CalculateReferenceSpeed(); - bool CalculateSyncMachineSaturation(SyncGenerator* syncMachine, bool updateCurrents = true, double k = 1.0); + bool CalculateSyncMachineSaturation(SyncGenerator* syncMachine, + double& id, + double& iq, + double& sd, + double& sq, + bool updateCurrents = true, + double k = 1.0); void SaveData(); @@ -112,8 +119,8 @@ class Electromechanical : public ElectricCalculation // tests double m_wError = 0.0; - double m_sdC = 0.0; - double m_sqC = 0.0; + double m_sdC = 1.0; + double m_sqC = 1.0; double m_numIt = 0; }; -- cgit From c7c1963fae6f88a55b3f7e4a3f9ea17e964d23d2 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Wed, 4 Oct 2017 21:06:20 -0300 Subject: Saturation fixed in q axis --- 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 3dd239a..cbbb600 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -110,7 +110,7 @@ class Electromechanical : public ElectricCalculation double m_ctrlTimeStepMultiplier = 0.1; double m_tolerance = 1e-8; int m_maxIterations = 100; - double m_saturationTolerance = 1e-4; + double m_saturationTolerance = 1e-8; std::vector m_eventTimeList; std::vector m_eventOccurrenceList; -- cgit From bc5a3e8923cb8efedbbd5b88e212eb0e9009cf87 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Thu, 5 Oct 2017 20:02:59 -0300 Subject: Add copyright on files and documentation update --- Project/Electromechanical.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Project/Electromechanical.h') diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h index cbbb600..1514a53 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef ELECTROMECHANICAL_H #define ELECTROMECHANICAL_H -- cgit From 89befdb9b259d02249876e39ec6fd28860272439 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Fri, 6 Oct 2017 17:06:15 -0300 Subject: A lot of documentation written --- 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 1514a53..bd6784d 100644 --- a/Project/Electromechanical.h +++ b/Project/Electromechanical.h @@ -45,8 +45,8 @@ struct SyncMachineModelData { * @class Electromechanical * @author Thales Lima Oliveira * @date 23/09/2017 - * @file Electromechanical.h * @brief Calculates the electromechanical transient based on disturbances (e.g. system fault). + * @file Electromechanical.h */ class Electromechanical : public ElectricCalculation { -- cgit