《机电传动控制》——直流电机调速仿真作业

通过将原有直流电机调速例子运行之后 可以看到电流的稳定性不好,到达稳定的时间较长,超调量较大,稳态误差不够小,震荡明显。

原有的Controller只有比例控制,很粗糙,当增益较低时,稳态误差较大,当增益变大时,会引起电机电流和加速度的振荡。

经过考虑决定用PID调节,三个调节参数为比例调节Kp,积分调节Ki,微分调节Kd

Kp增大会减小电流值达到稳定的时间,但会增大超调量,降低系统稳定性;

Ki消除稳态误差,但会降低系统稳定性,减慢动态响应;

Kd能减小超调量,减小调节时间;

最终选择参数为Kp=7.5 Ki=0.1 Kd=45

最终得到的电机电流与电机速度变化曲线如下:

可见超调量为Mp=7.69%   Tp=0.0195s,比较理想。

完整代码:

type ElectricPotential = Real;

type ElectricCurrent = Real(quantity = "ElectricCurrent", unit = "A");

type Resistance = Real(quantity = "Resistance", unit = "Ohm", min = 0);

type Inductance = Real(quantity = "Inductance", unit = "H", min = 0);

type Voltage = ElectricPotential;

type Current = ElectricCurrent;

type Force = Real(quantity = "Force", unit = "N");

type Angle = Real(quantity = "Angle", unit = "rad", displayUnit = "deg");

type Torque = Real(quantity = "Torque", unit = "N.m");

type AngularVelocity = Real(quantity = "AngularVelocity", unit = "rad/s", displayUnit = "rev/min");

type AngularAcceleration = Real(quantity = "AngularAcceleration", unit = "rad/s2");

type MomentOfInertia = Real(quantity = "MomentOfInertia", unit = "kg.m2");

type Time = Real (final quantity="Time", final unit="s");

connector RotFlange_a "1D rotational flange (filled square)"

Angle phi "Absolute rotational angle of flange";

flow Torque tau "Torque in the flange";

end RotFlange_a; //From Modelica.Mechanical.Rotational.Interfaces

connector RotFlange_b "1D rotational flange (filled square)"

Angle phi "Absolute rotational angle of flange";

flow Torque tau "Torque in the flange";

end RotFlange_b; //From Modelica.Mechanical.Rotational.Interfaces

connector Pin "Pin of an electrical component"

Voltage v "Potential at the pin";

flow Current i "Current flowing into the pin";

end Pin; //From Modelica.Electrical.Analog.Interfaces

connector PositivePin "Positive pin of an electrical component"

Voltage v "Potential at the pin";

flow Current i "Current flowing into the pin";

end PositivePin; //From Modelica.Electrical.Analog.Interfaces

connector NegativePin "Negative pin of an electrical component"

Voltage v "Potential at the pin";

flow Current i "Current flowing into the pin";

end NegativePin; //From Modelica.Electrical.Analog.Interfaces

connector InPort "Connector with input signals of type Real"

partial model Rigid // Rotational class Rigid

"Base class for the rigid connection of two rotational 1D flanges"

Angle phi "Absolute rotation angle of component";

RotFlange_a rotFlange_a "(left) driving flange (axis directed into plane)";

RotFlange_b rotFlange_b "(right) driven flange (axis directed out of plane)";

equation

rotFlange_a.phi = phi;

rotFlange_b.phi = phi;

end Rigid; // From Modelica.Mechanics.Rotational.Interfaces

model Inertia "1D rotational component with inertia"

extends Rigid;

parameter MomentOfInertia J = 1 "Moment of inertia";

AngularVelocity w "Absolute angular velocity of component";

AngularAcceleration a "Absolute angular acceleration of component";

equation

w = der(phi);

a = der(w);

J*a = rotFlange_a.tau + rotFlange_b.tau;

end Inertia; //From Modelica.Mechanics.Rotational

partial model TwoPin // Same as OnePort in Modelica.Electrical.Analog.Interfaces

"Component with two electrical pins p and n and current i from p to n"

Voltage v "Voltage drop between the two pins (= p.v - n.v)";

Current i "Current flowing from pin p to pin n";

PositivePin p;

NegativePin n;

equation

v = p.v - n.v;

0 = p.i + n.i;

i = p.i;

end TwoPin;

model DCMotor "DC Motor"

extends TwoPin;

extends Rigid;

OutPort SensorVelocity(n=1);

OutPort SensorCurrent(n=1);

parameter MomentOfInertia J"Total Inertia";

parameter Resistance R"Armature Resistance";

parameter Inductance L"Armature Inductance";

parameter Real Kt"Torque Constant";

