Link to home
Start Free TrialLog in
Avatar of chantalcookware
chantalcookware

asked on

Water Rocket Project in Excel Visual Basic

I have a water powered rocket project for my college engineering class, and I have to write a program in Visual Basic in Excel that proves several physics equations about the trajectory of the rocket.

There are 3 phases to the program, but if I could just get one, I believe I could figure out the rest.

I've attached the information in a Word Document.

Thank you!
VBA-Program-of-Water-Rocket.docx
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Are you the lecturer? It is against the policy of this forum to do students' homework for them.

You have submitted a thirty page explanation of the mathematics involved in this project, but it isn't clear where you are having difficulty. Is it just a matter of converting the equations to code?

I suggest that you put the initial values in a cells of a spreadsheet.

Start at or near the end of the calculation. You will see that the values on the right-hand side need to be determined, so go back and insert the calculation for those values.

In this example I started with acceleration, and saw that we need to find the force and mass of the object, so two more lines have been inserted. But these two lines in turn have right-hand variable that need to be calculated and so on.
Option Explicit

Sub Rocket()
'Declare variables
    Dim sh As Worksheet
    Dim hRocket As Double 'Height
    
    Dim vRocket As Double 'Velocity
    
    Dim mWater As Double 'Mass
    Dim mRocket As Double
    Dim mPayload As Double
    Dim mAir As Double
    Dim mTotal As Double
    
    Dim fNet As Double 'Force
    Dim fThrust As Double
    Dim fGravity As Double
    Dim fDrag As Double
    
    Dim aRocket As Double 'Acceleration
    Dim tim As Double 'Time
    
    'Constants
    Const g As Double = 9.81
    
    
    
    'Get initial values
    Set sh = ActiveWorkbook.Sheets(1)
    mRocket = sh.Cells(2, 1).Value
    mWater = sh.Cells(2, 2).Value
    
    'Calculations
    '...
    
    fNet = fThrust - fDrag - fGravity
    mTotal = mWater + mPayload + mRocket + mAir
    
    aRocket = fNet / mTotal

End Sub

Open in new window

Avatar of chantalcookware
chantalcookware

ASKER

I'm the Teaching Assistant for the engineering class and have little background in VBA, but I have more experience with the Physics aspect of the code. I'm looking for help in setting up the loops of the program and the code for the actual excel page where data is inputed into. Thank you
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So in order to have all 3 phases as loops, would you set those up with For loops as well?

Sorry I'm very new to VBA!
The code is only to give you an idea about how to go about it. It is incomplete and doesn't actually work, so outline code for the other phases would be much the same.

Providing full working code for such a project is beyond the remit of this forum. We are not permitted to solicit business, but some experts can take on this sort of work on a paid basis. Any that do will have contact information in their profiles.