Thursday, August 21, 2014

LARP Drawings and Your Very Own State Space Equation

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).

If we want to show this mathematically it looks like this ----------------------------->
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. 

Wednesday, August 6, 2014

The Weird Ways My Dog Sleeps, ThermoPlastics and ThermoSets

My Cute But Weird Dog (obligatory non-technical post)


So you may or may not know that I have a dog called Alfie. I love him to pieces. I am like a crazy cat lady except instead of spreading my affection over 20 cats I give it all to just one doggie. Alfie is the sweetest thing. But he is very weird sometimes...







Here are two pictures of him in some positions he deems 10/10 for comfort, would sleep in again. He stayed in the first position for at least an hour and in the second for at least half an hour. I don't even know how a dog can bend its leg under itself like that??




ThermoPLASTIC Stuff! ((1-2))

If you want to buy these from the polymer shape they come in the form of "solid matter" (pellot like things) Polymer chains already created!

Crystallization and Alien Geometry Races

In one of my previous blogs I talked about crystallization of a polymer. This occurs when a Thermoplastic crystalline is slow cooled. All of the polymer chains huddle together as if trying to warm themselves as the temperature falls before freezing completely (woah, that's a morbid analogy). The slower you cool it, the more crystalline it will be although it can never be completely crystalline, it sort of maxes out at about 45%.

It doesn't stop there though after the chains fold themselves into little sheets of folded polymer called lamallae, the lamallae will twist themselves into a circular arrangement like the picture below.
Once in this arrangement, we call them Spherulites. This is kind of cool because it makes them sound like an alien race of evil spheres. They also look awesome up close (Left).

So... do we think that this arrangement is more or less dense than an amorphous structure (where the polymer strings just hang out in a random arrangement). Its more dense! Which is great because it means that we can measure how crystalline a polymer is just by weighing it.


Report Card For a Highly Crystalline (or dense) Polymer

  • Stiffness = A+ all those polymers are hugging each other tightly within their lamallae and spherulites and will not be easily wrenched apart
  • Heat Deflection = A+ this means that the polymer now needs to be heated to higher temperatures before it will melt.
  • Chemical Resistance = A+ Not really sure why this is, anyone care to share their thoughts
  • Hardness = A+ something something that's what she said something. 
  • Tensile Strength = A+ yes this is different to hardness, tensile strength is like how much weight it could hold and hardness its ability to dent other materials.
  • Impact Strength = C- being crystalline makes polymers brittle! If you hit it with a hammer, it will shatter!
  • Ductility = C- those polymer chains are just holding onto each other too tightly for there to be much give
As a side note, if you were to assess an Amorphous structure (with the random arrangement of polymers) the results above would be exactly the opposite. Have a think as to why...

MOAR CRYSTALLIZATION!

So if you think crystallisation is really cool you can increase it by doing a number of things. 
  1. Cooling the polymer slower
  2. Cooling the polymer to the right temperature
  3. Adding bits of fiber to the polymer - these fibres act as nucleation sites which basically means that crystallization likes to happen there.  

ThermoSET Stuff! ((1-2))

If you want to buy these from the Polymer Shop you will find them as either a liquid or solid resin. You have to process these yourself to get your polymer chains and cross links. This makes sense as they can only be processed once!

How do I process My Thermosets?

Thermosets need a little bit of encouragement in order to start reacting and forming their strong covalent cross links. They need a catalyst such as heat, pressure, UV light and sometimes they just need time. Once you get them going though they produce A LOT OF HEAT! This is because they are exothermic (meaning they release a lot of energy when reacting).

I know what some of you clever sods are thinking, "but they degrade in high temperatures, doesn't that mean that they will kill themselves as they form?" Well yes if left them to their own devices, things don't work out. Which is why heat must be removed and moderated during the reaction. 

Stick to Your Strengths!

Thermosets are way stronger than thermoplastics. They are often used for this reason. So when processing them, they should be given the strongest properties possible by being allowed to cure almost completely.
Here's a graph of their cooling over time where alpha is the degree of cure. Obviously you don't want o be waiting around all year for them to be perfect so you have to stop the cure when the graph starts to level out and not when alpha = 1. 

The more inquisitive of you may wonder how the degree of cure is calculated. Obviously you can't figure out how far along the cure is by counting all the cross links between the chains. What you can do though is look at the amount of heat released (in the form of enthalpy) and compare it to the total amount of heat that could be released. dHa/dHt = alpha 

Sunday, August 3, 2014

Sweet Buns, Katanas and Heat Exchanges

Sweet Buns ((1))

I am a youtube hair style enthusiast. It's my guilty pleasure to spend an unnecessary amount of time getting ready for parties so that I can learn a new hairstyle. Often I don't even care about doing my makeup.
Hair is both ridiculous and crazy cool. I've always found it weird that unlike most other animals our hair doesn't seem to stick around to keep us warm at all. The fact that our hair pretty much only has an aesthetic use says a lot about people I think. But isn't it cool that somehow, when we twist it into some knots and smooth it down or whatever, this somehow means that we can make ourselves more "attractive". That's whacked, its not just me, right?? But then the general public does seem to like a lot of whacked things that aren't entirely natural or practical. So although its whacked, its not at all surprising.
I would really like to get into doing hair for balls and weddings and things when I get a bit older so hit me up if you are willing to trade me some baking for a hair style for x event in the future. I love that stuff, weird as it is.

Katana ((1))

I bought my first Larp-safe weappon today!! MUCH EXCITE! It's a katana and its beautiful. I have no idea how I am going to be able to use it but man it is cool. Its got a weighted hilt so it feels like you are wielding the real thing except that you're in no danger of splitting flies in half mid air. I will post photos when i get it :) And then I will have to start learning how to use it.

