- 积分
- 87
- 回帖
- 0
- 西莫币
-
- 贡献
-
- 威望
-
- 存款
-
- 阅读权限
- 5
- 最后登录
- 1970-1-1
该用户从未签到
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
刚开始学习PMSM的直接转矩控制 对于一本教材上关于直接转矩控制仿真模型有几个问题,忘各位大神帮忙解答下
1是开关选择S函数里的输出不理解,这边V_Table说是根据开关表的来的 但明显不一样啊 还有函数V_Table的输出是啥的 感觉跟前面的数组不对应啊
function [sys,x0,str,ts] = PMSM_switch(t,x,u,flag)
% The following outlines the general structure of an S-function.
%
switch flag, %判断flag,看当前处于哪个状态
%%%%%%%%%%%%%%%%%%
% Initialization %
%%%%%%%%%%%%%%%%%%
case 0,
[sys,x0,str,ts]=mdlInitializeSizes;
%%%%%%%%%%%
% Outputs %
%%%%%%%%%%%
case 3,
sys=mdlOutputs(t,x,u);
case {2,4,9},
sys=[];
%%%%%%%%%%%%%%%%%%%%
% Unexpected flags %
%%%%%%%%%%%%%%%%%%%%
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
%=============================================================================
% mdlInitializeSizes
% Return the sizes, initial conditions, and sample times for the S-function.
%=============================================================================
%
function [sys,x0,str,ts]=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;%用于设置参数的结构体用simsizes来生成
sizes.NumContStates = 0;%连续状态变量的个数
sizes.NumDiscStates = 0; %离散状态变量的个数
sizes.NumOutputs = 1; %输出变量的个数
sizes.NumInputs = 3; %输入变量的个数
sizes.DirFeedthrough = 1; %是否存在反馈
sizes.NumSampleTimes = 1; %采样时间个数,至少是一个
sys = simsizes(sizes);%设置完后赋给sys输出
x0 = [];%状态变量设置为空,表示没有状态变量
str = [];
ts = [-1 0]; %采样周期设为0表示是连续系统,-1表示采用当前的采样时间
% end mdlInitializeSizes
%
%=============================================================================
% mdlOutputs
% Return the block outputs.
%=============================================================================
%
function sys=mdlOutputs(t,x,u)
%%根据文章的表格计算得到
V_Table=[2 4 6 1 3 5;4 1 5 2 6 3;3 6 2 5 1 4 ;5 3 1 6 4 2];
x=2*u(1)+u(2)+1;
sys=V_Table(x,u(3));
% end mdlOutputs
2是如图S-function输出是同时输入到后面的3个lookup模块吗 这三个lookup模块的input的设置都是[1,2,3,4,5,6]
|
-
|