0% found this document useful (0 votes)
257 views80 pages

Optimization Presentation 2015

This document provides an overview of an optimization workshop held at Universiti Tenaga Nasional – PutraJaya Campus on November 12th, 2015. The workshop covered three main parts: (1) introduction to optimization, including definitions, methods, and examples; (2) MATLAB optimization using functions, toolboxes, and algorithms; and (3) Simulink optimization using parameter modeling, identification, and the Simulink Optimization Design GUI. Attendees would learn optimization concepts and hands-on experience applying techniques in MATLAB and Simulink through examples from various engineering domains like mechanical, electrical, and environmental sciences.

Uploaded by

fnagi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
257 views80 pages

Optimization Presentation 2015

This document provides an overview of an optimization workshop held at Universiti Tenaga Nasional – PutraJaya Campus on November 12th, 2015. The workshop covered three main parts: (1) introduction to optimization, including definitions, methods, and examples; (2) MATLAB optimization using functions, toolboxes, and algorithms; and (3) Simulink optimization using parameter modeling, identification, and the Simulink Optimization Design GUI. Attendees would learn optimization concepts and hands-on experience applying techniques in MATLAB and Simulink through examples from various engineering domains like mechanical, electrical, and environmental sciences.

Uploaded by

fnagi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 80

Optimization with MATLAB

A Hands-On Workshop
Farrukh Nagi
Universiti Tenaga Nasional PutraJaya Campus
12th Nov, 2015
http://metalab.uniten.edu.my/~farrukh/OPTIM15.zip
1

Introduction To Optimization

PART I

Contents
PART 1 INTRODUCTION TO OPTIMIZATION
1. Introduction to Optimization
What is optimization
Optimization Methods
Linear Programming
Fundamentals of non-linear optimization
Optimality Conditions
Steepest Descent Methods
Optimization Exercise & Solutions

PART 2 - MATLAB OPTIMIZATION


2. Matlab/Simulink Optimization
Optimization Functions
Optimization Toolbox
Unconstrained minimax Optimization
fminunc, fminsearch
Linear Constrained Optimization
Non-linear Constrained Optimization
Optimization Algorithm Response
Least Square Curve Fitting
Simplex Methods
Environmental Science Optimization

PART 3 - SIMULINK OPTIMIZATION


RESPONSE
3. SIMULINK Assign Blocks and Ports
Parametric Modeling
Parameter Identification
Parameter Passing with Component Block Input
Simulink Optimization Design (SOD) GUI
Optimizer Output
Simulink/Matlab program Sample List
4. REFERENCES
5

What is Optimization?
Optimization is an iterative process
by which a desired solution(max/min)
of the problem can be found while
satisfying all its constraint or bounded
conditions.
Optimization problem could be linear
or non-linear.

Figure 2: Optimum solution is


found while satisfying its
constraint (derivative must be
zero at optimum).

Non linear optimization is accomplished by


numerical Search Methods.

Search methods are used iteratively before a solution is


achieved.
The search procedure is termed as algorithm.

Why and What is needed for Optimization


Optimization gives iterative search solution for
all mathematical problems
A system mathematical model representation or it
can help you to find a mathematical model from
real data
An Objective function consist mathematical
model and variables
Call Objective function with OPTIMIZER

INVOKING OPTIMIZER WITH MATLAB


1. OPTIMIZER.m

2. OPTIMIZER GUI

@Objective function .m

Mathematical model .m
Simulink Block model . mdl

3. SIMULINK OPTIMIZER

Objective function.mdl

Simulink Block model . mdl

IEEE Optimization Workshop @ UNITEN


Hands-on Optimization Experience
Learning optimization with Examples and Case
studies
Basic Physics and Maths Examples-

See Slide 22

Case Studies - Mechanical , Electrical/ Electronic


and Environmental Sciences See Slide 44
Consultancy and Research work

contd
CONSULTANCY WORK
i) Plant Noise control Optimization
OPTIM15\Noise\Conn_octave3_j_10.m

RESEARCH WORK

Noise Control

Component
Location

i) Optimize Location of power Electronics components on PCB


OPTIM15\Heat transfer\my_SA_air.m
ii) Optimize light control system in indoor spaces
OPTIM15\illumination\illum0_start.m

illumination
modeling

10

Optimization Methods
One-Dimensional Unconstrained Optimization
Golden-Section Search
GA
Quadratic Interpolation
Presentation
Newton's Method
Multi-Dimensional Unconstrained Optimization
PSO
Presentation
Non-gradient or direct methods
Gradient methods
Linear Programming (Constrained)
SA presentation
Graphical Solution
Simplex Method
Genetic Algorithm (GA) Survival of the fittest principle based upon
evolutionary theory \OPTIM15\GA\GA Presentation.ppt
Particle Swarm Optimization (PSO) Concept of best solution in
the neighborhood : \OPTIM15\PSO\ PSO Presentation.ppt

Others .

11

Fundamentals of Optimization

The solution of the linear problem lies on boundaries of


the feasible region.

Figure 3: Solution of linear problem

Figure 4: Three dimensional


solution of non-linear problem

Non-linear problem solution lies within and on the


boundaries of the feasible region.

12

13
13

Fundamentals of Non-Linear Optimization Contd

Figure 7: Local point is equal to global point if


the function is convex.
Figure 6: Global versus local optimization.

A set S is convex if the line segment joining any two points in the
set is also in the set.

convex

not convex

convex

not convex

not convex
14

Fundamentals of Non-Linear Optimization

Contd

Function f is convex if f(Xa) is less than value of the corresponding


point joining f(X1) and f(X2).

Convexity condition Hessian 2nd order derivative) matrix of


function f must be positive semi definite ( eigen values +ve or zero).

Figure 8: Convex and nonconvex set

Figure 9: Convex function


15

Optimality Conditions

First order Condition (FOC)

f ( X *) 0

Hessian Second derivative of f of several variables


2 f

x
H 2
f
xy

2 f

yx
2 f
y 2

Second order condition (SOC)


Eigen values of H(X*) are all positive
Determinants of all lower order of H(X*) are +ve

16

Optimization Methods Constrained


a.) Indirect approach by transforming into unconstrained problem.
b.) Exterior Penalty Function (EPF) and Augmented Lagrange
Multiplier
c.) Direct Method Sequential Linear Programming (SLP), SQP and
Steepest Generalized Reduced Gradient Method (GRG)
2

-1

-2
-2

-1

Figure 10: Descent Gradient or LMS

17

Contd

Fundamentals of Linear Optimization


Single Objective function f(x)
Maximization
Minimization
Design Variables, xi , i=0,1,2,3..
Constraints
Inequality
Equality

Maximize X1 + 1.5 X2
Subject to:
X1 + X2 150
0.25 X1 + 0.5 X2 50
X1 50
X2 25
X1 0, X2 0

Figure 5: Example of design variables and


constraints used in non-linear optimization.

Optimal points
Local minima/maxima points: A point or Solution x* is at local point
if there is no other x in its Neighborhood less than x*
Global minima/maxima points: A point or Solution x** is at global
point if there is no other x in entire search space less than x**

18

Steepest descent method

19

Example

20

Example (cont.)

21

Matlab steepest descent- fminunc


%startpresentgrad.m
clc
clf
hold off
x0=[5,1];
options = optimset('OutputFcn', @outfun); %for graphic display
options=optimset('LargeScale','off','Display','iter-detailed'); %for iteration
options=optimset(options,'GradObj','on'); %for enabling gradient object
options = optimset(options,'OutputFcn', @outfun);
[x,fval]=fminunc(@myfuncon2,x0,options);
function [f,g]=myfuncon2(x)
f=0.5*x(1)^2+2.5*x(2)^2;
if nargout > 1
g(1)=x(1); %gradient 1 supplied
g(2)=5*x(2); %gradient2 supplied
foo=max(abs(g));
hold on
End
%cs=surf(w1,w2,J);
Grid

