Sorry About My Lack of Posts...
So I've been pretty bad at posting recently and that's because honours year engineering is intense. I'm constantly trying to stay ahead but constantly lagging behind! I'm sure you can all relate in one way or another although I swear some people in my year have at least 20 more hours in the week than me because they are doing just fine!
Some LARPing Drawings
Those of you who know me, may be aware that I'm a wee bit of a doodler. Right now I'm on a crucible doodle mission. Here's a sneak peak of some drawings that may make an appearance in your next game. I'm not going to say how or why. You'll just have to find that out yourself!
Creating A State Space Model (3)
Now this is an important one so if you want to continue following my control systems posts, I would advise you to make sure you understand it.
State space models are a a really convenient way of depicting a real life mathematical system. They involve...
- some inputs which could vary with time (u(t))
- some outputs which could vary with time (y(t))
- and some state variables which vary with time (x(t)) These are basically just stuff which happens inside a system.
For instance, if we wanted to model a radio we would have an input of some radio waves, u(t), an output of some sound waves y(t) and some internal processes which work on converting radio waves to sound waves, x(t).
This may seem a little but complicated but its really very logical when you think about it.
Top Line: The x with a dot on its head is the derivative of x, this is kind of like the rate of change in x. So the rate of change of the state variable is caused by a combination of the state variables (timed by some constant matrix A) plus some input (multiplied by some constant matrix B)
Bottom Line: Basically says that the outputs of the system is made up of the inputs and the state variables. Which makes sense really. If you think about the radio example, when you change the radio waves, you are going to hear a different sound. Also if your radio is a little bit broken and the internal system isn't working, you will get a different sound output as well.
EXAMPLE TIME!
Say we have the system in the picture to the left. A mass on a spring. Someone applies a force to one end f(t) and we measure the distance it travels q(t).
The first thing we have to do is form some governing equations which involve both f(t) and q(t). In this case we can do this by summing the forces on the mass to get the following governing equation...
By the way the q with a double dot above it is the second derivative of q. So its like the rate of change of the rate of change of distance - acceleration.
The second thing we do is isolate our inputs, outputs and state variables. So our input ( u(t) ) is f(t) - the force we add to make the system move and our output ( y(t) ) is the measured distance q(t). As a rule of thumb, the number of state variables needed in an equation is equal to the order of the differential equation. Check out those two dots on top of the q! That means we've got ourselves a second order equation so we need two state variables which in this case are x = [q ; qdot] position and speed.
The third thing (that I like to do) is form the state space equation with the matrices A,B,C and D left blank...
You may be wondering how I know what the size of matrix A, B, C and D are. I can explain it logically but I also have a general rule for you to use.
Logic: The right hand side of the top equation has two rows [qdot, qdoubledot]. So I know that I need to end up with two rows on the left hand side. Since the A matrix is timed by the 2x1 state variable matrix, I know that in order to end up with 2 rows after the matrix multiplication that I need a 2x2 matrix. If that seems a bit odd, have a look at matrix multiplication again and you'll get the idea.
Rule: Number of inputs(# i): 1, Number of outputs(# o): 1, Number of state variables(# s): 2
A = (# s) x (# s) , so 2x2
B = (# s) x (# i), so 2x1
C = (# o) x (# s) so 1x2
D = (# o) x (# i) so 1x1
The Fourth step is to fill A,B,C and D in according to the governing equations.
qdot = 0q + 1qdot + 0f
^^ qdot = qdot just like 1=1.
qdotdot = (-k/m)*q + 0qdotdot + (1/m)f
^^notice how I rearranged the governing equation to find this
q = 1q + 0qdot + 0f
So putting these into matrices...
AND THERE YOU HAVE IT! YOUR VERY OWN STATE SPACE EQUATION!!
Well done you if you followed! See if you can do the whole thing yourself without looking at my notes. That way you'll know if you understand or not.