# Rocket engine gimballing - torque and angular acceleration question

1. Apr 4, 2014

### ryanie

Hello

Firstly i just registered, Im a final year computer science student and im busy working on my thesis (the deadline is fast approaching) im working this application of a rocket going into orbit and physics is not my forte. I need some help on converting the gimbal of a rocket engine into angular acceleration. The application Im writing only works on a 2d plane. It doesnt need to be exact but im really struggling with this problem.

I have a basic rocket.
A rocket has a payload with set dimensions but specified mass.
Then any number of stages below that. A stage has
-mass
-1 to 15 rocket engines each producing a variable amount of thrust in kN
-length
-diameter

The payload is cone shaped and all the stages below that are cylindrical and all can be thought of as uniformly solid (except each stage can have different dimensions)

A rocket engine can be gimballed either left or right by a certain number of degrees.

This is the piece of code I have at the moment but it wrong because the rocket spins about to about half the speed of light immediatley when the simulation starts.

Code (Text):
private void updateRocketRotation(double deltaT) {

double totalLength = 750;

for (Stage stage : stages) {
totalLength += stage.getLength();
}

double torque = (stages.get(stages.size() - 1).getAdjacentThrust() * 1000) * (totalLength - centerOfMass / 100);

System.out.println("torque = " + torque + " kN");

double distCenterOfMass = centerOfMass - 375;
double momentOfIntertia = payload.mass * (distCenterOfMass / 100);

double distanceFromTop = 375;
for (Stage stage : stages) {
distanceFromTop += stage.getLength();
distCenterOfMass = centerOfMass - distanceFromTop;
if (distCenterOfMass < 0) {
distCenterOfMass = distanceFromTop - centerOfMass;
}
momentOfIntertia += payload.mass * (distCenterOfMass / 100);
}

System.out.println("final moment of intertia = " + momentOfIntertia + " kg/m^2");

double angularAcceleration = torque / momentOfIntertia;
rotation += angularAcceleration * deltaT;

System.out.println("set rocket rotation = " + rotation + " °");
}
Basically what this code does is calculates the torque the engine are producing by multiplying the thrust the engine are producing perpedicular to the rocket (i just did some trigonometry to figure that out) by the center of mass (i could also be calculating that wrong) this is spiting out and extremely large amount of torque and i just dont know if its correct.

then its works out moments of interia which i use the method from this paper - http://www.philsrockets.org.uk/forces.pdf

I take the payload and each stage and multiply its mass from the distance from the center of mass then divide the torque by the final moment of inertia.

Theres alot more code i can supply if you need to see where im going wrong

Forgive me if I seem lazy but I afford to spend anymore time research physics, i feel i have bitten off more than i can chew with my dissertation and im getting desperate to figure this out

Last edited: Apr 4, 2014
2. Apr 7, 2014

### Bandersnatch

Hi ryanie,

It's hard to identify the problem just from that piece of code(not to mention programming is not my forte ;) ).

Can you give us
1. the equations you used to calculate the torque
2. the units and range of values for mass, thrust and the dimensions of the rocket/stages that you use
3. the range of values for the torque that the program is outputting(that you say are too high)?

3. Apr 7, 2014

### ryanie

Hi Bandersnatch

Thanks for the reply. Unfortunatley i dont have time at the moment to give an in depth reply. The solution im using seems be working but its almost undoubtly incorrect.

I will be in touch later tonight

4. Apr 7, 2014

### sgb27

A few things I noticed at first glance:

Moment of inertia has units of mass times length squared. So this line:

momentOfIntertia += payload.mass * (distCenterOfMass / 100);

is wrong, you probably want to be squaring the distance to the centre of mass. Also in your debug text you might want to change the units displayed to kg.m^2.

Why are you adding the payload mass to the moment of inertia for every stage, you only have one payload right? I think you want to be adding the mass of the stage rather than the mass of the payload in that line.

And this line:

rotation += angularAcceleration * deltaT;

You are doing a simple numerical integration of the angular acceleration, which will give you angular velocity. You need to integrate again to get the angular rotation, something like this:

angularVelocity += angularAcceleration * deltaT;
angularRotation += angularVelocity * deltaT;

5. Apr 8, 2014

### ryanie

sjb27 and Bandersnatch.

I do really appreciate you guys taking the effort to help, alas I have run out of time and cannot afford to work on the problem any longer.

My thesis is not graded on the 'correctness' of the application rather the things you learnt along the way kinda thing.

I want to focus my attention else where on the application, the current implementation will suffice. Maybe in a couple of week ill come back and correct it and share my lovely little simulation with you....and then you can scoff...

:) Thanks again