Вы находитесь на странице: 1из 43

Solution manual for

Space Engineering Laboratory


Department of Instrumentation and Control Engineering

Manikandan M M.Tech Scholar, Astronomy and Space Engineering Registration No: 100944015

Manipal Institute of Technology


A Constituent Institute of Manipal University

Manipal -576104

Certificate

This is to certify that the Laboratory Manual and Journal for the lab titled SPACE MANIKANDAN M ENGINEERING LABORATORY submitted by __________________ bearing 100944015 Registration no: ___________of second semester of M.Tech Astronomy and Space Engineering/Control Systems for the academic year 2010-2011 has been submitted as per the laboratory course requirements, which has been evaluated and duly certified.

Place: Manipal

Date: 04th May, 2011

Lab-in-Charge

Department of Instrumentation and Control Engineering


Manipal Institute of Technology-576104

Contents S.No 1 One degree of freedom yaw rotor control 2 Real time two degree of freedom control 3 Real time PD control of ball position 4 WMV ball position real time control 5 To control the position of ball on the beam using PID controller 6 To control the position of the ball on the beam using root locus technique 7 Design a robust controller for ball position 8 Plot the response of helicopter system using a PID controller to control the system for constant pitch position, travel rate and roll angle(assume suitable values) Plot the response of helicopter system using a PID controller to control the system for varying pitch position at constant travel rate and roll angle(assume suitable values) Plot the response of helicopter system using a PID controller to control the system for constant pitch position, varying travel rate and constant roll angle(assume suitable values) Astrograv Experiments.Design and analysis using DSpace real-time control platform Experiment Name One degree of freedom pitch rotor control Page No Remarks

10

11 12

Experiment No: 1

TWIN ROTOR MIMO SYSTEM

The description of the TRMS setup in this experiment refers to the mechanical part and the control aspect. For details on the mechanical and electrical connection, the interface and an explanation of how the signals are measured and transferred to the PC, we will consider the following experiments. As shown in Figure , the TRMS mechanical unit consists of two rotors placed on a beam together with a counterbalance. The whole unit is attached to the tower allowing for safe helicopter control experiments.

Apart from the mechanical units, the electrical unit (placed under the tower) plays an important role for TRMS control. It allows for measured signals transfer to the PC and control signal application via an I/O card. The mechanical and electrical units provide a complete control system setup presented in second Figure below.

In order to design any control algorithms one must first understand the physical background behind the process and carry out identification experiments. The next section explains the modelling process of the TRMS. Every control project starts with plant modelling, so as much information as possible is given about the process itself. The mechanical-electrical model of the TRMS is presented in next Figure below.

Usually, phenomenological models are nonlinear, that means at least one of the states ( rotor current, position) is an argument of a nonlinear function. In order to present such a model as a transfer function (a form of linear plant dynamics representation used in control engineering), it has to be linearised. According to the electrical-mechanical diagram presented in above Figure the non-linear model equations can be derived.

Figure: Actual Real Time Model in space Engineering lab at MIT

At the end after model values are calculated we will have ( (

as the cross reaction momentum approximated by: ) )

Again the DC motor with the electrical circuit is approximated by: ( )

The motor and the electrical control circuit is approximated by a first order transfer function thus in Laplace domain the motor momentum is described by: ( )

Experiment No: 1A

One DOF Pitch Rotor Control

The Simulink diagram for the above said program is given as:

The pitch control PID values for one DOF twin rotor system are observed as;

The step response for these values is observed as:


1.4

1.2

RESPONSE

0.8

0.6

0.4

0.2

10

20

30

40

50 TIME

60

70

80

90

100

Experiment No: 1B

One DOF Yaw Rotor Control

The Simulink diagram for the above said program is given as:

The Yaw control PID values for one DOF twin rotor system are observed as;

The step response for these values is observed as:

1.5

RESPONSE
0.5 0 0

10

20

30

40

50 TIME

60

70

80

90

100

Experiment No: 1C

One DOF Tail Rotor Control

The Simulink diagram for the above said program is given as:

The tail control PID values for one DOF twin rotor system are observed as;

The step response for these values is observed as:

2 1.8 1.6 1.4

RESPONSE

1.2 1 0.8 0.6 0.4 0.2 0

10

20

30

40

50 TIME

60

70

80

90

100

Experiment No: 1D

One DOF Main Rotor Control

The Simulink diagram for the above said program is given as:

The main control PID values for one DOF twin rotor system are observed as;

The step response for these values is observed as:

1.4

1.2

RESPONSE

0.8

0.6

0.4

0.2

10

20

30

40

50 TIME

60

70

80

90

100

Experiment No: 2

Magnetic Levitation System

The description of the Maglev setup in this section refers to the mechanical-electrical part and the control aspect. For details on how the signals are measured and transferred to the PC, refer to the experiments in details. As shown in Figure below, the Maglev unit consists of a Connection-Interface Panel with a Mechanical Unit on which a coil is mounted. An infra-red sensor is attached to the Mechanical Unit. Two steel spheres are included in the package.

Apart from the mechanical units electrical units play an important role in Maglev control. They allow measured signals to be transferred to the PC via an I/O card. The Analogue Control Interface is used to transfer control signals from the PC to Maglev and back. The mechanical and electrical units provide a complete control system setup presented in Figure below.

In order to design any control algorithms one must first understand the physical background behind the process and carry out identification experiments. The next thing to explain is the modelling process of the Magnetic Levitation. Every control project starts with plant modelling, so as much information as possible is given about the process itself. The mechanical-electrical model of Maglev is presented in Figure below. Usually, phenomenological models are nonlinear, that means at least one of the states (i current, x ball position) is an argument of a nonlinear function. In order to present such a model as a transfer function (a form of linear plant dynamics representation used in control engineering), it has to be linearised. According to the electricalmechanical diagram presented in Figure below the nonlinear model equations can be derived. The simplest nonlinear model of the magnetic levitation system relating the ball position and the coil current i is the following:

where k is a constant depending on the coil (electromagnet) parameters. To present the full phenomenological model a relation between the control voltage u and the coil current would have to be introduced analysing the whole Maglev circuitry. However Maglev is equipped with an inner control loop providing a current proportional to the control voltage that is generated for control purpose:

Equations above will constitute a nonlinear model, which has been assembled in Simulink.

Real time Magnetic Levitation system in Space Engineering Lab of MIT

Experiment No: 2

Magnetic Levitation System

The Simulink diagram for the above said program is given as:

The main control PID values for MAGLEV system are observed as;

The step response for the above said program is given by:

1.2

0.8

AMPLITUDE

0.6

0.4

0.2

-0.2

10

20

30

40

50 TIME

60

70

80

90

100

Experiment No: 3

Ball and Beam Systems

The ball & beam control system is a kind of education and experiment equipment, specially designed for courses in automatic control principle, modern control engineering, and electrical motor control. The control system designed with this experiment equipment is able to control the position of a stainless steel ball on the track by adjusting the rotating angle of a beam. The Ball & Beam control system consists of two parts, namely the Ball & Beam body and the control system. The Ball & Beam body consists of a v-grooved steel bar and a free rolling ball. The linear sensor measures the position of the ball on the track by measuring the output voltage from the stainless steel bar. A DC motor is connected to a reducer, which controls the angle of beam; accordingly realize the position control of the ball.

The digital control system consists of an intelligent control module, which is a high precision, fully digital servo drive, with embedded intelligence and built-in 100W power amplifier. The drive is used for brushless motors with sinusoidal or trapezoidal commutation, or DC brush motors. Programmable with the high-level Motion Language, the intelligent control module embeds on one board advanced motion control and PLC-specific functionality. Combined with a high-level Motion Language, a graphical platform for quick configuration, tuning and motion programming, the Intelligent Control module represents a flexible and easy way to implement solution for a wide range of applications. A user-friendly graphical control interface can visually shows the results of the controller and all of the operating data. Real-Time control interface are provided in MATLAB Simulink and LabVIEW, making it convenient to implement basic experiments and arithmetic studied. Suggested Experiments: 1. System modeling; 2. Design of feedback controller; 3. P ,PD and PID control system design; 4. Design controllers using root locus methods. 5. Design controllers using frequency response methods. 6. Design controllers using user define arithmetic.

Real time model of Ball and Beam system in Space Engineering lab of MIT

Experiment No: 3A

Ball and Beam Systems Control Problems(P,PI,PID)

M mass of the ball 0.11 kg R radius of the ball 0.015 m d lever arm offset 0.03 m g gravitational acceleration 9.8 m/s2 L length of the beam 1.0 m J ball's moment of inertia 9.99e-6 kgm2 r ball position coordinate alpha beam angle coordinate theta servo gear angle The design criteria for this problem are:

Settling time less than 3 seconds Overshoot less than 5%

System Equations
The Lagrangian equation of motion for the ball is given by the following:

( )

Linearization of this equation about the beam angle, alpha = 0, gives us the following linear approximation of the system:

The equation which relates the beam angle to the angle of the gear can be approximated as linear by the equation below:

Substituting this into the previous equation, we get: ( )

1. Transfer Function
Taking the Laplace transform of the equation above, the following equation is found: ( ) ( ) ( )

NOTE: When taking the Laplace transform to find the transfer function initial conditions are assumed to be zero.

Rearranging we find the transfer function from the gear angle (theta(s)) to the ball position (R(s)). ( ) ( )

It should be noted that the above plant transfer function is a double integrator. As such it is marginally stable and will provide a challenging control problem.

2. State-Space
The linearized system equations can also be represented in state-space form. This can be done by selecting the ball's position (r) and velocity (rdot) as the state variables and the gear angle (theta) as the input. The state-space representation is shown below: * +

+* +

[ ( )

However, for our state-space example we will be using a slightly different model. The same equation for the ball still applies but instead of controlling the position through the gear angle, theta, we will control alphadouble dot. This is essentially controlling the torque of the beam. Below is the representation of this system:

[ ]

( [

) ]

[ ]

[ ]

][ ]

Note: For this system the gear and lever arm would not be used, instead a motor at the center of the beam will apply torque to the beam, to control the ball's position.

Matlab Representation and Open-Loop Response


1. Transfer Function
The transfer function found from the Laplace transform can be implemented in Matlab by inputting the numerator and denominator as vectors. To do this we must create an m-file and copy the following text into it:
m = 0.111; R = 0.015; g = -9.8; L = 1.0; d = 0.03; J = 9.99e-6; K = (m*g*d)/(L*(J/R^2+m)); num = [-K]; den = [1 0 0]; printsys(num,den)

%simplifies input

Our output should be:


num/den = 0.21 ---------s^2

Now, we would like to observe the ball's response to a step input of 0.25 m. To do this you will need to add the following line to your m-file: step(0.25*num,den) NOTE: Matlab commands from the control system toolbox are highlighted in red.

You should see the following plot showing the balls position as a function of time:

From this plot it is clear that the system is unstable in open-loop causing the ball to roll right off the end of the beam. Therefore, some method of controlling the ball's position in this system is required. Three examples of controller design are listed below for the transfer function problem. You may select from PID, Root Locus, and Frequency Response.

2. State-Space
The state-space equations can be represented in Matlab with the following commands (these equations are for the torque control model).
m = 0.111; R = 0.015; g = -9.8; J = 9.99e-6; H = -m*g/(J/(R^2)+m); A=[0 1 0 0 0 0 H 0 0 0 0 1 0 0 0 0]; B=[0;0;0;1]; C=[1 0 0 0]; D=[0];

The step response to a 0.25m desired position can be viewed by running the command below: step(A,B*.25,C,D) Your output should look like the following:

Like the plot for the transfer function this plot shows that the system is unstable and the ball will roll right off the end of the beam. Therefore, we will require some method of controlling the ball's position in this system. The State-Space example below shows how to implement a controller for this type of system. PID Controlling

Closed-loop Representation
The block diagram for this example with a controller and unity feedback of the ball's position is shown below:

Recall, that the transfer function for a PID controller is:

Proportional Control
The closed-loop transfer function for proportional control with a proportional gain (kp) equal to 100, can be modeled by copying the following lines of Matlab code into an m-file (or a '.m' file located in the same directory as Matlab)
m = 0.111; R = 0.015; g = -9.8; L = 1.0; d = 0.03; J = 9.99e-6; K = (m*g*d)/(L*(J/R^2+m)); %simplifies input num = [-K]; den = [1 0 0]; kp = 1; numP = kp*num; [numc, denc] = cloop(numP, den)

NOTE: Matlab commands from the control system toolbox are highlighted in red.

We have numerator and denominator as:


numc = 0 denc = 1.0000 0 0.2100 0 0.2100

Now, we can model the system's response to a step input of 0.25 m. Add the following line of code to your m-file and run it:
step(0.25*numc,denc)

We should get the following output:

As, we can see the addition of proportional gain does not make the system stable. Try changing the value of kp and note that the system remains unstable.

