diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-11-08 19:24:39 -0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-08 19:24:39 -0200 |
commit | 879830d81c4d01084990e655028b60fd01bcc244 (patch) | |
tree | 5497752183130eeb282506ae2dda7ad196ea2509 /Project/Load.cpp | |
parent | 24808d2de827f219b683ad46744a179ae25bc859 (diff) | |
parent | 3f2f03cc1aac38ad880c0859707b30654a3c935c (diff) | |
download | PSP.git-879830d81c4d01084990e655028b60fd01bcc244.tar.gz PSP.git-879830d81c4d01084990e655028b60fd01bcc244.tar.xz PSP.git-879830d81c4d01084990e655028b60fd01bcc244.zip |
Merge pull request #41 from Thales1330/wip/zip-load
Wip zip load
Diffstat (limited to 'Project/Load.cpp')
-rw-r--r-- | Project/Load.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
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<double> 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<double>(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; +} |