diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2019-07-18 09:22:27 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-18 09:22:27 -0300 |
commit | 8357c081eb75147bb8f94d8b6e367d88ea3898ed (patch) | |
tree | 9d9726fdcefb917475d6b33344d2b832d4e78ef8 /Project/Bus.cpp | |
parent | 295b775ad53eb1e128b705e6028f9690dc6fa640 (diff) | |
parent | 7f46d390b8cc1d5f37560f52b222198dbc5e1225 (diff) | |
download | PSP.git-8357c081eb75147bb8f94d8b6e367d88ea3898ed.tar.gz PSP.git-8357c081eb75147bb8f94d8b6e367d88ea3898ed.tar.xz PSP.git-8357c081eb75147bb8f94d8b6e367d88ea3898ed.zip |
Merge pull request #50 from Thales1330/wip/induction-motor
Wip/induction motor
Diffstat (limited to 'Project/Bus.cpp')
-rw-r--r-- | Project/Bus.cpp | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/Project/Bus.cpp b/Project/Bus.cpp index eecc06a..5c8c190 100644 --- a/Project/Bus.cpp +++ b/Project/Bus.cpp @@ -239,23 +239,31 @@ wxString Bus::GetTipText() const } tipText += _("\n\nSsc = ") + wxString::FromDouble(std::abs(m_electricalData.scPower), 5) + _(" p.u."); + tipText += _("\n\nTHD = ") + wxString::FromDouble(std::abs(m_electricalData.thd), 5) + wxT("\%"); return tipText; } -bool Bus::GetPlotData(ElementPlotData& plotData) +bool Bus::GetPlotData(ElementPlotData& plotData, PlotStudy study) { - if(!m_electricalData.plotBus) return false; - plotData.SetName(m_electricalData.name); - plotData.SetCurveType(ElementPlotData::CT_BUS); - - std::vector<double> absVoltage, argVoltage; - for(unsigned int i = 0; i < m_electricalData.stabVoltageVector.size(); ++i) { - absVoltage.push_back(std::abs(m_electricalData.stabVoltageVector[i])); - argVoltage.push_back(wxRadToDeg(std::arg(m_electricalData.stabVoltageVector[i]))); + if(study == STABILITY) { + if(!m_electricalData.plotBus) return false; + plotData.SetName(m_electricalData.name); + plotData.SetCurveType(ElementPlotData::CT_BUS); + + std::vector<double> absVoltage, argVoltage; + for(unsigned int i = 0; i < m_electricalData.stabVoltageVector.size(); ++i) { + absVoltage.push_back(std::abs(m_electricalData.stabVoltageVector[i])); + argVoltage.push_back(wxRadToDeg(std::arg(m_electricalData.stabVoltageVector[i]))); + } + plotData.AddData(absVoltage, _("Voltage")); + plotData.AddData(argVoltage, _("Angle")); + } else if(FREQRESPONSE) { + if(!m_electricalData.plotPQData) return false; + plotData.SetName(m_electricalData.name); + plotData.SetCurveType(ElementPlotData::CT_BUS); + plotData.AddData(m_electricalData.absImpedanceVector, _("Impedance")); } - plotData.AddData(absVoltage, _("Voltage")); - plotData.AddData(argVoltage, _("Angle")); return true; } @@ -308,6 +316,10 @@ rapidxml::xml_node<>* Bus::SaveElement(rapidxml::xml_document<>& doc, rapidxml:: auto stabFaultReactance = XMLParser::AppendNode(doc, stability, "FaultReactance"); XMLParser::SetNodeValue(doc, stabFaultReactance, m_electricalData.stabFaultReactance); + auto powerQuality = XMLParser::AppendNode(doc, electricalProp, "PowerQuality"); + auto plotPQData = XMLParser::AppendNode(doc, powerQuality, "Plot"); + XMLParser::SetNodeValue(doc, plotPQData, m_electricalData.plotPQData); + return elementNode; } @@ -341,6 +353,9 @@ bool Bus::OpenElement(rapidxml::xml_node<>* elementNode) m_electricalData.stabFaultResistance = XMLParser::GetNodeValueDouble(stability, "FaultResistance"); m_electricalData.stabFaultReactance = XMLParser::GetNodeValueDouble(stability, "FaultReactance"); + auto powerQuality = electricalProp->first_node("PowerQuality"); + if(powerQuality) m_electricalData.plotPQData = XMLParser::GetNodeValueInt(powerQuality, "Plot"); + if(m_electricalData.stabHasFault) SetDynamicEvent(true); return true; } |