Presentation is loading. Please wait.

Presentation is loading. Please wait.

Optimal control T. F. Edgar Spring 2012.

Similar presentations


Presentation on theme: "Optimal control T. F. Edgar Spring 2012."β€” Presentation transcript:

1 Optimal control T. F. Edgar Spring 2012

2 Optimal Control Static optimization (finite dimensions)
Calculus of variations (infinite dimensions) Maximum principle (Pontryagin) / minimum principle Based on state space models Min 𝑉 𝒙,𝒖 S.t. 𝒙 =𝒇 𝒙, 𝒖, 𝑑 𝒙 𝑑 0 is given 𝑉 𝒙,𝑒 =Ξ¦ 𝒙 𝑑 𝑓 + 𝑑 0 𝑑 𝑓 𝐿 𝒙,𝒖,𝑑 𝑑𝑑 General nonlinear control problem

3 Special Case of 𝑽 Minimum fuel: 𝑑 𝑓 𝒖 𝑑𝑑 Minimum time: 𝑑 𝑓 1𝑑𝑑 Max range : π‘₯ 𝑑 𝑓 Quadratic loss: 0 𝑑 𝑓 𝒙 𝑇 𝑸𝒙+ 𝒖 𝑇 𝑹𝒖 𝑑𝑑 Analytical solution if state equation is linear, i.e., 𝒙 =𝑨𝒙+𝑩𝒖

4 β€œLinear Quadratic” problem - LQP
Note 𝐼𝑆𝐸= 0 𝑑 𝑓 π‘₯ 2 𝑑𝑑 is not solvable in a realistic sense (𝑒 is unbounded), thus need control weighting in 𝑉 E.g., 𝑉= 0 𝑑 𝑓 π‘₯ 2 +π‘Ÿ 𝑒 2 𝑑𝑑 π‘Ÿ is a tuning parameter (affects overshoot)

5 𝑉=π‘ƒπ‘Ÿπ‘œπ‘“π‘–π‘‘ ? Ex. Maximize conversion in exit of tubular reactor max π‘₯ 3 𝑑 𝑓 π‘₯ 3 : Concentration 𝑑: Residence time parameter In other cases, when π‘₯ and 𝑒 are deviation variables, π‘₯ 2 +π‘Ÿ 𝑒 π‘₯ 2 +π‘Ÿ 𝑒 2 𝑑𝑑 Objective function does not directly relate to profit (See T. F. Edgar paper in Comp. Chem. Eng., Vol 29, 41 (2004))

6 Initial conditions (a) π‘₯ 0 β‰ 0, π‘₯ 𝑑 𝑓 β†’ π‘₯ 𝑑 =0 or 𝑉= 0 𝑑 𝑓 π‘₯βˆ’ π‘₯ 𝑑 2 𝑑𝑑 Set point change, π‘₯ 𝑑 is the desired π‘₯ (b) π‘₯ 0 β‰ 0, impulse disturbance, π‘₯ 𝑑 =0 (c) π‘₯ 0 =0, model includes disturbance term

7 Other considerations: β€œopen loop” vs. β€œclosed loop”
β€œopen loop”: optimal control is an explicit function of time, depends on π‘₯ 0 -- β€œprogrammed control” β€œclosed loop”: feedback control, 𝑒 𝑑 depends on π‘₯ 𝑑 , but not on π‘₯ 0 . e.g., 𝑒 𝑑 =βˆ’πΎ 𝑑 π‘₯ 𝑑 Feedback control is advantageous in presence of noise, model errors. Optimal feedback control arises from a specific optimal control problems, the LQP.

8 Derivation of Minimum Principle
min 𝑉 𝒙,𝒖 =Ξ¦ 𝒙 𝑑 𝑓 + 0 𝑑 𝑓 𝐿 𝒙 𝑑 ,𝒖 𝑑 ,𝑑 𝑑𝑑 𝒙 =𝒇 𝒙,𝒖,𝑑 𝒙 𝑛×1 , 𝒖 π‘ŸΓ—1 Ξ¦, 𝐿, 𝑓 have continuous 1st partial w.r.t. 𝒙,𝒖,𝑑 Form Lagrangian 𝑉 𝑒 =Ξ¦+ 𝑑 0 𝑑 𝑓 𝐿+ 𝝀 𝑇 π’‡βˆ’ 𝒙 𝑑𝑑 Multipliers: adjoint variables, costates

