021-64886750

  • 实时目标机

    Simulink模型库

    Demo套件

info@yisuworld.com

永磁同步电机控制系统仿真系列文章——永磁同步电机模型(3)

网站首页    技术blog和使用技巧    永磁同步电机控制系统仿真系列文章——永磁同步电机模型(3)

上一篇内容:

1)基本永磁同步电机模型(Basic PMSM Model,以下简称B_PMSM_M)的数学模型

2B_PMSM_M的Simulink实现。

3)常用的离散化解算方法。

4)使用后向欧拉法解算B_PMSM_M的电流方程。

关于整个系统文章的内容请参考第一篇文章:

永磁同步电机控制系统仿真系列文章1

这一篇主要讨论的内容包括:变步长与定步长,对比PMSM模型在各种解算方法精度,在定步长仿真时如何选择解算方法和确定仿真步长。

 

——变步长与定步长——

 

我们不在理论方面讨论这个概念,而是重点讲清楚,在Simulink中进行电力电子仿真时变步长与定步长的差别。

 

Simulink工具箱Specialized Power System(原来名称SimPowerSystem)是大家进行电力电子仿真最常用的建模工具之一,其帮助文件中有一段关于连续积分算法的描述

https://ww2.mathworks.cn/help/physmod/sps/powersys/ug/simulating-with-continuous-integration-algorithms.html

 

Simulink® software provides a variety of solvers. Most of the variable-step solvers work well with linear circuits. However circuits containing nonlinear models, especially circuits with circuit breakers and power electronics, require stiff solvers.

Best accuracy and fastest simulation speed is usually achieved with ode23tb.

“Simulink®软件提供多种解算器。大多数的变步长解算器都能很好地处理线性电路。然而,包含非线性模型的电路,特别是带有断路器和电力电子元件的电路,需要刚性解算器。

使用ode23tb通常可以获得最佳精度和最快的模拟速度。

 

因此ode23tb是一种很适合电力电子系统仿真的解算器。但是Specialized Power System帮助文件中有一段关于变步长和定步长方法的描述:

https://ww2.mathworks.cn/help/physmod/sps/powersys/ug/choosing-an-integration-method.html?s_tid=srchtitle

 

One important feature of Simscape™ Electrical™ Specialized Power Systems software is its ability to simulate electrical systems either with continuous variable-step integration algorithms or with a fixed-step using a discretized system. For small size systems, the continuous method is usually more accurate. Variable-step algorithms are also faster because the number of steps is fewer than with a fixed-step method giving comparable accuracy. When using line-commutated power electronics, the variable-step, event-sensitive algorithms detect the zero crossings of currents in diodes and thyristors with a high accuracy so that you do not observe any current chopping. However, for large systems (containing either a large number of states or nonlinear blocks), the drawback of the continuous method is that its extreme accuracy slows down the simulation. In such cases, it is advantageous to discretize your system.

You can consider small size a system that contains fewer than 50 electrical states and fewer than 25 electronic switches. Circuit breakers do not affect the speed much, because these devices are operated only a couple of times during a test.

“Simscape™ Electrical™ Specialized Power Systems软件的一个重要特征是指它能够用连续变步长积分算法或使用离散化系统以定步长仿真电力系统的能力。对于小规模系统,连续方法通常更精确。考虑可比的精度,变步长算法的速度更快,因为变步长的步数比定步长方法要少。当使用换流电力电子器件时,变步长和事件敏感算法可以高精度地检测二极管和晶闸管中电流的过零点,因此您不会观察到任何截流。然而,对于大型系统(包含大量的状态或非线性模块),连续方法的缺点是其极高的精度降低了仿真速度。在这种情况下,将系统离散化是有利的。

你可以考虑小规模的系统,它包含少于50个电气状态和少于25个电子开关。断路器对速度的影响不大,因为这些器件在试验过程中只运行几次。

 

