资源简介
应用matlab软件搭建闭环开关磁阻电机模型;仿真结果运行完美,可以作为参考学习资料
代码片段和文件信息
function [sysx0strtssimStateCompliance] = relay1(txuflag)
switch flag
%%%%%%%%%%%%%%%%%%
% Initialization %
%%%%%%%%%%%%%%%%%%
case 0
[sysx0strtssimStateCompliance]=mdlInitializeSizes;
%%%%%%%%%%%%%%%
% Derivatives %
%%%%%%%%%%%%%%%
case 1
sys=[];
%%%%%%%%%%
% Update %
%%%%%%%%%%
case 2
sys=[];
%%%%%%%%%%%
% Outputs %
%%%%%%%%%%%
case 3
sys=mdlOutputs(txu);
%%%%%%%%%%%%%%%%%%%%%%%
% GetTimeOfNextVarHit %
%%%%%%%%%%%%%%%%%%%%%%%
case 4
sys=[];
%%%%%%%%%%%%%
% Terminate %
%%%%%%%%%%%%%
case 9
sys=[];
%%%%%%%%%%%%%%%%%%%%
% 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 = 6;
sizes.NumInputs = 1;
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 = [-1 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.
%=============================================================================
%
function sys=mdlUpdate(txu)
sys = [];
% end mdlUpdate
%
%=============================================================================
% mdlOutput
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4276 2013-09-16 09:54 DITC\relay1.m
文件 4276 2013-09-16 09:54 DITC\relay2.m
文件 4276 2013-09-16 09:54 DITC\relay3.m
文件 172775 2013-09-17 20:25 DITC\Traditional_DITC_2010b.mdl
目录 0 2018-10-25 18:58 DITC
----------- --------- ---------- ----- ----
185603 5
评论
共有 条评论