C:\OPTIM15/Presentatio
n/Problems and
Excercises.doc

function stop = outfun(x, optimValues, state)


ww1= -6:0.05:6;
ww2=ww1;
[w1,w2]=meshgrid(ww1,ww2);
J=-1*(0.5*w1.^2+2.5*w2.^2);
cs=contour(w1,w2,J,20);
grid
stop=false
hold on;
plot(x(1),x(2),bl+);
drawnow

Microsoft Word
Document

22
22

MATLAB Optimization

PART II

23

MATLAB/SIMULINK OPTIMIZATION METHODS


M-Files
Custom code
@functions

@functions
Scripts

MATLAB

MATLAB

>>Command
Window

>>Optimtool

Simulink

Simulink

Model.mdl

Ports/
Block
update

-GUI-

Design
Optimization

Model
Block

24

Function Optimization

Optimization concerns the minimization or maximization of


functions

Standard Optimization Problem:

min f x
x

g x 0

hi x 0 Equality Constraints
~

Subject to:

Inequality Constraints

x L k xk xU k Side Constraints

Where:

f x
~

x
~

is the objective function, which measure and evaluate the performance of a


system. In a standard problem, we are minimizing the function. For
maximization, it is equivalent to minimization of the ve of the objective
function.
is a column vector of design variables, which can
affect the performance of the system.
25

Function Optimization (Cont.)

Constraints Limitation to the design space. Can be linear or


nonlinear, explicit or implicit functions

g x 0

hi x 0
~

Equality Constraints
Inequality Constraints

Most algorithm require less than!!!

x L k xk xU k

Side Constraints

26

Optimization Toolbox
Is a collection of functions that extend the capability of MATLAB.
The toolbox includes routines for:

Unconstrained optimization
Constrained nonlinear optimization, including goal attainment
problems, minimax problems, and semi-infinite minimization
problems
Quadratic and linear programming
Nonlinear least squares and curve fitting

Nonlinear systems of equations solving


Constrained linear least squares
Specialized algorithms for large scale problems

27

Unconstrained Minimization

Consider the problem of finding a set of values [x1 x2]T that


solves

min f x e x1 4 x12 2 x22 4 x1 x2 2 x2 1


x
~

x x1
~

x2

Steps:
Create an M-file that returns the function value (Objective
Function). Call it objfun.m

Then, invoke the unconstrained minimization routine. Use

fminunc
28

Step 1 Obj. Function


x x1
function f = objfun(x)

x2

f=exp(x(1))*(4*x(1)^2+2*x(2)^2+4*x(1)*x(2)+2*x(2)+1);

Objective function

29

Step 2 Invoke Routine


Starting with a guess
x0 = [-1,1];

Optimization parameters settings

options = optimset(LargeScale,off);
[xmin,feval,exitflag,output]=
fminunc(objfun,x0,options);
Output arguments

Input arguments
30

Results
xmin =
0.5000

Minimum point of design variables

-1.0000

feval =

Objective function value

1.3028e-010
exitflag =
1
output =

Exit flag tells if the algorithm is converged.


If exit flag > 0, then local minimum is found

iterations: 7
funcCount: 40

Some other information

stepsize: 1
firstorderopt: 8.1998e-004
algorithm: 'medium-scale: Quasi-Newton line search'
31

More on fminunc Input


[xmin,feval,exitflag,output,grad,hessian]=
fminunc(fun,x0,options,P1,P2,)
fun
x0
Option
P1,P2,

: Return a function of objective function.


: Starts with an initial guess. The guess must be a vector
of size of number of design variables.
: To set some of the optimization parameters. (More
after few slides)
: To pass additional parameters.

32

More on fminunc Output