9 ( 𝝀 𝑇 𝒙 𝑑𝑑 = 𝝀 𝑇 𝒙 𝑑 𝑓 βˆ’ 𝝀 𝑇 𝒙 𝑑 𝟎 + 𝝀 𝑇 𝒙 𝑑𝑑 )
Define 𝐻=𝐿+ 𝝀 𝑇 𝒇 (Hamiltonian) 𝑉 𝑒 =Ξ¦+ 𝑑 0 𝑑 𝑓 π»βˆ’ 𝝀 𝑇 𝒙 𝑑𝑑 = Ξ¦ π‘₯ βˆ’ 𝝀 𝑇 𝒙 𝑑 𝑓 + 𝑑 0 𝑑 𝑓 𝐻+ 𝝀 𝑇 𝒙 𝑑𝑑 ( 𝝀 𝑇 𝒙 𝑑𝑑 = 𝝀 𝑇 𝒙 𝑑 𝑓 βˆ’ 𝝀 𝑇 𝒙 𝑑 𝟎 𝝀 𝑇 𝒙 𝑑𝑑 ) Since 𝑉 is Lagrangian, we treat as unconstrained problem with variables: 𝒙 𝑑 , 𝝀 𝑑 , 𝒖 𝑑 Use variations: 𝛿𝒙 𝑑 , 𝛿𝒖 𝑑 , 𝛿 𝑉 (for 𝛿𝝀 𝑑 => original constraint, the state equation.) 𝛿 𝑉 =0= 𝑑Φ 𝑑π‘₯ βˆ’ πœ† 𝑇 𝑑 𝑓 πœ† 𝑇 𝛿π‘₯ 𝑑 𝑑 0 𝑑 𝑓 𝐻 𝑒 𝛿𝑒+ 𝐻 π‘₯ 𝛿π‘₯+ πœ† 𝑇 𝛿π‘₯ 𝑑𝑑

10 Since 𝛿π‘₯ 𝑑 , 𝛿𝑒 𝑑 are arbitrary (β‰ 0), then
πœ•π» πœ•π‘₯ + πœ† =0  πœ† =βˆ’ πœ•π» πœ•π‘₯ (n equations. β€œadjoint equation”) πœ•π» πœ•π‘’ =0, β€œoptimality equation” for weak minimum 𝑑= 𝑑 𝑓 , πœ•Ξ¦ πœ•π‘₯ βˆ’πœ†=0  πœ† 𝑑 𝑓 =βˆ’ πœ•Ξ¦ πœ•π‘₯ 𝑑 𝑓 (n boundary conditions) If π‘₯ 𝑑 0 is specified, then 𝛿π‘₯ 𝑑 0 =0 Two point boundary value problem (β€œTPBVP”)

11 Example: 𝑑 π‘₯ 1 𝑑𝑑 =π‘’βˆ’ π‘₯ (1st order transfer function) min 𝑉= 𝑑 𝑓 π‘₯ 𝑒 2 𝑑𝑑 LQP 𝐻= π‘₯ 𝑒 2 + πœ† 1 π‘’βˆ’ π‘₯ 1 πœ† 1 =βˆ’ π‘₯ 1 + πœ† 1 , πœ† 1 𝑑 𝑓 =0 𝐻 𝑒 =𝑒+ πœ† 1 =0 𝑒 π‘œπ‘π‘‘ =βˆ’ πœ† 1 (but don’t know πœ† 1 𝑑 yet)

