diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2017-01-18 17:15:35 -0200 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2017-01-18 17:15:35 -0200 |
commit | 46115e4326fc679fe6f1f2c32164b95420e689eb (patch) | |
tree | c5c60bad223bd8e3c97252b31ab8ed2b5e3e2a25 /Project/Fault.cpp | |
parent | 44a7475053ea042bfca9cd31998ddb5b16910688 (diff) | |
download | PSP.git-46115e4326fc679fe6f1f2c32164b95420e689eb.tar.gz PSP.git-46115e4326fc679fe6f1f2c32164b95420e689eb.tar.xz PSP.git-46115e4326fc679fe6f1f2c32164b95420e689eb.zip |
Some doc, class restruct and SC power implemented
Diffstat (limited to 'Project/Fault.cpp')
-rw-r--r-- | Project/Fault.cpp | 24 |
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; +} |