谁能帮我看看异步机的数模 S-函数啊
:@Q 为什么老是又错误啊?哪位大侠行侠仗义啊
帮帮忙呀
急用呀!
多谢多谢啊!
输入是Us,Is,n0,输出是磁链Ψα,Ψβ与转矩Tf
%异步机模型的S-函数
function = ybj(t,x,u,flag)
switch flag,
%Initialization
case 0,
=mdlInitializeSizes;
%Derivatives
case 1,
sys=mdlDerivatives(t,x,u);
%Output
case 3,
sys=mdlOutputs(t,x,u);
%Terminate
case {2,4,9}
sys=[];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
%end sfundsc2
%mdlInitializeSizes
function =mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates= 8;
sizes.NumDiscStates= 0;
sizes.NumOutputs = 5;
sizes.NumInputs = 7;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
x0= zeros(8,1);
str = [];
ts= ;%Sample period of 0.1 seconds(10Hz)
%end mdlInitializeSizes
%function sys=mdlDerivatives(t,x,u,R1,R2,LA,M1,M2,MAa,Rs,Ls,Lr,J,Rw)
function sys=mdlDerivatives(t,x,u)
R1=0.252;
R2=0.332;
p0=2;
LA=0.0816;
M1=0.04;
M2=M1;
MAa=0.08;
Rs=diag();
Ls=;
Lr=Ls;
J=0.075;
Rw=0.0375;
Msr=MAa*;
Mrs=Msr';
L=
K1=inv(L);
%K2=dMrs/dSt
K2=-MAa*;
%K3=dMrs/dt
K3=p0*x(7)*K2;
%K4=dL/dSt
K4=;
%K5=dL/dt
K5=;
A=[-K1*(Rs+K5),zeros(6,1),zeros(6,1);p0*x(1:6)'*K4/(2*J),-Rw/J,0;zeros(1,6),p0,0];
B=;
sys=A*x+B*u;
function sys=mdlOutputs(t,x,u)
MAa=0.08;
p0=2;
K2=-MAa*;
K4=;
sys(1:3)=x(1:3);
sys(4)=30*x(7)/pi;
sys(5)=p0*x(1:6)'*K4*x(1:6)/2;
%end mdloutputs
可以与我即时联系
我的QQ号是303567174寝室电话是0472-6984256
谢谢啊谢谢! 本版面有关于电机的S函数的帖子,自己搜索 出错在什么地方,因为你只给了s函数,单从程序上看没有错啊
页:
[1]