Scheduling controller based on multi-MPC

Source: Internet
Author: User

1 Introduction

In this paper, we will analyze the MPC example with MATLAB in detail.
Mpc:model Predictive Control Toolbox
Start the design tool: Start the design tool by entering the MATLAB command: ' Mpctool '.
The three columns on the left side of the graph in 1 are the Controlled object Model (plant model), the predictive controller (Controllers), and the Emulator (Scenarios).

The Model Predictive Control Toolbox is a graphical user interface design. This GUI is part of the control and Evaluation tool manager GUI. See


Mo (measured output): The current measurable signal
Ref (Reference Signa): Reference signal
Md (optional measured disturbance signa): optional measurement of interference signals
Mv (Optimal manipulated variables): Optimal manipulation variables
The MPC generally calculates the optimal manipulating variables by solving a two-time plan (here we use ORD45)
A simple example is as follows:

2. Multiple MPC scheduling Controller Solutions

2.1 System Description
If your object model is non-linear, designing a controller operation can perform well in a specific target area, but may not perform well in other regions. A common method of compensation is to design multiple controllers, each oriented to a specific combination of operating conditions. They switch between real-time as the situation changes. Access to this technology is a traditional example of scheduling. The following example shows how to coordinate multiple model predictive controllers
The system is composed of two objects M1 and M2 respectively connected to two separate springs K1 and K2. It is assumed that a completely inelastic collision occurs when the M1 and M2 collide. Force F is a tensile force for M1, which is a manipulated variable (manipulated variable MV). The goal is to make the M1 position Y1 track the given reference position R (Reference Signa).
When M1 and M2 are separated, the M1 move freely. When a collision occurs, the M1 + M2 move together because it is a completely inelastic collision. We assume that only M1 locations and contact sensors provide feedback. The latter is used to trigger the switching of the MPC controller to select MPC1 or MPC2. Here, we believe that the position and speed of the M2 are not controllable. Here, we think the right direction is the positive direction. As shown in the following:
2.2 Model parameters

Clear  AllCLCM1=1;% M1 of qualityM2=5;% M2 of qualityK1=1;% Spring K1 constant kK2=0.1;% Spring K2 constant kB1=0.3;% coefficient of friction with air, proportional to speedB2=0.8;% friction coefficientyeq1=Ten;% position of rigid wall 1YEQ2=-Ten;% position of rigid Wall 2

2.3 State Space Model

Location and speed of the STATES:M1
MV: Thrust F
MD: Object 1 A constant error between the force F of the demand of the spring and the actual given F, used to compensate for the spring elasticity, so that when M is at the initial position 0, the spring force is zero.
Location of the MO:M1

2.3.1 when M1 and M2 have no contact with the model MPC1

percent state space model%WhenM1AndM2A state model when not in contact.A1=[0 1;-k1/M1-b1/M1];B1=[0 0;-1/M1k1*yeq1/M1];C1=[1 0];D1=[0 0];sys1=ss (A1,B1,C1,D1); % build State space expression sys1=setmpcsignals (sys1,' MD ',2); % The second input is a measurable disturbance

"Note":
1.Sys = SS (a,b,c,d): A state space model used to describe continuity
2.Setmpcsignals: Sets the i/0 signal model of the MPC controlled object. The system must be a linear time-invariant system, ' MD ': measurable input disturbances, and a second input is a measurable input disturbance. If no input variable specified is MV


The final result:

2.3.2 Model MPC2 When M1 and M2 are connected together

% 当M1和M2接触时候的状态模型.A2=[0 1;-(k1+k2)/(M1+M2) -(b1+b2)/(M1+M2)];B2=[0 0;-1/(M1+M2) (k1*yeq1+k2*yeq2)/(M1+M2)];C2=[1 0];D2=[0 0];sys2=ss(A2,B2,C2,D2);sys2=setmpcsignals(sys2,‘MD‘,2);

2.4 MULTI-MPC Control Settings