parameter Real Ke"EMF Constant";

AngularVelocity w "Angular velocity of motor";

AngularAcceleration a "Absolute angular acceleration of motor";

Torque tau_motor;

RotFlange_b rotFlange_b; // Rotational Flange_b

equation

w = der(rotFlange_b.phi);

a = der(w);

v = R*i+Ke*w+L*der(i);

tau_motor = Kt*i;

J*a = tau_motor + rotFlange_b.tau;

SensorVelocity.signal[1] = w;

SensorCurrent.signal[1] = i;

end DCMotor;

class Resistor "Ideal linear electrical Resistor"

extends TwoPin; // Same as OnePort

parameter Real R(unit = "Ohm") "Resistance";

equation

R*i = v;

end Resistor; // From Modelica.Electrical.Analog.Basic

class Inductor "Ideal linear electrical Inductor"

extends TwoPin; // Same as OnePort

parameter Real L(unit = "H") "Inductance";

equation

v = L*der(i);

end Inductor; // From Modelica.Electrical.Analog.Basic

class Ground "Ground node"

Pin p;

equation

p.v = 0;

end Ground; // From Modelica.Electrical.Analog.Basic

model PWMVoltageSource

extends TwoPin;

InPort Command(n=1);

parameter Time T = 0.003;

parameter Voltage Vin = 200;

equation

T*der(v)+ v = Vin*Command.signal[1]/10;

end PWMVoltageSource;

block Controller

InPort command(n=1);

InPort feedback(n=1);

OutPort outPort(n=1);

Real error;

Real error_i;

Real error_d;

Real pout;

parameter Real Kp=7.5;

parameter Real Ki=0.1;

parameter Real Kd=45;

parameter Real Max_Output_Pos = 10;

parameter Real Max_Output_Neg = -10;

algorithm

error := command.signal[1] - feedback.signal[1];

error_i:=error_i+error;

error_d:=error-pre(error);

pout := Kp * error+Ki*error_i+Kd*error_d;

if pout > Max_Output_Pos then

outPort.signal[1] := Max_Output_Pos;

elseif pout < Max_Output_Neg then

outPort.signal[1] := Max_Output_Neg;

else

outPort.signal[1] := pout;

end if;

end Controller;

block CommandSignalGenerator

OutPort outPort(n=1);

Real acc;

equation

if time <= 1 then

acc =60;

elseif time <3 then

acc = 0;

elseif time <4 then

acc = -60;

else

acc = 0;

end if;

der(outPort.signal[1]) = acc;

end CommandSignalGenerator;

parameter Integer n = 1 "Dimension of signal vector";

input Real signal[n] "Real input signals";

end InPort; // From Modelica.Blocks.Interfaces

connector OutPort "Connector with output signals of type Real"

parameter Integer n = 1 "Dimension of signal vector";

output Real signal[n] "Real output signals";

end OutPort; // From Modelica.Blocks.Interfaces

model DCMotorControlSystem

Ground ground1;

Inertia inertia1(J = 3, w(fixed = true));

DCMotor motor1(J = 1,R = 0.6,L = 0.01,Kt=1.8, Ke= 1.8,rotFlange_b(phi(fixed = true)));

CommandSignalGenerator sg1;

Controller con1;

PWMVoltageSource PowerSource1;

equation

connect(sg1.outPort, con1.command);

connect(con1.feedback, motor1.SensorVelocity);

connect(con1.outPort, PowerSource1.Command);

connect(PowerSource1.p, motor1.p);

connect(motor1.rotFlange_b, inertia1.rotFlange_a);

connect(PowerSource1.n, ground1.p);

connect(ground1.p, motor1.n);

end DCMotorControlSystem;

simulate( DCMotorControlSystem, stopTime=5 )

plot({motor1.i,motor1.w})

时间: 2024-08-27 22:59:26

《机电传动控制》——直流电机调速仿真作业的相关文章

机电传动控制——直流电机调速仿真作业

本次调速仿真采用PID调节.首先要确定PID中的各项设计参数,仿真过程中采用临界比例度法确定了大概的Kp值.在若干次调整的过程中,发现加入微分环节后调整时间略有上升,故采用PI调节.调整参数确定为Kp=75,Ki=22.控制器部分的程序如下图所示.原理图如下 ASR和ACR调节器均使用PI控制器,控制程序如下 电机电流和速度曲线如下图所示 从图中可以看出:电流迅速上升至最大值后不变,然后电机开始匀加速,电流波形明显的改善.电机速度稳定,稳态偏差基本为零.Kp值越大,电流越快上升至最大值,ki值对

机电传动控制——直流电机调速仿真实验

