Modelica 中的 PI 控制器无法使用逆变器和 PMSM 达到参考值

2024-06-18

我正在尝试调查 Modelica 示例Modelica.Electrical.Machines.Examples.SynchronousInductionMachines.SMPM_VoltageSource但我更换了signalVoltage由逆变器和 PWM 模块组成signalPWM这是基于Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM。因此,我想研究 PWM 调制电压,而不是正弦电压。 问题在于,由于控制器的积分部分,控制器不断线性增加其输出,因为它永远不会达到所需 q 电流的参考值。此外,它还输出奇怪的值voltageController.y[1]在 [24E3,...,150E3] 范围内,这可能是问题所在。

The controller output: enter image description here

and the current output: enter image description here

不幸的是,我不明白为什么控制器在正弦电压下工作得很好,而在 PWM 电压下却不能。

下面是我的主要模型:

model SMPM_INV_SineLoad "Test example: PermanentMagnetSynchronousInductionMachine fed by FOC"
  extends Modelica.Icons.Example;
  import Modelica.Constants.pi;
  constant Integer m = 3 "Number of phases";
  parameter Modelica.SIunits.Frequency f = 8000 "Switching frequency";
  parameter Modelica.SIunits.AngularVelocity wRef = 30 "Desired speed of the PMSM";
  parameter Modelica.SIunits.Current Idq[2] = {0, 10} "Desired d- and q-current";
  parameter Modelica.SIunits.AngularVelocity wNominal = 2 * pi * smpmData.fsNominal / smpmData.p "Nominal speed";
  parameter Modelica.SIunits.Torque TLoad = 5 "Nominal load torque";
  parameter Modelica.SIunits.Inertia JLoad = 0.29 "Load's moment of inertia";
  parameter Modelica.SIunits.Voltage VBat_2 = 100 "Half Battery Voltage";
  Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_PermanentMagnet smpm(phiMechanical(start = 0, fixed = true), wMechanical(start = 0, fixed = true), useSupport = false, useThermalPort = false, p = smpmData.p, fsNominal = smpmData.fsNominal, Rs = smpmData.Rs, TsRef = smpmData.TsRef, Lszero = smpmData.Lszero, Lssigma = smpmData.Lssigma, Jr = smpmData.Jr, Js = smpmData.Js, frictionParameters = smpmData.frictionParameters, statorCoreParameters = smpmData.statorCoreParameters, strayLoadParameters = smpmData.strayLoadParameters, VsOpenCircuit = smpmData.VsOpenCircuit, Lmd = smpmData.Lmd, Lmq = smpmData.Lmq, useDamperCage = smpmData.useDamperCage, Lrsigmad = smpmData.Lrsigmad, Lrsigmaq = smpmData.Lrsigmaq, Rrd = smpmData.Rrd, Rrq = smpmData.Rrq, TrRef = smpmData.TrRef, permanentMagnetLossParameters = smpmData.permanentMagnetLossParameters, TsOperational = 293.15, alpha20s = smpmData.alpha20s, TrOperational = 293.15, alpha20r = smpmData.alpha20r) annotation(Placement(transformation(extent = {{-20, -50}, {0, -30}}, origin = {-0, -10}, rotation = 0), visible = true));
  Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(terminalConnection = "Y") annotation(Placement(transformation(extent = {{-20, -34}, {0, -14}}, origin = {-0, -10}, rotation = 0), visible = true));
  Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {20, -10}), visible = true));
  Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J = JLoad) annotation(Placement(transformation(extent = {{50, -50}, {70, -30}}, origin = {-0, -10}, rotation = 0), visible = true));
  Modelica.Electrical.MultiPhase.Sensors.CurrentSensor currentSensor(m = m) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-10, -10}), visible = true));
  Modelica.Electrical.Machines.Utilities.VoltageController voltageController(p = smpm.p, Ld = smpm.Lssigma + smpm.Lmd, Lq = smpm.Lssigma + smpm.Lmq, Rs = Modelica.Electrical.Machines.Thermal.convertResistance(smpm.Rs, smpm.TsRef, smpm.alpha20s, smpm.TsOperational), fsNominal = smpm.fsNominal, VsOpenCircuit = smpm.VsOpenCircuit) annotation(Placement(transformation(extent = {{-50, 40}, {-30, 60}}, origin = {-0, -10}, rotation = 0), visible = true));
  Modelica.Mechanics.Rotational.Sensors.TorqueSensor torqueSensor annotation(Placement(transformation(extent = {{10, 10}, {-10, -10}}, rotation = 180, origin = {40, -70}), visible = true));
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {50, -10}), visible = true));
  Modelica.Electrical.Machines.Sensors.RotorDisplacementAngle rotorDisplacementAngle(p = smpm.p) annotation(Placement(transformation(origin = {20, -50}, extent = {{-10, 10}, {10, -10}}, rotation = 270), visible = true));
  Modelica.Electrical.Analog.Basic.Ground groundM annotation(Placement(transformation(origin = {-80, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 270), visible = true));
  Modelica.Electrical.MultiPhase.Basic.Star starM(final m = m) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {-60, -20}), visible = true));
  Modelica.Electrical.Machines.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensor annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = 180, origin = {-30, -20}), visible = true));
  parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData smpmData(useDamperCage = false) annotation(Placement(transformation(extent = {{-20, -80}, {0, -60}}, origin = {-0, -10}, rotation = 0), visible = true));
  Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor annotation(Placement(transformation(origin = {-10, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 270), visible = true));
  Modelica.Mechanics.Rotational.Sources.SignTorque signTorque1(tau_constant = -TLoad, w0 = wNominal) annotation(Placement(visible = true, transformation(origin = {90, -50}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant id(k = Idq[1]) annotation(Placement(transformation(extent = {{-90, 60}, {-70, 80}}, origin = {-0, -10}, rotation = 0), visible = true));
  SignalPWM signalPWM1[m](useConstantDutyCycle = false, f = f) annotation(Placement(visible = true, transformation(origin = {22.087, 64.88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.PowerConverters.DCAC.MultiPhase2Level multiPhase2Level1 annotation(Placement(visible = true, transformation(origin = {22.083, 116.565}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Sources.ConstantVoltage U_n(V = VBat_2) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-30, 97.365}), visible = true));
  Modelica.Electrical.Analog.Basic.Ground ground annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {-50, 127.365}), visible = true));
  Modelica.Electrical.Analog.Sources.ConstantVoltage U_p(V = VBat_2) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-30, 137.365}), visible = true));
  Modelica.Blocks.Sources.Constant iq(k = Idq[2]) annotation(Placement(transformation(extent = {{-90, 20}, {-70, 40}}, origin = {0, -10}, rotation = 0), visible = true));
