diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2019-07-24 00:02:49 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-24 00:02:49 -0300 |
commit | 4f434e4a1cccce69e4b680e4734df52244d3a30b (patch) | |
tree | 54886abf6d62d9341377d535e52b36016b602107 /Project/Workspace.cpp | |
parent | 8357c081eb75147bb8f94d8b6e367d88ea3898ed (diff) | |
parent | 0ca6710a7e003952e1212c8e32ebb2e7c008d508 (diff) | |
download | PSP.git-4f434e4a1cccce69e4b680e4734df52244d3a30b.tar.gz PSP.git-4f434e4a1cccce69e4b680e4734df52244d3a30b.tar.xz PSP.git-4f434e4a1cccce69e4b680e4734df52244d3a30b.zip |
Merge pull request #51 from Thales1330/wip/induction-motor
Newton bug fixed
Diffstat (limited to 'Project/Workspace.cpp')
-rw-r--r-- | Project/Workspace.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp index 0bd53fa..b057bdc 100644 --- a/Project/Workspace.cpp +++ b/Project/Workspace.cpp @@ -1134,8 +1134,21 @@ bool Workspace::RunPowerFlow() else if(simProp.basePowerUnit == UNIT_kVA) basePower *= 1e3; PowerFlow pf(GetElementList()); - bool result = pf.RunGaussSeidel(basePower, simProp.powerFlowMaxIterations, simProp.powerFlowTolerance, - simProp.initAngle, simProp.accFator); + bool result = false; + switch(simProp.powerFlowMethod) { + case GAUSS_SEIDEL: { + result = pf.RunGaussSeidel(basePower, simProp.powerFlowMaxIterations, simProp.powerFlowTolerance, + simProp.initAngle, simProp.accFator); + } break; + case NEWTON_RAPHSON: { + result = pf.RunNewtonRaphson(basePower, simProp.powerFlowMaxIterations, simProp.powerFlowTolerance, + simProp.initAngle); + } break; + case GAUSS_NEWTON: { + result = pf.RunGaussNewton(basePower, simProp.powerFlowMaxIterations, simProp.powerFlowTolerance, + simProp.initAngle, simProp.accFator, simProp.gaussTolerance); + } break; + } if(!result) { wxMessageDialog msgDialog(this, pf.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR); msgDialog.ShowModal(); @@ -1547,9 +1560,9 @@ bool Workspace::RunFrequencyResponse() for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) { if(Bus* bus = dynamic_cast<Bus*>(*it)) { busList.push_back(bus); } } - + auto data = m_properties->GetFreqRespData(); - + FrequencyResponseForm frForm(this, busList, data.injBusNumber, data.initFreq, data.finalFreq, data.stepFreq); if(frForm.ShowModal() == wxID_OK) { @@ -1568,7 +1581,8 @@ bool Workspace::RunFrequencyResponse() else if(simProp.basePowerUnit == UNIT_kVA) basePower *= 1e3; PowerQuality pq(GetElementList()); - bool result = pq.CalculateFrequencyResponse(simProp.stabilityFrequency, data.initFreq , data.finalFreq, data.stepFreq, data.injBusNumber, basePower); + bool result = pq.CalculateFrequencyResponse(simProp.stabilityFrequency, data.initFreq, data.finalFreq, + data.stepFreq, data.injBusNumber, basePower); wxMessageDialog msgDialog( this, wxString::Format(_("Calculations done.\nDo you wish to open the frequency response graphics?")), |