12 Free canonical equations (eliminate 𝑒)
(1) π‘₯ 1 =π‘’βˆ’ π‘₯ 1 =βˆ’ πœ† 1 βˆ’ π‘₯ ( π‘₯ is known) (2) πœ† 1 =βˆ’ π‘₯ 1 + πœ† 1 , πœ† 1 𝑑 𝑓 =0 Combine (1) and (2), πœ† 1 =2 πœ† 1  πœ† 1 = π‘˜ 1 𝑒 2 𝑑 + π‘˜ 2 𝑒 βˆ’ 2 𝑑 0= π‘˜ 1 𝑒 2 𝑑 𝑓 + π‘˜ 2 𝑒 βˆ’ 2 𝑑 𝑓 π‘₯ 1 = πœ† 1 βˆ’ πœ† 1 = π‘˜ 1 1βˆ’ 2 𝑒 2 𝑑 + π‘˜ 𝑒 βˆ’ 2 𝑑 π‘₯ 1 0 = π‘˜ 1 1βˆ’ π‘˜ 𝑒 π‘œπ‘π‘‘ 𝑑 = π‘₯ βˆ’ 𝑒 𝑑 𝑓 𝑒 2 𝑑 βˆ’ 𝑒 𝑑 𝑓 βˆ’ 2 𝑑 = 𝑐 1 𝑒 2 𝑑 βˆ’ 𝑐 2 𝑒 βˆ’ 2 𝑑 𝑒<0 βˆ€π‘‘ for π‘₯ 0 >0, initially correct to reduce π‘₯ 𝑑

13 Another example: π‘₯ 1 = π‘₯ 2 π‘₯ 2 =𝑒 (double integrator) 𝑉= ∞ π‘₯ π‘₯ 𝑒 2 𝑑𝑑 𝐻= 1 2 π‘₯ π‘₯ 𝑒 2 + πœ† 1 π‘₯ 2 + πœ† 2 𝑒 πœ† 1 =βˆ’ πœ•π» πœ• π‘₯ 1 =βˆ’ π‘₯ 1 πœ† 2 =βˆ’ πœ•π» πœ• π‘₯ 2 =βˆ’ π‘₯ 2 βˆ’ πœ† 1 𝐻 𝑒 =0=𝑒+ πœ† 2  𝑒 π‘œπ‘π‘‘ =βˆ’ πœ† 2

14 Free canonical equations
π‘₯ 1 = π‘₯ 2 π‘₯ 2 =βˆ’ πœ† 2 πœ† 1 =βˆ’ π‘₯ 1 πœ† 2 =βˆ’ π‘₯ 2 βˆ’ πœ† 1 (𝒙, 𝝀 coupled)  πœ† 2 βˆ’ πœ† 2 + πœ† 2 =0 Char. Equation: π‘Ÿ 4 βˆ’ π‘Ÿ 2 +1=0 οƒ  π‘Ÿβ€² 2 βˆ’ π‘Ÿ β€² +1=0 π‘Ÿ β€² =0.5Β±0.707𝑗 π‘Ÿ=Β±0.85Β±0.4𝑗 (4 roots, apply boundary condition)

15 Can motivate feedback control via discrete time, one step ahead
π‘₯ π‘˜+1 =𝑒 π‘₯ π‘˜ +𝑓 𝑒 π‘˜ Set π‘˜=0, π‘₯ 1 =𝑒 π‘₯ 0 +𝑓 π‘₯ 0 ( π‘₯ 0 fixed) min 𝑉= π‘₯ 1 2 +π‘Ž 𝑒 0 2 𝑉= 𝑒 π‘₯ 0 +𝑓 𝑒 π‘Ž 𝑒 0 2 πœ•π‘‰ πœ• 𝑒 0 =2𝑓 𝑒 π‘₯ 0 +𝑓 𝑒 0 +2π‘Ž 𝑒 0 =0 0=𝑒 π‘₯ 0 +𝑓 𝑒 0 + π‘Ž 𝑓 𝑒 0  𝑒 0 = βˆ’π‘’ π‘₯ 0 𝑓+ π‘Ž 𝑓 Feedback control

