Upload
july-aye
View
107
Download
1
Embed Size (px)
Citation preview
CEE 170 Jet Cart Design Project Aye, July Basravi, Saba Greene, Heather Masoodnia, Marta Lee, Patrick Long, Joshua Saeby, Oliver
December 12, 2014
Winter 2014
TEAM 15-‐ POSH JJ
2
Introduction……………………………………………………………………………………………………………………………………………………..3 Water Jet Cart Mechanics…………………………………………………………………………………………………………………………………3
Theory…………………………………………………………………………………………………………………………………………………3
Water Jet Cart Design and Fabrication………………………………………………………………………………………………………………6
Approach…………………………………………………………………………………………………………………………………………….6 Materials and Methods……………………………………………………………………………………………………………………….7 Testing Procedure……………………………………………………………………………………………………………………………….7 Analysis……………………………………………………………………………………………………………………………………………….8 Final Cart Design………………………………………………………………………………………………………………………………….8
Water Jet Cart Modeling……………………………………………………………………………………………………………………………………8
Matlab Code Theory…………………………………………………………………………………………………………………………….8 Rolling Test………………………………………………………………………………………………………………………………………….8 Water Jet Test Runs……………….……………………………………………………………….……………………………………………9 Calibration……………………………………………………………………………………………………..…………………………………….9
Water Jet Cart Optimization…………….……………………………………………………….…………………………………………….…………9
Race Results………………………………………………………………………………………………………………………………………………………9
Discussion………………………………………………………………………………………………………………………………………………………….10
Appendix A: Preliminary Testing Day Data…………………………………………………………………………………………………………11
Appendix B: Race Day Data……………………………………………………………………………………………………………………………….12
Appendix C: MatLab Code Before Optimization…………………………………………………………………………………………………13
Appendix D: MatLab Code After Optimization……………………………………………………………………………………………………17
Appendix E: AutoCAD DWG’s……………..……………………………………………………………………………………………………………..20
Appendix F: References……….……………..……………………………………………………………………………………………………………..23
3
Introduction The purpose of this project is to design and construct a cart that would be able to transfer momentum from a water jet to propel itself up a 2% slope in a straight line for 50 feet. The two competition categories are to travel across a distance of 50 feet in the least amount of time as well as developing a MATLAB code that would most accurately predict the total time required. Teams were given the options of using nozzle sizes of diameter 3/8 inches, ½ inches, ¾ inches, or 1 inch. The amount of water and pressure used was determined by a 15 point system where every inch of water costs 1 point and every 5 psi of pressure costs 1 point.
Water Jet Cart Design and Fabrication
Theory
Three equations are used to describe the jet of water out of the tank and the movement of the cart: 1. The Continuity Equation 2. The Bernoulli Equation 3. The Conservation of Momentum Equation
First, the Continuity Equation is used to relate the change in height of water inside the tank with respect to time.
𝑄!"# = −𝑑(𝑆𝑡𝑜𝑟𝑎𝑔𝑒)
𝑑𝑡
Next, set 𝑄!"# =!!𝑑!𝑉! and
!(!"#$%&')!"
= !!𝐷! !!
!"
Setting them equal to each other, !!!"
!!𝑑! = 𝑉!
!!𝐷!
Finally, !!!"= − !!
!!𝑉!
Next, the Bernoulli equation is used to find the exit velocity of the tank (𝑉!), which will be renamed as the jet velocity (𝑉!) assuming steady, incompressible, and inviscid flow. However, some of the variables need to be manipulated to account for minor and major losses from the nozzle.
𝑃!𝛾+𝑉!!
2𝑔+ 𝑧! =
𝑃!𝛾+𝑉!!
2𝑔+ 𝑧!
4
Assume that 𝑉!, 𝑃!, and 𝑧! are equal to 0 because there is no horizontal velocity in the tank, no gage pressure since the nozzle is only experiencing atmospheric pressure and the nozzle will be at a height of 0 since it is considered as the origin. Next, the Bernoulli equation is manipulated to account for ℎ!, which is the energy loss due to friction from nozzle. The equation can be reduced to:
𝑃!𝛾+ ℎ =
𝑉!!
2𝑔+ ℎ!
In order to specify the exact energy losses, the equation is changed to include the Darcy-‐Weisbach friction factor for the nozzle (𝑓) and the minor loss coefficient from the valve (𝑘!). Finally, the equation becomes:
𝑃!𝛾+ ℎ =
𝑉!!
2𝑔+ 𝑘! + 𝑓
𝐿𝐷
𝑉!!
2𝑔
By rearranging this equation for 𝑉!:
𝑉! = 2𝑔
𝑃!𝛾 + ℎ
1 + 𝑘! + 𝑓𝐿𝐷
Then, 𝑉! is plugged into the equation for !!!"
: 𝑑ℎ𝑑𝑡
= −𝑑!
𝐷!𝑉!
𝑑ℎ𝑑𝑡
= −𝑑!
𝐷!∗ 2𝑔
𝑃!𝛾 + ℎ
1 + 𝑘! +𝑓𝐿𝐷
As the water leaves the tank, the pressure inside the tank will begin to decrease. Since the total mass of air in the tank does not shift, the head space becomes larger therefore the pressure drops. The following equation assumed an adiabatic and an isentropic process, which means that there is no heat exchanged with the environment and there is no loss in entropy, respectively.
𝑃 𝑉𝑜𝑙! = 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡 The specific heat ratio 𝑘 is represented by the equation
𝑘 = 𝑐!/𝑐! The head space in the tank (the space that the air occupies as the water leaves through the nozzle) is calculated using, where 𝑠 represents the height of the headspace:
𝑉𝑜𝑙𝑢𝑚𝑒 =
𝜋4𝐷!𝑠
The previous equation with related the pressure and the specific heat ratio is rewritten as
𝑃!𝑠!! = 𝑃𝑠! The initial height of water and headspace in the tank is equal to the new height of water and headspace in the tank at every instance in time.
𝑠! + ℎ! = 𝑠 + ℎ
5
Therefore the pressure equation can be rewritten in relation to the depth in the tank as in the following equation which can replace the pressure (P) in the equation for 𝑉!
𝑃 = 𝑃!𝑠!
𝑠! + ℎ! − ℎ
!
In order to implement the Conservation of Momentum equation, Newton’s Second Law of Motion is used, where the force exerted on the cart is proportional to the mass times the acceleration of the cart.
𝐹 = 𝑚𝑎 To relate velocity into the equation, acceleration is rewritten as the change in velocity over time: 𝑎= !"!"#$
!"
When solving for this term, there are certain calibration parameters that must be included to account for the slope of the terrain and the drag force that the air exerts on the cart, which are 𝑔 sin 𝜃 and 𝐶!respectively.
𝑑𝑉!"#$𝑑𝑡
=𝐹𝑚− 𝑔 sin 𝜃 − 𝐶!
Through the application of the Conservation of Momentum and Reynold’s Transport Theorem, the sum of forces can be defined as:
∑𝐹 = 𝜌𝐴𝑉 𝑉!"# − [𝜌𝐴𝑉]𝑉!" The equation from above can be simplified by noticing that Vout is not in the x-‐direction, and cancelling out the negative sign since the force is pushing the cart to the right:
𝐹!"#$ = (𝜌𝐴𝑉)𝑉!" The equation above can be altered to take into account the relative velocity. The relative velocity is the difference between the velocity of the water jet and the velocity of the cart. By plugging it into the equations for !"!"#$
!" , we obtain an alternate differential
equation used in the model.
𝑑𝑉!"#$𝑑𝑡
=𝛼𝜌𝐴𝑀!"#$
𝑉!"# − 𝑉!"#$!− 𝑔 sin 𝜃 − 𝐶!
A is the cross-‐sectional area of the nozzle and the momentum transfer coefficient is represented by 𝛼 (𝛼 is generally between 1 and 2). When the cart begins to gain velocity it faces opposing forces, forces in the opposite direction. For example the drag force which is generated by a fluid, in this case air, which the cart is moving through. The drag force acts in the opposite direction as the cart and results in the equations:
𝐹! =12𝐶!𝐴!𝜌𝑉!"#$!
where 𝐶! is the drag coefficient of the fluid, 𝐴! is the frontal area of the cart, 𝜌 is the density of the air and 𝑉!"#$ is the velocity of the cart. The velocity of the cart and the drag force in this situation are not constant. This behavior is shown by
𝑑𝐹!𝑑𝑡
=12𝐶!𝐴!𝜌(
𝑑𝑉!"#$𝑡
)!
The equation accounts for the change in velocity of the cart as it travels. The MatLab code provided incorporates this equations by using a 0.44 drag force coefficient. The code can provide a more accurate output and prediction of the cart travel time since it takes into account the forces in the positive and negative direction.
6
Water Jet Cart Design and Fabrication
Approach The momentum of the jet is used most effectively when the amount of water hitting the cart is equal to the amount of water that comes out. With this in mind, a design incorporating a half-‐pipe shape was used in order to allow the maximum momentum transfer. The placement of the deflector was the next important decision for the design. Where the deflector was located relative to the wheels of the cart would determine how stable the cart would be during its run. Next, the ropes were added to bring down the sides of the bucket that were less stable, so that it would become more parallel to the deck. This helped the deflector withstand the horizontal force of the jet of water effectively. Otherwise, there would be too much force pushing up on the deflector creating uplift, which would hinder the cart. The deflector also added weight, which would shift the center of gravity of the cart. This is important because when a cart has a high center of gravity, it is easier for the cart to spin out and it also prevents the cart from moving straight, which would be critical in the accuracy competition.
Figure 2: Two of the group members (Heather and Marta) after constructing the initial design.
7
Materials and Methods Home Depot 5-‐gallon bucket: 14.5 in. height, 12 in. diameter 1-‐½ in. Zinc Plated Corner Braces (quantity of 2) ¼ in. Bolts and Nuts (quantity of 8) Wrench Saw (for cutting the plastic bucket) Drill Skateboard Trucks, Bearings, and Wheels The decision factors in materials chosen for our cart included cost and ease of construction. For this reason, we decided to steer clear from metals and instead used wood for the base and plastic for the deflector. A wooden skateboard deck was used for the base, which was cheap when ordered online. The pros about purchasing only the deck and not a whole skateboard were that there was no grip tape added nor trucks, wheels, and bearings. We were free to use materials that would work best for our project and custom build the cart. First, the bottom of the 5-‐gallon bucket was cut off with the saw in order to end up with a cylindrical shape. Next, the bucket was in half in order to create a deflector. Bolt holes were created in the deflector using a drill for where it would be bolted to the skateboard deck as well as where the ropes would go. The deflector is then placed so that a semicircle shape would be seen in the side profile view. Next, bolt holes were created in the skateboard deck for where the rope’s knots would be placed, where the bottom of the deflector would be bolted to the deck, as well as where the L bracket would be attached. Next, the deflector was attached to the skateboard using a wrench, zinc L brackets, bolts, and nuts. The rope was then attached from the top of the deflector to the skateboard deck with the knots placed under the skateboard deck to account for the uplift that the deflector would experience. Finally, the skateboard trucks, wheels, and bearings were attached to the bottom of the skateboard deck.
Testing Procedure The cart testing began by placing the cart in front of the jet so that that the nozzle was hitting the deflector as close to the center as possible. The cart was checked to make sure it was aimed straight towards the finish line between the two infrared sensors. Next, the tank was fixed to the design settings that we would test, which was the combination of height of water, pressure, nozzle size, and nozzle angle. Then, the lever was released to allow the jet of water to hit the deflector and propel the cart to move forward. The cart was timed from the time the cart crossed the start line at the first two infrared sensors to the time the cart crossed finish line at the last two infrared sensors. Since we were allotted 10 minutes to make as many runs as possible, we tried to use a moderate design setting first so that we could decide whether to increase or decrease pressure. We assumed that the pressure would affect the cart the most, so we started out using 60 psi and 3 inches of water with a ¾ inch diameter nozzle without an angle. We increased height of water and lowered the pressure every run after, but our cart kept spinning out. We then tried using a bigger nozzle thinking it might help spread the water evenly across the surface area of our deflector, but our hypothesis was incorrect. The nozzle created a jet of water too big for the surface area of our deflector, which meant that there was too much eccentricity, causing the cart to keep spinning out. When we finally decided to go to the smallest nozzle, there was progress. Our cart was able to roll, but it did not roll straight and it was curving to the left too much. With this progress, we kept increasing pressure and decreasing water until we found a sweet spot with 3 inches of water and 60 psi. Even though we had to aim the cart to the right to account for our cart traveling in a curve to the left, we felt that this design setting would be the best for our cart and proceeded to modify our cart based on the two completed times we obtained.
8
Analysis Some of the complications we observed during our preliminary testing was that the cart was spinning out too much with higher nozzle diameters and that it was not rolling straight. After thinking about how the center of gravity affects the stability of a cart, it was decided that a weight needed to be added. The skateboard and deflection piece were so light in weight that the cart kept spinning out. The five pound weight was added to the back of the cart for more balance. Before the final race the bearings and wheels were also tightened to ensure the cart would run straight, resolving our second complication. These two things combined improved the speed and balance of our cart for the final race. A minor complication we had was that the infrared sensors did not work with our cart because we failed to create a letter-‐size profile section, which meant that our cart was not tripping the sensors. To comply with this, we added a cardboard piece that helped with increasing the profile cross-‐section. Final Cart Design The final design of the cart was not far off from our initial design. Our first idea for this design luckily worked well with a few minor adjustments. The design idea of using a bucket made the cart very light weight but adding a five pound flat weight to the front of the skateboard fixed this problem easily. During the testing of the cart the cart veered to the left slightly. We decided to tighten the bearings and tested it again by rolling the cart straight. Tightening the bearings made the cart roll straight. With these two problems fixed we decided to not make any more changes to the design. With the cart rolling straight and weighing enough to not spin out, it was able to make it across the finish line without a problem. Water Jet Cart Modeling MatLab Code Theory The MatLab code was developed by first inputting a combination of initial conditions, given parameters, and parameters calculated from test data and calibration. Next we created a handle for the velocity function, and setup the ODE 45 function with the inputs of the velocity function, time interval, and initial conditions. The outputs of the ODE 45 function are the velocity of the cart and the time. The function for the velocity of the cart has a system of three equations. The first is the change in height of water in the tank over time. This equation has two “if” statements incorporated into it to set the velocity of the jet equal to zero when there is no water in the tank, and to set the relative velocity to zero when the cart is out of range of the jet. The second equation gives the relative velocity between the cart and the jet. The third equation gives the horizontal position of the cart. Next we incorporated an options function for the ODE function, which will output the results from the ODE set once the cart reaches 50ft. Then we used a “for” loop to take the output of the height of water in the tank from the ODE function at every time step and recalculated the velocity of the water jet at every time step. Finally we set up the code to output the time it takes for the cart to travel 50ft and plot the velocity of the cart versus time, the position of the car versus time, and the velocity of the jet versus time. Rolling Test In order to calibrate for rolling resistance and air resistance, a rolling test was used. The cart was timed when rolled down a hill of known slope, provided in Appendix C. The cart was rolled down the hill three times and the average length was 81 feet at a time of 8.3 seconds. The water jet velocity value was set to 0 so the only forces acting on the cart were gravity, rolling resistance and air resistance. Air resistance was easily estimated by using following equation:
𝐹! =12𝐶!𝐴!𝜌𝑉!"#$!
The area of the cart (𝐴!) was estimated to be 13in x 8in for a total of .0671 m2. The constant 𝐶!was first estimated to be 0.50, which is similar to that of a small car. After running the code and adjusting for other variables, 0.55 was decided for the final coefficient of drag. The rolling resistance was more difficult to account for but it was obtained by comparing the values obtained when the water jet velocity was zero and known coefficients for friction for hard rubber on concrete.
𝐹! = 𝑔 ∙ 𝐶! After changing the values for mass and alpha, a final guess was made for the coefficient of friction to be 0.3. The total resistance from rolling and air was estimated to be about 0.7 Newtons.
9
Water Jet Test Runs The data from the preliminary test run was used to determine the momentum transfer coefficient. Only two out of eleven tests were able to cross the finish line. One of the first things noticed was that the cart deviated heavily to the left. In order to account for this, the length of the travelled path way was modified from 50 feet to 70 feet. Because the only two successful runs had identical water height, pressure, and nozzle diameter, the two times were averaged. If more data was obtained for different water heights, pressure and nozzle diameter, it would have been possible to plot more data points and use the method of root-‐mean-‐square error (RMSE) to measure the differences between more values. Calibration The goal of calibration was to take the data we collected during the initial cart test and modify our MatLab code to match that data. The MatLab coded required a calibration for the momentum transfer coefficient, 𝛼, which is between 1 and 2. An 𝛼 value of 1 would indicate that no water was reflected directly back by the cart design and an 𝛼 value of 2 would indicate that all the water was reflected back. Observations of water reflection and value estimated comparing output times led to the MatLab code using an 𝛼 value equal to 1. In order to come up with the predicted time, the mass of the cart was increased to what the cart’s weight would be on race day and the length of the path was changed back to 50 feet to get an estimated time of about 3.92 seconds. Water Jet Cart Optimization The calibrated model was used to determine the optimal tank settings by inputting a variety of combinations and checking the best times. We let MatLab spit out different values for time according to different pressures, heights of water, and nozzle diameters. The best value we received was a time of 3.11 seconds for a configuration with 4 inches of water and 55 psi with a nozzle diameter of 3/8 inches. One of the reasons we did not use this optimal configuration for our final race day was because we knew that there was no way for our model to account for the fact that the jet would be hitting the deflector for only a fraction of the time, meaning that the amount of water used was not really helping. Also, we knew that a model could differ greatly from what would really happen, so we stuck with using the 3 inches of water and 60 psi with a nozzle diameter of 3/8 inches and no angle for the final race. Race Results The first six race times were done for the accuracy competition. The first two runs did not finish because we had a bit of eccentricity from the jet, which caused the cart to roll to the left too far and pass the infrared sensors. Because our first two runs failed, it was critical that we were efficient with each following run so that we could have as many runs as possible in the ten minutes of allotted time. Run 3 (3 inches of water, 60 psi, 3/8” nozzle diameter, 0 angle) had a race time of 4.625 seconds, which was too far off from our prediction. We believe this occurred because of eccentric loading again, because the cart barely passed between the two sensors. Run 4 and 5 were fairly accurate with the same design settings and we were extremely pleased with the resulting 3.783 seconds and 4.086 seconds race times. The average race time taken from the mean of these two race times is 3.935 seconds. Run 6 also had the same design settings, but the cart traveled too slow, finishing in 5.034 seconds. The next 5 runs were for the speed competition. Run 7 (2 inches of water, 65 psi, 3/8” nozzle diameter, 0 angle) resulted in a slightly faster time of 3.63 seconds, which was exciting to see for our cart, which was extremely heavy compared to other carts. Run 8 (1 inch of water, 70 psi, 3/8” nozzle diameter, 0 angle) resulted in even faster time of 3.300 seconds while Run 9 (1 inch of water, 70 psi, ½” nozzle diameter, 0 angle) resulted in the fastest time for our cart, 3.178 seconds. Run 10 (2 inches of water, 65 psi, ½” nozzle diameter, 0 angle) and Run 11 (3 inches of water, 60 psi, ½” nozzle diameter, 0 angle) resulted in times of 3.825 and 3.505, which were done just to see how the change in nozzle diameter affected the cart. Because of the comparison of the fourth and fifth race times with the average race time, we can state that our prediction had a percentage error of 0.381% from the actual time. Also, the graph below shows the root mean square error of 0.1258.
10
The fastest times were 3.178 seconds and 3.300 seconds, which occurred when our settings were 1 inch of water height and 70 psi. This is exciting to see because our theory about how the cart would perform better with less water, and more pressure was correct due to the fact that the water was hitting the deflector for only a fraction of the test. The time of 3.178 seconds was obtained when we used the 1 inch of water and 70 psi with a ½” diameter. Discussion The cart performed as expected in terms of direction and stability during the final race. We had assumed the cart would go slower but stop spinning out due to the additional weight. However, we were unsure if the time predicted from our MatLab model would be accurate. Overall, the cart traveled in a fairly straight line when the jet was aimed as close as possible to the center of our deflector and there was no spinning out. We knew the fact that we tightened the bearings would allow the cart to roll better because it helped with the balance of the cart and frictional forces from the ground. On the final race day, the cart resulted in an average time extremely close to the predicted time of our MatLab model. The cart could be improved by developing some calculations to determine exactly where the center of gravity of. Once this location was known, we would be able to optimize the location in order to predict how the momentum from the jet would impact it. Some other Another improvement could have been widening the wheelbase to provide better stability for the cart. The model could be improved by using a different method to find the rolling and momentum transfer coefficients. A lot of human error was involved when it came to rolling the cart down the hill and taking data points. Conditions on the day we performed the rolling test were rainy, which would be more similar to the race day because the ground would also be wet from the water jet. However, it could also have affected our data negatively since the friction factors were not exactly the same between the two locations. We were also off on the MatLab model because there was no way to account for the fact that the water jet was hitting the cart for only a fraction of the test. Because of this, it wasn’t entirely true to say that the height of water used was 3 inches. In reality, only about 1 inch of the water was actually being used. Also, we only had two times to work with during our preliminary test, so our calibration for the momentum transfer coefficient was extremely off.
The project experience could be improved if we had access to better equipment. For example, it was nice that we used simple materials to work with, but this did not create the best cart. Teams that did not care about the cost or constructability did better in the speed competition due to the fact that they used aluminum and had access to metal working tools. Fabrication lab hours were also scheduled during times when a lot of the team members had class. Our race day and time was also scheduled during our Mechanics of Materials class, which upset the other professor.
11
Appendix A: Preliminary Water Jet Test Run Data:
Run Number
Height of Water (in)
Pressure (PSI)
Nozzle Diameter (in)
Race Time (seconds)
1 3 60 3/4 Failed
2 4 55 3/4 Failed
3 5 50 1/2 Failed
4 7 40 1/2 Failed
5 8 35 1/2 Failed
6 7 40 3/8 Failed
7 5 50 3/8 Failed
8 4 55 3/8 Failed
9 3 60 3/8 4.59
10 2 65 3/8 Failed
11 3 60 3/8 4.47
12
Appendix B: Race Day Data:
Run Number
Height of Water (in)
Pressure (PSI)
Nozzle Diameter (in)
Race Time (seconds)
1 3 60 3/8 Failed
2 3 60 3/8 Failed
3 3 60 3/8 4.625
4 3 60 3/8 3.783
5 3 60 3/8 4.086
6 3 60 3/8 5.034
7 2 65 3/8 3.630
8 1 70 3/8 3.300
9 1 70 1/2 3.178
10 2 65 1/2 3.825
11 3 60 1/2 3.505
13
Appendix C: MatLab Code Before Optimization Jet Cart Main Script: clear clc djet= 0.75/39.37; %diameter of nozzle L = ( (13.25) + 7.75)/39.37; % total length of nozzle and apparatus (m) h0 = 3; % initial height of water in tank (in) P0 = 5*(15 - h0); % initial pressure of tank (lbf/in^2) % 1 inch of h_0 = 1 point, 5 psi of P_0 = 1 point, % 15 points total S0 = (25-h0)/39.37; % initial height of air in tank (m) P0 = 6894.75*P0; % initial pressure of tank (Pa) (6894.75 Pa / lbf/in^2) h0 = h0/39.37; % initial height of water in tank (m) mc = 2; % mass of cart (kg) dtank =12/39.37; % diameter of water tank (m) rho = 1000; % density of water (kg/m^3) @ 20 C, 1 atm alpha = 1; %momentum transfer coefficient g = 9.81; % acceleration due to gravity (m/s^2) x0 = [h0,0,0]; tend = 1000; Aj = (pi./4) * (djet.^2); % area of water jet (m^2) k = 1.40; % ratio of specific heats for air (unitless) Kv = 0.05; % minor loss coefficient for ball valve (unitless, Pa/Pa) f = 0.02; % Darcy friction factor (unitless, Pa/Pa) slope = 0.02; % slope of hill (unitless, opposite/adjacent) theta = atan(slope); % incline of slope (radians) %set ode options options = odeset('Events',@terminal); %Creates function handle% h=@(t,y) Cart(djet,dtank,alpha,rho,Aj,mc,g,S0,theta,P0,h0,k,Kv,f,L,y); %Use built-in function ode45% [t,y] = ode45(h,[0 tend], x0, options); %Calculates pressure from given parameters and height at intervals. for i=1:length(y)
14
P(i,1)=P0*(S0/(S0+h0-y(i,1)))^k; % Calculates velocity of the jet using calculated pressure and height of % water in the tank. If there is no water in the tank, there will be no % jet velocity if y(1,1)>0 Vj(i,1)= sqrt((2*(g*y(i,1)+P(i,1)/rho))/(1+Kv+f*(L/djet))); else Vj(i,1)=0; end end %Plotting Velocity of cart, Position of cart, and Velocity of Jet, all with %respect to time v(:,1)=y(:,2); x(:,1)=y(:,3); t_end=t(end); v_end=v(end)*3.28084; subplot(3,1,1) plot(t,v) ylabel('Velocity (m/s)'); xlabel('Time (s)'); subplot(3,1,2) plot(t,x) ylabel('Position (m)'); xlabel('Time (s)'); subplot(3,1,3) plot(t,Vj) ylabel('Velocity of Jet (m/s)'); xlabel('Time (s)'); disp(['The cart velocity at 50 ft is ' num2str(v_end) '(ft/s)']) disp(['The cart reaches 50 ft at ' num2str(t_end) '(s)']
Terminal Velocity Function: function [value,isterminal,direction] = terminal(t,y) value = y(3)-(50/3.28); isterminal = 1; direction = 1; end
15
Cart Function: function f = Cart(djet,dtank,alpha,rho,Aj,mc,g,S0,theta,P0,h0,k,Kv,f,L,y) P=P0*(S0/(S0+h0-y(1)))^k ; if y(1) > 0; Vj=sqrt((2*(g*y(1)+P/rho))/(1+Kv+f*(L/djet))); %Equation 3 f(1) = -(djet.^2/dtank.^2)*Vj; else f(1)=0; Vj=0; end %If the velocity of the jet is greater than the velocity of the cart, then %there will be a relative velocity between them. If the velocity of the %cart is greater, then there will be no relative velocity, in the sense %that we want Vr equal to zero so that the Jet will no longer propel the %cart if Vj > y(2) Vr=Vj -y(2); else Vr=0; end %Equation 11 f(2) = ((alpha * rho *Aj)/(mc)) * Vr^2 - g*sin(theta); %Equation 13 f(3) = y(2); f = f(:); end
17
Appendix D: MatLab Code After Optimization Jet Cart Main Script: clear clc djet= 0.375/39.37; %diameter of nozzle L = ( (13.25) + 7.75)/39.37; % total length of nozzle and apparatus (m) h0 =1; % initial height of water in tank (in) Set at 1 inch since we used only about an inch of water to propel cart P0 = 60; % initial pressure of tank (lbf/in^2) % 1 inch of h_0 = 1 point, 5 psi of P_0 = 1 point, % 15 points total S0 = (25-h0)/39.37; % initial height of air in tank (m) P0 = 6894.75*P0; % initial pressure of tank (Pa) (6894.75 Pa / lbf/in^2) h0 = h0/39.37; % initial height of water in tank (m) mc = 2.7; % mass of cart (kg) dtank =12/39.37; % diameter of water tank (m) rho = 1000; % density of water (kg/m^3) @ 20 C, 1 atm alpha = 1.0; %momentum transfer coefficient g = 9.81; % acceleration due to gravity (m/s^2) x0 = [h0,0,0]; tend = 1000; Aj = (pi./4) * (djet.^2); % area of water jet (m^2) k = 1.40; % ratio of specific heats for air (unitless) Kv = 0.05; % minor loss coefficient for ball valve (unitless, Pa/Pa) f = 0.02; % Darcy friction factor (unitless, Pa/Pa) slope = 0.02; % slope of hill (unitless, opposite/adjacent) theta = atan(slope); % incline of slope (radians) %set ode options options = odeset('Events',@terminal); %Creates function handle% h=@(t,y) Cart(djet,dtank,alpha,rho,Aj,mc,g,S0,theta,P0,h0,k,Kv,f,L,y); %Use built-in function ode45% [t,y] = ode45(h,[0 tend], x0, options); for i=1:length(y) P(i,1)=P0*(S0/(S0+h0-y(i,1)))^k;
18
if y(1,1)>0 Vj(i,1)= sqrt((2*(g*y(i,1)+P(i,1)/rho))/(1+Kv+f*(L/djet))); else Vj(i,1)=0; end end v(:,1)=y(:,2); x(:,1)=y(:,3); t_end=t(end); v_end=v(end)*3.28084; subplot(3,1,1) plot(t,v) ylabel('Velocity (m/s)'); xlabel('Time (s)'); subplot(3,1,2) plot(t,x) ylabel('Position (m)'); xlabel('Time (s)'); subplot(3,1,3) plot(t,Vj) ylabel('Velocity of Jet (m/s)'); xlabel('Time (s)'); disp(['The cart velocity at 50 ft is ' num2str(v_end) '(ft/s)']) disp(['The cart reaches 50 ft at ' num2str(t_end) '(s)']) Terminal Velocity Function: function [value,isterminal,direction] = terminal(t,y) value = y(3)-(75/3.28); isterminal = 1; direction = 1; end
19
Cart Function: function f = Cart(djet,dtank,alpha,rho,Aj,mc,g,S0,theta,P0,h0,k,Kv,f,L,y) P=P0*(S0/(S0+h0-y(1)))^k ; if y(1) > 0; Vj=sqrt((2*(g*y(1)+P/rho))/(1+Kv+f*(L/djet))); %Equation 3 f(1) = -(djet.^2/dtank.^2)*Vj; else f(1)=0; Vj=0; end if Vj > y(2) Vr=Vj -y(2); else Vr=0; end %Equation 11 f(2) = ((alpha * rho *Aj)/(mc)) * Vr^2 - g*sin(theta) -0.78; %Equation 13 f(3) = y(2); f = f(:); end