summaryrefslogtreecommitdiffstats
path: root/Project/Electromechanical.h
diff options
context:
space:
mode:
Diffstat (limited to 'Project/Electromechanical.h')
-rw-r--r--Project/Electromechanical.h74
1 files changed, 70 insertions, 4 deletions
diff --git a/Project/Electromechanical.h b/Project/Electromechanical.h
index b25a53b..bd6784d 100644
--- a/Project/Electromechanical.h
+++ b/Project/Electromechanical.h
@@ -1,12 +1,53 @@
+/*
+ * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
+ *
+ * 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 <https://www.gnu.org/licenses/>.
+ */
+
#ifndef ELECTROMECHANICAL_H
#define ELECTROMECHANICAL_H
#include "ElectricCalculation.h"
#include <wx/progdlg.h>
+#include <wx/log.h>
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 <thales@ufu.br>
+ * @date 23/09/2017
+ * @brief Calculates the electromechanical transient based on disturbances (e.g. system fault).
+ * @file Electromechanical.h
+ */
class Electromechanical : public ElectricCalculation
{
public:
@@ -21,6 +62,8 @@ class Electromechanical : public ElectricCalculation
std::vector<double> m_transEdErrorVector;
std::vector<double> m_transEqErrorVector;
std::vector<double> m_numItVector;
+ std::vector<double> m_sdCVector;
+ std::vector<double> m_sqCVector;
protected:
void SetEventTimeList();
@@ -28,18 +71,38 @@ 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<double> 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);
+ bool CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator,
+ double& id,
+ double& iq,
+ double& sd,
+ double& sq,
+ double& pe,
+ double k = 1.0);
void CalculateReferenceSpeed();
+ bool CalculateSyncMachineSaturation(SyncGenerator* syncMachine,
+ double& id,
+ double& iq,
+ double& sd,
+ double& sq,
+ bool updateCurrents = true,
+ double k = 1.0);
void SaveData();
@@ -64,6 +127,7 @@ class Electromechanical : public ElectricCalculation
double m_ctrlTimeStepMultiplier = 0.1;
double m_tolerance = 1e-8;
int m_maxIterations = 100;
+ double m_saturationTolerance = 1e-8;
std::vector<double> m_eventTimeList;
std::vector<bool> m_eventOccurrenceList;
@@ -72,6 +136,8 @@ class Electromechanical : public ElectricCalculation
// tests
double m_wError = 0.0;
+ double m_sdC = 1.0;
+ double m_sqC = 1.0;
double m_numIt = 0;
};