The parameter setting ts=0.2 of the MPC simulation; %Sampling Time p= -; % Forecast time domain length m=1; % Control Time domain lengthThe MPC model MPC1=MPC (SYS1,TS,P,M) was established; %DefinedM1AndM2Separation ofMPCModel% setting limit,FThe size cannot be0,FMaximum slope absolute value +MPC1.MV=struct (' Min ',0,' Max ',INF,' Ratemin ',-1E3,' Ratemax ',1E3);MPC2=MPC (Sys2,Ts, p,m); % definitionM1AndM2Connected toMPC2ModelMPC2.MV=MPC1.MV; % system1and system2The same as the control limits

2.5 Simulation parameter settings

%% 仿真参数设置Tstop=100;             % 仿真时间y1initial=0;           % 物体1的初始位置y2initial=10;          % 物体2的初始位置open_system(‘wc1‘);   % 调用wc1.MDLdisp(‘Start simulation by switching control between MPC1 and MPC2 ...‘);set_param(‘wc1/signals‘,‘Open‘,‘On‘);%设置系统和模型的参数值sim(‘wc1‘,Tstop);%开始动态系统仿真
3.Simulatink implementations

The simulation block diagram looks like this:




The above section of the total simulation diagram simulates the movement of two objects, and this movement is displayed as a signal in the oscilloscope. And when the position and acceleration of the M1 are greater than the position and acceleration of the M2, the model output Boolean is true or false; The lower part contains the following elements:
1. Multiple MPC controllers,. This has four inputs: measurable output (MO), reference (ref), measurable interference (MD) input and a unique function block switch input for multiple MPC controllers.
2. A pulse generator changes the position that the M1 needs to reach (Controller reference signal). The output of this pulser is a square wave with a amplitude of 5, with a frequency of 0.015 per second.
3. Simulate the contact of the sensor. When switch input 1 o'clock activates the first controller MPC1, this time M1 and M2 are separated. When two objects have the same position, the Compare to constant evaluates to 1, the ADD1 adder output value for the 2,multiple MPC controllers The switch port is entered 2, automatically start the second controller MPC2.

4. Solution Evaluation

Demonstrates the process of simulation:

4.1 MPC1 and MPC2 work together
Demonstrates the simulation of multiple MPC controllers for this example:

? On top of the graph, the cyan line (which is where we M1 need to arrive, produced by reference) it starts from-5. The M1 position (yellow) starts from 0. Under MPC1 control, the M1 moves quickly to the desired position. M2 (red) moves in the same direction starting from 10
At about t = 13 seconds, M2 and M1 have a completely inelastic collision. M1 is connected with M2. The third picture shows the change of the switching signal, at this moment from 1 to 2, so MPC2 starts to work.
The M2 and M1 are still connected when the m1+m2 exceeds the desired position. The controller MPC2 adjusts the Force F (the picture in the middle) so that the m1+m2 quickly returns to the desired position. When R mutates to 5 o'clock, the effect is very good.

4.2 Single MPC1 has been working
Assuming that our controller MPC1 is running under all conditions

%再进行一次无论在什么情况下只用MPC1系统的实验disp(‘Now repeat simulation by using only MPC1 ...‘);MPC2save=MPC2;     %先将MPC2保存起来MPC2=MPC1;          %用MPC2来代替MPC21sim(‘wc1‘,Tstop);  %动态系统仿真

Shows the image that MPC1 works alone

If the system is always MPC1, Force F is not enough, when the M1 and M2 chains together, moving slowly, the next change occurs when the need to not reach the desired position

4.3 single MPC2 has been working

%再进行一次无论在什么情况下只用MPC2系统的实验disp(‘Now repeat simulation by using only MPC2 ...‘);MPC1=MPC2save;MPC2=MPC1;sim(‘WC1‘,Tstop);

Assuming that our controller MPC2 is running under all conditions
Shows the image that MPC1 works alone

When M1 and M2 separate, MPC2 is still used, excessive use of f, excessive compensation, resulting in oscillation. When M2 and M1 are connected together, the movement is smoother and as expected. The final transition causes particularly severe oscillations. M1 and M2 frequent collisions, M1 cannot reach the desired location.

5. References

