我做的s函数(无刷双馈电机模型),检查了好久,没有错误,可是波形不对
大家帮忙看看,我用s函数写的无刷双馈电机的模型没有错误,但是输出的转速和角速度的波形不对
不知道为什么:@Q
郁闷了好久了
请高手务必帮忙!!在此表示非常的感谢
我把我得模型和参考的文献穿上来
那个.doc的文荡下载下来后把扩展名改为.pdf即可打开
function = BDFM(t,x,u,flag)
%SIMOM Example state-space M-file S-function with internal A,B,C,D matrices
% This S-function implements a system described by state-space equations:
%
% dx/dt = A*x + B*u
% y = C*x + D*u
%
% where x is the state vector, u is vector of inputs, and y is the vector
% of outputs. The matrices, A,B,C,D are embedded into the M-file.
%
% See sfuntmpl.m for a general S-function template.
%
% See also SFUNTMPL.
%电机的数学模型为
%'=-inv(L)**'+inv(L)*';
% uqr=0,udr=0
%R=[Rp 0 0 0 0 0;
% 0 Rp 0 0 0 0;
% 0 0 Rc 0 0 0;
% 0 0 0 Rc 0 0;
% 0 0 0 0 Rr 0;
% 0 0 0 0 0 Rr]
%G=[ 0 Pp*Lsp*w 0 0 0 Pp*Mp*w;
% -Pp*Lsp*w 0 0 0 -Pp*Mp*w 0 ;
% 0 0 0 Pc*Lsc*w 0 Pc*Mc*w;
% 0 0 -Pc*Lsc*w 0 Pc*Mc*w 0] ;
% 0 0 0 0 0 0 ;
% 0 0 0 0 0 0 ]
%L=[ Lsp 0 0 0 Mp 0 ;
% 0 Lsp 0 0 0 Mp;
% 0 0 Lsc 0 -Mc 0 ;
% 0 0 0 Lsc 0 Mc;
% Mp 0 -Mc 0 Lr 0 ;
% 0 Mp 0 Mc 0 Lr]
J=0.03;
Rp=0.81;
Rc=0.81;
Lsp=80e-3;
Lsc=630e-3;
Mp=0.89e-3;
Mc=4.3e-3;
Pp=3;
Pc=1;
Lr=0.04e-3;
Rr=1.57e-3;
TL=15;
switch flag,
%%%%%%%%%%%%%%%%%%
% Initialization %
%%%%%%%%%%%%%%%%%%
case 0
= mdlInitializeSizes;
%%%%%%%%%%%%%%%
% Derivatives %
%%%%%%%%%%%%%%%
case 1,
sys = mdlDerivatives(t,x,u);
%%%%%%%%%%%
% Outputs %
%%%%%%%%%%%
case 3,
sys = mdlOutputs(t,x,u);
%%%%%%%%%%%%%
% Terminate %
%%%%%%%%%%%%%
case{2,4,9}
sys=[]; % Unused flags
otherwise
error(['Unhandled flag=',num2str(flag)]); % Error handling
end
%end simom
%
%=============================================================================
% mdlInitializeSizes
% Return the sizes, initial conditions, and sample times for the S-function.
%=============================================================================
%
function = mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates= 7;% 有iqp, idp, icp ,idc ,iqr, idr,w
sizes.NumDiscStates= 0;
sizes.NumOutputs = 2;%输出有Te,w
sizes.NumInputs = 4;% 输入有uqp ,udp, uqc, udc
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
x0= ;
str = [ ];
ts= ;
% end mdlInitializeSizes
%
%=============================================================================
% mdlDerivatives
% Return the derivatives for the continuous states.
%=============================================================================
%
function sys = mdlDerivatives(t,x,u)
J=0.03;
Rp=0.81;
Rc=0.81;
Lsp=80e-3;
Lsc=630e-3;
Mp=0.89e-3;
Mc=4.3e-3;
Pp=3;
Pc=1;
Lr=0.04e-3;
Rr=1.57e-3;
TL=15;
R=[Rp 0 0 0 0 0;
0 Rp 0 0 0 0;
0 0 Rc 0 0 0;
0 0 0 Rc 0 0;
0 0 0 0 Rr 0;
0 0 0 0 0 Rr];
G=[ 0 Pp*Lsp*x(7) 0 0 0 Pp*Mp*x(7) ;
-Pp*Lsp*x(7) 0 0 0-Pp*Mp*x(7) 0 ;
0 0 0 Pc*Lsc*x(7)0 Pc*Mc*x(7);
0 0-Pc*Lsc*x(7) 0Pc*Mc*x(7) 0;
0 0 0 0 0 0;
0 0 0 0 0 0 ];
L=[ Lsp 0 0 0 Mp 0 ;
0 Lsp 0 0 0 Mp;
0 0 Lsc 0 -Mc 0 ;
0 0 0 Lsc 0 Mc;
Mp 0 -Mc 0 Lr 0 ;
0 Mp 0 Mc 0 Lr];
U=
X=
A=R+G;
dI=-1*inv(L)*A*X+inv(L)*U;
Te=Pp*Mp*+Pc*Mc*;
% w=x(7);
dw=(Te-TL)/J;
sys=;
% end mdlDerivatives
%
%=============================================================================
% mdlOutputs
% Return the output vector for the S-function
%=============================================================================
%
function sys = mdlOutputs(t,x,u)
J=0.03;
Rp=0.81;
Rc=0.81;
Lsp=80e-3;
Lsc=630e-3;
Mp=0.89e-3;
Mc=4.3e-3;
Pp=3;
Pc=1;
Lr=0.04e-3;
Rr=1.57e-3;
TL=15;
Te=Pp*Mp*+Pc*Mc*;
w=x(7);
sys=[ Te;w ];
% end mdlOutputs 怎么没有人来指导一下呢?:@Q 今天我回去看看啊
我也做了几个电机模型了
qq347843421
方便联系
:victory: 问题解决了吗:@D 你那个simulink的模型怎么打不开呢?????? 我也很想学习一下这方面的东西!不过我刚刚开始,hai meiyou s henme jingyan ! 下来看看,我们也做无刷双馈,不是我们是直接用模块搭建的,还行。没有你这么复杂 我也在做无刷双馈,下来帮你看看昂
页:
[1]