# ABE 565 Week 15 - Simulation

Complete the following problems using SLAM. Note that SLAM code is provided for all of the problems and only simple modifications to the code are required in completing the problems.

Instructions for running slam are located here.

## Grain Elevator Revisited

The grain elevator operator would like to know how long after closing it takes to empty the loads of grain that have arrived prior to closing. Statements have been added to the original SLAM code to allow you to obtain the information - the last entity is sent to a terminate node that will stop the simulation with the time the last entity leaves the system.

The SLAM code for this problem is shown below and may also be copied from ~engelb/565/ele2.dat.

```GEN, ENGEL, ELEVATOR, 12/2/94,10,Y,Y,Y/Y,N,Y/1,72;
LIMITS,6,12,100;
NETWORK;
CREATE, EXPON(288);
ACT/5,,TNOW .LE. 36000;
WEIGHT QUEUE(1);
ACTIVITY(1)/1,RLOGN(120.,60.);
ACTIVITY(1)/2,EXPON(240);
GOON,1;
ACT/6,,TNOW .GE. 36000 .AND. NNACT(1) .EQ. 0 .AND. NNACT (2) .EQ. 0,QUIT;
ACT/7;
TERMINATE;
QUIT   TERMINATE,1;
ENDNETWORK
INITIALIZE,0,40000;
FIN;
```

The original problem description is available in week 15.

1. The elevator operator would like to know how long (on average) it takes to unload the grain loads that are in the system after the initial 10 hours has expired.

## Mower repair shop

A repair shop for lawn mowers currently employs two (2) people. On average, 23 mowers needing repair arrive each day with an exponential distribution. The employees each work 8.5 hours per day. Repair times are normally distributed. Bob, who is more experienced, can repair an average of one (1) mower each hour with a standard deviation of 15 minutes. Sam, who is less experienced, repairs an average of 7 mowers each day with a standard deviation of 20 minutes per lawn mower repair.

When there are more than 5 mowers waiting to be repaired, the customers take their mower to another shop. Don't use 5 8.5-hour days to represent the work week. Instead, use a 42.5 hour period to represent a work week.

The SLAM code for the above problem is shown below and can also be copied from ~engelb/565/mower.dat. Note that a SLAM time unit represents an hour.

```GEN, ENGEL, MOWER REPAIR, 12/2/94,5,Y,Y,Y/Y,N,Y/1,72;
LIMITS,6,12,100;
NETWORK;
CREATE,EXPON(0.4444);
WAIT   QUEUE(1),0,5,BALK(LOST),SORT;
SORT   SELECT,,CYC,,WAIT;
; Bob's service time, Bob is first because he is quickest
ACTIVITY(1)/1,RNORM(1.,0.25),,DONE;
; Sam's service time
ACTIVITY(1)/2,RNORM(1.214,0.33),,DONE;
DONE   TERMINATE;
LOST   QUEUE(2);
ENDNETWORK
INITIALIZE,0,42.5;
FIN;
```
1. Draw the SLAM network diagram.
2. On average, how many customers are lost each week?
3. The repair shop owner is considering hiring another person to work in the shop and has narrowed the list to two people, Sally and Jane. Sally has worked in a mower repair shop in the past and can repair a mower in 65 minutes on average with a standard deviation of 20 minutes. Jane has never repaired lawn mowers but is expected to be able to repair 5 each day with a standard deviation of 30 minutes per repair. If the loss of a customer is worth \$30 in labor, Sally's salary is \$10.00/hr, and Jane's salary is \$250 per 5-day work week; what would you do? Hire Sally, hire Jane, hire both, hire neither? Use the results of the simulation to justify your answer! You'll need to add an activity to represent Sally and an activity to represent Jane.

## Grain Harvesting - An Example of Combined Simulation

In this problem, a combination of discrete and continuous simulation is used. In addition, Fortran code has been written and compiled into SLAM. You will use this modified SLAM and the SLAM network code to answer questions about a grain harvesting system that involves a combine harvesting soybeans from a field, trucks transporting the soybeans to a storage facility and unloading the soybeans.