Heat Exchanges ((2))

So heat exchangers are a pretty common place thing for a mechanical engineer. They are basically a component through which flows two fluids which do not mix (i.e. they are in separate pipes). They will be separated by some conductive metal so that heat is conducted between the two streams. This heats on of the streams and cools the other. 

The reason I am telling you about heat exchangers is because they are relevant to my fourth year project. My fourth year project is all about waste heat recovery cycles. This means that take some hot fluid created in an industrial process e.g. some hot water. Then we put it through a thermodynamic cycle in order to turn the heat into electricity. In order to extract energy from heat you need to transfer the heat from the waste fluid into the fluid that you use to drive a turbine (a device which a flow of fluid rotates in order to generate electricity). In our project, the fluid we are investigating is carbon dioxide. I want to see how well heat can be transferred between my waste fluid and carbon dioxide when the carbon dioxide is at different pressures. 
It gets a wee bit more complicated than that but for the sake of simplicity and the time it takes me to write a blog post just keep all of that in mind. 

((3))

One method of calculating the heat transfer rate (how fast heat energy can be passed between streams) is called the Log Mean Temperature Difference Method or LMTD for shorts.This is what it looks like:
  • Qdot is just the heat transfer rate
  • U is the overall heat transfer coefficient (which basically says how easy or hard it is to transfer heat between the two fluids)
  • A is the area over which heat transfer between the two fluids occurs 
  • Triangle Tlm is the log mean temperature difference defined in the second equation
  • ln is a natural log (basically an operation which is a little more complex than multiplication and stuff)
  • Th,in is the temperature of the hot stream at the inlet of the heat exchanger
  • Th, out is the temperature of the hot stream at the outlet of the heat exchanger
  • Tc, in and Tc,out are the corresponding cold stream values

Creating a Model 

