Advertisement
Guest User

Untitled

a guest
Nov 4th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 1.39 KB | None | 0 0
  1. clear
  2.  
  3.  // Electric parameters
  4.  Ua = 6;     // [V] Armature voltage
  5.  Ra = 21.2;  // [Ohm] Armature resistance at 22°C
  6.  R = Ra;
  7.  La = 217e-6; // [H] Armature inductance
  8.  kE = 4.1157e-3; // [V/rad/s] Back-EMF const.
  9.  // Mechanical parameters
  10.  kM = 4.12e-3; // [Nm/A] Torque const.
  11.  J = 5.2e-9; // [kgm2] Rotor inertia
  12.  Kf = 2.414e-8; // [Nms] Viscous friction
  13.  Tm = 1.13e-3; // [Nm] Stall torque
  14.  Tl = 0; // [Nm] Load torque
  15.  // Thermal parameters
  16.  Rth1 = 20; // [K/W] Thermal resistance
  17.  Rth2 = 48; // [K/W] Thermal resistance
  18.  alpha = 0.004; // [1/K] Temperature coefficient
  19.  Tamb = 22; // [°C] Ambient temperature
  20.  
  21.  function xdot=DCmotor(t, x)
  22.  
  23.  w = x(1);
  24.  ia = x(2);
  25.  
  26.  ui = kE * w;
  27.  Te = kM * ia;
  28.  Ploss = ia^2 * R;
  29.  dTemp = Ploss * (Rth1 + Rth2);
  30.  R = Ra * (1 + alpha*dTemp);
  31.  Twind = dTemp + Tamb;
  32.  
  33.  xdot(1) = (Te - Tl - Kf*w) / J;
  34.  xdot(2) = (Ua - ui - R*ia) / La;
  35.  
  36.  endfunction
  37.  
  38.  taum = 6.5e-3; // [s] Mechanical time const.
  39.  t = 0 : taum/100 : 10*taum;
  40.  t0 = 0;
  41.  x0 = [0; 0];
  42.  
  43.  x = ode(x0,t0,t,DCmotor);
  44.  
  45.  figure(1)
  46.  plot(t,x(1,:)*60/2/%pi, "linewidth", 3);
  47.  xgrid(5, 1, 7);
  48.  xlabel("time [s]", "fontsize", 3, "color", "blue");
  49.  ylabel("Speed [rpm]", "fontsize", 3, "color", "blue");
  50.  figure(2)
  51.  plot(t,x(2,:), "linewidth", 3);
  52.  xgrid(5, 1, 7);
  53.  xlabel("time [s]", "fontsize", 3, "color", "blue");
  54.  ylabel("Armature current [A]", "fontsize", 3, "color", "blue");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement