Rocket engine gimballing - torque and angular acceleration question

AI Thread Summary
A final year computer science student is seeking assistance with converting the gimbal of a rocket engine into angular acceleration for their thesis project, which involves simulating a rocket's launch. The student is struggling with the physics involved, particularly in calculating torque and moment of inertia, leading to unrealistic results in their simulation. Feedback from other forum members highlights errors in the calculation of moment of inertia and the integration of angular acceleration, suggesting that the student should square the distance to the center of mass and correctly account for the mass of each stage. Despite the issues, the student plans to prioritize other aspects of the application and may revisit the physics calculations later. The discussion emphasizes the learning process over the immediate correctness of the simulation.
ryanie
Messages
9
Reaction score
0
Hello

Firstly i just registered, I am a final year computer science student and I am busy working on my thesis (the deadline is fast approaching) I am 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 I am writing only works on a 2d plane. It doesn't need to be exact but I am 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:
    private void updateRocketRotation(double deltaT) {

        double totalLength = 750;

        for (Stage stage : stages) {
            totalLength += stage.getLength();
        }
        
        System.out.println("adjacent thrust = " + stages.get(stages.size() - 1).getAdjacentThrust() + " kN");
        double torque = (stages.get(stages.size() - 1).getAdjacentThrust() * 1000) * (totalLength - centerOfMass / 100);
        
        System.out.println("torque = " + torque + " kN");

        //payload distance from center of mass, payload has constant dimensions
        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 don't 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 a lot more code i can supply if you need to see where I am 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 I am getting desperate to figure this out
 
Last edited:
Science news on Phys.org
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)?
 
Hi Bandersnatch

Thanks for the reply. Unfortunatley i don't have time at the moment to give an in depth reply. The solution I am using seems be working but its almost undoubtly incorrect.

I will be in touch later tonight
 
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;
 
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 learned 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
 
I was watching a Khan Academy video on entropy called: Reconciling thermodynamic and state definitions of entropy. So in the video it says: Let's say I have a container. And in that container, I have gas particles and they're bouncing around like gas particles tend to do, creating some pressure on the container of a certain volume. And let's say I have n particles. Now, each of these particles could be in x different states. Now, if each of them can be in x different states, how many total...
Thread 'Why work is PdV and not (P+dP)dV in an isothermal process?'
Let's say we have a cylinder of volume V1 with a frictionless movable piston and some gas trapped inside with pressure P1 and temperature T1. On top of the piston lay some small pebbles that add weight and essentially create the pressure P1. Also the system is inside a reservoir of water that keeps its temperature constant at T1. The system is in equilibrium at V1, P1, T1. Now let's say i put another very small pebble on top of the piston (0,00001kg) and after some seconds the system...
Back
Top