In the last post I showed you more or less what kind of controller is needed to control the rocket. In this post I will be showing you some results from different controllers. The simulations shown in here are linear simulations of the rocket with the controller. They are not simulations of the controller in a non-linear simulation of the rocket.

I used Simulink to simulate, and matlab to create the movies that I show in here. In order to demonstrate the simulation, I disturb the TVC initially by some angle and then I let the controller do its thing. Since the controller is an LQR controller, it will try to set all the states to zero. I will first demonstrate the drift minimization controller, and then the load alleviation controller. In each section I will also apply a side wind to the rocket to show you how the controller is handling the wind. With this in mind….. lets get going!!!!!!!

## Drift Minimization

Ok. So in drift minimization all we are trying to do is minimize the drift rate. I realize that is not actually minimizing drift, but for the sake of the exercise that is all we are going to try to do. As was shown previously the lqr solution is arrived by using the cost function Q. This function basically ignores the rotation angle and the rotational rate.

For the first simulation I have setup the rotation and rotation rate to zero, but the TVC angle to 0.1 radians. Once I get the gains for each state feedback, I applied an over all gain to all the gains. The blue line is the rocket (normalized in length) and the red is the thrust vector. One thing to note about all the animations is that I have exaggerated the rotation angles (tvc and rocket) by a factor of 100.

With an overall gain of 0.03, the result of the controller is shown below.

If I reduce the gain further the motion is more oscillatory.

And if I reduce it even further it is unstable.

If I increase the gain, the motion is less oscillatory, and becomes exponentially stable. However this comes at the expense of the TVC angle being “large”.

### Drift Minimization with Constant Side Wind

So now lets see what happens if instead of perturbing the TVC system, I perturb the side wind on the rocket. Since I am minimizing the drift rate, the expectation is that the controller will attempt to position the rocket so that it is fighting against the wind to maintain a drift rate of about 0.

In order to introduce the drift due to some wind we use the “input” αw in the state space representation shown above. Any cross wind would simply increase or decrease the angle of attack seen by the rocket. In order to do this in Simulink modified the B matrix to be a 3×2 matrix. The TVC angle and the angle of attack due to wind are the inputs to the system. I apply a disturbance to the angle of attack. This figure shown below shows the modification to my Simulink model.

Using the controller for drift rate control, I apply a pulse disturbance at time 1second. Notice that the rocket is able to return the drift rate back to zero.

Now there is a problem in the LQR approach that will become really obvious soon. If I apply a constant wind, the controller will not return the drift rate back to zero. Instead it will be some constant value which can get close to zero if I up the overall gain on the controller. What this means is that the rocket will keep drifting.

One way to solve this is by including the drift state into the LQR solution or by attaching an integrator into the LQR solution so that the rocket will eventually return to a drift of zero.

## Load Minimization

So we can see what drift rate or drift minimization does. Now lets look at controlling the angle of attack of the rocket and by extension the loads on the rocket. As it was shown before, the load minimization is achieved by minimizing the Q matrix:

Lets take a look at what that does to our rocket.

### Load Minimization with Impulse Side Wind

If the rocket is hit by a gust, the TVC will force the rocket to move with the wind in order to minimize the angle of attack of the rocket. This means that the rocket will drift since it is trying to minimize the angle of attack. However once the gust is over, the drift rate will return to zero. Here is an example:

In the previous example the rocket is hit with a gust in the left direction. The TVC will force the rocket to move in that direction. Be aware that the gain in the previous example is 100. I did that to demonstrate the TVC action.