3周《机电传动控制》学习笔记
1 model motor1 "An DC Motor Model" 2 type Voltage=Real(unit="V"); 3 type Current=Real(unit="A"); 4 type Resistance=Real(unit="Ohm"); 5 type Speed=Real(unit="r/min"); 6 type Torque=Real(unit="N.m"); 7 type Inertia=Real(unit="kg.m^2"); 8 9 Torque Tm"Torque of the Motor"; 10 Speed n"Speed of the Motor"; 11 Current i"Armature Current"; 12 Voltage u"Voltage Source"; 13 Resistance R_ad"External Resistance"; 14 parameter Real J = 1"Total Inertia"; 15 parameter Real R = 0.6"Armature Resistance"; 16 parameter Real Kt = 1.8"Torque Constant"; 17 parameter Real Ke = 0.189"EMF Constant"; 18 parameter Real Tl = 29.2"Load Torque"; 19 20 21 equation 22 23 Tm-Tl = J * der(n) * 6.28 / 60; 24 Tm= Kt * i; 25 u= i * (R+R_ad) + Ke * n; 26 27 if time <= 0.1 then 28 u = 0; 29 else 30 u = 240; 31 end if; 32 33 if n<=634.9 then 34 R_ad=4.33; 35 elseif n<=952.4 then 36 R_ad=1.87; 37 elseif n<=1111.1 then 38 R_ad=0.63; 39 else 40 R_ad=0; 41 end if; 42 43 end motor1;