ecture Energy Systems: Hardware and Control - Control Part University of Freiburg Winterterm 27/28 Eercise Sheet with solutions Prof. Dr. Moritz Diehl, Dr. Gianluca Frison and Benjamin Stickan For questions on the eercise please contact Benjamin Stickan (benjamin.stickan@imtek.uni-freiburg.de) Within the control part of the Energy Systems: Hardware and Control course there will be 45 min. eercise sessions after each lecture. The eercises are guided by tutors and will contain some MATAB-based tasks. Therefore, a MATAB installation including the Control System Toolbo is needed. Getting started. Ecept MATAB is not yet installed on your computer, the first thing you need to do is install it. Detailed installation and licensing instructions can be found at https://www.rz.uni-freiburg.de/services-en/beschaffung-em/ software-en/matlab-license Remember that the Control System Toolbo is required. 2. If you are new to MATAB, the first thing you will appreciate is the etensive help system. You can simply type doc into the console and the documentation opens. If you type doc plot, you will find a detailed description of function plot. 3. Here are some useful commands for the eercises: hold on/off figure close all clear clc Problem : Dynamical System, ODE, Simulation and Solution A simple pendulum is sketched in figure. The pointmass m is fied to a solid, massless rod of length l, which is connected to a frictionless hinge on the other side. All movements take place in the vertically oriented -y-plane and the gravitation g acts in y-direction. (a) Derive the equation of motion for the pendulum and note it in the shape α f(α). How do the mass or the length determine the motion of the pendulum? y E 2 ml2 α 2 + mgl( cos(α)) de conservation of energy α g l sin(α) α l (b) What are the states, which are needed to completely describe the system? [ [ α α 2 m Figure : Sketch of a simple pendulum (c) Convert the ODE to the system of equations f(). [ [ [ α α α g l sin(α) 2 g l sin( )
(d) Simulate the motion of the pendulum for seconds using different initial values. Therefore write a function function d nonlin_pendel(t, ) which implements the system of equations. For the simulation use lsode and the following constants: l m, g 9.8 m s 2. Solution see problem.m. (e) What characterizes steady states? Calculate the steady states for the pendulum.! [ 2 g l sin( ) 2ss, ss n π with n Z [ n π ss (f) inearize the system at the steady state ss [, and write the system of equations in the shape A + Bu and y α C. Compute the state space matrices A,B and C. [ f f ( ss ) 2 ( ss ) f 2 f ( ss ) 2 2 ( ss ) [ [ [ g l cos( ss) g l cos() g l (g) Compare the linear and the nonlinear system via simulations using increasing initial values for α() ranging from π/8 to π. With increasing α() the linear approimation gets worse. But for control tasks we want to keep our system close to a desired state, so the linearization is a good simplification and thus an important and very useful tool. For plot run problem.m Problem 2: Buck-converter, Modelling and Stabilization. The electrical circuit sketched below shows a simplified buck-converter with a constant load at the output. The system can be described in state-space representation as A + Bu, y C, D [, u : v, y : v C. i (t) i R (t) i C (t) v(t) v C (t) (a) Derive the the I/O-ODE (Input/Output-Ordinary Differential Equation) for the given circuit using equations i C, v di and i R v C (Hint: Use Kirchhoff s voltage law for inductors and current law for capacitors) v v C + v v C + ( i C + i R ) v C + v C + v C v (b) Convert the I/O-ODE to state space representations, i.e. set up the A, B, C, D-matrices for using (i) the control canonical form. ẋ(t) A(t) + Bu(t) () y(t) C(t) + Du(t) (2) 2
[ y [ [ + u (ii) the observer canonical form. [ [ + u y [ (c) Now derive matrices A, B, and or the state vector given as : [ i v C. Inductor current: di v Epress v C by utilizing Kirchhoff s voltage law: v v v C di v v C Capacitor voltage: Epress i C by utilizing Kirchoff s current law: i C i C i i R i v C i v C State-space representation: [ di [ } {{ } A C [ [ + }{{} B }{{} v u (d) Derive the characteristic polynomial. Evaluate the eigenvalues of the system for 4.7 mh, µf and i. Ω ii. Ω Is the system BIBO-stable in both cases? Characteristic polynomial: Roots of the characteristic polynomial: Ω: p(λ) det(λi A) [ λ det λ + λ 2 + λ + 3
λ 2 +! λ ± i ± i.46 3 Cf Re(λ i ) for all eigenvalues. system is undamped and therefore not BIBO-stable. Ω λ 2 + λ +! λ ± i 2 4Rl 2C2 f + 5 ± i.46 3 Re(λ i ) < for all eigenvalues. system is damped and therefore BIBO-stable. (e) Write down the time constant τ in seconds and the resulting oscillating frequency in Hz for both values of. (Hint: In this eample, the time constant τ is a measure for the amplitude decay (damping) and is defined as τ Re(λ). The oscillating frequency is defined as f ω Im(λ) ) Ω: Time constant τ: Oscillating Frequency: τ ms Re(λ) ω Im(λ) Cf Ω Time constant τ: Oscillating Frequency: f ω 232.5 Hz τ Re(λ) 2 2 ms ω Im(λ) f ω 232. Hz 4R 2 l C2 f + (f) Create a new MATAB script and define variables 4.7 mh, Cf µf and Rl. Also define matrices A, B, C and D according to task (c). (g) Use the ss(a,b,c,d) command to create a state-space model sys_ol and evaluate the systems step response with the step(sys,tfinal) function (Tfinal. s) for i. Ω ii. Ω (h) Is the system controllable and/or stabilizable? C [ B AB [ det(c) 2 4
The system is fully controllable and therefore also stabilizable. 2. Now we want to introduce a state feedback with gain K to stabilize the system in the case where no load is connected ( inf). (a) Where do the two poles have to be shifted to obtain the following characteristics for the closed-loop system?: τ ms, f Hz Re(λ /2 ) τ Im(λ /2 ) ± 2f π ± 628.385 (b) Use the MATAB function place(a,b,p) to calculate the corresponding feedback vector K and implement the system matri A cl as well as the closed-loop model sys_stable for the stabilized system. A cl A BK (B cl B, C cl C) (c) Simulate sys_stable with the step() command and verify frequency and damping is as desired. 5