initial equation
  smpm.is[1:2] = zeros(2);
equation
  connect(terminalBox.plug_sn, smpm.plug_sn) annotation(Line(points = {{0, 0}, {0, 0}, {0, 0}}, color = {0, 0, 255}, visible = true, origin = {-16, -40}));
  connect(terminalBox.plug_sp, smpm.plug_sp) annotation(Line(points = {{0, 0}, {0, 0}, {0, 0}}, color = {0, 0, 255}, visible = true, origin = {-4, -40}));
  connect(smpm.flange, angleSensor.flange) annotation(Line(points = {{-6.667, -10}, {3.333, -10}, {3.333, 20}, {13.333, 20}}, visible = true, origin = {6.667, -40}, color = {64, 64, 64}));
  connect(currentSensor.plug_n, terminalBox.plugSupply) annotation(Line(points = {{-10, -10}, {-10, -28}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
  connect(angleSensor.phi, voltageController.phi) annotation(Line(points = {{20, 11}, {20, 34}, {-34, 34}, {-34, 38}}, color = {1, 37, 163}, visible = true, origin = {0, -10}));
  connect(currentSensor.i, voltageController.iActual) annotation(Line(points = {{-21, 0}, {-46, 0}, {-46, 38}}, color = {1, 37, 163}, visible = true, origin = {-0, -10}));
  connect(inertiaLoad.flange_a, torqueSensor.flange_b) annotation(Line(points = {{50, -40}, {50, -60}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
  connect(torqueSensor.flange_a, smpm.flange) annotation(Line(points = {{30, -60}, {30, -40}, {0, -40}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
  connect(speedSensor.flange, smpm.flange) annotation(Line(points = {{23.333, 20}, {13.333, 20}, {13.333, -10}, {-26.667, -10}}, visible = true, origin = {26.667, -40}, color = {64, 64, 64}));
  connect(rotorDisplacementAngle.flange, smpm.flange) annotation(Line(points = {{10, -40}, {0, -40}}, visible = true, origin = {-0, -10}, color = {64, 64, 64}));
  connect(rotorDisplacementAngle.plug_p, smpm.plug_sp) annotation(Line(points = {{14, -30}, {-4, -30}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
  connect(rotorDisplacementAngle.plug_n, smpm.plug_sn) annotation(Line(points = {{26, -30}, {26, -20}, {-16, -20}, {-16, -30}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
  connect(voltageQuasiRMSSensor.plug_p, currentSensor.plug_n) annotation(Line(points = {{-20, -10}, {-10, -10}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
  connect(starM.plug_p, voltageQuasiRMSSensor.plug_n) annotation(Line(points = {{-50, -10}, {-40, -10}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
  connect(groundM.p, starM.pin_n) annotation(Line(points = {{-70, -28}, {-70, -10}}, color = {10, 90, 224}, visible = true, origin = {-0, -10}));
  connect(currentQuasiRMSSensor.plug_n, currentSensor.plug_p) annotation(Line(points = {{0, 0}, {0, 0}, {0, 0}}, color = {0, 0, 255}, visible = true, origin = {-10, 0}));
  connect(inertiaLoad.flange_b, signTorque1.flange) annotation(Line(visible = true, origin = {75, -50}, points = {{-5, 0}, {5, 0}}, color = {64, 64, 64}));
  connect(id.y, voltageController.id_rms) annotation(Line(points = {{-69, 70}, {-60, 70}, {-60, 56}, {-52, 56}}, color = {1, 37, 163}, visible = true, origin = {-0, -10}));
  connect(voltageController.y[1:3], signalPWM1[1:3].dutyCycle) annotation(Line(visible = true, origin = {-16.728, 52.44}, points = {{-12.272, -12.44}, {-7.272, -12.44}, {-7.272, 12.44}, {26.815, 12.44}}, color = {1, 37, 163}));
  connect(ground.p, U_n.p) annotation(Line(visible = true, origin = {-40, 112.78}, points = {{-10, 4.585}, {-10, 4.557}, {10, 4.557}, {10, -5.415}}, color = {10, 90, 224}));
  connect(U_p.n, U_n.p) annotation(Line(visible = true, origin = {-30, 117.365}, points = {{0, 10}, {0, -10}}, color = {10, 90, 224}));
  connect(U_n.n, multiPhase2Level1.dc_n) annotation(Line(visible = true, origin = {-15.583, 93.045}, points = {{-14.417, -5.68}, {-14.417, -10.68}, {0.583, -10.68}, {0.583, 13.52}, {27.666, 13.52}}, color = {10, 90, 224}));
  connect(U_p.p, multiPhase2Level1.dc_p) annotation(Line(visible = true, origin = {-15.583, 141.045}, points = {{-14.417, 6.32}, {-14.417, 11.32}, {0.583, 11.32}, {0.583, -14.48}, {27.666, -14.48}}, color = {10, 90, 224}));
  connect(signalPWM1[1:3].fire, multiPhase2Level1.fire_p[1:3]) annotation(Line(visible = true, origin = {16.085, 85.551}, points = {{0.002, -9.671}, {0.002, -4.671}, {-0.002, -4.671}, {-0.002, 19.014}}, color = {190, 52, 178}));
  connect(signalPWM1[1:3].notFire, multiPhase2Level1.fire_n[1:3]) annotation(Line(visible = true, origin = {28.085, 85.551}, points = {{0.002, -9.671}, {0.002, -4.671}, {-0.002, -4.671}, {-0.002, 19.014}}, color = {190, 52, 178}));
  connect(multiPhase2Level1.ac, currentQuasiRMSSensor.plug_p) annotation(Line(visible = true, origin = {22.417, 66.626}, points = {{9.666, 49.939}, {27.583, 49.939}, {27.583, -26.626}, {-32.417, -26.626}, {-32.417, -46.626}}, color = {10, 90, 224}));
  connect(iq.y, voltageController.iq_rms) annotation(Line(visible = true, origin = {-62.25, 27}, points = {{-6.75, -7}, {-1.75, -7}, {-1.75, 7}, {10.25, 7}}, color = {1, 37, 163}));
  annotation(experiment(StopTime = 2.0, Interval = 0.1), Diagram(coordinateSystem(extent = {{-200, -200}, {200, 200}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {10, 10})), Documentation(info = "<html>
<p>
A synchronous induction machine with permanent magnets accelerates a quadratic speed dependent load from standstill.
The rms values of d- and q-current in rotor fixed coordinate system are controlled by the voltageController,
and the output voltages fed to the machine. The result shows that the torque is influenced by the q-current,
whereas the stator voltage is influenced by the d-current.</p>
<p>
Default machine parameters of model <a href=\"modelica://Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_PermanentMagnet\">SM_PermanentMagnet</a> are used.
</p>
</html>"));
end SMPM_INV_SineLoad;

以及信号PWM模型:

model SignalPWM "Generates a pulse width modulated (PWM) boolean fire signal"
  extends Modelica.Electrical.PowerConverters.Icons.Control;
  parameter Boolean useConstantDutyCycle = true "Enables constant duty cycle";
  parameter Real constantDutyCycle = 0 "Constant duty cycle" annotation(Dialog(enable = useConstantDutyCycle));
  parameter Modelica.SIunits.Frequency f = 1000 "Switching frequency";
  parameter Modelica.SIunits.Time startTime = 0 "Start time";
  Modelica.Blocks.Interfaces.RealInput dutyCycle if not useConstantDutyCycle "Duty cycle" annotation(Placement(transformation(extent = {{-140, -20}, {-100, 20}})));
  Modelica.Blocks.Interfaces.BooleanOutput fire "Firing PWM signal" annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-60, 110})));
  Modelica.Blocks.Interfaces.BooleanOutput notFire "Firing PWM signal" annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {60, 110})));
  Modelica.Blocks.Sources.Constant const(final k = constantDutyCycle) if useConstantDutyCycle annotation(Placement(transformation(extent = {{-100, -60}, {-80, -40}})));
  Modelica.Blocks.Nonlinear.Limiter limiter(uMax = 500000, uMin = -500000) annotation(Placement(transformation(extent = {{-60, -10}, {-40, 10}})));
  Modelica.Blocks.Logical.Less greaterEqual annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, origin = {22, -8})));
  Modelica.Blocks.Discrete.ZeroOrderHold zeroOrderHold(final startTime = startTime, final samplePeriod = 1 / f) annotation(Placement(transformation(extent = {{-30, -10}, {-10, 10}})));
  Modelica.Blocks.Sources.SawTooth sawtooth(final period = 1 / f, final amplitude = 1000000, final nperiod = -1, final offset = -500000, final startTime = startTime) annotation(Placement(transformation(origin = {-50, -50}, extent = {{-10, -10}, {10, 10}})));
  Modelica.Blocks.Logical.Not inverse annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = 90, origin = {52, 20})));
equation
  connect(const.y, limiter.u) annotation(Line(points = {{-79, -50}, {-70, -50}, {-70, 0}, {-62, 0}}, color = {0, 0, 127}));
  connect(dutyCycle, limiter.u) annotation(Line(points = {{-120, 0}, {-62, 0}}, color = {0, 0, 127}));
  connect(limiter.y, zeroOrderHold.u) annotation(Line(points = {{-39, 0}, {-32, 0}}, color = {0, 0, 127}));
  connect(zeroOrderHold.y, greaterEqual.u2) annotation(Line(points = {{-9, 0}, {10, 0}}, color = {0, 0, 127}));
  connect(sawtooth.y, greaterEqual.u1) annotation(Line(points = {{-39, -50}, {0, -50}, {0, -8}, {10, -8}}, color = {0, 0, 127}));
  connect(greaterEqual.y, inverse.u) annotation(Line(points = {{33, -8}, {52, -8}, {52, 8}}, color = {255, 0, 255}));
  connect(greaterEqual.y, fire) annotation(Line(points = {{33, -8}, {36, -8}, {36, 80}, {-60, 80}, {-60, 110}}, color = {255, 0, 255}));
  connect(inverse.y, notFire) annotation(Line(points = {{52, 31}, {52, 80}, {60, 80}, {60, 110}}, color = {255, 0, 255}));
  annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, initialScale = 0.1, grid = {10, 10}), graphics = {Line(visible = true, points = {{-100, 0}, {-98, 0}, {12, 0}}, color = {64, 64, 64}), Line(visible = true, points = {{-60, -22}, {-60, -64}, {44, -64}, {44, -36}}, color = {64, 64, 64}), Line(visible = true, points = {{-80, -16}, {-80, -20}, {-40, 20}, {-40, -20}, {-36, -16}}, color = {64, 64, 64}), Line(visible = true, points = {{-62, 0}, {-76, 4}, {-76, -4}, {-62, 0}}, color = {64, 64, 64}), Line(visible = true, points = {{44, -36}, {44, -36}, {40, -50}, {44, -50}, {48, -50}, {44, -36}}, color = {64, 64, 64}), Line(visible = true, points = {{20, -20}, {22, -20}, {24, -20}, {24, 20}, {44, 20}, {44, -20}, {64, -20}, {64, -16}}, color = {190, 53, 179}), Line(visible = true, points = {{-40, -16}, {-40, -20}, {0, 20}, {0, -20}, {4, -16}}, color = {64, 64, 64}), Line(visible = true, points = {{60, -20}, {62, -20}, {64, -20}, {64, 20}, {84, 20}, {84, -20}, {84, -20}, {88, -20}}, color = {190, 53, 179})}), Documentation(info = "<html>
<p>
This controller can be used both for DC/DC and AC/DC converters.
The signal input of the PWM controller is the duty cycle; the duty cycle is the ratio of the on time
to the switching period. The output firing signal is strictly determined by the actual duty cycle, indicated as <code>d</code> in Fig.&nbsp;1.
</p>

<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
  <caption align=\"bottom\"><b>Fig. 1:</b> Firing (<code>fire</code>) and inverse firing (<code>notFire</code>) signal of PWM control; <code>d</code> = duty cycle; <code>f</code> = switching frequency </caption>
  <tr>
    <td>
      <img src=\"modelica://Modelica/Resources/Images/Electrical/PowerConverters/dutyCycle.png\">
    </td>
  </tr>
</table>

<p>
The firing signal is generated by comparing the sampled duty cycle input with a periodic saw tooth signal [<a href=\"modelica://Modelica.Electrical.PowerConverters.UsersGuide.References\">Williams2006</a>].
</p>
</html>"));
end SignalPWM;

编辑:我已经降低了所需的 q 电流Idq={0,84} Ato Idq={0,10} A和负载TLoad = 120 Nm to TLoad = 5 Nm并仍然从那些疯狂的高电压信号voltageController.

  • 有人可能知道如何解决控制器的问题,以便我获得正确的模拟结果吗?
  • 为什么达不到MSL例子中的参考值? PWM模块有那么大问题吗?
  • 模拟的这种行为让我感到困惑,因为我使用真实的电机和 PWM 控制,并且它在类似的配置下工作得很好。

任何帮助将不胜感激!


原答案

在 ±200V 的电压和 120Nm 的负载下,根本不可能获得所需的电流。

与原始 MSL 示例相反,您使用 120Nm 的符号扭矩作为负载。 如果您在原始 MSL 示例中使用它,您会注意到机器 不断加速并且所需的电压无限制地增长(例如绘图smpm.plug_sp.pin[1].v看到那个)。

在您的示例中,电压限制为 200V。未获得所需电流-53A和84.6A, 但机器仍然产生 127Nm 的扭矩,这让机器加速。 随着速度的增加,对于一定的扭矩/电流需求,所需的电压也会增加 - 但在您的示例中,实际电压是有限的。因此永远不会达到设定电流。

您可以考虑:

  • 增加可用电压
    (但对于当前设置,您需要数千伏的不切实际的高值)
  • 要求较低的电流
    (您可以设置Id无论如何,在 0 上,因为你有一台机器Ld=Lq,所以只有Iq产生扭矩并Id用于弱磁)
  • 让您的电流控制器了解电压限制
    (使用例如Modelica.Blocks.Continuous.LimPID为此,它已经包含了抗饱和功能)

更新答案

问题出在你的 PWM 计算上。 我用原来的例子重建了这个例子SignalPWM来自 MSL 的块和VoltageToDutyCycle成分。

在下面的屏幕截图中,f=14kHz 的新模型的仿真结果与具有理想电压源的 MSL 版本进行了比较。屏幕截图显示了控制器输出(如您的问题)和 Iq。

结果是用下面的包计算的。它包含

  • 所有常见组件和变量的部分模型
  • PWM 和逆变器的示例
  • 理想连续电压源的示例

请注意,如果达到最大电压,我原来的答案中的提示仍然存在。控制器不知道电压限制,这可能导致积分器饱和问题。

package SMPM
  partial model SMPM_base "Test example: PermanentMagnetSynchronousInductionMachine fed by FOC"
    extends Modelica.Icons.Example;
    import Modelica.Constants.pi;
    constant Integer m=3 "Number of phases";
    parameter Modelica.SIunits.Frequency f=14000 "Switching frequency";
    parameter Modelica.SIunits.AngularVelocity wRef=30 "Desired speed of the PMSM";
    parameter Modelica.SIunits.Current Idq[2]={0,10} "Desired d- and q-current";
    parameter Modelica.SIunits.AngularVelocity wNominal=2*pi*smpmData.fsNominal/smpmData.p "Nominal speed";
    parameter Modelica.SIunits.Torque TLoad=5 "Nominal load torque";
    parameter Modelica.SIunits.Inertia JLoad=0.29 "Load's moment of inertia";
    parameter Modelica.SIunits.Voltage VBat_2=100 "Half Battery Voltage";
    final parameter Real Vmax=VBat_2*sqrt(2);
    Modelica.Electrical.Machines.BasicMachines.SynchronousInductionMachines.SM_PermanentMagnet smpm(
      phiMechanical(start=0, fixed=true),
      wMechanical(start=0, fixed=true),
      useSupport=false,
      useThermalPort=false,
      p=smpmData.p,
      fsNominal=smpmData.fsNominal,
      Rs=smpmData.Rs,
      TsRef=smpmData.TsRef,
      Lszero=smpmData.Lszero,
      Lssigma=smpmData.Lssigma,
      Jr=smpmData.Jr,
      Js=smpmData.Js,
      frictionParameters=smpmData.frictionParameters,
      statorCoreParameters=smpmData.statorCoreParameters,
      strayLoadParameters=smpmData.strayLoadParameters,
      VsOpenCircuit=smpmData.VsOpenCircuit,
      Lmd=smpmData.Lmd,
      Lmq=smpmData.Lmq,
      useDamperCage=smpmData.useDamperCage,
      Lrsigmad=smpmData.Lrsigmad,
      Lrsigmaq=smpmData.Lrsigmaq,
      Rrd=smpmData.Rrd,
      Rrq=smpmData.Rrq,
      TrRef=smpmData.TrRef,
      permanentMagnetLossParameters=smpmData.permanentMagnetLossParameters,
      TsOperational=293.15,
      alpha20s=smpmData.alpha20s,
      TrOperational=293.15,
      alpha20r=smpmData.alpha20r) annotation (Placement(transformation(
          extent={{-20,-50},{0,-30}},
          origin={40,-50},
          rotation=0), visible=true));
    Modelica.Electrical.Machines.Utilities.TerminalBox terminalBox(terminalConnection="Y") annotation (Placement(transformation(
          extent={{-20,-34},{0,-14}},
          origin={40,-50},
          rotation=0), visible=true));
    Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=90,
          origin={60,-80}), visible=true));
    Modelica.Mechanics.Rotational.Components.Inertia inertiaLoad(J=JLoad) annotation (Placement(transformation(
          extent={{50,-50},{70,-30}},
          origin={60,-50},
          rotation=0), visible=true));
    Modelica.Electrical.MultiPhase.Sensors.CurrentSensor currentSensor(m=m) annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=270,
          origin={30,-20}), visible=true));
    Modelica.Electrical.Machines.Utilities.VoltageController voltageController(
      p=smpm.p,
      Ld=smpm.Lssigma + smpm.Lmd,
      Lq=smpm.Lssigma + smpm.Lmq,
      Rs=Modelica.Electrical.Machines.Thermal.convertResistance(
          smpm.Rs,
          smpm.TsRef,
          smpm.alpha20s,
          smpm.TsOperational),
      fsNominal=smpm.fsNominal,
      VsOpenCircuit=smpm.VsOpenCircuit) annotation (Placement(transformation(
          extent={{-50,40},{-30,60}},
          origin={-60,-10},
          rotation=0), visible=true));
    Modelica.Mechanics.Rotational.Sensors.MultiSensor multiSensor annotation (Placement(transformation(
          extent={{10,10},{-10,-10}},
          rotation=180,
          origin={90,-90}), visible=true));
    Modelica.Electrical.Analog.Basic.Ground groundM annotation (Placement(transformation(
          origin={-60,-60},
          extent={{-10,-10},{10,10}},
          rotation=270), visible=true));
    Modelica.Electrical.MultiPhase.Basic.Star starM(final m=m) annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=180,
          origin={-30,-60}), visible=true));
    Modelica.Electrical.Machines.Sensors.VoltageQuasiRMSSensor voltageQuasiRMSSensor annotation (Placement(transformation(
          extent={{-10,10},{10,-10}},
          rotation=180,
          origin={-10,-60}), visible=true));
    parameter Modelica.Electrical.Machines.Utilities.ParameterRecords.SM_PermanentMagnetData smpmData(useDamperCage=false)
      annotation (Placement(transformation(extent={{140,100},{160,120}}, rotation=0), visible=true));
    Modelica.Electrical.Machines.Sensors.CurrentQuasiRMSSensor currentQuasiRMSSensor annotation (Placement(transformation(
          origin={30,10},
          extent={{-10,-10},{10,10}},
          rotation=270), visible=true));
    Modelica.Mechanics.Rotational.Sources.SignTorque signTorque1(tau_constant=-TLoad, w0=wNominal) annotation (Placement(visible=true,
          transformation(
          origin={150,-90},
          extent={{10,-10},{-10,10}},
          rotation=0)));
    Modelica.Blocks.Sources.Constant id(k=Idq[1])
      annotation (Placement(transformation(extent={{-160,50},{-140,70}}, rotation=0), visible=true));
    Modelica.Blocks.Sources.Constant iq(k=Idq[2])
      annotation (Placement(transformation(extent={{-160,0},{-140,20}}, rotation=0), visible=true));
    Modelica.Electrical.MultiPhase.Sensors.VoltageSensor voltageSensor annotation (Placement(transformation(
          extent={{-10,10},{10,-10}},
          rotation=180,
          origin={-10,-88}), visible=true));
    Modelica.Blocks.Math.Mean meanVoltage(f=f/4) annotation (Placement(transformation(extent={{-30,-120},{-50,-100}})));
  initial equation 
    smpm.is[1:2] = zeros(2);
  equation 
    connect(terminalBox.plug_sn, smpm.plug_sn)
      annotation (Line(
        points={{24,-80},{24,-80}},
        color={0,0,255}));
    connect(terminalBox.plug_sp, smpm.plug_sp)
      annotation (Line(
        points={{0,0},{0,0}},
        color={0,0,255},
        origin={36,-80}));
    connect(starM.plug_p, voltageQuasiRMSSensor.plug_n)
      annotation (Line(
        points={{-50,-10},{-50,-10}},
        color={10,90,224},
        origin={30,-50}));
    connect(voltageSensor.plug_n, voltageQuasiRMSSensor.plug_n) annotation (Line(points={{-20,-88},{-20,-60}}, color={0,0,255}));
    connect(meanVoltage.u, voltageSensor.v[1]) annotation (Line(points={{-28,-110},{-10,-110},{-10,-98.3333}}, color={0,0,127}));
    connect(angleSensor.flange, smpm.flange) annotation (Line(points={{60,-90},{40,-90}}, color={0,0,0}));
    connect(smpm.flange, multiSensor.flange_a) annotation (Line(points={{40,-90},{80,-90}}, color={0,0,0}));
    connect(voltageController.phi, angleSensor.phi) annotation (Line(points={{-94,28},{-94,-6},{60,-6},{60,-69}}, color={0,0,127}));
    connect(id.y, voltageController.id_rms) annotation (Line(points={{-139,60},{-120,60},{-120,46},{-112,46}}, color={0,0,127}));
    connect(iq.y, voltageController.iq_rms) annotation (Line(points={{-139,10},{-120,10},{-120,34},{-112,34}}, color={0,0,127}));
    connect(voltageController.iActual, currentSensor.i) annotation (Line(points={{-106,28},{-106,-20},{19,-20}}, color={0,0,127}));
    connect(voltageQuasiRMSSensor.plug_p, terminalBox.plugSupply)
      annotation (Line(points={{0,-60},{30,-60},{30,-78}}, color={0,0,255}));
    connect(voltageSensor.plug_p, terminalBox.plugSupply)
      annotation (Line(points={{0,-88},{10,-88},{10,-60},{30,-60},{30,-78}}, color={0,0,255}));
    connect(currentSensor.plug_n, terminalBox.plugSupply) annotation (Line(points={{30,-30},{30,-78}}, color={0,0,255}));
    connect(multiSensor.flange_b, inertiaLoad.flange_a) annotation (Line(points={{100,-90},{110,-90}}, color={0,0,0}));
    connect(inertiaLoad.flange_b, signTorque1.flange) annotation (Line(points={{130,-90},{140,-90}}, color={0,0,0}));
    connect(starM.pin_n, groundM.p) annotation (Line(points={{-40,-60},{-50,-60}}, color={0,0,255}));
    connect(currentQuasiRMSSensor.plug_n, currentSensor.plug_p) annotation (Line(points={{30,0},{30,-10}}, color={0,0,255}));
    annotation (
      experiment(
        StopTime=0.2,
        Interval=0.00001,
        __Dymola_Algorithm="Dassl"),
      Diagram(coordinateSystem(extent={{-180,-140},{180,140}}, preserveAspectRatio=true)));
  end SMPM_base;

  model SMPM_PWM
    extends SMPM_base;
    Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM pwm[m](each useConstantDutyCycle=false, each f=f)
      annotation (Placement(visible=true, transformation(extent={{-20,30},{0,50}},   rotation=0)));
    Modelica.Electrical.PowerConverters.DCAC.MultiPhase2Level multiPhase2Level
      annotation (Placement(visible=true, transformation(extent={{-20,90},{0,110}},   rotation=0)));
    Modelica.Electrical.PowerConverters.DCDC.Control.VoltageToDutyCycle voltageToDutyCycle[3](
      each useBipolarVoltage=true,
      each useConstantMaximumVoltage=true,
      each vMax=VBat_2) annotation (Placement(transformation(extent={{-60,30},{-40,50}})));
    Modelica.Electrical.Analog.Sources.ConstantVoltage U_n(V=VBat_2) annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=270,
          origin={-60,80}), visible=true));
    Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=270,
          origin={-80,100}),  visible=true));
    Modelica.Electrical.Analog.Sources.ConstantVoltage U_p(V=VBat_2) annotation (Placement(transformation(
          extent={{-10,-10},{10,10}},
          rotation=270,
          origin={-60,120}), visible=true));
    Modelica.Blocks.Math.Mean meanIq(f=f/4) annotation (Placement(transformation(extent={{-120,-60},{-140,-40}})));
  equation 
    connect(pwm[1:3].fire,multiPhase2Level. fire_p[1:3]) annotation (Line(
        visible=true,
        origin={-15.915,71.551},
        points={{-0.085,-20.551},{-0.085,17.7823}},
        color={190,52,178}));
    connect(pwm[1:3].notFire,multiPhase2Level. fire_n[1:3]) annotation (Line(
        visible=true,
        origin={-3.915,71.551},
        points={{-0.085,-20.551},{-0.085,17.7823}},
        color={190,52,178}));
    connect(U_p.p,multiPhase2Level. dc_p) annotation (Line(points={{-60,130},{-40,130},{-40,106},{-20,106}}, color={0,0,255}));
    connect(U_n.n,multiPhase2Level. dc_n) annotation (Line(points={{-60,70},{-40,70},{-40,94},{-20,94}}, color={0,0,255}));
    connect(voltageToDutyCycle.dutyCycle,pwm. dutyCycle) annotation (Line(points={{-39,40},{-22,40}}, color={0,0,127}));
    connect(multiPhase2Level.ac, currentQuasiRMSSensor.plug_p)
      annotation (Line(points={{0,100},{30,100},{30,20}},   color={0,0,255}));
    connect(voltageController.y,voltageToDutyCycle. v) annotation (Line(points={{-89,40},{-62,40}}, color={0,0,127}));
    connect(ground.p,U_n. p) annotation (Line(points={{-70,100},{-60,100},{-60,90}}, color={0,0,255}));
    connect(U_p.n,U_n. p) annotation (Line(points={{-60,110},{-60,90}}, color={0,0,255}));
    connect(meanIq.u, currentSensor.i[2]) annotation (Line(points={{-118,-50},{-106,-50},{-106,-20},{19,-20}}, color={0,0,127}));
    annotation (experiment(
        StopTime=0.2,
        Interval=0.00001,
        __Dymola_Algorithm="Dassl"));
  end SMPM_PWM;

  model SMPM_Continuous
    extends SMPM_base;
    Modelica.Electrical.MultiPhase.Basic.Star star(final m=m) annotation (
        Placement(transformation(extent={{10,-10},{-10,10}},
          rotation=270,
          origin={30,70})));
    Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(
          transformation(
          origin={30,100},
          extent={{-10,-10},{10,10}},
          rotation=180)));
    Modelica.Electrical.MultiPhase.Sources.SignalVoltage signalVoltage1(final m=m)
                   annotation (Placement(transformation(
          origin={30,40},
          extent={{10,10},{-10,-10}},
          rotation=270)));
  equation 
    connect(star.pin_n,ground. p)
      annotation (Line(points={{30,80},{30,90}},   color={0,0,255}));
    connect(star.plug_p, signalVoltage1.plug_n) annotation (Line(points={{30,60},{30,50}}, color={0,0,255}));
    connect(signalVoltage1.plug_p, currentQuasiRMSSensor.plug_p) annotation (Line(points={{30,30},{30,20}}, color={0,0,255}));
    connect(voltageController.y, signalVoltage1.v) annotation (Line(points={{-89,40},{18,40}}, color={0,0,127}));

    annotation (
      experiment(StopTime=0.2, __Dymola_Algorithm="Dassl"));
  end SMPM_Continuous;

  annotation(uses(Modelica(version="3.2.3")));
