From 46115e4326fc679fe6f1f2c32164b95420e689eb Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Wed, 18 Jan 2017 17:15:35 -0200 Subject: Some doc, class restruct and SC power implemented --- Project/Fault.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Project/Fault.cpp') 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 > > 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; +} -- cgit