So the tricky thing about the model that I have to create is that the above equation is only viable for constant specific heat (Cp). But at certain pressures (close to the critical pressure, where unfortunately our project's cycle is operating at) the Cp of carbon dioxide changes a lot! By the way, specific heat is pretty much a measure of how much energy it takes to increase the temperature of a fluid by one degrees. Ever wondered why it takes water about twice as long to boil as it does for oil? Yeah oil has about half the Cp value as water. Try it out yourself if you can spare a pot full of oil! 

This variation of cp means that I need to break the heat exchanger up into many very small parts so that I can assume constant specific heat across these tiny sections. Then I can integrate over all of these sections in order to get the overall heat transfer rate. This is why they teach us integration in high school by the way! Because of applications like this. Your teacher wasn't just doing it to see you suffer! 

But anyhow! I will have to talk more about this later because its getting late and university is tomorrow! Goodnight! 


Saturday, August 2, 2014

Hair stuff, Matrix Multiplication, Complex Numbers and Modal Method

HAIR STUFF! 

This is basically my obligatory non mathematical post. I did this using an inverse french braid (meaning that you cross strands of hair underneath rather than over top) which gives a really distinct platted look which follows the curvature of the head. 

The back bit I did using a technique which is a little hard to explain without a demonstration. But its super duper easy, holds really well and doesn't require as many bobby pins as you think. Intrigued? Ask me next time I see you and I'll give you a demonstration! 

SO! ONTO THE MATH!




Matrix Multiplication (difficulty 2 - Give it a try)

So matrix multiplication is relevant to a lot of things, including today's lesson! Previously we have done a 2x2 matrix multiplied by a 2x1 matrix. Today we will be doing something a little more complicated and multiplying a 2x2 matrix by a 2x2 matrix. Below I am going to show you how to do it by using letters. Don't panic when you see letters being used to explain math! Letters simply represent any number and they are easier to track than numbers. Anyway, here is our matrix multiplication... 

So we can see to make the top left element on the final matrix we used the top row of the first matrix and the left column of the second matrix, to get the top right element of the final matrix we used the top row of the first matrix and the right column of the second matrix etc etc. 

Give it a try on these two matricies:
[2,1; 2,2] and [3,1; 1,1]; did you get [7,3; 8,4]? if you didn't, let me know and I will see if I can sort out your problem. If you did, GOOD JOB YOU, YOU ARE AWESOME!

Modal Method (3)

So as mentioned before the modal method can only be used to find e^At...
  • If A is diagonalisable 
    • I've talked about this in a previous blog but in a nut shell you can check for diagonalablity (I feel like I'm just making these words up) finding the eigenvectors, putting them into a matrix (called P) and checking that that matrix has two linearly independent columns.
If you go through and find that the matrix is not diagonalisable then too bad how sad you have to use the expansion method.

The rest of this method involves using this formula... e^(At) = Pe^(LAMBDA.t).P^(-1) where
  • P is our friendly old matrix made out of our eigenvectors (which we have to find to prove we can use this method anyway)
  • LAMBDA (would usually be written as capital lambda and looks like this) is a matrix with our eigenvalues (also already found) on the diagonals
  • t is just a scalar representing time
Basically you put all your values into the formula and bob's your uncle. 

Inverting a Matrix (2)

There is one part that I want you to take notice of though... NOTICE how I have coloured the P^(-1) in red above? It means that we need to take the inverse of the matrix. Usually when we see ^(-1) on a scalar number e.g. 5^(-1) it simply means that we need to push the number down to the other side of the fraction line i.e. 5^(-1) == 1/5 but for a matrix EVERYTHING CHANGES. We now have to do an operation to it which might seem weird but it works on paper because algebra. If you don't believe me try converting a matrix into a scalar equation and try inverting that linearly. You'll get the same answer :)

What you need to know for a 2x2 matrix is that we swap the numbers on the diagonal that goes this way \ and we change the sign (e.g. from positive to negative) on the numbers on the diagonal this way /. And then you times the new matrix by one divided by the determinant of the original matrix (which I tell you how to do here in my calculation of eigenvalues). Let's see an example of that...


See if you can cover up my example and give it a go yourself!

Modal Method Example (4 just because there are so many steps!)

We're going to try to find e^(At) using the matrix A = [0,1; 1,0]. To solve this I have to introduce the idea of complex numbers...

COMPLEX NUMBERS!
These are also known as imaginary numbers because in real life they don't exist as a number!! 
Complex numbers are literally the square root of -1. Think about it, a square root sign is the opposite of a squared sign. The square of positive two and the square of negative two both work out to be the same number 2^2 = 4 & (-2)^2 = 4 as a negative times a negative is a positive. Therefore it is impossible to reverse this and take the square root of a negative number. Try it on a calculator! We represent these numbers as the letter "i"  or "j" which literally means the square root of -1. From this we can see...
  • j^1 = j
  • j^2 = -1
  • j^3 = -j
  • j^4 = 1 and so on and so forth.  
Although we call them imaginary, this does not go to say that they are useless. They are actually used in a lot of applications and can tell us a lot about a system if they arise. 

BACK TO OUR EXAMPLE...



Doesn't that just come out beautifully!


Euler's formula can be found here for anyone who is interested in seeing for themselves how it works :)