Proportional-Derivative Control
Now, we will add a derivative term to the controller. Copy the following lines of code to an m-file and run it to view the system's response to this control method.
m = 0.111; R = 0.015; g = -9.8; L = 1.0; d = 0.03; J = 9.99e-6; K = (m*g*d)/(L*(J/R^2+m)); %simplifies input num = [-K]; den = [1 0 0]; kp = 10; kd = 10; numPD = [kd kp]; numh = conv(num, numPD); [numc, denc] = cloop(numh, den); t=0:0.01:5; step(0.25*numc,denc,t)

Our plot should be similar to the following:

Now the system is stable but the overshoot is much too high and the settling time needs to go down a bit. From the PID tuning , we see that by increasing kd we can lower overshoot and decrease the settling time slightly. Therefore, make kd = 20 in your m-file and run it again. Our output should be:

The overshoot criterion is met but the settling time needs to come down a bit. To decrease the settling time we may try increasing the kp slightly to increase the rise time. The derivative gain (kd) can also be increased to take off some of the overshoot that increasing kp will cause. After playing with the gains a bit, the following step response plot can be achieved with kp = 15 and kd = 40:

As you can see from the above plot all the control objectives have been met without the use of an integral controller (settling time for this example is considered achieved when the response is less than 2% of it's final value). Remember, that for a control problem there is more than one solution for the problem.

Experiment No: 3B

Ball and Beam Systems Control Problems(Root Locus)

Root locus Technique


The open-loop transfer function of the plant for the ball and beam experiment is given below: ( ) ( ) The design criteria for this problem are:
Settling time less than 3 seconds Overshoot less than 5%

To see the derivation of the equations for this problem refer to the ball and beam modeling page. A schematic of the closed loop system with a controller is given below:

Open-loop Root Locus


The main idea of the root locus design is to estimate the closed-loop response from the open-loop root locus plot. By adding zeroes and/or poles to the original system (adding a compensator), the root locus and thus the closed-loop response will be modified. Let us first view the root locus for the plant in open loop. Create an m-file with the following Matlab code in order to model the plant and plot the root locus.
m = R = g = L = d = J = K = num den 0.111; 0.015; -9.8; 1.0; 0.03; 9.99e-6; (m*g*d)/(L*(J/R^2+m)); = [-K]; = [1 0 0]; rlocus(num,den)

%simplifies input

NOTE: Matlab commands from the control system toolbox are highlighted in red.

Now, run the m-file and you should see the following root locus plot:

As we can see the system has two poles at the origin which go off to infinity along the imaginary axes. The design criteria can also be plotted onto the root locus using the sgrid command. This command generates a grid of constant damping ratio and natural frequency. The damping ratio and natural frequency were found using the following equation, which relates the them to our percent overshoot (PO) and settling time (Ts) requirements:

Note, that the equation with Ts is found by assuming settled is when the response remains within 2% of it's final value. From these equation damping ratio and natural frequency were found to be 0.7 and 1.9 respectively. sgrid(0.70, 1.9)
axis([-5 5 -2 2])

The area between the two dotted diagnol lines represents locations where the percent overshoot is less than 5%. The area outside the curved line represents locations where the setttling time is less than 3 seconds. Note that no region of the plot falls within the design criteria shown be these lines. To remedy this and bring the root locus into the left-hand plane for stability we will try adding a lead-compensator to the system.

Lead Controller
A first order lead compensator tends to shift the root locus into the left-hand plane. A lead compensator has the form given below:
( ) ( ( ) )

where, the magnitude of zo is less than the magnitude of po. Now, let us add the controller to the plant and view the root locus. We will position the zero near the origin to cancel out one of the poles. The pole of our compensator will be placed to the left of the origin to pull the root locus further into the left-hand plane. Add the following lines of Matlab code to your m-file.
zo = 0.01; po = 5; numlead = [1 zo]; denlead = [1 po]; numl = conv(num,numlead); denl = conv(den,denlead);

rlocus(numl,denl) sgrid(0.70, 1.9)


Run your m-file in the Matlab command window and you should see the following:

Now, the branches of the root locus are within our design criteria.

Selecting a Gain
Now that we have moved the root locus into the left-hand plane, we may select a gain that will satisfy our design requirements. We can use the rlocfind command to help us do this. Add the following onto the end of your m-file.
[kc,poles]=rlocfind(numl,denl)

Go to the plot and select a point near those indicated by the cross mark on the plot below:

We should see in the Matlab command window something similar to the following (your numbers will be slightly different):
selected_point = -2.4988+ 1.2493i kc = 37.3131 poles = -2.4950+ 1.2493i -2.4950- 1.2493i -0.0101

Now, we can plot the response with this gain.

Plotting the Closed-loop Response


This value of kc can be put into the system and the closed-loop response to a step input of 0.25 m can be obtained. Add the following lines to your m-file to perform this analysis.
numl2 = kc*numl; [numcl,dencl] = cloop(numl2,denl);

t=0:0.01:5; figure step(0.25*numcl,dencl,t)

Run the m-file and we select a point on the root locus similar to the selected point above. The step response should look like the following:

From this plot we see that when a 0.25m step input is given to the system both the settling time and percent overshoot design criteria are met. Note: A design problem does not necessarily have a unique answer. Using this method (or any other) may result in many different compensators. Try running your m-file several more times selecting a different point each time and study the effect this has on the step response. For practice you may also want to go back to the original open-loop root locus and try to find other ways to add zeros and poles to get a better response.

Experiment No: 3C

Ball and Beam Systems Control Problem (Frequency Response)

Frequency response
The open-loop transfer function of the plant for the ball and beam experiment is given below: ( ) ( ) The design criteria for this problem are:

Settling time less than 3 seconds Overshoot less than 5%

A schematic of the closed loop system with a controller is given below:

Open-loop Bode Plot


The main idea of frequency based design is to use the Bode plot of the open-loop transfer function to estimate the closed-loop response. Adding a controller to the system changes the open-loop Bode plot, therefore changing the closed-loop response. Let's first draw the bode plot for the original open-loop transfer function. Create an m-file with the following code and then run it in the Matlab command window:
m = R = g = L = d = J = K = num den 0.111; 0.015; -9.8; 1.0; 0.03; 9.99e-6; (m*g*d)/(L*(J/R^2+m)); = [-K]; = [1 0 0]; bode(num,den)

%simplifies input

NOTE: Matlab commands from the control system toolbox are highlighted in red.

All the transfer function for the ball and Beam system for each controller comes from the modelling of the system which is described earlier. Weshould get the following Bode plot given on the next page as:

From this plot we see that the phase margin is zero. Since the phase margin is defined as the change in openloop phase shift necessary to make a closed-loop system stable this means that our zero phase margin indicates our system is unstable. We want to increase the phase margin and we can use a lead compensator controller to do this.

Phase-Lead Controller
A first order phase-lead compensator has the form given below: ( ) ( )

The phase-lead compensator will add positive phase to our system over the frequency range 1/aT and 1/T, which are called the corner frequencies. The maximum added phase for one lead compensator is 90 degrees. For our controller design we need a percent overshoot of 5, which corresponds to a zeta of 0.7. Generally zeta * 100 will give you the minimum phase margin needed to obtain your desired overshoot. Therefore we require a phase margin greater than 70 degrees. To obtain "T" and "a", the following steps can be used. 1. Determine the positive phase needed: We need at least 70 degrees from our controller. 2. Determine the frequency where the phase should be added (center frequency): In our case this is difficult to determine because the phase vs. frequency graph in the bode plot is a flat line. However, we have a relation between bandwidth frequency (wbw) and settling time which tells us that wbw is approximately 1.92 rad/s. Therefore we want a center frequency just before this. For now we will choose 1. 3. Determine the constant "a" from the equation below, this determines the equired space between the zero and the pole for the maximum phase added.

where phi refers to the desired phase margin. For 70 degrees, a = 0.0311. 4. Determine "T" and "aT" from the following equations:

For 70 degrees and center frequency (w) = 1, aT = 0.176 and T = 5.67 Now, we can add our lead controller to the system and view the bode plot. Remove the bode command from your m-file and add the following:
k=1; numlead = k*[5.67 1]; denlead = [0.176 1]; numl = conv(num,numlead); denl = conv(den,denlead);

bode(numl,denl) We should get the following bode plot:

We can see that our phase margin is now 70 degrees. Let's check the closed-loop response to a step input of 0.25m. Add the following to your m-file:
[numcl,dencl] = cloop(numl,denl); t=0:0.01:5; step(0.25*numcl,dencl,t)

We should get the following plot:

Although the system is now stable and the overshoot is only slightly over 5%, the settling time is not satisfactory. Increasing the gain will increase the crossover frequency and make the response faster. Make k = 5, your response should look like:

The response is faster, however, the overshoot is much too high. Increasing the gain further will just make the overshoot worse.

Adding More Phase


We can increase our phase-lead compensator to decrease the overshoot. In order to make the iterative process easier use the following program. Create an m-file and copy the function from your web-browser into it (make sure the function command starts in the first column of the m-file).
function[ ] = phaseball() %define TF m = 0.111; R = 0.015; g = -9.8; L = 1.0; d = 0.03; J = 9.99e-6; K = (m*g*d)/(L*(J/R^2+m)); %simplifies input num = [-K]; den = [1 0 0]; %ask user for controller information pm = input('Phase Margin?.......'); w = input('Center Frequency?...'); k = input('Gain?...............'); %view compensated system bode plot pmr = pm*pi/180; a = (1 - sin(pmr))/(1+sin(pmr)); T = sqrt(a)/w; aT = 1/(w*sqrt(a)); numlead = k*[aT 1]; denlead = [T 1]; numl=conv(num,numlead); denl=conv(den,denlead); figure bode(numl,denl) %view step response [numcl,dencl]=cloop(numl,denl); t=0:0.01:5; figure step(0.25*numcl,dencl,t)

With this m-file you can choose the phase margin, center frequency, and gain. Run our m-file with the following values and we should see the plots below on your screen.
Phase Margin?.......80 Center Frequency?...1 Gain?...............1

The overshoot is fine but the settling time is just a bit long. We try different numbers and see what happens. Using the following values the design criteria was met.
Phase Margin?.......85 Center Frequency?...1.9 Gain?...............2

Note: A design problem does not necessarily have a unique answer. Using this method (or any other) may result in many different compensators. For practice you may want to go back and change the added phase, gain, or center frequency.

Experiment No: 3D

Ball and Beam Systems Control Problem (State Space and digital PID)

State space:
The state-space representation of the ball and beam example is given below:

[ ]

( [

) ]

[ ]

[ ]

Remember, unlike the previous examples where we controlled the gear's angle to control the beam and ball, here we are controlling alpha-double dot. By doing this we are essentially controlling a torque applied at the centre of the beam by a motor. Therefore, we do not need a gear and lever system. The design criteria for this problem are:

Settling time less than 3 seconds Overshoot less than 5%

Full-State Feedback Controller


We will design a controller for this physical system that utilizes full-state feedback control. A schematic of this type of system is shown below:

Recall, that the characteristic polynomial for this closed-loop system is the determinant of (sI-(A-BK)), where s is the Laplace variable. For our system the A and B*K matrices are both 4x4. Hence, there should be four poles for our system. In designing our full-state feedback controller we can move these poles anywhere we want. For our design we desire an overshoot of less than 5% which corresponds to a zeta of 0.7 (please refer to your textbook for the relationship between overshoot and damping ratio). On a root locus this criterion is represented as a 45 degree line emanating from the origin and extending out into the left-half plane. We want to place our poles on or beneath this line. Our next criterion is a settling time less than 3 seconds, which corresponds to a sigma = 4.6/Ts = 4.6/3 = 1.53, represented by a vertical line at -1.53 on the root locus. Anything beyond this line in the left-half plane is a suitable place for our poles. Therefore we will place our poles at -2+2i and -2-2i. We will place the other poles far to the left for now, so that they will not affect the response too much. To start with place them at -20 and -80. Now that we have our poles we can use Matlab to find the controller (K matrix) by using the place command. Copy the following code to an mfile to model the system and find the K matrix:

NOTE: Matlab commands from the control system toolbox are highlighted in red.

m R g J

= = = =

0.111; 0.015; -9.8; 9.99e-6;

H = -m*g/(J/(R^2)+m); A=[0 1 0 0 0 0 H 0 0 0 0 1 0 0 0 0]; B=[0;0;0;1]; C=[1 0 0 0]; D=[0]; p1=-2+2i; p2=-2-2i; p3=-20; p4=-80; K=place(A,B,[p1,p2,p3,p4])

Running our m-file and we should get the following output for the K matrix:
place: ndigits= 15 K = 1.0e+03 * 1.8286 1.0286 2.0080 0.1040

After adding the K matrix, the state space equations now become: ( )

We can now simulate the closed-loop response to a 0.25m step input by using the lsim command. Add the following to your m-file:
T = 0:0.01:5; U = 0.25*ones(size(T)); [Y,X]=lsim(A-B*K,B,C,D,U,T); plot(T,Y)

Running our m-file and we should get the following plot:

From this plot we see that there is a large steady state error for which we will need to add reference input (explained in next section). However, the overshoot and settling time criteria are met. If we wanted to reduce the overshoot further than we would make the imaginary part of the pole smaller than the real part. Also, if we wanted a faster settling time we would move the poles further in the left-half plane.

Reference Input
Now we want to get rid of the steady-state error. In contrast to the other design methods, where we feedback the output and compare it to the reference input to compute an error, with a full-state feedback controller we are feeding back both states. We need to compute what the steady-state value of the states should be, multiply that by the chosen gain K, and use a new value as our reference for computing the input. This can be done by adding a constant gain Nbar after the reference. The schematic below shows this relationship:

Nbar can be found using the user-defined function rscale (copy it to the directory that our m-file is in). Copy the following to our m-file and run it to view the step response with Nbar added.
Nbar=rscale(A,B,C,D,K) T = 0:0.01:5; U = 0.25*ones(size(T)); [Y,X]=lsim(A-B*K,B*Nbar,C,D,U,T); plot(T,Y)

Note: Non-standard Matlab commands used in this example are highlighted in green.

Our output should be:


place: ndigits= 15 Nbar = 1.8286e+03

Now the steady-state error is gone and all the design criteria are satisfied. Note: A design problem does not necessarily have a unique answer. Using this method (or any other) may result in many different compensators.

Digital control:
In this digital control version of the ball and beam experiment, we are going to use the PID control method to design the digital controller. The open-loop transfer function was derived as ( ) ( )

m mass of the ball 0.11 kg g gravitational acceleration 9.8 m/s2 d lever arm offset 0.03 m L length of the beam 1.0 m R radius of the ball 0.015 m J ball's moment of inertia 9.99e-6 kgm2 R(s) ball position coordinate (m) theta(s) servo gear angle 0.25 rad The design criteria for this problem are:

Settling time less than 3 seconds Overshoot less than 5%

Digital PID controller


If we refer to any of the PID control problem for continuous systems, the PID transfer function was expressed as ( )

As we noticed the above transfer function was written in terms of s. For the digital PID control, we use the following transfer function in terms of z. ( ) ( )

Discrete transfer function


The first thing to do here is to convert the above continuous system transfer function to discrete transfer function. To do this, we are going to use the Matlab function called c2dm. To use this c2dm, we need to specify four arguments: numerator and denominator matrices, sampling time (Ts), and the 'method'. You should already be familiar with how to enter numerator and denominator matrices. The sampling time should be smaller than 1/(30*BW) sec, where BW is the closed-loop bandwidth frequency. The method we will use is the zero-order hold ('zoh'). Assuming that the closed-loop bandwidth frequency is around 1

rad/sec, let the sampling time be 1/50 sec/sample. Now we are ready to use c2dm. Enter the following commands to an m-file.
m = 0.111; R = 0.015; g = -9.8; L = 1.0; d = 0.03; J = 9.99e-6; K = (m*g*d)/(L*(J/R^2+m)); num = [-K]; den = [1 0 0]; Ts = 1/50; [numDz,denDz]=

%simplifies input

c2dm (num,den,Ts,'zoh')

Running this m-file in the Matlab command window gives us the following matrices.
numDz = 1.0e-0.4 * 0 denDz = 1 -2 1 0.4200 0.4200

From these matrices, the discrete transfer function can be written as ( ) ( ) ( )

Open-loop response
Now we will observe the ball's response to a step input of 0.25 m. To do this, enter the following commands to an new m-file and run it in the command window. You should see the following response.
numDz = 0.0001*[0.42 0.42]; denDz = [1 -2 1]; [x] = dstep (0.25*numDz,denDz,251); t=0:0.02:5; stairs(t,x)

From this plot, it is clear that the open-loop system is unstable causing the ball to roll off from the end of the beam.

Proportianal Control
Now we will add the proportional control (Kp) to the system and obtain the closed-loop system response. For now let Kp equal to 100 and see what happens to the response. Enter the following commands to an new m-file and run it in the command window.
numDz = 0.0001*[0.42 0.42]; denDz = [1 -2 1]; Kp=100; [numDzC,denDzC]=cloop (Kp*numDz,denDz); [x] = dstep (0.25*numDzC,denDzC,251); t=0:0.02:5; stairs(t,x)

As you can see, the addition of proportional control does not make the system stable. You may try to increase the proportional gain (Kp) and confirm that the system remains unstable.

Proportional-Derivative control
Now we will add a derivative term to the controller. Keep the proportional gain (Kp) equal to 100, and let the derivative gain (Kd) equal to 10. Copy the following code to an new m-file and run it to view the system response.
numDz = 0.0001*[0.42 0.42]; denDz = [1 -2 1]; Kp=100; Kd=10; numpd = [Kp+Kd -(Kp+2*Kd) Kd]; denpd = [1 1 0]; numDnew = conv(numDz,numpd); denDnew = conv(denDz,denpd); [numDnewC,denDnewC] =

cloop(numDnew,denDnew);

[x] = dstep (0.25*numDnewC,denDnewC,251); t=0:0.02:5; stairs(t,x)

Now the system is stable, but the rise time is too long. We see that the increasing the proportional gain (Kp) will decrease the rise time. Let's increase the proportional gain (Kp) to 1000 and see what happens. Change Kp in the above m-file from 100 to 1000 and rerun it in the command window. We should see the following step response.

As we can see, all of the design requirements are satisfied. For this particular problem, no implementation of an integral control was needed. But remember there is more than one solution for a control problem. For practice, you may try different P, I and D combinations to obtain a satisfactory response.

Experiment No: 4

3 DOF Helicopter System

The 3DOF helicopter simulator consists of a pedestal upon which a long arm is mounted. The arm carries the "helicopter body" on one end and a counterweight on the other. The arm can also tilt about an "elevation" axis as well as swivel about a vertical (travel) axis. Optical encoders mounted on these axes allow for measuring the elevation and travel of the arm. The helicopter body mounted at the end of the arm is free to pitch around the "pitch" axis. The pitch angle is measured via a third encoder. Two motors with propellers mounted on the helicopter body can generate a force proportional to the voltage applied to the motors. The force generated by the propellers causes the helicopter body to lift off the ground. The counterweight can reduce the power requirements on the motors; it is adjusted so that the effective mass of the body is proper. All electrical signals to and from the arm are transmitted via a slip-ring in order to eliminate the possibility of tangled wires and reduce the amount of friction.

The 3DOF helicopter simulator consists of a pedestal upon which a long arm is mounted. The arm carries the "helicopter body" on one end and a counterweight on the other. The arm can also tilt about an "elevation" axis as well as swivel about a vertical (travel) axis. Optical encoders mounted on these axes enable the measuring of the elevation and travel of the arm. The helicopter body mounted at the end of the arm is free to pitch around the "pitch" axis. The pitch angle is measured via a third encoder. Two motors with propellers mounted on the helicopter body can generate a force proportional to the voltage applied to the motors. The force generated by the propellers causes the helicopter body to lift off the ground. The counterweight can reduce the power requirements on the motors; it is adjusted so that the effective mass of the body is proper. All electrical signals to and from the arm are transmitted via a slip-ring in order to eliminate the possibility of tangled wires and reduce the amount of friction. Hardware platform based on PC and DSP-based motion controller. Experimental entity platform provided for the major of aviation. Comprehensive experiment kit, covering the dynamic modeling, classic control experiment, modern control experiment, optimized control experiment and intelligent control experiments. Users can select relevant algorithm for the experiment and teaching needs of various courses.

Experiment No: 4A

3 DOF Helicopter System (Pitch Control)

The simulink diagram for the above said experiment is given below:

PID pitch control values for the above said experiment is given as:

The step response for the above said values is given as:
1.4

1.2

RESPONSE

0.8

0.6

0.4

0.2

10

20

30

40

50 TIME

60

70

80

90

100

Experiment No: 4B

3 DOF Helicopter System(Roll Control)

The simulink diagram for the above said experiment is given as:

PID roll control values for the above experiment is given as:

The step response for the above given values is:

1.4

1.2

RESPONSE

0.8

0.6

0.4

0.2

10

20

30

40

50 TIME

60

70

80

90

100

Experiment No: 4C

3 DOF Helicopter System(Travel Control)

The simulink diagram for the above given experiment is:

PID travel control values for the above said experiment is:

The step response for the above given values is:


1.4

1.2

RESPONSE

0.8

0.6

0.4

0.2

10

20

30

40

50 TIME

60

70

80

90

100

Вам также может понравиться