资源简介
基于EKF的三相PMSM无传感器矢量控制,根据现代永磁同步电机控制原理及Matlab仿真搭建,仿真模型已通过调试,波形完美,可以作为参考资料

代码片段和文件信息
function [sysx0strts] =EKF(txuflag)
% The following outlines the general structure of an S-function.
switch flag
%%%%%%%%%%%%%%%%%%
% Initialization %
%%%%%%%%%%%%%%%%%%
case 0
[sysx0strts]=mdlInitializeSizes;
%%%%%%%%%%%%%%%
% Derivatives %
%%%%%%%%%%%%%%%
%%%%%%%%%%
% Update %
%%%%%%%%%%
case 2
sys=mdlUpdate(txu);
%%%%%%%%%%%
% Outputs %
%%%%%%%%%%%
case 3
sys=mdlOutputs(txu);
%%%%%%%%%%%%%%%%%%%%%%%
% GetTimeOfNextVarHit %
%%%%%%%%%%%%%%%%%%%%%%%
case {149}
sys=[];
%%%%%%%%%%%%%
% Terminate %
%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% Unexpected flags %
%%%%%%%%%%%%%%%%%%%%
otherwise
error([‘Unhandled flag = ‘num2str(flag)]);
end
% end sfuntmpl
%=============================================================================
% mdlInitializeSizes
% Return the sizes initial conditions and sample times for the S-function.
%=============================================================================
%
function [sysx0strts]=mdlInitializeSizes
global P0;
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 4;
sizes.NumOutputs = 4;
sizes.NumInputs = 4;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
% initialize the initial conditions
x0 = [0 0 0 0];
P0 = diag([0.1 0.1 0 0]);%P估计初值
% str is always an empty matrix
str = [];
ts = 1e-6;
% end mdlInitializeSizes
%=======================================================================
% mdlDerivatives
% Return the derivatives for the continuous states.
%=======================================================================
function sys = mdlUpdate(txu)
global P0;
Rs = 2.875;%电阻
Ls = 0.0085;%电感
np = 2;%极对数
J = 0.008;%转动惯量
flux = 0.3;%磁链
B1 = 0;%阻尼系数
Q = diag([0.1 0.1 1 0.01]);
R = diag([0.2 0.2]);
T = 1e-6;
vs_ab = [u(1) u(2)]‘;
is_ab = [u(3) u(4)]‘;
H = [1 0 0 0; 0 1 0 0];
B = [1/Ls 0 0 0; 0 1/Ls 0 0]‘;
F = [-Rs/Ls 0 flux/Ls*sin(x(4)) flux/Ls*x(3)*cos(x(4));0 -Rs/Ls -...
flux/Ls*cos(x(4)) flux/Ls*x(3)*sin(x(4)); 0 0 0 0; 0 0 1 0];%雅克比矩阵
%非线性系统矩阵函数3/2*np^2*flux/J*(x(2)*cos(x(4))-x(1)*sin(x(4)))-B1*x(3)/J
f1 = [-Rs/Ls*x(1)+flux/Ls*x(3)*sin(x(4));-Rs/Ls*x(2)-flux/Ls*x(3)*cos(x(4)); 0; x(3)];
f2 = diag([1 1 1 1])+T*F;%系统转移矩阵
X_pred = x+T*(f1+B*vs_ab);%系统转移矩阵
Y_pred = H*X_pred;%测量预测值
Y = is_ab;
P_pred = f2*P0*f2‘+Q;%预测值
K = P_pred*H‘*inv(H*P_pred*H‘+R);%增益
sys = X_pred+K*(Y-Y_pred);
P0 = P_pred-K*H*P_pred;%估计值
%=============================================================================
% mdlOutputs
% Return the block outputs.
%=============================================================================
%
function sys=mdlOutputs(txu)
sys=x;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2970 2018-10-31 19:04 PMSM-EKF\EKF.m
文件 40210 2018-11-02 00:01 PMSM-EKF\PMSM_EKF.slx
目录 0 2018-11-02 00:04 PMSM-EKF
----------- --------- ---------- ----- ----
43180 3
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论