总结这两段话,基本的意思就是,小规模系统(少于50个电气状态和少于25个电子开关)使用连续变步长方式,推荐ode23tb解算器。系统规模较大推荐定步长方式,那么选择怎么样的解算方法和步长呢,Specialized Power System帮助文件中有一段关于这个问题的描述

https://ww2.mathworks.cn/help/physmod/sps/powersys/ug/simulating-discretized-electrical-systems.html

 

To perform a discrete simulation, open the powergui block and set Simulation type to Discrete, and specify the sample time. The electrical system is discretized using the Tustin/Backward Euler (TBE) method. This method combines the Tustin method and the Backward Euler method. It allows you to simulate snubberless diode and thyristor converters. It eliminates numerical oscillations seen with the Tustin method and provides better accuracy than the Backward Euler method.

The TBE discretization method combines the accuracy of the Tustin method and the numerical oscillation damping property of the Backward-Euler method. It allows you to simulate power electronic circuits with virtually no snubber, using purely resistive snubbers with a very large resistance value resulting in negligible leakage currents.

The precision of the simulation is controlled by the time step that you choose for the discretization. Usually sample times of 20 µs to 50 µs give good results for simulation of switching transients on 50 Hz or 60 Hz power systems or on systems using line-commutated power electronic devices such as diodes and thyristors. Systems using forced-commutated power electronic switches are usually operating at high switching frequencies and require smaller sample times. For example, simulating a pulse-width-modulated (PWM) inverter operating at 5 kHz requires a maximum time step of 1 µs.

Even if you discretize your electric circuit, you can still use a continuous control system. However, the simulation speed is improved by use of a discrete control system.

通过这段话我们知道,tustin方法准确更高,后向欧拉方法稳定性更好。仿真精密度与仿步长相关,50Hz或者60Hz的电力系统推荐20 µs ~ 50 µs的仿真步长,5kHzPWM逆变器推荐1µs因此对于电力电子系统,仿真频率是PWM开关频率的200倍。此外根据笔者的经验,除了开关频率之外,死区时间也是确定仿真步长需要考虑的重要因素这个问题我们会在后面的内容讨论。

总之,由于变步长不适用于实时仿真,并且当仿真规模较大时仿真速度较慢,因此一般选择定步长仿真。为保证仿真精度,对于电力电子系统,仿真步长是PWM开关周期的1/200

 

 

——PMSM模型各种解算方法的结果对比——

 

