文章目录
- Matlab 仿真——直流电机速度控制(1)直流电机建模
- 1. 物理模型
- 2. 系统方程
- 2.1 转换方程表达
- 2.2 状态空间表达
- 3. 设计要求
- 4. Matlab表达
- 4.1 转换方程表达
- 4.2 状态空间表达
- 5. 引用
Matlab 仿真——直流电机速度控制(1)直流电机建模
该系列我们学习如何对直流电机进行速度控制,第一节我们先分析一个简化的电机模型,并推导它的转换方程和状态空间方程,然后定义我们要实现的速度控制需要达到的性能。
1. 物理模型
一个直流电机模型如下所示:
为了简化讨论,假设转子和转轴都是刚体,转子受到的磁场恒定,转子受到的摩擦为粘性摩擦,即受到的摩擦力与速度成正比。 假设该电机的物理参数为: (J) 转子的转动惯量 0.01 kg.m^2 (b) 电机粘性摩擦常数 0.1 N.m.s (Ke) 电动势常数 0.01 V/rad/sec (Kt) 电机扭矩常数 0.01 N.m/Amp (R ) 电阻 1 Ohm (L) 电感 0.5 H
2. 系统方程
有了物理模型和参数之后,我们开始推导该电机的系统方程。一般情况下直流电机的扭力与电流成正比(磁场恒定),那么我们有:
反电动势与转速成正比:
不失一般性,我们令Kt=Ke,统统用K表示。根据牛顿第二定律和基尔霍夫电压定律得到:
2.1 转换方程表达
对上述两式进行拉氏变换得到:
通过消除电流项得到:
2.2 状态空间表达
我们选择转速和电流作为我们的状态变量得到z状态空间表达:
3. 设计要求
现在我们确定电机的性能参数,并根据参数来设计控制器。首先我们希望它输入1V电压的时候稳定状态下保持0.1 rad/sec的转速,稳定时间2s,稳态误差不超过1%,并且受到阶跃输入干扰的时候超调小于5%。根据以上要求我们总结出以下需求:
- 稳定时间<2s
- 超调<5%
- 稳态误差<1%
4. Matlab表达
接下来我们在Matlab里面表达出该系统
4.1 转换方程表达
<code class="prism language-python has-numbering"><span class="token operator">%</span>motor parameter J <span class="token operator">=</span> <span class="token number">0.01</span><span class="token punctuation">;</span> b <span class="token operator">=</span> <span class="token number">0.1</span><span class="token punctuation">;</span> K <span class="token operator">=</span> <span class="token number">0.01</span><span class="token punctuation">;</span> R <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span> L <span class="token operator">=</span> <span class="token number">0.5</span><span class="token punctuation">;</span> <span class="token operator">%</span>motor tf function s <span class="token operator">=</span> tf<span class="token punctuation">(</span><span class="token string">'s'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> P_motor <span class="token operator">=</span> K<span class="token operator">/</span><span class="token punctuation">(</span><span class="token punctuation">(</span>J<span class="token operator">*</span>s<span class="token operator">+</span>b<span class="token punctuation">)</span><span class="token operator">*</span><span class="token punctuation">(</span>L<span class="token operator">*</span>s<span class="token operator">+</span>R<span class="token punctuation">)</span><span class="token operator">+</span>K<span class="token operator">^</span><span class="token number">2</span><span class="token punctuation">)</span> </code>
输出
4.2 状态空间表达
<code class="prism language-python has-numbering">A <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token operator">-</span>b<span class="token operator">/</span>J K<span class="token operator">/</span>J <span class="token operator">-</span>K<span class="token operator">/</span>L <span class="token operator">-</span>R<span class="token operator">/</span>L<span class="token punctuation">]</span><span class="token punctuation">;</span> B <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">0</span> <span class="token number">1</span><span class="token operator">/</span>L<span class="token punctuation">]</span><span class="token punctuation">;</span> C <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">1</span> <span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span> D <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> motor_ss <span class="token operator">=</span> ss<span class="token punctuation">(</span>A<span class="token punctuation">,</span>B<span class="token punctuation">,</span>C<span class="token punctuation">,</span>D<span class="token punctuation">)</span> </code>
输出
下一节我们用Matlab来分析这个系统。
5. 引用