[1] A. Bemporad, S. Di Cairano, I. v. Kolmanovsky, and D. Hrovat, "Hybrid
Modeling and control of a multibody magnetic actuator for automotive applications, "Proc. 46th IEEE (R) Conf. On Decisio N and Control, New Orleans, LA, 2007.
[2]http://cn.mathworks.com/help/mpc/gs/coordination-of-multiple-model-predictive-controllers.html#bs670e3-8
[3] Li Guoyong, intelligent predictive control and its MATLAB implementation. Beijing: Electronic Industry Press, 2010.

6. Appendix
a scheduling controller with multiple MPC% CLC% Clear allSystem ParametersClear allclcm1=1;% M1 of qualityM2=5;% M2 of qualityk1=1;% Spring K1 constant kK2=0.1;% Spring K2 constant kb1=0.3;% coefficient of friction with air, proportional to speedB2=0.8;% friction coefficientyeq1=Ten;% position of rigid wall 1yeq2=-Ten;% position of rigid Wall 2A model of the percent state space% Status: M speed and position% controlled variable: F% measurable disturbance: Spring 1 of Changshu;% Measurement output: position of M1% when M1 and M2 are not in contact with the state model.a1=[0 1;-K1/M1-B1/M1]; b1=[0 0;-1/m1 k1*yeq1/m1]; c1=[1 0];D 1 =[0 0]; Sys1=ss (A1,B1,C1,D1);% build State space expressionSys1=setmpcsignals (SYS1,' MD ',2)  ;% The second input is a measurable disturbance% when M1 and M2 are in contact with the state model.A2=[0 1;-(K1+K2)/(M1+M2)-(B1+B2)/(M1+M2)]; B2=[0 0;-1/(M1+M2) (K1*YEQ1+K2*YEQ2)/(M1+M2)]; C2=[1 0];D 2 =[0 0]; Sys2=ss (A2,B2,C2,D2); Sys2=setmpcsignals (Sys2,' MD ',2);Percent MPC simulation parameter settingts=0.2;% Sample Timep= -;% Forecast time domain lengthm=1;% Control time domain lengthset up MPC model with percentMPC1=MPC (SYS1,TS,P,M);% definition of M1 and M2 separated MPC modelMPC1.Mv=struct (' Min ',0,' Max 'Inf' Ratemin ',-1e3,' Ratemax ',1e3);% setting limit, the size of F cannot be 0MPC2=MPC (SYS2,TS,P,M);% define MPC model for M1 and M2 connectionsMPC2.mv=MPC1.MV;% System 1 and System 2 control limits are the samePercent simulation parameter settingtstop= -;% Emulation TimeY1initial=0;the initial position of the% object 1Y2initial=Ten;the initial position of the% object 2Open_system (' WC1 ');% Call Wc1.mdlPercent start three simulations% dual system MPC1 and MPC2 simulation experimentdisp(' Start simulation by switching control between MPC1 and MPC2 ... '); Set_param (' Wc1/signals ',' Open ',' on ');% Set parameter values for system and modelSim' WC1 ', tstop);% dynamic system emulation% to be carried out again regardless of the circumstances of the experiment using only the MPC1 systemdisp(' now repeat simulation by using only MPC1 ... '); MPC2SAVE=MPC2;% Save the MPC2 first.MPC2=MPC1;% use MPC2 to replace MPC21Sim' WC1 ', tstop);% to be carried out again regardless of the circumstances of the experiment using only the MPC2 systemdisp(' now repeat simulation by using only MPC2 ... '); Mpc1=mpc2save; Mpc2=mpc1;sim (' WC1 ', tstop);Percent close simulation window% bdclose (' WC1 ')% Close (findobj (' Tag ', ' Wc1_demo '))Percent Reference%[1] A. Bemporad, S. Di Cairano, I. v. Kolmanovsky, and D. Hrovat, "Hybrid% modeling and control of a multibody magnetic actuator for Automotive% applications, "in Proc. 46th IEEE (R) Conf. On decision and Control, New% Orleans, LA,.%[2]http://cn.mathworks.com/help/mpc/gs/coordination-of-multiple-model-predictive-controllers.html#bs670e3-8%[3] Li Guoyong, intelligent predictive control and its MATLAB implementation. Beijing: Electronic industry press,.

Scheduling controller based on multi-MPC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.