16 Continuous Time LQP 𝒙 =𝑨𝒙+𝑩𝒖
𝑉= 1 2 𝒙 𝑇 𝑑 𝑓 𝑺𝒙 𝑑 𝑓 𝑑 𝑓 𝒙 𝑇 𝑸𝒙+ 𝒖 𝑇 𝑹𝒖 𝑑𝑑 𝑺, 𝑸β‰₯𝑢, 𝑹β‰₯𝑢 𝐻= 𝝀 𝑇 𝑨𝒙+𝑩𝒖 𝒙 𝑇 𝑸𝒙 𝒖 𝑇 𝑹𝒖 𝝀 =βˆ’π‘Έπ’™βˆ’ 𝑨 𝑇 𝝀, 𝝀 𝑑 𝑓 =𝑺𝒙 𝑑 𝑓 𝑯 𝒖 =𝑢= 𝑩 𝑇 𝝀+𝑹𝒖 𝒖 π‘œπ‘π‘‘ =βˆ’ 𝑹 βˆ’1 𝑩 𝑇 𝝀 (𝑹>𝑢) 𝑯 𝒖𝒖 =𝑹>𝑢

17 Free canonical equations
𝒙 =π‘¨π’™βˆ’π‘© 𝑹 βˆ’1 𝑩 𝑇 𝝀 (𝒙 0 given) 𝝀 =βˆ’π‘Έπ’™βˆ’ 𝑨 𝑇 𝝀 (𝝀 𝑑 𝑓 given) Let 𝝀=𝑷𝒙 (Riccati transformation) 𝒖 π‘œπ‘π‘‘ =βˆ’ 𝑹 βˆ’1 𝑩 𝑇 𝑷𝒙, let 𝑲= 𝑹 βˆ’1 𝑩 𝑇 𝑷 (feedback control) Then we have ODE in 𝑷 𝒙 =π‘¨π’™βˆ’π‘© 𝑹 βˆ’1 𝑩 𝑇 𝑷𝒙 (1) 𝝀 =βˆ’π‘Έπ’™βˆ’ 𝑨 𝑇 𝝀  𝑷 𝒙+𝑷 𝒙 =βˆ’π‘Έπ’™βˆ’ 𝑨 𝑇 𝑷𝒙 (2)

18 Substitute Eq. (1) into Eq. (2):
𝑷 +𝑷𝑨+ 𝑨 𝑇 π‘·βˆ’π‘·π‘© 𝑹 βˆ’1 𝑩 𝑇 𝑷+𝑸=𝑢 (Riccati ODE) 𝑷 𝑑 𝑓 =𝑺 ( backward time integration) At steady state, 𝑷→ 𝑷 𝑒 for 𝑑 𝑓 β†’ ∞, solve steady state equation. 𝑷 is symmetric, 𝑷= 𝑷 𝑇

19 Example 𝑸= , 𝑑 𝑓 β†’βˆž 𝑨= βˆ’ , 𝑩= , 𝑅=0.1 Plug into Riccati Equation (Steady state) 5 𝑃 𝑃 11 βˆ’ 𝑃 12 =0 10 𝑃 12 2 βˆ’1= 𝑃 11 𝑃 12 βˆ’ 𝑃 22 =0  𝑃 11 = 𝑃 22 = 𝑃 12 = 𝑃 21 =0.3162 Feedback Matrix: 𝑲= 𝑹 βˆ’1 𝑩 𝑇 𝑷= βˆ’1.706 βˆ’3.162

20 Generally 3 ways to solve steady state Riccati Equation:
(1) integration of ode’s οƒ  steady state; (2) Newton-Raphson (non linear equation solver); (3) transition matrix (analytical solution).

21 Transition matrix approach
𝒙 𝝀 = 𝜸 = 𝑨 βˆ’π‘© 𝑹 βˆ’1 𝑩 𝑇 βˆ’π‘Έ βˆ’ 𝑨 𝑇 𝜸 Reverse time integration (Boundary Condition: at 𝑑= 𝑑 𝑓 ): Let 𝜏= 𝑑 𝑓 βˆ’π‘‘ When 𝑑= 𝑑 𝑓 , 𝜏=0 π‘‘πœΈ π‘‘πœ = 𝜸 = βˆ’π‘¨ 𝑩 𝑹 βˆ’1 𝑩 𝑇 𝑸 𝑨 𝑇 𝜸 𝜸= 𝑒 𝒛 𝜏 𝜸 𝜏=0 Partition exponential 𝒙 𝝀 =𝜸= πœƒ 11 πœƒ 12 πœƒ 21 πœƒ 𝜸 𝜏=0

