Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 %Title: LAB 5 2 %Filename: BaleHauling.m 3 %Author: 4 %Date: 5 Description: This function takes in a list of bale locations and the number

image text in transcribed

image text in transcribed

1 %Title: LAB 5 2 %Filename: BaleHauling.m 3 %Author: 4 %Date: 5 Description: This function takes in a list of bale locations and the number 6 % of bales that can be picked up at a time before unloading. 8 function (CumulativeDistance, CumulativeTime] = BaleHauling (DATA, FullLoad) %set the inital total distance travelled %set the initial total time elapsed 10 CumulativeDistance = @; 11 Cumulative Time = 0; 12 13 %Your code goes here... 14 15 end Code to call your function e Reset 1 BALES = (1, -80,210;2, -120, 190;3, -130,160;4, -90,160;... 5,-68,180; 6,-30, 170; 7,-30, 150;3, -70,140;... 9,-30,130;10,-10,110; 11, -50,100;12,-80, 120;... 4 13,-110, 140, 14,-120, 110;15, -150, 130;16, -180, 130;... 5 17, -170, 110;18, -170,80;19, -130,80;20,-170, 60;... 21,-120,60;22, -80,80;23, -60,60;24, -30,80;... 25, -10,60;26,-30,40;27,-20,20;28,-50,10;... 3 29,-70,40,30,-90,10;31,-120,30,32, -160,30;... 33, -148, 10;34,-120, -1]; 10 11 BaleHauling(BALES,6); 12 BaleHauling(BALES,5); 13 BaleHauling(BALES, 7); Forage crops used in biofuel production are typically baled for transportation and storage. The objective of this exercise is to develop a MATLAB program to compute how long it would take to collect all the bales in a field, with the number of bales to be collected and the number of bales per trailer load considered as variables. You are provided an Excel file with the bale coordinates listed in the order they are to be collected. Assume for script development that the bales can be loaded on the transport trailer 6 at a time - however, this number must be a variable that can be changed to any positive integer between 1 and the total number of bales to be collected. Assume one transport trailer is available (.e., all bales loaded sequentially) and the time to load each bale is 2 minutes. The tractor/trailer travels at 5 mph in the field. A full load can be unloaded in 5 minutes, regardless of how many bails are loaded. Develop your script incrementally and check the result from each part before moving to the next. Parts 1 through 5 should be completed by hand and used to check your script developed in Part 6. ASSIGNMENT Create a MATLAB function that simulates loading and unloading all bales. The function must accept two arguments. The first is a matrix with the defining the bale numbers and their positions. The second is a scalar that defines the number of bales for a full load. hat. Your function must be fully commented and produce the correct outputs required in Part 8. Parts 1 through 5 should be done by hand so that you have reference calculates to compare your simulation results. PROCEDURE Part 1 The first step is to calculate how long it would take to go from the gate (0.0) to the first data point (-80,210) and load that bale at that location. The coordinates are given in meters. Note: (0.0) will not be in the data set you are to read in. The data point (-80, 210) will be the first location given. Part 2 Calculate how long it would take to move to the second bale and load the bale (-120, 190). Part 3 Continue until 6 bales are on the trailer. Calculate the time needed to drive back to the gate and unload the trailer Bale Number 1 2 3 4 4 5 x (m) -80 -120 -130 -90 -60 y (m) 210 190 160 160 180 170 6 -30 Part 4 Calculate the time to drive to the seventh bale and load the bale. Bale Number (m) y (m) -30 150 Part 5 Continue loading the trailer until full-drive back to the gate and unload Bale Number (m) y (m) 8 -70 140 9 -30 130 10 -10 110 11 -50 100 12 -80 120 Note: you should have calculated total distance travelled of 1068.6 m in 41.95 min at this point. If not, make sure you're not leaving out individual steps, such as the distance time to travel back to the gate or the time it takes to load a bale after traveling to each bale. Part 6 The data listing bale numbers and locations is provided in the MATLAB Grader and used in the function call. The total number of bales can be determined from the size of the matrix you read in using the size or length() functions in MATLAB, or by the value in the last row of the first column of the matrix. Assign that value to the variable representing total number of bales for use throughout your script. Create another variable representing the number of bales per load. It may be useful to create variables that store your current and previous location for easy computation of distance travelled between points. You should also have variables that store the cumulative distance travelled and time as defined in the function declaration. A simple way to test your program is to reduce the number of bales by manually overriding the value used to represent the total number of bails. Try limiting the simulation to 8 bales and verify that you get the exact same result as your hand calculations, then check the solution for 12 bales. Check to make sure your function will still work if you change the number of bales per load to values other than 6. Your function must generate a single figure showing the distance travelled versus time for each bale pick-up and load drop-off. Use the following figure as an example for how to format your figure Bale Hauling Simulation Distance Travelled vs. Time 2500 DODO 2000 E 1500 000000 1000 Some 117 total dist26709 Time 1 %Title: LAB 5 2 %Filename: BaleHauling.m 3 %Author: 4 %Date: 5 Description: This function takes in a list of bale locations and the number 6 % of bales that can be picked up at a time before unloading. 8 function (CumulativeDistance, CumulativeTime] = BaleHauling (DATA, FullLoad) %set the inital total distance travelled %set the initial total time elapsed 10 CumulativeDistance = @; 11 Cumulative Time = 0; 12 13 %Your code goes here... 14 15 end Code to call your function e Reset 1 BALES = (1, -80,210;2, -120, 190;3, -130,160;4, -90,160;... 5,-68,180; 6,-30, 170; 7,-30, 150;3, -70,140;... 9,-30,130;10,-10,110; 11, -50,100;12,-80, 120;... 4 13,-110, 140, 14,-120, 110;15, -150, 130;16, -180, 130;... 5 17, -170, 110;18, -170,80;19, -130,80;20,-170, 60;... 21,-120,60;22, -80,80;23, -60,60;24, -30,80;... 25, -10,60;26,-30,40;27,-20,20;28,-50,10;... 3 29,-70,40,30,-90,10;31,-120,30,32, -160,30;... 33, -148, 10;34,-120, -1]; 10 11 BaleHauling(BALES,6); 12 BaleHauling(BALES,5); 13 BaleHauling(BALES, 7); Forage crops used in biofuel production are typically baled for transportation and storage. The objective of this exercise is to develop a MATLAB program to compute how long it would take to collect all the bales in a field, with the number of bales to be collected and the number of bales per trailer load considered as variables. You are provided an Excel file with the bale coordinates listed in the order they are to be collected. Assume for script development that the bales can be loaded on the transport trailer 6 at a time - however, this number must be a variable that can be changed to any positive integer between 1 and the total number of bales to be collected. Assume one transport trailer is available (.e., all bales loaded sequentially) and the time to load each bale is 2 minutes. The tractor/trailer travels at 5 mph in the field. A full load can be unloaded in 5 minutes, regardless of how many bails are loaded. Develop your script incrementally and check the result from each part before moving to the next. Parts 1 through 5 should be completed by hand and used to check your script developed in Part 6. ASSIGNMENT Create a MATLAB function that simulates loading and unloading all bales. The function must accept two arguments. The first is a matrix with the defining the bale numbers and their positions. The second is a scalar that defines the number of bales for a full load. hat. Your function must be fully commented and produce the correct outputs required in Part 8. Parts 1 through 5 should be done by hand so that you have reference calculates to compare your simulation results. PROCEDURE Part 1 The first step is to calculate how long it would take to go from the gate (0.0) to the first data point (-80,210) and load that bale at that location. The coordinates are given in meters. Note: (0.0) will not be in the data set you are to read in. The data point (-80, 210) will be the first location given. Part 2 Calculate how long it would take to move to the second bale and load the bale (-120, 190). Part 3 Continue until 6 bales are on the trailer. Calculate the time needed to drive back to the gate and unload the trailer Bale Number 1 2 3 4 4 5 x (m) -80 -120 -130 -90 -60 y (m) 210 190 160 160 180 170 6 -30 Part 4 Calculate the time to drive to the seventh bale and load the bale. Bale Number (m) y (m) -30 150 Part 5 Continue loading the trailer until full-drive back to the gate and unload Bale Number (m) y (m) 8 -70 140 9 -30 130 10 -10 110 11 -50 100 12 -80 120 Note: you should have calculated total distance travelled of 1068.6 m in 41.95 min at this point. If not, make sure you're not leaving out individual steps, such as the distance time to travel back to the gate or the time it takes to load a bale after traveling to each bale. Part 6 The data listing bale numbers and locations is provided in the MATLAB Grader and used in the function call. The total number of bales can be determined from the size of the matrix you read in using the size or length() functions in MATLAB, or by the value in the last row of the first column of the matrix. Assign that value to the variable representing total number of bales for use throughout your script. Create another variable representing the number of bales per load. It may be useful to create variables that store your current and previous location for easy computation of distance travelled between points. You should also have variables that store the cumulative distance travelled and time as defined in the function declaration. A simple way to test your program is to reduce the number of bales by manually overriding the value used to represent the total number of bails. Try limiting the simulation to 8 bales and verify that you get the exact same result as your hand calculations, then check the solution for 12 bales. Check to make sure your function will still work if you change the number of bales per load to values other than 6. Your function must generate a single figure showing the distance travelled versus time for each bale pick-up and load drop-off. Use the following figure as an example for how to format your figure Bale Hauling Simulation Distance Travelled vs. Time 2500 DODO 2000 E 1500 000000 1000 Some 117 total dist26709 Time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago