From f54297e08079fe1954920ca2742b0bed19f86181 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Wed, 10 Jul 2019 14:14:30 -0300 Subject: Induction motor implementation start Machine initialization implemented. It seems that it's working. Check a OMIB with the motor. --- Project/IndMotor.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'Project/IndMotor.cpp') diff --git a/Project/IndMotor.cpp b/Project/IndMotor.cpp index e8008dd..ff5c116 100644 --- a/Project/IndMotor.cpp +++ b/Project/IndMotor.cpp @@ -151,17 +151,47 @@ rapidxml::xml_node<>* IndMotor::SaveElement(rapidxml::xml_document<>& doc, rapid SaveCADProperties(doc, elementNode); // Element properties + // General auto electricalProp = XMLParser::AppendNode(doc, elementNode, "ElectricalProperties"); auto isOnline = XMLParser::AppendNode(doc, electricalProp, "IsOnline"); XMLParser::SetNodeValue(doc, isOnline, m_online); auto name = XMLParser::AppendNode(doc, electricalProp, "Name"); XMLParser::SetNodeValue(doc, name, m_electricalData.name); + auto ratedPower = XMLParser::AppendNode(doc, electricalProp, "RatedPower"); + XMLParser::SetNodeValue(doc, ratedPower, m_electricalData.ratedPower); + XMLParser::SetNodeAttribute(doc, ratedPower, "UnitID", m_electricalData.activePowerUnit); auto activePower = XMLParser::AppendNode(doc, electricalProp, "ActivePower"); XMLParser::SetNodeValue(doc, activePower, m_electricalData.activePower); XMLParser::SetNodeAttribute(doc, activePower, "UnitID", m_electricalData.activePowerUnit); auto reactivePower = XMLParser::AppendNode(doc, electricalProp, "ReactivePower"); XMLParser::SetNodeValue(doc, reactivePower, m_electricalData.reactivePower); XMLParser::SetNodeAttribute(doc, reactivePower, "UnitID", m_electricalData.reactivePowerUnit); + auto useMachineBase = XMLParser::AppendNode(doc, electricalProp, "UseMachineBase"); + XMLParser::SetNodeValue(doc, useMachineBase, m_electricalData.useMachinePowerAsBase); + + // Stability + auto stability = XMLParser::AppendNode(doc, electricalProp, "Stability"); + auto inertia = XMLParser::AppendNode(doc, stability, "Inertia"); + XMLParser::SetNodeValue(doc, inertia, m_electricalData.inertia); + auto r1 = XMLParser::AppendNode(doc, stability, "StatorResistence"); + XMLParser::SetNodeValue(doc, r1, m_electricalData.r1); + auto x1 = XMLParser::AppendNode(doc, stability, "StatorReactance"); + XMLParser::SetNodeValue(doc, x1, m_electricalData.x1); + auto r2 = XMLParser::AppendNode(doc, stability, "RotorResistence"); + XMLParser::SetNodeValue(doc, r2, m_electricalData.r2); + auto x2 = XMLParser::AppendNode(doc, stability, "RotorReactance"); + XMLParser::SetNodeValue(doc, x2, m_electricalData.x2); + auto xm = XMLParser::AppendNode(doc, stability, "MagnetizingReactance"); + XMLParser::SetNodeValue(doc, xm, m_electricalData.xm); + auto loadChar = XMLParser::AppendNode(doc, stability, "LoadCharacteristic"); + auto aw = XMLParser::AppendNode(doc, loadChar, "Constant"); + XMLParser::SetNodeValue(doc, aw, m_electricalData.aw); + auto bw = XMLParser::AppendNode(doc, loadChar, "Linear"); + XMLParser::SetNodeValue(doc, bw, m_electricalData.bw); + auto cw = XMLParser::AppendNode(doc, loadChar, "Quadratic"); + XMLParser::SetNodeValue(doc, cw, m_electricalData.cw); + + SaveSwitchingData(doc, electricalProp); return elementNode; } @@ -176,12 +206,29 @@ bool IndMotor::OpenElement(rapidxml::xml_node<>* elementNode, std::vectorfirst_node("Name")->value(); + m_electricalData.ratedPower = XMLParser::GetNodeValueDouble(electricalProp, "RatedPower"); + m_electricalData.ratedPowerUnit = + static_cast(XMLParser::GetAttributeValueInt(electricalProp, "RatedPower", "UnitID")); m_electricalData.activePower = XMLParser::GetNodeValueDouble(electricalProp, "ActivePower"); m_electricalData.activePowerUnit = static_cast(XMLParser::GetAttributeValueInt(electricalProp, "ActivePower", "UnitID")); m_electricalData.reactivePower = XMLParser::GetNodeValueDouble(electricalProp, "ReactivePower"); m_electricalData.reactivePowerUnit = static_cast(XMLParser::GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID")); + m_electricalData.useMachinePowerAsBase = XMLParser::GetNodeValueInt(electricalProp, "UseMachineBase"); + + // Stability + auto stability = electricalProp->first_node("Stability"); + m_electricalData.inertia = XMLParser::GetNodeValueDouble(stability, "Inertia"); + m_electricalData.r1 = XMLParser::GetNodeValueDouble(stability, "StatorResistence"); + m_electricalData.x1 = XMLParser::GetNodeValueDouble(stability, "StatorReactance"); + m_electricalData.r2 = XMLParser::GetNodeValueDouble(stability, "RotorResistence"); + m_electricalData.x2 = XMLParser::GetNodeValueDouble(stability, "RotorReactance"); + m_electricalData.xm = XMLParser::GetNodeValueDouble(stability, "MagnetizingReactance"); + auto loadChar = stability->first_node("LoadCharacteristic"); + m_electricalData.aw = XMLParser::GetNodeValueDouble(loadChar, "Constant"); + m_electricalData.bw = XMLParser::GetNodeValueDouble(loadChar, "Linear"); + m_electricalData.cw = XMLParser::GetNodeValueDouble(loadChar, "Quadratic"); m_inserted = true; -- cgit From ec20e2ac95f8a5013f2293a7a2a96016fb805581 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Thu, 11 Jul 2019 18:06:08 -0300 Subject: Induction motor DAE implemented Need some testing Check inertia --- Project/IndMotor.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Project/IndMotor.cpp') diff --git a/Project/IndMotor.cpp b/Project/IndMotor.cpp index ff5c116..93dc38c 100644 --- a/Project/IndMotor.cpp +++ b/Project/IndMotor.cpp @@ -234,3 +234,15 @@ bool IndMotor::OpenElement(rapidxml::xml_node<>* elementNode, std::vector Date: Fri, 12 Jul 2019 02:03:28 -0300 Subject: Motor start implemented and bugfixes --- Project/IndMotor.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Project/IndMotor.cpp') diff --git a/Project/IndMotor.cpp b/Project/IndMotor.cpp index 93dc38c..8d84608 100644 --- a/Project/IndMotor.cpp +++ b/Project/IndMotor.cpp @@ -229,6 +229,9 @@ bool IndMotor::OpenElement(rapidxml::xml_node<>* elementNode, std::vector Date: Sat, 13 Jul 2019 01:14:14 -0300 Subject: Multiple motor initialization implemented --- Project/IndMotor.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'Project/IndMotor.cpp') diff --git a/Project/IndMotor.cpp b/Project/IndMotor.cpp index 8d84608..13e9b4d 100644 --- a/Project/IndMotor.cpp +++ b/Project/IndMotor.cpp @@ -171,6 +171,8 @@ rapidxml::xml_node<>* IndMotor::SaveElement(rapidxml::xml_document<>& doc, rapid // Stability auto stability = XMLParser::AppendNode(doc, electricalProp, "Stability"); + auto plotMotor = XMLParser::AppendNode(doc, stability, "PlotIndMachine"); + XMLParser::SetNodeValue(doc, plotMotor, m_electricalData.plotIndMachine); auto inertia = XMLParser::AppendNode(doc, stability, "Inertia"); XMLParser::SetNodeValue(doc, inertia, m_electricalData.inertia); auto r1 = XMLParser::AppendNode(doc, stability, "StatorResistence"); @@ -183,6 +185,10 @@ rapidxml::xml_node<>* IndMotor::SaveElement(rapidxml::xml_document<>& doc, rapid XMLParser::SetNodeValue(doc, x2, m_electricalData.x2); auto xm = XMLParser::AppendNode(doc, stability, "MagnetizingReactance"); XMLParser::SetNodeValue(doc, xm, m_electricalData.xm); + auto useCageFactor = XMLParser::AppendNode(doc, stability, "UseCageFactor"); + XMLParser::SetNodeValue(doc, useCageFactor, m_electricalData.useKf); + auto cageFactor = XMLParser::AppendNode(doc, stability, "CageFactor"); + XMLParser::SetNodeValue(doc, cageFactor, m_electricalData.kf); auto loadChar = XMLParser::AppendNode(doc, stability, "LoadCharacteristic"); auto aw = XMLParser::AppendNode(doc, loadChar, "Constant"); XMLParser::SetNodeValue(doc, aw, m_electricalData.aw); @@ -219,17 +225,20 @@ bool IndMotor::OpenElement(rapidxml::xml_node<>* elementNode, std::vectorfirst_node("Stability"); - m_electricalData.inertia = XMLParser::GetNodeValueDouble(stability, "Inertia"); + m_electricalData.plotIndMachine = XMLParser::GetNodeValueInt(stability, "Inertia"); + m_electricalData.inertia = XMLParser::GetNodeValueDouble(stability, "PlotIndMachine"); m_electricalData.r1 = XMLParser::GetNodeValueDouble(stability, "StatorResistence"); m_electricalData.x1 = XMLParser::GetNodeValueDouble(stability, "StatorReactance"); m_electricalData.r2 = XMLParser::GetNodeValueDouble(stability, "RotorResistence"); m_electricalData.x2 = XMLParser::GetNodeValueDouble(stability, "RotorReactance"); m_electricalData.xm = XMLParser::GetNodeValueDouble(stability, "MagnetizingReactance"); + m_electricalData.useKf = XMLParser::GetNodeValueInt(stability, "UseCageFactor"); + m_electricalData.kf = XMLParser::GetNodeValueDouble(stability, "CageFactor"); auto loadChar = stability->first_node("LoadCharacteristic"); m_electricalData.aw = XMLParser::GetNodeValueDouble(loadChar, "Constant"); m_electricalData.bw = XMLParser::GetNodeValueDouble(loadChar, "Linear"); m_electricalData.cw = XMLParser::GetNodeValueDouble(loadChar, "Quadratic"); - + if(!OpenSwitchingData(electricalProp)) return false; if(m_swData.swTime.size() != 0) SetDynamicEvent(true); @@ -244,10 +253,13 @@ bool IndMotor::GetPlotData(ElementPlotData& plotData, PlotStudy study) plotData.SetName(m_electricalData.name); plotData.SetCurveType(ElementPlotData::CT_IND_MOTOR); - plotData.AddData(m_electricalData.slipVector, _("Slip")); + plotData.AddData(m_electricalData.terminalVoltageVector, _("Terminal voltage")); + plotData.AddData(m_electricalData.activePowerVector, _("Active power")); + plotData.AddData(m_electricalData.reactivePowerVector, _("Reactive power")); + plotData.AddData(m_electricalData.currentVector, _("Current")); plotData.AddData(m_electricalData.electricalTorqueVector, _("Electrical torque")); plotData.AddData(m_electricalData.mechanicalTorqueVector, _("Mechanical torque")); - plotData.AddData(m_electricalData.velocityVector, _("Velocity")); - plotData.AddData(m_electricalData.currentVector, _("Current")); + plotData.AddData(m_electricalData.velocityVector, _("Speed")); + plotData.AddData(m_electricalData.slipVector, _("Slip")); return true; } -- cgit