1.直流电机模型 ? 2.PID调节参数的作用: 1.比例系数Kp的作用是加快系统的响应速度,提高系统的调节精度.? 2.积分作用系数Ki的作用是消除系统的稳态误差. 3.微分系数Kd的作用是改善系统的动态特性. ? ? 3. 控制函数controller的编写 调试KP,TI,TD的值 Kp=2.5 ti=1.2 td=0.31 4.仿真结果 上升时间 tp=0.0282 无超调

机电传动——控制直流电机调速

这次的直流调速采用PID的思路来写控制函数Controller,利用输出的瞬间值与预期值之间的偏差作为控制因子,反馈到PID控制器中,从而进一步控制下一个瞬间的输入值,从而使各项参数准确的到达指定值,并且没有超调和波动 首先直流电机基本的参数模型定义如下 model PWMVoltageSource extends TwoPin; InPort Command(n=1); parameter Time T = 0.003; parameter Voltage Vin = 200; equatio

机电传动控制直流电机调速

使用PID控制器,在Cotroller的算法中,使用errori表示误差积分,errord表示误差微分,计算方式为 error := command.signal[1] - feedback.signal[1]; errori:=errori+error; errord:=error-pre(error); pout := Kp * error+Ki*errori+Kd*errord; 调试的步骤为:先调整Kp,将上升时间调到比较低的数值,但是增大Kp使上升时间的同时,超调量会Mp增大,所以下一

机电传动控制直流调速作业

一.仿真测试: 本次作业对直流调速控制器进行设计,预期采用PID控制,控制器设计如下: 其仿真结果如下: 二.对控制器和结果做以下解释: 1.控制器期初限定的10V输出限定对控制结果影响较大,使积分环节对振动的稳定作用变差: 2.微分环节引入反而使电流曲线更为尖锐,过渡曲线不平滑,因此放弃微分环节: 3.结果显示响应较快,但不够平滑,速度曲线变化不大,超调量很小.

直流电机调速仿真作业

这里对之流电机的速度调节使用pid调节的方法,其中pid调节的三个参数及其调节作用如下:       比例调节作用:比例控制是一种最简单的控制方式.其控制器的输出与输入误差信号成比例关系.是按比例反应系统的偏差,系统一旦出现了偏差,比例调节立即产生调节作用用以减少偏差.比例作用大,可以加快调节,减少误差,但是过大的比例,使系统的稳定性下降,甚至造成系统的不稳定.当仅有比例控制时系统输出存在稳态误差(Steady-state error). 积分调节作用:在积分控制中,控制器的输出与输入误差信号的

《机电传动控制》第五周作业

机电传动控制第五周作业 一.传动电机或控制电机在工业或生活中的应用: 1.电气伺服传动领域 在要求速度控制和位置控制(伺服)的场合,特种电机的应用越来越广泛.开关磁阻电动机.永磁无刷直流电动机.步进电动机.永磁交流伺服电动机.永磁直流电动机等都已在数控机床.工业电气自动化.自动生产线.工业机器人以及各种军.民用装备等领域获得了广泛应用.如交流伺服电机驱动系统应用在凹版印刷机中,以其高控制精度实现了极高的同步协调性,使这种印刷设备具有自动化程度高.套准精度高.承印范围大.生产成本低.节约能源.维修

《机电传动控制》第十一周作业(二)

3. 直流电机双闭环调速系统控制仿真 把上述单闭环速度控制系统改为速度环和电流环双闭环控制系统,两个环路都使用PI控制器,先整定电流环参数,再整定速度环参数,获得最佳系统动态响应. 由第2问中的仿真结果可知,电枢电流的稳定值为25A,加在电动机上的电源电压为250V,不妨假设电动机允许的电流最大值为稳定值的2倍,即50A.当电枢电流为50A时,电源电压应为500V左右.所以搭建如下所示的电路来调整电流环的参数: 电流调节器PI内部的结构为: 仿真结果: 由仿真结果可以看出在开始的时候,电流值基本

《机电传动控制》第十一周作业(一)

1直流电机单闭环调速系统比例控制仿真 搭建的电路图: 仿真结果: 角速度稳定值为196.454rad/s,速度稳态误差小于4rad/s. 仿真的时候有个问题: 当把二极管接到电路中时:即电路图如下 进行仿真时:出现如下提示框 说是电源短路,难道是因为电压值超过了二极管的反向电压值,从而导致反向击穿二极管,使得二极管反向导通,从而造成电源短路吗? 2. 直流电机单闭环调速系统比例积分控制仿真 搭建的电路图如下: 仿真结果: 电流最大值为173A,到达稳态的时间为2.125s.