搭建Simulink仿真模型如下,图中B_PMSM_M_Continuous模块为B_PMSM_M模型的连续方式,可以参考第一篇文章“永磁同步电机控制系统仿真系列文章——永磁同步电机模型(1”。B_PMSM_M的内容可以参考第二篇文章“永磁同步电机控制系统仿真系列文章——永磁同步电机模型(2”。

 

img1

 

点击Simulink的左侧模型的图标img2,选择Colors,在右侧可以看到,这个模型有Continuous的部分,也有Discrete的部分。其他的还有ConstantMultrate(多速率)的部分。红色为B_PMSM_M的离散模型,黄色部分为多速率的仿真模型,连续的PMSM模型就包含在其内部。连续的部分Solver(解算器)选择Fixed-stepode8,其仿真结果作为的基准值。关于多速率的内容在后续的内容中会详细讲解。

 

img3

 

B_PMSM_M的电机参数如下:

表1        Parameters for Basic PMSM Model

NO.

Name

Unit

Description

Value

 

Const_Ld

[H]

Stator inductance in direct axis Lsd

0.13189e-3

 

Const_Lq

[H]

Stator inductance in quadrature axis Lsq

0.36850e-3

 

Const_Psi

[Wb]

Flux induced by magnet Psi

0.05968

 

Const_Rs

[Ohm]

Stator resistance Rs

0.02141

 

Const_PolePairs

[]

Number of pole pairs

4

 

仿真的输入条件:

表2        In ports

NO.

Name

Unit

Description

Value

 

v_Stator[a;b;c]

[V]

Motor voltage [a;b;c]

35

 

omegaa_mach

[rad|s]

Mechanical angle speed of the motor

100*2*π

 

theta_mach

[rad]

Mechanical angle of the motor

0~2π

 

T_step

[s]

Step time

500μs

 

Reset

[0|1]

Reset the state

0

 

利用SimulinkSimulation Data Inspector工具,记录和分析仿真波形如下:

img4

500μs步长下输入的电机电压

 

img5

500μs步长下电机的d轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

img6

        500μs步长下电机的q轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

为了更清楚的比较仿真波形查看前0.01sdq波形如下:

 

img7

500μs步长下电机的d轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

img8

500μs步长下电机的q轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

再对比50μs5μs0.5μs步长下的仿真波形:

img9

50μs步长下电机的d轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

img10

50μs步长下电机的q轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

img11

5μs步长下电机的d轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

img12

5μs步长下电机的q轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

img13

0.5μs步长下电机的d轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

img14

0.5μs步长下电机的q轴电流(绿色:连续方式;蓝色:后向欧拉;黄色:后向欧拉,紫色:Tustin

 

此外,再记录四个仿真步长下,d电流在0.030sq电流在0.055s的数值进行对比:

 

表3        d轴电流在0.030s的数值

NO.

Method

500μs

50μs

5μs

0.5μs

 

Continuous(ode8)

-111.2

-242.91

-257.325

-258.7768

 

Forward Euler

-135.0

-247.41

-257.800

-258.8247

 

Backward Euler

-93.5

-238.48

-256.860

-258.7301

 

Tustin

-110.6

-242.89

-257.327

-258.7770

 

表4        q轴电流在0.055s的数值

NO.

Method

500μs

50μs

5μs

0.5μs

 

Continuous(ode8)

44.3

101.54

106.707

107.2324

 

Forward Euler

58.3

103.95

106.944

107.2574

 

Backward Euler

37.2

99.46

106.471

107.2099

 

Tustin

44.5

101.59

109.700

107.2330

 

观察仿真波形和数值结果可知:

1随着仿真步长逐步减少,观察500μs50μs步长下连续仿真d轴电流在0.030s的数值,相差50%以上,观察50μs5μs步长下连续仿真d轴电流在0.030s的数值,相差5.6%以上,5μs与0.5μs步长相差0.56%q轴仿真波形也可以观察出相同的现象,随之仿真步长的少,仿真波形趋于一致,仿真的结果也逐步准确。离散解算方法仿真结果也可以观察出相同的现象因此可以得出结论,对于定步长仿真,不论是连续方式还是离散方式,仿真的步长越小,仿真结果越准确。 

 

2对比三种离散解算方式与连续方式的波形,在仿真步长为500μs50μs,Tustin的仿真波形与连续方式的波形基本一致Backward Euler次之,Forward Euler较差因此对比三种离散解算方法Tustin的仿真精度最好,Backward Euler次之,Forward Euler最差。

 

3)对比三种离散解算方式与连续方式的波形,在仿真步长为5μs0.5μs,仿真波形几乎是一致的,尤其是当仿真步长为0.5μs时,就算是最简单的前向欧拉方法与连续方式ode8的误差也小于0.02%。因此我们在进行实时仿真时,当仿真模型在CPU上运行时,由于CPU的处理能力有限,仿真步长一般为20~50 μs,推荐的使用Tusin法,次选后向欧拉法,前向欧拉法是不可用的。但是当仿真模型在FPGA上运行时,FPGA具备强大的运行能力,仿真步长一般小于0.1μs,前向欧拉法就完全可以满足仿真精度的需求

 

至此关于B_PMSM_M的内容就这些了,下一篇就要讨论饱和永磁同步电机模型(Saturation PMSM Model,简称S_PMSM_M)和谐波永磁同步电机模型(Harmonics PMSM Model,简称H_PMSM_M)。

 

2020年10月15日 16:40
浏览量:0