[xmin,feval,exitflag,output,grad,hessian]=
fminunc(fun,x0,options,P1,P2,)
xmin
: Vector of the minimum point (optimal point).
The size
is the number of design variables.
feval
: The objective function value of at the optimal
point.
exitflag
: A value shows whether the optimization routine
is
terminated successfully. (converged if >0)
Output
: This structure gives more details about the
optimization
grad
: The gradient value at the optimal point.
hessian
: The hessian value of at the optimal point
33

>> optimtool - % GUI

34

Non-Linear least
squares

35

Non-Linear least
squares

36

Simplex Methods

Minimize

37

Derivative-free optimization

Downhill
simplex
method

38

Derivative-free optimization

Downhill
simplex
method

39
39

Example:Equality Constrained optimization

40

Example (cont.)

41

Example (cont.)

42

43
43

Inequality Constrained Optimization

44

Inequality Constrained Optimization - GUI

45

Environmental Sciences Optimization Case Studies


1. Fish Harvesting/fishharvester/
2. River Pollution../WWTP_RivPol/
3. Noise Pollution./Noise/
4. Turbine controller/Gas_bio_Turbine/

Fish Harvesting

WWTP_RivPol

Noise Control

Turbine controller

Data Fitting
1. Hydrology .../hydrology/
2. Anthropometric.../anthropometry/

hydrology

Anthropometry

46

fminunc and fminsearch

fminunc uses algorithm with gradient and hessian information.

Two modes:
Large-Scale: interior-reflective Newton
Medium-Scale: quasi-Newton (BFGS)
Not preferred in solving highly discontinuous functions.

This function may only give local solutions..

fminsearch is generally less efficient than fminunc for


problems of order greater than two. However, when the problem
is highly discontinuous, fminsearch may be more robust.

This is a direct search method that does not use numerical


or analytic gradients as in fminunc.

This

function may only give local solutions.


47

Constrained Minimization

Vector of
Lagrange
Multiplier at
optimal point

[xmin,feval,exitflag,output,lambda,grad,hessian]
=
fmincon(fun,x0,A,B,Aeq,Beq,LB,UB,NONLCON,options,
P1,P2,)

48

Example
function f = myfun(x)

min f x x1 x2 x3
x
~

Subject to:

f=-x(1)*x(2)*x(3);

2 x12 x2 0
x1 2 x2 2 x3 0
x1 2 x2 2 x3 72
0 x1 , x2 , x3 30

1 2 2

A
, B

1
2
2

0
72

LB 0 , UB

30
30

30
49

Example (Cont.)

For

2 x12 x2 0

Create a function call nonlcon which returns 2 constraint vectors [C,Ceq]


function [C,Ceq]=nonlcon(x)
C=2*x(1)^2+x(2);
Ceq=[];

Remember to return a null


Matrix if the constraint does
not apply

50

Example (Cont.)
Initial guess (3 design variables)
x0=[10;10;10];
A=[-1 -2 -2;1 2 2];
B=[0 72]';
LB = [0 0 0]';
UB = [30 30 30]';

1 2 2
0
A
, B

72
1
2
2


0
30
30
LB 0 , UB

0
30

[x,feval]=fmincon(@myfun,x0,A,B,[],
[],LB,UB,@nonlcon)

CAREFUL!!!
fmincon(fun,x0,A,B,Aeq,Beq,LB,UB,NONLCON,options,P1,P2
,)
51

Example (Cont.)
Warning: Large-scale (trust region) method does not currently solve this type of problem, switching to medium-scale (line
search).
> In D:\Programs\MATLAB6p1\toolbox\optim\fmincon.m at line 213
In D:\usr\CHINTANG\OptToolbox\min_con.m at line 6
Optimization terminated successfully:
Magnitude of directional derivative in search direction less than 2*options.TolFun and maximum constraint violation is less
than options.TolCon
Active Constraints:
2
9
x=
0.00
0.00
16.231
feval =
-4.657237250542452e-025

