资源简介
根据运动控制理论撰写的直接转矩控制仿真模型,经过几届毕业设计验证!
代码片段和文件信息
function [sysx0strtssimStateCompliance] = DTCPulse(txuflag)
%SFUNTMPL General M-file S-function template
% The following outlines the general structure of an S-function.
%
switch flag
%%%%%%%%%%%%%%%%%%
% Initialization %
%%%%%%%%%%%%%%%%%%
case 0
[sysx0strtssimStateCompliance]=mdlInitializeSizes;
%%%%%%%%%%%%%%%
% Derivatives %
%%%%%%%%%%%%%%%
case 1
sys=mdlDerivatives(txu);
%%%%%%%%%%
% Update %
%%%%%%%%%%
case 2
sys=mdlUpdate(txu);
%%%%%%%%%%%
% Outputs %
%%%%%%%%%%%
case 3
sys=mdlOutputs(txu);
%%%%%%%%%%%%%%%%%%%%%%%
% GetTimeOfNextVarHit %
%%%%%%%%%%%%%%%%%%%%%%%
case 4
sys=mdlGetTimeOfNextVarHit(txu);
%%%%%%%%%%%%%
% Terminate %
%%%%%%%%%%%%%
case 9
sys=mdlTerminate(txu);
%%%%%%%%%%%%%%%%%%%%
% Unexpected flags %
%%%%%%%%%%%%%%%%%%%%
otherwise
DAStudio.error(‘Simulink:blocks:unhandledFlag‘ num2str(flag));
end
% end sfuntmpl
%
%=============================================================================
% mdlInitializeSizes
% Return the sizes initial conditions and sample times for the S-function.
%=============================================================================
%
function [sysx0strtssimStateCompliance]=mdlInitializeSizes
%
% call simsizes for a sizes structure fill it in and convert it to a
% sizes array.
%
% Note that in this example the values are hard coded. This is not a
% recommended practice as the characteristics of the block are typically
% defined by the S-function parameters.
%
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 3;%输出依次为u1u2u3.
sizes.NumInputs = 4;%u(1)是P/N判别方向u(2)是sgn(dfai)判别磁链偏差符号u(3)是sgn(dTe)判别转矩偏差符号u(4)是磁链fai用于判别磁链位置.
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1; % at least one sample time is needed
sys = simsizes(sizes);
%
% initialize the initial conditions
%
x0 = [];
%
% str is always an empty matrix
%
str = [];
%
% initialize the array of sample times
%
ts = [0 0];
% Specify the block simStateCompliance. The allowed values are:
% ‘UnknownSimState‘ < The default setting; warn and assume DefaultSimState
% ‘DefaultSimState‘ < Same sim state as a built-in block
% ‘HasNoSimState‘ < No sim state
% ‘DisallowSimState‘ < Error out when saving or restoring the model sim state
simStateCompliance = ‘UnknownSimState‘;
% end mdlInitializeSizes
%
%=============================================================================
% mdlDerivatives
% Return the derivatives for the continuous states.
%=============================================================================
%
function sys=mdlDerivatives(txu)
sys = [];
% end mdlDerivatives
%
%=============================================================================
% mdlUpdate
% Handle discrete state updates sample time hits and major time step
% requirements.
%=========================================================================
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 93072 2011-04-17 15:41 DTC\DTC.mdl
文件 66233 2011-04-10 16:06 DTC\DTC02.mdl
文件 8678 2011-04-10 15:48 DTC\DTCPulse.m
文件 7429 2011-04-17 15:12 DTC\DTCPulse02.m
文件 8702 2011-04-10 14:03 DTC\pulse.asv
文件 8813 2011-04-10 14:13 DTC\pulse.m
目录 0 2011-04-17 15:42 DTC
----------- --------- ---------- ----- ----
192927 7
评论
共有 条评论