📄 sh_ge_se_ex_ode.m
字号:
% 编写建立自激过程微分方程的M—函数
% 将该M—函数定义为sh_ge_se_ex_ode(shunt_generator_self_excited_ode)
function dydt=tongbufadianji(t,y)
% 首先指定全局变量
%global a1 a2 a3 a4 Rf
% 下面输入电机基本数据:
r=.02282,Rfd=.00255,Rkd=.01687,Rkq=.04635;Ufd=24;w=314,Ufd=24,
Laa0=0.616;Laa2=0.285;Mab0=.576;Mab2=.245;Mafd0=.569,Makd0=0.469,Makq0=0.469,Lfd=0.3,Lkd=0.23,Lkq=0.23,Mfkd=0.32;
L=[ -(Laa0+Laa2*cos(2*w*t), -(-Mab0+Mab2*cos(2*(w*t+2*pi/3))), -(-Mab0+Mab2*cos(2*(w*t-2*pi/3))), Mafd0*cos(w*t), Makd0*cos(w*t), -Makq0*sin(w*t);
-(-Mab0+Mab2*cos(2*(w*t+2*pi/3))), -(Laa0+Laa2*cos(2*(w*t-2*pi/3))), -(-Mab0+Mab2*cos(2*(w*t))), Mafd0*cos(w*t-2*pi/3)), Makd0*cos(w*t-2*pi/3)), -Makq0*sin(w*t-2*pi/3));
-(-Mab0+Mab2*cos(2*(w*t-2*pi/3))), -(-Mab0+Mab2*cos(2*(w*t))), -(Laa0+Laa2*cos(2*(w*t+2*pi/3))), Mafd0*cos(w*t+2*pi/3)), Makd0*cos(w*t+2*pi/3)), -Makq0*sin(w*t+2*pi/3));
-Mafd0*cos(w*t), -Mafd0*cos(w*t-2*pi/3), -Mafd0*cos(w*t+2*pi/3), Lfd, Mfkd, 0;
-Makd0*cos(w*t), -Makd0*cos(w*t-2*pi/3), -Makd0*cos(w*t+2*pi/3), Mfkd, Lkd, 0;
Makq0*sin(w*t), Makq0*sin(w*t-2*pi/3), Makq0*sin(w*t+2*pi/3), 0, 0, Lkq]
G=[ 2*Laa2*sin(2*w*t), 2*Mab2*sin(2*(w*t+2*pi/3))), 2*Mab2*sin(2*(w*t-2*pi/3))), -Mafd0*sin(w*t), -Makd0*sin(w*t), -Makq0*cos(w*t);
2*Mab2*sin(2*(w*t+2*pi/3))), 2*Laa2*sin(2*(w*t-2*pi/3))), 2*Mab2*sin(2*(w*t))), -Mafd0*sin(w*t-2*pi/3)), -Makd0*sin(w*t-2*pi/3)), -Makq0*cos(w*t-2*pi/3));
2*Mab2*sin(2*(w*t-2*pi/3))), 2*Mab2*sin(2*(w*t))), 2*Laa2*sin(2*(w*t+2*pi/3))), -Mafd0*sin(w*t+2*pi/3)), -Makd0*sin(w*t+2*pi/3)), -Makq0*cos(w*t+2*pi/3));
Mafd0*sin(w*t), Mafd0*sin(w*t-2*pi/3), Mafd0*sin(w*t+2*pi/3), 0, 0, 0;
Makd0*sin(w*t), Makd0*sin(w*t-2*pi/3), Makd0*sin(w*t+2*pi/3), 0, 0, 0;
Makq0*cos(w*t), Makq0*cos(w*t-2*pi/3), Makq0*cos(w*t+2*pi/3), 0, 0, 0]
% 下面进行曲线拟合:
R=[-r, 0, 0, 0, 0, 0;
0, -r, 0, 0, 0, 0;
0, 0, -r, 0, 0, 0;
0, 0, 0, Rfd, 0, 0;
0, 0, 0, 0, Rkd, 0;
0, 0, 0, 0, 0, Rkq]
Uabc=[0,0,0,Ufd,0,0];
dydt=inv(L)*Uabc+w*inv(L)*G*y-inv(L)*R*y;
function fangzhen
%RIGIDODE Euler equations of a rigid body without external forces
tspan = [0 200];
y0 = [0;1;0;0;0;0;0];
% Solve the problem using ode45
[t,y]=ode45('tongbufadianji',tspan,y0);
%ic=cos(t+2*pi/3).*y(:,1)-sin(t+2*pi/3).*y(:,2);
plot(t,y(:,5))
% 下面列写标准形式微分方程并将感应电势用励磁电流的拟合多项式函数表示:
% 这里的a(1)、a(2)、a(3)、a(4)是指上一步的多项式拟合系数a(i)
dydt=[1/Lf*(a(1)*iff^3+a(2)*iff^2+a(3)*iff^1+a(4))-Rf/Lf*iff];
% 给全局变量赋值
a1=a(1);a2=a(2);a3=a(3);a4=a(4);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -