1

对于我的一个项目,我用它自己的电流控制器控制一个 BLDC 电机。

为了设计电机控制器,我为流动函数安装了一些时间跟踪:

捕捉整个系统的动态,即电机、电流控制器/驱动器和负载。

J是转子惯量,[kg*m^2]

r阻尼常数(线性摩擦)

tau是扭矩常数 [Nm/A]

u[t]当前输入

der(der(phi))是角加速度

der(phi)角速度

拟合值表示整个系统对于电机、负载和电机的电流控制器/驱动器的“连续”近似来说已经足够好了。在控制方案中,我给出了一个以安培为单位的信号 u(t),我期望一个扭矩和一个角速度作为输出。当时我只需要角速度,但我离题了,这种方法效果非常好,但在数学中进行了拟合和设计。

我想在 modelica 中构建一个更大、更复杂的机器人系统(特别是 Systemmodeler,但是,modelica library 3.2.x),但是我遇到了一些问题。

我的第一次尝试是:

在此处输入图像描述

但是,当使用另一个外部负载(外部模型)进行模拟时,我遇到了很多问题,一些比我更有经验的人告诉我,这种建模形式是“单向”而不是“modelica 方法”,而是更多的simulink形式。

也就是说,它应该是双向的,而不仅仅是数字输出,以便正确地与多体外部模型做出反应,这将连接到。

我的第二次尝试是:

在此处输入图像描述

当连接到我更大的多体模型时,它确实更像预期的那样工作,当施加外部扭矩/负载时,这个模型会产生反应。然而,当模拟这个模型以查看它与纯块模型相比的公平性时,它们无论如何都不相同。我不得不花费大量时间尝试拟合惯性和摩擦数据以获得相似的结果。

所以我的问题是,什么是最好的方法,将纯块模型(数学模型)或至少,我的纯块模型,变成一个更现实的模型,或者至少,将连接输出变成更现实,或者我猜是“非正式”的.

我不想使用我的第二次尝试,因为与我的第一个模型相比,我不能相信与块相比我必须调整的值实际上是正确的,因为它们不适合真实世界数据的值。

4

1 回答 1

5

一般很难回答。基本上,您需要了解哪个模型对应于您要建模的系统/方程的哪个部分,然后将它们组合起来以产生相同的整体行为。

原始模型/方程式似乎包括(如果我误解了方程式,请纠正我):

  1. 对应的惯性J * dot(dot(phi))
  2. 对应的线性摩擦模型r * dot(phi)
  3. 输入产生的扭矩乘以常数(在这种情况下可能是扭矩常数乘以输入电流),对应于tau * u(t)

如果您不了解组件,我认为除了花时间理解 Modelica 代码或至少每个组件的文档之外别无他法。

我将使用以下组件来描述行为

  1. Modelica.Mechanics.Rotational.Components.Inertia
  2. Modelica.Mechanics.Rotational.Components.Damper
  3. 这可以通过结合Modelica.Blocks.Math.GainModelica.Mechanics.Rotational.Sources.Torque

结果是: 信号控制电机

作为扩展,我建议使用物理量(电流)作为输入。这可以通过将模型更改为:

电流控制马达

使用两个更有意义的组件(第一条评论中要求的电阻和电感)扩展模型会导致:

直流电机

注意:该模型实际上是一个 3~ 电机的 1~ 表示。我认为终端电阻/电感的参数应该仍然有效,但我强烈建议通过计算空载运行和标称负载下的速度来验证模型。

如果您需要生成上述屏幕截图的代码(使用 MSL 4.0.0):

package MotorExamples
  model SignalControlledMotor
    extends Modelica.Electrical.Machines.Icons.Machine;

    parameter Real k "Gain value multiplied with input signal";
    parameter Modelica.Units.SI.Inertia J "Moment of inertia";
    parameter Modelica.Units.SI.RotationalDampingConstant d "Damping constant";

    Modelica.Blocks.Interfaces.RealInput u(final unit="A")
      annotation (Placement(transformation(extent={{-140,-20},{-100,20}}), iconTransformation(extent={{-140,-20},{-100,20}})));
    Modelica.Blocks.Math.Gain gain(k=k)
      annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
    Modelica.Mechanics.Rotational.Sources.Torque torque
      annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
    Modelica.Mechanics.Rotational.Components.Inertia inertia(J=J)
      annotation (Placement(transformation(extent={{0,-10},{20,10}})));
    Modelica.Mechanics.Rotational.Components.Damper damper(d=d)
      annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=270,
          origin={60,-30})));
    Modelica.Mechanics.Rotational.Interfaces.Flange_a flange "Mechanical flange of motor"
      annotation (Placement(transformation(extent={{90,-10},{110,10}})));
    Modelica.Mechanics.Rotational.Components.Fixed fixed
      annotation (Placement(transformation(extent={{50,-70},{70,-50}})));

  equation 
    connect(gain.u, u) annotation (Line(points={{-82,0},{-120,0}}, color={0,0,127}));
    connect(torque.tau, gain.y) annotation (Line(points={{-42,0},{-59,0}}, color={0,0,127}));
    connect(inertia.flange_a, torque.flange) annotation (Line(points={{0,0},{-20,0}}, color={0,0,0}));
    connect(inertia.flange_b, damper.flange_a) annotation (Line(points={{20,0},{60,0},{60,-20}},
                                                                                        color={0,0,0}));
    connect(damper.flange_a, flange) annotation (Line(points={{60,-20},{60,0},{100,0}},
                                                                               color={0,0,0}));
    connect(damper.flange_b, fixed.flange) annotation (Line(points={{60,-40},{60,-60}}, color={0,0,0}));
    annotation (Icon(graphics={Line(points={{-60,0},{-100,0}}, color={0,0,0})}));
  end SignalControlledMotor;

  model CurrentControlledMotor
    extends Modelica.Electrical.Machines.Icons.Machine;

    parameter Modelica.Units.SI.ElectricalTorqueConstant k "Transformation coefficient";
    parameter Modelica.Units.SI.Inertia J "Moment of inertia";
    parameter Modelica.Units.SI.RotationalDampingConstant d "Damping constant";

    Modelica.Units.SI.Voltage v = p.v - n.v "Terminal voltage";

    Modelica.Electrical.Analog.Basic.RotationalEMF
                                                 emf(k=k)
      annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
    Modelica.Mechanics.Rotational.Components.Inertia inertia(J=J)
      annotation (Placement(transformation(extent={{0,-10},{20,10}})));
    Modelica.Mechanics.Rotational.Components.Damper damper(d=d)
      annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=270,
          origin={60,-30})));
    Modelica.Mechanics.Rotational.Interfaces.Flange_a flange "Mechanical flange of motor"
      annotation (Placement(transformation(extent={{90,-10},{110,10}})));
    Modelica.Mechanics.Rotational.Components.Fixed fixed
      annotation (Placement(transformation(extent={{50,-70},{70,-50}})));

    Modelica.Electrical.Analog.Interfaces.PositivePin p "Positive electrical pin"
      annotation (Placement(transformation(extent={{-110,50},{-90,70}})));
    Modelica.Electrical.Analog.Interfaces.NegativePin n "Negative electrical pin"
      annotation (Placement(transformation(extent={{-110,-70},{-90,-50}})));
  equation 
    connect(inertia.flange_a, emf.flange) annotation (Line(points={{0,0},{-20,0}}, color={0,0,0}));
    connect(inertia.flange_b, damper.flange_a) annotation (Line(points={{20,0},{60,0},{60,-20}},
                                                                                        color={0,0,0}));
    connect(damper.flange_a, flange) annotation (Line(points={{60,-20},{60,0},{100,0}},
                                                                               color={0,0,0}));
    connect(damper.flange_b, fixed.flange) annotation (Line(points={{60,-40},{60,-60}}, color={0,0,0}));
    connect(emf.p, p) annotation (Line(points={{-30,10},{-30,60},{-100,60}}, color={0,0,255}));
    connect(emf.n, n) annotation (Line(points={{-30,-10},{-30,-60},{-100,-60}}, color={0,0,255}));
    annotation (                                 Icon(graphics={Line(points={{-60,40},{-80,40},{-80,60},{-100,60}},
                                                                                                color={28,108,200}),
                                                                Line(points={{-60,-40},{-80,-40},{-80,-60},{-100,-60}},
                                                                                                color={28,108,200})}));
  end CurrentControlledMotor;

  model DC_Motor
    extends Modelica.Electrical.Machines.Icons.Machine;

    parameter Modelica.Units.SI.ElectricalTorqueConstant k "Transformation coefficient";
    parameter Modelica.Units.SI.Resistance R "Terminal Resistance";
    parameter Modelica.Units.SI.Inductance L "Terminal Inductance";
    parameter Modelica.Units.SI.Inertia J "Moment of inertia";
    parameter Modelica.Units.SI.RotationalDampingConstant d "Damping constant";

    Modelica.Units.SI.Voltage v = p.v - n.v "Terminal voltage";

    Modelica.Electrical.Analog.Basic.RotationalEMF
                                                 emf(k=k)
      annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
    Modelica.Mechanics.Rotational.Components.Inertia inertia(J=J)
      annotation (Placement(transformation(extent={{30,-10},{50,10}})));
    Modelica.Mechanics.Rotational.Components.Damper damper(d=d)
      annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=270,
          origin={70,-30})));
    Modelica.Mechanics.Rotational.Interfaces.Flange_a flange "Mechanical flange of motor"
      annotation (Placement(transformation(extent={{90,-10},{110,10}})));
    Modelica.Mechanics.Rotational.Components.Fixed fixed
      annotation (Placement(transformation(extent={{60,-70},{80,-50}})));

    Modelica.Electrical.Analog.Interfaces.PositivePin p "Positive electrical pin"
      annotation (Placement(transformation(extent={{-110,50},{-90,70}})));
    Modelica.Electrical.Analog.Interfaces.NegativePin n "Negative electrical pin"
      annotation (Placement(transformation(extent={{-110,-70},{-90,-50}})));
    Modelica.Electrical.Analog.Basic.Resistor resistor(R=R) annotation (Placement(transformation(extent={{-80,50},{-60,70}})));
    Modelica.Electrical.Analog.Basic.Inductor inductor(L=L) annotation (Placement(transformation(extent={{-40,50},{-20,70}})));
  equation 
    connect(inertia.flange_a, emf.flange) annotation (Line(points={{30,0},{10,0}}, color={0,0,0}));
    connect(inertia.flange_b, damper.flange_a) annotation (Line(points={{50,0},{70,0},{70,-20}},
                                                                                        color={0,0,0}));
    connect(damper.flange_a, flange) annotation (Line(points={{70,-20},{70,0},{100,0}},
                                                                               color={0,0,0}));
    connect(damper.flange_b, fixed.flange) annotation (Line(points={{70,-40},{70,-60}}, color={0,0,0}));
    connect(emf.n, n) annotation (Line(points={{0,-10},{0,-60},{-100,-60}},     color={0,0,255}));
    connect(resistor.p, p) annotation (Line(points={{-80,60},{-100,60}}, color={0,0,255}));
    connect(emf.p, inductor.n) annotation (Line(points={{0,10},{0,60},{-20,60}}, color={0,0,255}));
    connect(inductor.p, resistor.n) annotation (Line(points={{-40,60},{-60,60}}, color={0,0,255}));
    annotation (                                 Icon(graphics={Line(points={{-60,40},{-80,40},{-80,60},{-100,60}},
                                                                                                color={28,108,200}),
                                                                Line(points={{-60,-40},{-80,-40},{-80,-60},{-100,-60}},
                                                                                                color={28,108,200})}));
  end DC_Motor;

  model Test
    extends Modelica.Icons.Example;
    MotorExamples.SignalControlledMotor signalControlledMotor(
      k=1,
      J=0.1,
      d=1) annotation (Placement(transformation(extent={{-12,70},{8,90}})));
    Modelica.Blocks.Sources.Step step(height=10, startTime=0.1) annotation (Placement(transformation(extent={{-90,70},{-70,90}})));
    CurrentControlledMotor currentControlledMotor(
      k=1,
      J=0.1,
      d=1) annotation (Placement(transformation(extent={{-12,-10},{8,10}})));
    Modelica.Electrical.Analog.Sources.SignalCurrent signalCurrent
      annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=0,
          origin={-40,6})));
    Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-70,-28},{-50,-6}})));
    DC_Motor               dC_Motor(
      k=1,
      R=1.39,
      L=0.572e-3,
      J=0.1,
      d=1) annotation (Placement(transformation(extent={{-12,-76},{8,-56}})));
    Modelica.Electrical.Analog.Sources.SignalCurrent signalCurrentDC
      annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=0,
          origin={-40,-60})));
    Modelica.Electrical.Analog.Basic.Ground ground1
                                                   annotation (Placement(transformation(extent={{-70,-94},{-50,-72}})));
    Modelica.Blocks.Continuous.FirstOrder firstOrder(T=1e-3) annotation (Placement(transformation(extent={{-60,74},{-48,86}})));
  equation 
    connect(signalCurrent.n, currentControlledMotor.p) annotation (Line(points={{-30,6},{-12,6}},     color={0,0,255}));
    connect(signalCurrent.p, currentControlledMotor.n)
      annotation (Line(points={{-50,6},{-60,6},{-60,-6},{-12,-6}},       color={0,0,255}));
    connect(signalCurrent.p, ground.p) annotation (Line(points={{-50,6},{-60,6},{-60,-6}},      color={0,0,255}));
    connect(signalCurrentDC.p, dC_Motor.n) annotation (Line(points={{-50,-60},{-60,-60},{-60,-72},{-12,-72}}, color={0,0,255}));
    connect(signalCurrentDC.p, ground1.p) annotation (Line(points={{-50,-60},{-60,-60},{-60,-72}}, color={0,0,255}));
    connect(signalCurrentDC.n, dC_Motor.p) annotation (Line(points={{-30,-60},{-12,-60}}, color={0,0,255}));
    connect(step.y, firstOrder.u) annotation (Line(points={{-69,80},{-61.2,80}}, color={0,0,127}));
    connect(firstOrder.y, signalControlledMotor.u) annotation (Line(points={{-47.4,80},{-14,80}}, color={0,0,127}));
    connect(firstOrder.y, signalCurrent.i) annotation (Line(points={{-47.4,80},{-40,80},{-40,18}}, color={0,0,127}));
    connect(firstOrder.y, signalCurrentDC.i)
      annotation (Line(points={{-47.4,80},{-40,80},{-40,40},{-80,40},{-80,-40},{-40,-40},{-40,-48}}, color={0,0,127}));
    annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)));
  end Test;
  annotation (uses(Modelica(version="4.0.0")));
end MotorExamples;
于 2021-05-13T06:29:12.037 回答