%% ANN-based programmable LQR for inverter-fed induction motor
%
% Bartlomiej Ufnalski
% Institute of Control and Industrial Electronics
% Warsaw University of Technology
%
% The idea (dated back to 2006) is to use linear-quadratic regurator (LQR)
% concept to synthesize optimal controller for plants with the non-constant
% state matrix. It is assumed that this matrix changes with working point.
% An induction motor can serve here as an example.
%
% Basically, this model illustrates the concept described in detail here:
% http://dx.doi.org/10.1109/IJCNN.2006.246811
% (Neural-Network-based Programmable State Feedback Controller for
% Induction Motor Drive)
%
% rev. 2014.10.02 for Matlab Central
%
clear all
training = 0; % this submission already includes ANN stored in .mat --> you can run the model skipping the training stage;
% training = 1 is needed if you experiment with different Q
% and R matrices (see:
% http://www.mathworks.com/help/control/ref/lqr.html)
with_noise = 1;
%
% Plant parameters (induction motor)
Ls = 0.1004;
Lr = 0.0969;
Lm = 0.0915;
sigma = 1-Lm*Lm/Lr/Ls;
lambda = Ls*Lr-Lm*Lm;
Rr = 1.294;
Tr = Lr/Rr;
Ts = 1e-4;
Tp = Ts;
Rs = 1.54;
Rs_ident_error = 1; % Rs in EMF estimation = Rs * Rs_ident_error
wc = 1/Ts;
pb = 3;
psi_ref = 0.7;
J = 0.15;
slip_max = 280;
omega_max = 300; % omega flux
%
if training == 0,
load net_lqr.mat
open('sfoc_lqr_ann.slx');
disp('Simulating...');
set_param('sfoc_lqr_ann','SimulationCommand','start');
return
end
%
% The ststes: isx isy psisx omegam p1-psi p2-omega
%
k = 1;
disp('LQR: calculating gain matrices K for different slips at different speeds...');
for a1 = -omega_max:20:omega_max,
% disp(['LQR: calculating gain matrices for different slips at ',num2str(a1),'rad/s']);
for a2 = -slip_max:20:slip_max,
A = [-(Rr*Ls+Rs*Lr)/lambda a2 Rr/lambda 0 0 0;
-a2 -Rr*Ls/lambda a2*Lr/lambda 0 0 0;
-Rs 0 0 0 0 0;
0 0 -1/J*3/2*pb*psi_ref*a1/Rs 0 0 0;
0 0 1 0 0 0;
0 0 0 1 0 0];
B = [Lr/lambda 0;
0 0;
1 0;
0 1/J*3/2*pb*psi_ref/Rs;
0 0;
0 0];
%
% Q and R by guessing and checking. The Bryson's rule might be helpful.
% Some hints on choosing Q in augmented systems (i.e. with
% auxiliary state variables) can be found here:
% http://dx.doi.org/10.1109/TIE.2014.2334669
% (Particle Swarm Optimization of the Multi-oscillatory LQR for a 3-phase 4-wire Voltage Source Inverter with an LC Output Filter
% AKA Particle Swarm Optimization of the Multi-Oscillatory LQR
% for a Three-Phase Four-Wire Voltage Source Inverter with an LC Output Filter)
% or here:
% State-Space Current Control For Four-Leg Grid-Connected PWM
% Rectifiers With Active Power Filtering Function (PEMC 2014)
% or soon here: http://pe.org.pl/last.php?lang=1 (A. Galecki,
% B. Ufnalski, A. Kaszewski, L.M. Grzesiak).
%
Q = diag([1/100 1/100 1/0.7^2 1/10000 1/0.7^2 1/10000].*[0.1 0.1 0.002 0.1 100000 100]);
R = diag([1/40000 1/40000].*[0.01 0.01]);
%
[Klqr,S,E] = lqr(A,B,Q,R);
inputANN(:,k) = [a1;a2];
outputANN(:,k) = [Klqr(1,:)';Klqr(2,:)'];
k = k+1;
end
end
%
norm_input = max(abs(inputANN'))';
norm_inputANN = repmat(norm_input',max(size(inputANN)),1)';
norm_output = max(abs(outputANN'))';
norm_outputANN = repmat(norm_output',max(size(outputANN)),1)';
P = inputANN./norm_inputANN;
T = outputANN./norm_outputANN;
s1 = 3;
s2 = 5;
[s3,pom] = size(T);
%
net = feedforwardnet([s1,s2]);
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'tansig';
net.layers{3}.transferFcn = 'purelin';
net.divideFcn='dividetrain';
net.trainParam.show = 5;
net.trainParam.epochs = 100;
disp('Training...');
net = train(net,P,T);
%
gensim(net,-1); % The net has to be copied manually into .slx. Sorry for that. I could do better.
net.userdata.norm = [norm_input' norm_output'];
save net_lqr net
% Some graphs can be plotted using lqr_ann_graphs script.
% That's all folks!

天天Matlab代码科研顾问
- 粉丝: 3w+
- 资源: 4139
最新资源
- 关于站内信(操作日志)的一套代码实现
- FPGA RGMII接口以太网实现UDP、ICMP及ARP协议全面支持的功能详解,FPGA RGMII接口以太网支持UDP、ICMP和ARP协议的高性能网络通信方案,fpga rgmii接口以太网,支
- 个人饮食习惯及身体状况与体重的关系数据集.zip
- Python -面向对象案例教程
- codelldb-v1.11.4-win32-x64.vsix , Visual Studio Code插件下载
- 风光出力场景生成与消减:蒙特卡洛模拟与拉丁超立方生成技术结合快速前推法与同步回代削减策略,风光出力场景生成与消减:蒙特卡洛模拟与拉丁超立方生成技术结合快速前推法与同步回代削减策略,风光出力场景生成与消
- Matlab下的随机森林数据分类代码详解:一键更换Excel文件,附运行视频演示,Matlab下的随机森林数据分类:详细注释代码与灵活换数据功能,附运行视频指导,matlab代码 基于随机森林的数据分
- 树懒种族分类数据集.zip
- 基于EMD-ARMA算法的风光出力组合预测方法:经验模态分解与自回归移动平均模型的应用,基于EMD-ARMA算法的风光出力组合预测方法:分解重构与自回归移动平均模型应用,基于EMD-ARMA的组合风光
- 西门子S7-1200模拟电梯程序案例:四层电梯LAD编程入门指南,附注释与中文变量标注,博途v15及以上版本适用,西门子S7-1200仿真模拟电梯程序实例:四层电梯控制LAD编程详解,注释清晰中文标注
- 级联H桥型STATCOM与多能源变换器技术:自抗扰控制与不平衡电网正负序解耦策略研究,级联H桥型STATCOM与多能源变换器技术:负序补偿、不平衡电网控制及有源功率解耦策略研究,级联H桥,级联H桥型s
- 红酒品质预测数据集.zip
- 零基础入门转录组下游分析-单因素cox筛选预后相关特征教程配套资源
- spring-jdbc(eclipse)
- PDF多目录合并程序一款可批量合并多个文件夹内的pdf工具.exe
- ABB机器人外部启动与博图V16 FB功能块实现与西门子通讯配置手册:含GSD文件、机器人DSQC系列板卡支持888-2/888-3配置解析指南 ,ABB机器人外部启动与博图V16的FB功能块通讯配置
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