A combine with a 15 foot header and a 200 bushel grain tank harvests soybeans at 3.0 miles per hour in a field that is 1 mile long and 0.5 mile wide. The time to turn around at each end of the field is normally distributed with a mean of 25 seconds and a standard deviation of 10 seconds. Unloading occurs on the go at a rate of 6000 bushels per hour. Unloading may begin whenever the grain in the tank exceeds 100 bushels, and is assumed to occur continuously until the truck is filled. Unloading ceases whenever the combine grain tank is empty, but the truck continues to follow the combine through the field. If a truck is not available when the combine grain tank is filled, the combine ceases harvest, but will begin to unload immediately upon the arrival of a truck. Harvesting continues when the grain tank level drops below 190 bushels. Harvesting stops when the combine reaches the far side of the field, but the simulation continues until all the trucks have unloaded for that day.

The yield varies with position in the field. Function DTABL performs a two dimensional, linear interpolation of the table values for yield.

There are up to two trucks available for hauling the grain from the combine to the grain bin at the central farm headquarters. Initially, the trucks are in the shed at the farm headquarters and return there each night. The travel times are normally distributed with mean values given on the figure. The standard deviations are 5 mph for road travel, and 1/10th of the mean value for field travel. When a truck arrives at the field gate, it waits in line for its turn to be loaded. The travel time to and from the combine depends on where the combine is in the field. Unloading ceases when the combine is turning around at the ends of the field. It also ceases when the combine grain tank becomes empty. Naturally, when a truck is filled to capacity, it is released to return to the farmstead where it dumps its load. Harvesting starts at time 0, continues for 8 hours, then stops for 16 hours. Thus in each 24 hour period, only 8 hours are used for harvesting. A truck which completes its dumping after dark (during the 16 hour break), stays at the shed overnight.

Use the SLAM model in ~engelb/565/ called combine to simulate the attached network diagram for the above problem. The network portion of the code is in ~engelb/565/combine.dat. To do this, first copy combine.dat into one of your directories. Then copy it to fort.5 as you have done previously with SLAM code. Next run the SLAM code using the modified SLAM code that includes the Fortran code that has been written for this simulation by typing ~engelb/565/combine from the directory in which you have copied combine.dat to fort.5 (note you use ~engelb/565/combine rather than running slam as you did in previous problems).

The level of grain in the combine grain tank and in the bin at the farmstead will be plotted. Statistics on truck round trip time, truck utilization, combine utilization, and pit utilization will be collected by the model. Use the model to answer the following questions.

1. What is the amount of time required to harvest the field? (Run the simulation several times with different SEEDS for stream 9; i.e., the statement SEEDS, 1239654 (9); will change the seed value and should be added near the top of the combine.dat file.)
2. How long does harvest take if truck number 2 is not available? (Again, use several runs.) Comment out the "ENTRY" line in the combine.dat file that represents truck 2.
3. How much does combine utilization decrease if truck 2 is unavailable?
4. The farmer is considering a new combine. He has estimated the savings per hour reduction in harvest time to be worth \$125. Given the following information, which option shown below would you choose? Explain why.
```Combine speed (mph)   Width of header (ft)    Increased cost/year
3.0                    15                No increased cost
3.6                    16                \$ 2,200
3.5                    20                \$ 5,750
3.1                    25                \$ 7,100
```
The combine speed and header width can be changed in the combine.dat file by editing the INTLC line changing the SPEED and SWATH variables to appropriate values from the above table.
5. Would your choice change if truck 2 was unavailable?

The SLAM network statement file is located in ~engelb/565/combine.dat. You should copy the file to your directory for use. SLAM has been recompiled with the fortran code linked for this problem. The executable file is ~engelb/565/combine. Since this is a large file, I would recommend using it in its present location. If you are interested in looking at the fortran code for this problem, it is located in ~engelb/565/combine.f.