我正在尝试构建自己的6步驱动无刷直流电机。我创建了具有逻辑门选择模块的逆变器和具有梯形反电动势功能的电动机。
但是,在仿真过程中,电动机达到60度电,而不是通过设置逆变器来改变操作区域,而是在求解电动势生成器中的电流方程时使仿真崩溃。
这些是我创建自己的部分;
model EMF3 "Elecromechanical model of Rotor"
parameter Integer p "number of pole pairs";
parameter SI.ElectricalTorqueConstant Kt "Torque constant";
parameter SI.ElectricalTorqueConstant Ke "Voltage constant";
SI.Voltage Ea "Induced emf from rotor - phase a";
SI.Voltage Eb "Induced emf from rotor - phase b";
SI.Voltage Ec "Induced emf from rotor - phase c";
SI.Voltage Vn "Neutral Point Voltage";
SI.AngularVelocity w "rotor angular speed";
Modelica.Electrical.Analog.Interfaces.PositivePin PA annotation(
Placement(visible = true, transformation(origin = {-99.27, 78.9927}, extent = {{-12, -12}, {12, 12}}, rotation = 0), iconTransformation(origin = {-105.27, 60.9927}, extent = {{-12, -12}, {12, 12}}, rotation = 0)));
Modelica.Electrical.Analog.Interfaces.PositivePin PB annotation(
Placement(visible = true, transformation(origin = {-100.686, -0.7299}, extent = {{-12, -12}, {12, 12}}, rotation = 0), iconTransformation(origin = {-104.686, -0.7299}, extent = {{-12, -12}, {12, 12}}, rotation = 0)));
Modelica.Electrical.Analog.Interfaces.PositivePin PC annotation(
Placement(visible = true, transformation(origin = {-100.438, -78.4088}, extent = {{-12, -12}, {12, 12}}, rotation = 0), iconTransformation(origin = {-104.438, -80.4088}, extent = {{-12, -12}, {12, 12}}, rotation = 0)));
Modelica.Mechanics.Rotational.Interfaces.Flange_b FB annotation(
Placement(visible = true, transformation(origin = {101.022, 6.42336}, extent = {{-12, -12}, {12, 12}}, rotation = 0), iconTransformation(origin = {101.022, 0.42336}, extent = {{-12, -12}, {12, 12}}, rotation = 0)));
equation
// Kirchoff Laws
PA.i + PB.i + PC.i = 0;
PA.v = Ea + Vn;
PB.v = Eb + Vn;
PC.v = Ec + Vn;
// Induced elecromotive force from rotor
Ea = Ke * w * ShapeFunc(p * FB.phi);
Eb = Ke * w * ShapeFunc(p * FB.phi - 2/3*pi);
Ec = Ke * w * ShapeFunc(p * FB.phi - 4/3*pi);
// Torque calculation at rotor shaft
w = der(FB.phi);
FB.tau = -Kt/2*(ShapeFunc(p * FB.phi) * PA.i + ShapeFunc(p * FB.phi - 2/3*pi) * PB.i + ShapeFunc(p * FB.phi - 4/3*pi) * PC.i) "negative because generated by rotor";
annotation(
Icon(coordinateSystem(grid = {0.1, 0.1}, initialScale = 0.1), graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {0, -1}, lineColor = {0, 0, 255}, extent = {{-74, 57}, {74, -57}}, textString = "%name")}),
Diagram(coordinateSystem(initialScale = 0.1)));
end EMF3;
function ShapeFunc
extends Modelica.Icons.Function;
input SI.Angle phi_e;
output Real y;
protected SI.Angle phi_e_wrapped;
algorithm
phi_e_wrapped := Modelica.Math.wrapAngle(phi_e,true);
y := if (phi_e_wrapped < 2*pi/3) then 1 else
if (phi_e_wrapped < pi) then 1 - 6/pi*(phi_e_wrapped - 2*pi/3) else
if (phi_e_wrapped < 5*pi/3) then -1 else
if (phi_e_wrapped < 2*pi) then -1 + 6/pi*(phi_e_wrapped - 2*pi/3) else 0;
end ShapeFunc;
model LookUpTable
parameter Integer p "Number of pole pairs";
Modelica.Blocks.Interfaces.RealInput phi annotation(
Placement(visible = true, transformation(origin = {-108, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-108, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Blocks.Interfaces.BooleanOutput S1 annotation(
Placement(visible = true, transformation(origin = {108, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {108, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.BooleanOutput S2 annotation(
Placement(visible = true, transformation(origin = {108, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {108, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.BooleanOutput S3 annotation(
Placement(visible = true, transformation(origin = {108, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {108, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.BooleanOutput S4 annotation(
Placement(visible = true, transformation(origin = {106, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {108, -18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.BooleanOutput S5 annotation(
Placement(visible = true, transformation(origin = {108, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {108, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.BooleanOutput S6 annotation(
Placement(visible = true, transformation(origin = {108, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {108, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
SI.Angle phi_e;
SI.Angle phi_e_wrapped;
equation
phi_e = phi*p;
phi_e_wrapped = Modelica.Math.wrapAngle(phi_e, true);
S1 = if phi_e_wrapped < pi / 3 then true
else if phi_e_wrapped < 2 * pi / 3 then true
else if phi_e_wrapped < pi then false
else if phi_e_wrapped < 4 * pi / 3 then false
else if phi_e_wrapped < 5 * pi / 3 then false
else false;
S2 = if phi_e_wrapped < pi / 3 then false
else if phi_e_wrapped < 2 * pi / 3 then false
else if phi_e_wrapped < pi then true
else if phi_e_wrapped < 4 * pi / 3 then true
else if phi_e_wrapped < 5 * pi / 3 then false
else false;
S3 = if phi_e_wrapped < pi / 3 then false
else if phi_e_wrapped < 2 * pi / 3 then false
else if phi_e_wrapped < pi then false
else if phi_e_wrapped < 4 * pi / 3 then false
else if phi_e_wrapped < 5 * pi / 3 then true
else true;
S4 = if phi_e_wrapped < pi / 3 then false
else if phi_e_wrapped < 2 * pi / 3 then false
else if phi_e_wrapped < pi then false
else if phi_e_wrapped < 4 * pi / 3 then true
else if phi_e_wrapped < 5 * pi / 3 then true
else false;
S5 = if phi_e_wrapped < pi / 3 then true
else if phi_e_wrapped < 2 * pi / 3 then false
else if phi_e_wrapped < pi then false
else if phi_e_wrapped < 4 * pi / 3 then false
else if phi_e_wrapped < 5 * pi / 3 then false
else true;
S6 = if phi_e_wrapped < pi / 3 then false
else if phi_e_wrapped < 2 * pi / 3 then true
else if phi_e_wrapped < pi then true
else if phi_e_wrapped < 4 * pi / 3 then false
else if phi_e_wrapped < 5 * pi / 3 then false
else false;
annotation(
Icon(graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}), Text(origin = {-5, 5}, extent = {{-57, 39}, {57, -39}}, textString = "LogicTable")}));
end LookUpTable;
其余仿真块均来自modelica库(DC / AC逆变器和电机中的R / L连接)
警告:已达到最大迭代次数,但未找到根目录
我会很高兴获得帮助!