22 𝒙 𝜏 = πœƒ 11 𝒙 𝑑 𝑓 + πœƒ 12 𝝀 𝑑 𝑓 = πœƒ 11 𝒙 𝑑 𝑓 + πœƒ 12 𝑷 𝑑 𝑓 𝒙 𝑑 𝑓 (1) 𝝀 𝜏 = πœƒ 21 𝒙 𝑑 𝑓 + πœƒ 22 𝝀 𝑑 𝑓 𝑷 𝜏 𝒙 𝜏 = πœƒ 21 𝒙 𝑑 𝑓 + πœƒ 22 𝑷 𝑑 𝑓 𝒙 𝑑 𝑓 (2) Combine (1) and (2), factor out 𝒙 𝑑 𝑓 𝑷 𝜏 πœƒ 11 + πœƒ 12 𝑷 𝑑 𝑓 = πœƒ 21 + πœƒ 22 𝑷 𝑑 𝑓 Fix integration βˆ†π‘‘, πœƒ 𝑖𝑗 Δ𝑑 is fixed 𝑷 π‘‘βˆ’βˆ†π‘‘ πœƒ 11 + πœƒ 12 𝑷 𝑑 = πœƒ 21 + πœƒ 22 𝑷 𝑑 Boundary condition: 𝑷 𝑑 𝑓 =𝑺 Backward time integration of 𝑃, then forward time integration 𝒙 =𝑨𝒙+𝑩𝒖 𝒖=βˆ’ 𝑹 βˆ’1 𝑩 𝑇 𝑷𝒙

23 Integral Action (eliminate offset)
Add terms 𝒖 𝑇 𝑹 𝒖 or 𝒙 1 𝑇 𝑸 𝒙 1 to objective function Example: π‘₯ 1 =π‘Ž π‘₯ 1 +𝑏𝑒 𝑉= π‘ž π‘₯ 1 2 +π‘Ÿ 𝑒 2 + π‘ž 𝑑𝑒 𝑑𝑑 2 𝑑𝑑 Augment state equation π‘₯ 1 =π‘Ž π‘₯ 1 +𝑏𝑒 (new state variable) 𝑑𝑒 𝑑𝑑 =𝑀 (new control variable) Calculate feedback control 𝑀 π‘œπ‘π‘‘ =βˆ’ π‘˜ 1 π‘₯ 1 βˆ’ π‘˜ 2 𝑒 𝑑𝑒 𝑑𝑑 =βˆ’ π‘˜ 1 π‘₯ 1 βˆ’ π‘˜ 2 π‘₯ 1 βˆ’π‘Ž π‘₯ 𝑏 Integrate: 𝑒= π‘˜β€² π‘₯ 1 𝑑𝑑 + π‘˜β€² 2 π‘₯ 1

24 Second method: π‘₯ 0 = π‘₯ 1 𝑑𝑑 ; π‘₯ 0 = π‘₯ 1 𝑉= π‘ž π‘₯ 1 2 +π‘Ÿ 𝑒 2 + π‘ž π‘₯ 𝑑𝑑 π‘₯ 0 = π‘₯ 1 π‘₯ 1 =π‘Ž π‘₯ 1 +𝑏𝑒 Optimal control: 𝑒=βˆ’ π‘˜ 1 π‘₯ 1 βˆ’ π‘˜ 0 π‘₯ 0 =βˆ’ π‘˜ 1 π‘₯ 1 βˆ’ π‘˜ π‘₯ 1 𝑑𝑑 With more state variables,  PID controller


Download ppt "Optimal control T. F. Edgar Spring 2012."

Similar presentations


Ads by Google