summaryrefslogtreecommitdiffstats
path: root/Project/Fault.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-01-18 17:16:30 -0200
committerGitHub <noreply@github.com>2017-01-18 17:16:30 -0200
commit69131a727782090ffd7cb467f449e8f26d3d2949 (patch)
treec5c60bad223bd8e3c97252b31ab8ed2b5e3e2a25 /Project/Fault.cpp
parent58148f1ebe5be64231965ca76ae13e4690528e55 (diff)
parent46115e4326fc679fe6f1f2c32164b95420e689eb (diff)
downloadPSP.git-69131a727782090ffd7cb467f449e8f26d3d2949.tar.gz
PSP.git-69131a727782090ffd7cb467f449e8f26d3d2949.tar.xz
PSP.git-69131a727782090ffd7cb467f449e8f26d3d2949.zip
Merge pull request #25 from Thales1330/bugfix/data-100117
Bugfix data 100117
Diffstat (limited to 'Project/Fault.cpp')
-rw-r--r--Project/Fault.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/Project/Fault.cpp b/Project/Fault.cpp
index 77ff6de..725a3ec 100644
--- a/Project/Fault.cpp
+++ b/Project/Fault.cpp
@@ -371,3 +371,27 @@ void Fault::UpdateElementsFault(double systemPowerBase)
}
}
}
+
+bool Fault::RunSCPowerCalcutation(double systemPowerBase)
+{
+ // Get adimittance matrix.
+ std::vector<std::vector<std::complex<double> > > yBusPos;
+ GetYBus(yBusPos, systemPowerBase, POSITIVE_SEQ, true);
+
+ // Calculate the impedance matrix.
+ if(!InvertMatrix(yBusPos, m_zBusPos)) {
+ m_errorMsg = _("Fail to invert the positive sequence admittance matrix.");
+ return false;
+ }
+
+ // Set the SC power.
+ for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
+ Bus* bus = *it;
+ auto data = bus->GetEletricalData();
+ int n = data.number;
+ data.scPower = 1.0 / std::abs(m_zBusPos[n][n]);
+ bus->SetElectricalData(data);
+ }
+
+ return true;
+}