end SMPM;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Modelica 中的 PI 控制器无法使用逆变器和 PMSM 达到参考值 的相关文章

  • 如何在 Openmodelica 中指定介质?

    我正在 Modelica 中模拟热泵热水系统 我附上了我的模特的照片 但是 当我运行模型时 出现错误 Medium 是部分的 部分类中不允许进行名称查找 您能告诉我吗 我该如何指定水箱 热泵冷凝器和管道中的水 我应该如何指定热泵蒸发器中的空
  • 两相 Modelica Media 示例

    我正在尝试在 OpenModelica 中开发具有单一物质 液体或蒸汽 的流动模拟 Modelica Media Water 模型确实有两个阶段 但极其复杂 并且很难用完全不同的物质来重现 我想找到一个我可以使用的两相介质的简单示例 有一个
  • 具有不同采样范围的采样函数的替代方案

    有没有替代方案样本函数在 Openmodelica 中 它接受不属于的参数type parameter 也就是说 替代方案应该允许在模拟期间对可变范围的值进行采样 最终目标是创建一个类 我可以用它来测量模拟过程中真实信号的 RMS 值 RM
  • 如何在 Dymola (Modelica) 中使用 /bigobj 进行编译

    我正在将一个相对较小的有限元 FE 模型集成到 Modelica 中 为此 我创建了一个模型 Modelica 类 它可以读取 Matlab 二进制文件格式的质量 M 和刚度 K 矩阵 我将 FE 模型与 Modelica 标准库 Mode
  • modelica:计算随时间变化的连续变量的最小值/最大值

    如上所述 我希望计算连续变量随时间变化的最小值 和 或最大值 这是一个演示的最小示例 model MinMaxTest Real u Real u min start 10 Real u max start 10 equation u si
  • matlab dymola 连接在一段时间后失败

    我有 mat 文件中的实验数据和用 dymola 编写的模型 我使用 dymolaM m 文件将命令从 matlab 发送到 dymola 这样我就可以使用 matlab 来优化模型的参数 Matlab从 mat文件中读取数据 以正确的方式
  • Modelica 仿真和方程初始化总时间计算

    我想测量 DAE 系统的总模拟和初始化时间 我对挂钟时间感兴趣 就像 Matlab 中函数 tic toc 给出的时间 我注意到在 Modelica 中 模拟时间有不同的标志 但实际上 与我按下模拟按钮到模拟结束所经过的时间 大约用手机时钟
  • 在 OpenModelica 中模拟闭式液压循环

    我想对一个封闭的液压循环进行建模 正如人们可以在 Modelica 标准库 流体 示例 加热系统中找到的那样 对于供暖系统以及我的 简约 示例 我遇到了同样的问题 系统是超定的 在接下来的讲座中 您可以发现加热系统是一个 坏例子 所以我想这
  • FMU FMI模拟,设置某类参数时不修改结果

    我为该示例开发了一个基于 MSL 流体库的简单 Modelica 模型 我将 MassFlowSource 与管道和 Boundary PT 连接为接收器功能 如下图所示 http www casimages com img php i 1
  • 在仿真期间暂停 JModelica 并传递增量输入

    您好 Modelica 社区 我想在 JModelica 中并行运行两个模型 但我不确定如何在模型之间传递变量 一个模型是 python 模型 另一个是 EnergyPlusToFMU 模型 JModelica 文档中的示例具有在模型仿真之
  • 单元测试 Modelica 组件库?

    我正在 Modelica 中创建一个组件库 并且希望获得一些有关对包进行单元测试的技术的意见 到目前为止 我有一个测试包 由一组模型组成 每个组件一个模型 每个测试模型都会实例化一个组件 并将其连接到一些非常简单的帮助器类 这些类提供必要的
  • 不同 Modelica 仿真环境之间有什么区别?

    有不同的 Modelica 仿真环境 包括 Dymola Wolfram SystemModeler OpenModelica 和 Jmodelica 所以 我尝试加载热流体库 ThermoSysProhttps github com Dw
  • 后续问题:Modelica仿真和方程初始化总时间计算

    我正在写这个相关问题this https stackoverflow com questions 61375492 modelica total time calculation of simulation and equation ini
  • 如何将自定义包添加到 Dymola/Modelica 的启动路径中?

    我有一个自定义包 我发现自己在 Dymola 模型中重复使用该包 并且我想将此包放在一个公共目录中 每当我启动 Dymola 时都会自动加载该目录 我当前的策略是在加载我正在处理的模型时加载自定义包 然后保存总计 这并不优雅 因为自定义包的
  • 使用内部/外部传播包

    我想在我的模拟中放置一个 系统 组件 类似于Modelica Fluid System and Modelica Mechanics MultiBody World 所有其他组件都可以从中访问Medium包 以便在整个流程图中仅设置一次工作
  • Dymola、空白和版本控制

    我在 Dymola 中打开了一个 Modelica 库 更改了一行 关闭 Dymola 并单击 全部保存 现在 TortoiseSVN 显示了数百个已更改的文件 而不是仅显示一个文件 其中更改了我想要执行的一行 所有这些变化要么是空格 要么
  • 如何在自定义 Fluid.System 中定义通用介质?

    我正在设计一组用于流体系统建模的自定义组件 由于整个模型中只有一种介质 因此我希望能够在一个地方定义该介质 这system大多数 Modelica Fluid 系统所需的组件无论如何看起来都是一个好地方 我已经尝试了以下 MWE 但我遇到了
  • 如何覆盖默认方程?

    所有派生类都应该从其基类继承一些默认方程 当默认方程对于派生类无效时 应该重新声明它 下面这个简单的例子有点愚蠢 我是否走在实现上述目标的正确轨道上 或者有没有更好的方法用 Modelica 语言来表达这一点 package Pkg par
  • Modelica 中的 PI 控制器无法使用逆变器和 PMSM 达到参考值

    我正在尝试调查 Modelica 示例Modelica Electrical Machines Examples SynchronousInductionMachines SMPM VoltageSource但我更换了signalVolta
  • Dymola/Modelica 中的扩散建模

    我在 Dymola 中建模扩散时遇到问题 我想要有两个独立的体积 充满空气 它们可以连接起来 从而通过扩散交换热量 我的方法是使用 Modelica Fluid 库并使用 Valve 连接两个 ClosedVolume 但正如我发现的 这个

随机推荐