From b23a673fbe5cfd322956cdff8ef3472da8e0dbff Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Tue, 7 Nov 2017 21:59:43 -0200 Subject: ZIP load fully implemented Need to save the new data --- Project/Load.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Project/Load.cpp') diff --git a/Project/Load.cpp b/Project/Load.cpp index 64cca31..7d47e5a 100644 --- a/Project/Load.cpp +++ b/Project/Load.cpp @@ -249,3 +249,26 @@ wxString Load::GetTipText() const return tipText; } + +bool Load::GetPlotData(ElementPlotData& plotData) +{ + if(!m_electricalData.plotLoad) return false; + plotData.SetName(m_electricalData.name); + plotData.SetCurveType(ElementPlotData::CT_LOAD); + + std::vector absVoltage, activePower, reactivePower, current; + for(unsigned int i = 0; i < m_electricalData.voltageVector.size(); ++i) { + absVoltage.push_back(std::abs(m_electricalData.voltageVector[i])); + activePower.push_back(std::real(m_electricalData.electricalPowerVector[i])); + reactivePower.push_back(std::imag(m_electricalData.electricalPowerVector[i])); + current.push_back(std::abs(std::complex(activePower[i], -reactivePower[i]) / + std::conj(m_electricalData.voltageVector[i]))); + } + + plotData.AddData(absVoltage, _("Voltage")); + plotData.AddData(activePower, _("Active power")); + plotData.AddData(reactivePower, _("Reactive power")); + plotData.AddData(current, _("Current")); + + return true; +} -- cgit