x1 2 x2 2 x3 0 Const. 1
x1 2 x2 2 x3 72 Const. 2
0 x1 30
Const. 3
Const. 5
Const. 4
Const. 7

0 x2 30

Const. 6

0 x3 30
2 x12 x2 0

Const. 8
Const. 9

Sequence: A,B,Aeq,Beq,LB,UB,C,Ceq
52

53

Constrained Optimization
An optimization algorithm is large scale when it uses linear algebra that does not need
to store, nor operate on, full matrices. In contrast, medium-scale methods internally
create full matrices and use dense linear algebra
The definition is based on the Karush-Kuhn-Tucker (KKT) conditions. The KKT
conditions are analogous to the condition that the gradient must be zero at a minimum,
modified to take constraints into account. The difference is that the KKT conditions hold
for constrained problems. The KKT conditions use the auxiliary Lagrangian function:

54

fmincon Algorithms
fmincon has four algorithm options: a) interior-point,
b) active-set, c) SQP, d) trust-region-reflective
a) An Interior point method is a linear or
nonlinear programming method (Forsgren et al.
2002) that achieves optimization by going
through the middle of the solid defined by the
problem rather than around its surface
b) Active Set Approach
Equality constraints always
remain in the active set Sk. The
search
direction
dk
is
calculated and minimizes the
objective
function
while
remaining on active constraint
boundaries.
55

Sequential Quadratic Programming and Trust Region


c) Sequential quadratic programming (SQP): is an iterative method for
nonlinear optimization . SQP methods are used on problems for which the
objective function and the constraints are twice continuously differentiable.
If the problem is unconstrained, then the method reduces to Newton's method for
finding a point where the gradient of the objective vanishes. If the problem has
only equality constraints, then the method is equivalent to applying Newton's
method to the first-order optimality conditions, or KarushKuhnTucker
conditions , of the problem.
d) Trust-Region Reflective: The basic idea is to approximate f with a simpler
function q, which reasonably reflects the behavior of function f in a neighborhood
N around the point x. This neighborhood is the trust region. A trial step s is
computed by minimizing (or approximately minimizing) over N. This is the trustregion sub problem
The current point is updated to be x + s if f(x + s) < f(x); otherwise, the current
point remains unchanged and N, the region of trust, is shrunk and the trial step
computation is repeated.
56

lsqnonlin in Matlab Multi Objective Curve fitting


clc;
%recfit.m
clear;
global data;
data= [ 0.6000 0.999
0.6500 0.998
0.7000 0.997
0.7500 0.995
0.8000 0.982
0.8500 0.975
0.9000 0.932
0.9500 0.862
1.0000 0.714
1.0500 0.520
1.1000 0.287
1.1500 0.134
1.2000 0.0623
1.2500 0.0245
1.3000 0.0100
1.3500 0.0040
1.4000 0.0015
1.4500 0.0007
1.5000 0.0003 ];
% experimental data,`1st coloum x, 2nd
coloum R
x=data(:,1);
Rexp=data(:,2);
plot(x,Rexp,'ro');
% plot the experimental data
hold on
b0=[1.0 1.0];
% start values for the
parameters
b=lsqnonlin('recfun',b0)
% run the lsqnonlin with start value b0,
returned parameter values stored in b
Rcal=1./(1+exp(1.0986/b(1)*(x-b(2))));
% calculate the fitted
value with parameter b plot(x,Rcal,'b');
%
plot the fitted value on the same graph

1
1 e

1.0986
( x b2 )
b1

Find b1 and
b2
>>recfit
>>b =

%recfun.m
function y=recfun(b)
0.0603
global
data; 1.0513
x=data(:,1);
Rexp=data(:,2);
Rcal=1./(1+exp(1.0986/b(1)*(x-b(2))));
% the calculated value from the model
%y=sum((Rcal-Rexp).^2);
y=Rcal-Rexp;
% the sum of the square of the
difference
%between calculated value and 57
experimental value

SIMULINK OPTIMIZATION
RESPONSE

PART III

58

SIMULINK & OPTIMIZATION DESIGN


1)

Passing Parameters with Ports Input/Output

2)

Objective Function

3)

Invoking Simulink from Matlab

4)
5)

Passing Parameters with Blocks assignin()


Simulink Optimization Design Voltage Doubler,
Buck Boast

6)

Parametric System Identification with Optimization

59

SIMULINK MODEL FILE Ports input/output


In-Port
Parameter
Optimized

Out-Port
Parameter
Optimized

60

SIMULINK MODEL FILE Ports input/output


/PSO/Live_fn_sim.mdl

/PSO/PSO.m

>> PSO % start program, Line 40 current_fitness(i) = Live_fn(current_position(:,i));

61

INVOKING FROM MATLAB

62

Parameter Passing to Block assignin()


OPTIM15\GA\lead_screw_model_opt_Motor_ga.mdl
DC Motor Model
%I EEE_ OPT IM_20 14\ lead _sc rew_ model _op t_M otor _ga. mdl
%mo tor_ sel ect_o pt_ ga.m
%mo tor_ sel ect_g a_f un.m
%>> load ga optio ns. mat

functionfunct=motor_select_ga_fun(x)
Ki=x(1);
Ka=x(2);
assignin('base','Ki',Ki);
assignin('base','Ka',Ka);
[t,xout,err]=sim('lead_screw_model_opt_Motor_ga',[010]);
K / (L s + R )
i

K /( J s + B)
a

funct=sqrt(sum(err).^2);

%motor_select_opt_ga.m
%lead_screw_model_opt_Motor_ga.mdl
%motor_select_ga_fun.m
%loadgaoptions.mat
clc
Ki=0.1;
Ka=1;
u0=[Ki,Ka];
options=gaoptimset(options,'PopulationSize',10,'TimeLimit',100,'Generations',200,'StallTimeLimit',20,'TolCon',1e6,'TolFun',1e6)
[x,funct]=ga(@motor_select_ga_fun,2,[],[],[],[],[0.0010.001],[],[],options)

63

SIMULINK OPTIMIZATION DESIGN


OPTIM15\leadscrew\lead_screw_model_opt_mdl.mdl
DC MOTOR
(Speed Control)
Motor Parameter Estimation

Block
Parameter
Optimized

Check Custom Bounds

Gain
num(s)

10

num(s)

-K-

0.5s+1
Constant1

den(s)

K /(L s + R )
i

K /(J s + B)
a

64

OPTIM15\leadscrew\lead_screw_model_optimization.mdl

65

SIMULINK MODEL FILE Subsystem block input


OPTIM15\Buck_Boost\Buck_PWM_OPT12_Fs_Optim

Block
Parameter
Optimized

Simulink
Optimization
Response GUI

Block
Parameter
Optimized

66

OPTIM15\Buck_Boost\Buck_PWM_OPT12_Fs_Optim

67

Components block Inputs


OPTIM15\lead screw\lead_screw_model_optimization_ref.mdl (._bnd.mdl)
Linear Electric Actuator (Motor Model)

Linear Electric Actuator (Motor Model)


This
model represents
a linear actuator. It consists of a DC motor driving a worm gear which in turn drives a lead screw to produce linear motion.
Optim_file
:lead_screw_model_optimization_optim
Manufacturer data for the actuator defines the no-load linear speed (26mm/s), rated load (1000N), rated-load linear speed (19mm/s), and maximum current
This model represents a linear actuator. It consists of a DC motor driving a
(5A). The maximum static force is 4000N and the rated voltage is 24V DC.
worm gear which in turn drives a lead screw to produce linear motion.
Manufacturer data for the actuator defines the no-load linear speed (26mm/s),
time
Constant
Tm speed
and Gear
Ratioand
N are
the optimization
ratedThe
loadMotor
(1000N),
rated-load
linear
(19mm/s),
maximum
current
(5A). The maximum static force is 4000N and the rated voltage is 24V DC.
See the Linear Electric Actuator (System-Level Model) for control design and
system-level modeling.

variable to maintain the RPM between 1800 - 2200.

Block
Parameter
Optimized

f(x)=0

Block Solver
Configuration2
Parameter
Optimized

-KGain

A
+

Current
Sensor
Friction

Torque

DC Motor
Tm - Time constant

N
3mm Lead
Worm Gear
Screw

PS S

Zero N t<2s,
1000N 4s<t<6s,
4000N t>6s

Load
Force

DC Voltage Source

R rpm

Speed
Sensor

c onsta nt=0.0 637Nm/A

Pmm/s

Speed
(rpm)

Linear
Speed

Speed
linear

Torqueconstant=0.0637Nm/A

Check Custom Bounds

68

%OPTIM15\lead screw\lead_screw_model_optimization_GA.m
%OPTIM15\lead screw\lead_screw_model_optimization_GA.mdl
%OPTIM15\lead screw\lead_screw_model_optimization_ga_fun.m
%lead_screw_model_optimization_GA.m
clc
Tm=0.1;
N=0.6
x0=[Tm N];
lb=[0.01 0.01];
ub=[1 1];
options=optimset('LargeScale','on','Display','iter','Maxiter',100,'MaxFunEvals',100,'TolX',1e6,'TolFun',1e-6);
[x,funct]=fmincon(@lead_screw_ga_fun,x0,[],[],[],[],lb,ub,[],options)
function fspeed=lead_screw_ga_fun(x)
t=[0 20];
assignin('base','Tm', x(1));
assignin('base','N',x(2));
[t, xout, err]=sim('lead_screw_model_optimization_GA',t);
fspeed=sum(sqrt((2000-err).^2))
69

OPTIM15\leadscrew\lead_screw_model_optimization_bnd.mdl

70

OPTIM15\leadscrew\lead_screw_model_optimization_ref.mdl

71

Parameter Identification White box offline Identification


i)

White Box Fit the data to model derived from scientific knowledge,
physical Laws such as Ohms law, Newton Laws, Thermodynamics,
Gravity.

ii)

Grey Box Fit the data to any other model such as Autoregressive ,
polynomial or Laplace Transfer . The model is chosen by the user.

iii)

Black Box Fit the data to the model chosen by the System Identification
software

Objective
Function

72

Parameter Identification White box offline Identification


OPTIM15\lead screw\vcb_mot_opt.m
VCB Motor parameters Optimization
__ _1____

__1____

(L s+R_a)

(Js+B)
To rque
Current

= 2rad/sec
[0.51]

[0 .010.00003]

%IEEE_OPTIM_2014\lead screw\vcb_mot_opt.m
%VCB_motor_opt_port.mdl
%vcb_mot_fun.m
clc
a=1;
b=1;
c=0.1;
d=0.1;
x0=[a b c d];
lb=[0.01 0.01 0.01 0.01];
ub=[10 10 10 10];
options=optimset('LargeScale','on','Display','iter','Maxiter',200,'MaxFunEvals',200,'TolX',1e-6,'TolFun',1e-6);
[x,funct]=fmincon(@vcb_mot_fun,x0,[],[],[],[],lb,ub,[],options)
t=[0 199.99];
[t, xout, spout]=sim('vcb_motor_opt_port',t);
plot(mtrtmed,spout)
hold
grid
plot(mtrtmed,mtrsigd)
hold off

Speed

function fspeed=vcb_mot_fun(x)
load mtrsig mtrsig
load mtrtme mtrtme
mtrsigd=downsample(mtrsig,10);
mtrtmed=downsample(mtrtme,10);
t=[0 199.99];
assignin('base','a', x(1));
assignin('base','b',x(2));
assignin('base','c', x(3));
assignin('base','d', x(4));
assignin('base','mtrsigd', mtrsigd);
assignin('base','mtrtmed',mtrtmed);
[t, xout, spout]=sim('vcb_motor_opt_port',t);
fspeed=sum(sqrt((mtrsigd-spout).^2));

73

Parametric Model with Simulink Optimization


OPTIM15\lead screw\vcb_motor_opt_Motor_trk.mdl

74

OPTIM15\lead screw\vcb_motor_opt_Motor_trk.mdl

75

END

QUESTIONS ?

76

MATLAB/SIMULINK OPTIMIZATION EXAMPLES


A.

PARTICLE SWARM OPTIMIZATION

1. DC Motor Gains optimization with PSO


(OPTIM15\PSO\lead_screw_model_opt_Motor_pso.mdl)
2. Particle Swarm Optimization function
(OPTIM15\PSO\Live_fn_sim.mdl)
________________________________________________________________
_
________________________________________________________________
_

B. GENETIC ALGORITHM
3. GA function optimization
(OPTIM15\GA\Live_fn_simGA.mdl)
4. DC Motor Parameter Optimization with GA
(OPTIM15\Diodes_amps\lead_screw_model_opt_Motor_ga.mdl)\
________________________________________________________________
77
_

C. SIMULATED ANNEALING METHOD COUSTOMIZED DATA


5. Plant Noise control Optimization
( OPTIM15\Noise\Conn_octave3_j_10.m )
6. Optimize Location of power Electronics components on PCB
(OPTIM15\Heat transfer\my_SA_air.m)
7. Optimize light control system in indoor spaces
(OPTIM15\illumination\illum0_start.m)
___________________________________________________________________
___________________________________________________________________

D. TRADITIONAL OPTIMIZATION METHODS


8. DC motor Gains optimization with Error signal
(OPTIM15\lead screw\lead_screw_model_opt_Motor.mdl)
9. Buck Boost converter optimization
(OPTIM15\Buck_Boost\Buck_PWM_OPT12_Fs_Optim.mdl)
(OPTIM15\Buck_Boost\Buck_PWM_OPT12_Ti_L.mdl)
___________________________________________________________________
___________________________________________________________________
78

E. REAL DATA PARAMETERIZING


10. VCB Motor Parameter Optimization
(OPTIM15\lead screw\vcb_motor_opt_Motor_trk.mdl)
11. Parameterizing Gas turbine Fuel Controller
(OPTIM15\Gas_bio_Turbine\GT_Biofuel_present_b.mdl)
(OPTIM15\Gas_bio_Turbine\turbID14.doc
12. Plant Noise control Optimization
(OPTIM15\Noise\Conn_octave3_j_10.m)
13. DC motor Gains optimization from Matlab m-files
(OPTIM15\lead screw\lead_screw_model_opt_Motor_fmin.mdl)
14.DC Motor Gains with Variable Load file
(OPTIM15\leadscrew\lead_screw_model_opt_Motor_Trk_
VarLooad.mdl)

________________________________________________________
________________________________________________________
79

REFERENCES
1. Optimization toolbox for use with MATLAB, User Guide, The MathWorks
Inc. 2006
2. Applied Optimization with MATLAB Programming, P. Venkataraman, Wiley
Inter Science, 2002
3. Optimization for Engineering Design, Kalyanmoy Deb, Prentice Hall, 1996.
4. Convex Optimization, Stephen Boyd and Lieven Vandenberghe, CUP 2004.
5. Numerical Recipes in C (or C++): The Art of Scientific Computing, W. H.
Press, Brain P. F. Saul A. T. W. T. Vetterling CUP ,1992/2002
6. http://users.powernet.co.uk/kienzle/octave/optim.html
7. http://www.cse.uiuc.edu/eot/modules/optimization/SteepestDescent/
80

You might also like