r ~teractive simulation 0 h~ e mot1fl~r-bun~hers Alabama Agricultural Experiment Station Auburn University David II. Teem, Acting Director Auburn University Alabama CONTENTS INTRODUCTION........................................................3 SIMULATION APPROACH.................................................4 USING THE PROGRAM...................................................5 SAMPLE OUTPUT.......................................................8 Page CONCLUSION......................................................... 10 APPENDIX A. Machine Models...................................11 APPENDIX APPENXIX B. Stand Maps....................................... C. 11 Program/ Hardware Interfacing........................12 APPENXIX D. Program Listing....................................12 FIRST PRINTING 3M, FEBRUARY 1986 available to all Information contained herein issex, or nationalpersons origin. color, without regard to race, An Interactive Simulation Program To Model Feller-Bunchers W.D. GREENE and B.L. LANFORD' INTRODUCTION IMULATION is a widely used tool for analyzing logging operations. Due to the wide variety of logging systems used and the variation among the types of forest stands harvested, simulation often offers the only way to examine certain logging situations. In general, simulation involves building a model of a system to be studied and examining how the model system reacts to changes in its operating environment. There are two basic types of simulation. 2 The most obvious method-physical (or analog) simulation is to build an actual working scale model and improve the design of the system by studying the scale model. This is often done by engineers before building a structure or building. This approach is not well suited to studying most logging operations. The other approach--numerical (or digital) simulation-models a system through mathematical equations which are developed after observing the system for an extended period of time. This approach has usually been employed when studying logging operations. The set of equations can be included in a computer program and different logging conditions examined with a few seconds ofcomputer time. Both physical and numerical simulation offer advantages and disadvantages. Many systems cannot be easily simulated with physical simulation and require the building of a scale model, which is time consuming. However, the results are often more easily interpreted and understood since the actual model can be seen and held. Numerical simulation is often more economical than physical simulation due to declining computing cost. However, efficient use of numerical 'Respectivelx Graduate Research Assistant and Associate Professor of Forestry. 2Bratle, P, B. L. Fox, and L. E. Schrage. 1983. A Guide to Simulation. Springer-Verlag, New York. 4 ALABAMA AGRICULTURAL EXPERIMENT STATION simulation requires not only a thorough knowledge of the system, but also mathematical, statistical, and programming skills. Numerical simulation results are often less easily accepted. This is often because the computer and program represent a "black box" which does not appear to respond to the input of the user. SIMULATION APPROACH Interactive simulation seeks to combine the advantages of both approaches. Most uses of interactive simulation display intermediate results on a graphics screen and ask the user for a response. For example, an application of interactive simulation to log merchandising displayed the outline of a tree stem on a graphics screen. 3 The user then decided how to cut the stem into logs before further processing. This type of simulation can both reduce the complexity of programming and provide easily accepted results. This can allow the use of a less expensive computer for the examination of problems which were previously difficult to study. One logging situation which has been difficult to accurately simulate with numerical simulation is the movement of a feller-buncher in plantation thinnings. The machine must avoid the remaining trees in the stand while efficiently moving between the trees to be cut. Many logging simulators do not adequately model these machine movements. Interactive simulation provides a better method of modelling the movements of a feller-buncher. A scale model of the machine is made of transparent plastic. This model is then moved by hand through a map of the stand. This stand map can be created by plotting a circle at the location of each tree in the stand. The size of the circle corresponds to the diameter of the tree. The stand map is then placed on a digitizing pad. The digitizing pad can detect the location of the model machine and send the location to a computer which stores the locations for later use. The computer then changes a portion of the screen display and prompts the user for the current action of the feller-buncher. Current actions include the common work elements of a feller-buncher cycle move to tree, shear, move to dump, and dump. A series of such locations defines a path of the machine. The user simply moves the model machine, digitizes points along the path, and selects the current action of the feller-buncher. To illustrate the method, an example will be shown. :Lembersk, M.R. and U.H. Chi. 1984. "Decision Simulators" Speed Implementation and Improve Operations. Interfaces 14(4): 1-15. AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS 5 USING THE PROGRAM The example will simulate a Morbell 4 feller-buncher thinning a pine plantation, figure 1. Methods of creating a scale model machine are given in Appendix A. The stand being thinned is 23 years old and was previously thinned at age 17. Stocking before thinning averages 350 trees per acre, while thinning should reduce the stand to 140 trees per acre. The stand map represents a plot 132 feet x 132 feet (2 ch. x 2 ch.) containing 0.4 acre, figure 2. Methods of creating a stand map are presented in Appendix B. The program splits the computer screen into three windows for displaying information, figure 3. The largest window contains a copy of the stand map that is on the digitizing pad. The two smaller windows display a summary of machine activities and messages for the user. In the stand map window, each circle represents a tree in the stand. To begin the simulation, the user moves the scale model machine on the digitizing pad into the stand and digitizes the location of the machine while approaching the first tree to be cut. Each time a point is digitized, the machine summary window is replaced by a menu of machine actions, figure 4. The operator chooses the appropriate action by pressing a programmed key on the keyboard. Each time a point is digitized and an action selected, the machine summary is updated and displayed. Once the machine model has moved to the tree, its location is digitized and the shear action selected. The computer searches for the "cut" tree, adds the tree to the head of the fellerbuncher, and updates the machine summary window. An "X" is drawn at the location of a cut tree to signify a stump. The user may now move the machine over that location since it no longer represents an obstacle. The above procedure is repeated until the shear head is full. The user then moves the model machine to the location of the bunch to FIG. 1. A 1:120 scale model representation of the Morbell. -Product names are mentioned for the reader's convenience and do not constitute an endorsement by the Alabama Agricultural Experiment Station. 6 ALABAMA AGRICULTURAL EXPERIMENT STATION C.00 "f) 25.00 X-D IRECTI ON 50.00 75.00 100.00 125. Tr kid U) U U CV . ci o e o . e " ID cii e o " e C)) OD i 0)- c-i 2:0 H ~) a e e o e oe O pp- 0- U H-W Oi Oi Li W Oi H CU Cr LU} O O) U-C " " L Cuj -I H- 1, S L O) . o L °0.00 25.00 50.00 75.00 100.00 OC) 125. X-DIRECT ION FIG. 2. A stand map representing 0.4 acre. be built and drops the trees, figure 5. The machine summary window is cleared, showing an empty head on the machine, and the dropped trees are drawn to scale in the direction they fell on the graphics screen. The bunch now represents another obstacle for the feller-buncher to maneuver around while searching for and cutting trees. The program contains checks to prevent the user from cutting the same tree twice and checks to see if another tree can fit into the head. However, the machine model must be moved in a realistic fashion by the user. In many ways the program accurately simulates actual conditions encountered by machine operators. The user must keep up with the number and size of trees in the head in order to make a rational decision about whether to cut another tree. Ithe head is nearly AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS 7 full, he looks for a small tree. If one is not available, he will dump his load. However, if a smaller tree is available, he may try to cut it before dropping the trees in the head. This accurately represents the activities of a feller-buncher operator. MACHINE SUMMARY .. · Trees head: 8 in BA, in head: 9.99 C.F. head: in X Coordinate: Last Action -- 8,6 988 FIG. 3. Screen display at the start of simulation showing stand map, machine summary, and empty message board. SUMMARY MACHINE ACTION MENU Fl- hove totree F3 - shear F5- ove dump to F? dump F9 EXI T FIG. 4. Screen display with machine summary replaced by action menu after receiving a digitized machine location (bottom center). 8 ALABAMA AGRICULTURAL EXPERIMENT STATION SUMARY MACHINE .... . . Trees in head: 8 in B,A, head: 8,0 CF.inhead 8,8, X Coordinate: 46,19 S.... . YCoordinate: 11,88 Last Action dump FIG. 5. Screen display after machine has cut 4 trees and started a bunch for skidding. SAMPLE OUTPUT When ending the simulation run, the program saves two files. One file contains the coordinates of the machine path in chronological order with their associated actions. The second file contains the coordinates and dimensions of the trees in the residual stand. These two files, along with the file containing the description of the original stand, are used in subsequent statistical summaries to measure the effectiveness of the thinning. Two general types of summaries are provided: (1) stand summaries and (2) machine summaries. The stand summary compares the original stand to the residual stand and computes the trees, basal area, and volume removed per acre in the thinning, table 1. This is provided in the stand and stock table format commonly used by foresters to report stand information. This summary can be used to determine the quality of the thinning performed from a silvicultural standpoint or as input for economic decisions. The difference in the stand before and after thinning will provide information on removals by diameter class-an important input for estimating logging cost. Machine summaries are provided in three parts: (1) an elemental time summary, (2) a summary by shear and dump cycles, and (3) a production summary. The elemental time summary, table 2, reports information as if a time study of the machine had been performed. AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS TABLE 1. STAND AND STOCK TABLE BEFORE AND AFTER THINNING 9 Stand/stock table, before thinning DBH T/ac. THT BA/ac. CD/ac. 6 135 43 26.5 5.7 7 110 47 29.4 6.8 8 65 52 22.7 5.5 9 30 57 13.3 3.3 10 10 62 5.5 1.4 Total 350 97.3 22.7 Stand/stock table, after thinning DBH T/ac. THT BA/ac. CD/ac. 6 5 43 1.0 0.2 7 43 47 11.4 2.6 8 53 52 18.3 4.4 9 30 57 13.3 3.3 10 10 62 5.5 1.4 Total 140 49.4 12.0 TABLE 2. ELEMENTAL TIME SUMMARY OF SIMULATION RUN Elemental time summary Element Move to tree .......... Shear ................ Move to dump ........ Dump ............... N 84 84 24 24 Mean 0.09 .14 .15 .32 S. Dev. 0.074 -0.000 .103 .095 C.V. 81.84 -0.00 66.62 29.65 Min. 0.02 .14 .01 .18 Max. 0.36 .14 .38 .46 Feller-buncher cycles are commonly divided into four elements: (1) move to tree, (2) shear, (3) move to dump, and (4) dump. These correspond to the machine actions available while running the simulation program. In analyzing the output of the run, shear and dump times are estimated using production equations developed from previous time studies of the machine. Travel to tree and travel to dump times are computed by dividing the distance traveled by the average speed of the machine. Elemental time figures are provided since they are an accepted method of describing machine performance. The summary by shear and dump cycles provides the most useful information from the simulation run, table 3. Information in this summary can indicate the effect of the stand on machine productivity and the ability of the operator to use the machine to its full potential. A good measure of stand effects on machine movement is provided by the "moves to tree needed" value. In maneuvering the machine model through a dense stand, more points will have to be digitized to accurately represent the machine path than would be the case in a sparsely stocked stand. A good indication of the ability of the operator to utilize the potential of the machine is provided by the "B.A. per dump" measure. This reports the basal area held by the shear head when the trees are dropped into the bunch. Feller-buncher production is often maximized when this measure reaches its maximum. The best measure of feller-buncher efficiency in this type of simulation is distance traveled. A method is more efficient than another if it cuts the same trees, but in doing so travels a shorter total distance. The final machine summary provides the typical production figures used in comparing machines, table 4. These measures include 10 ALABAMA AGRICULTURAL EXPERIMENT STATION 10 ALBAMA AGRICULTRLEPRMN TABLE 3. MACHINE SUIMARY BYSHEAR AND DTMP CYCLES TTO Item Shear: (n = 84) Moves to tree needed.............................. Distance between shears............................15.96 Elapsed time between shears ........................ Dump: (n = 24) M oves to tree .................................... Moves to dump................................... Trees per dump................................... B.A. per dump.................................... C.F. per dump.................................. Distance between dumps .......................... lime between dumps.............................. Mean 1.44 0.09 5.04 1.42 3.50 0.80 S. Dec. 0.6277 13.0656 0.0742 1.4590 0.6539 0.7223 0.1823 16.21 83.13 0.96 3.9202 33.6146 0.2630 Total distance traveled................1995.00 TABLE 4. PRODUCTION SUMMAIY FOR THE SIMULATION RUN Machine summary Trees/minute ....................................................... Cubic feet/productive machine hour.....................................762.81 Cords/productive machine hour..........................................8.48 2.74 trees per minute, cubic feet per productive machine hour, and cords per productive machine hour. These values represent a relative measure of unconstrained machine performance. As such, they are not to be taken as an accurate measure of field performance. However; comparison of these measures for different operating circumstances should provide an indication of the relative performance of the chine. ma- CONCLUSION Interactive simulation is a viable method for examining the working of machines in forest stands. The method offers potential for studying the operating patterns of machines in forest stands and the effects of stand characteristics on machine performance in partial cuts. This methods can be used on relatively inexpensive computer equipment with simple graphics capability without sacrificing detail. Such a method offers potential for studying and improving the work methods of operators and feller-bunchers in plantation thinnings. 5 A copy of this interactive simulation program written in Advanced Basic (BASICA 2.10) for use on an IBM Personal Computer or compatibles is available to interested parties. Contact the authors at School of Forestry, Auburn University, Alabama 36849, for details. AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS 11 APPENDIX A Machine Models A scale model of a feller-buncher must be made so that it properly represents the working area of the machine. The finished scale model may not necessarily resemble the machine being studied. For instance, a model of an excavator mounted machine, figure 6, does not resemble the real machine. It does, however, properly represent the working area of the machine. In the case of the Morbell feller-buncher used as an example here, the scale model closely resembles the actual machine. This is primarily due to the tricycle design of the machine. To create a model of the Morbell, its dimensions were obtained from manufacturer's literature. The rough outline of the machine was then sketched, figure 1. The circle at the rear of the machine represents the turning radius of the rear wheel. The two V-shaped extensions on the front of the machine represent the ability of the machine to extend its cutting head without moving the machine. This extension is limited to 4.5 feet. This model must be transferred to a transparent material (lucite or plexiglass) to be used with the simulation program. A simple model can be made by carefully scratching the outline of the machine into the material and darkening the lines to improve its appearance. FIG. 6. A scale model of an excavator-mounted feller-buncher. (Source: Fridley, J.L., J.L. Garbini, and J.E. Jorgensen. 1982. Interactive Simulation of Forest Thinning Concepts. ASAE Paper 82-1603.) APPENDIX B Stand Maps To create a stand map, a plotting program and appropriate stand data are needed. As a bare minimum, your stand data must contain the DBH and coordinates (x, y) of each tree in the stand. If this information is not available, a simulation can be run in a similar stand for which data are available or the data can be collected for the stand of interest. Once the data are obtained, a stand map can be generated by a plotting program such as that described by Conway and others6 or by any other graphics package. Scale should be carefully controlled so that the resulting map and the machine model are drawn to the same scale. 6 Conway, J. S., B. L. Lanford, B.J. Stokes, and W.D. Greene. 1985. Stand Map Plotting Program. Ala. Agr. Exp. Sta. Bull. No. 574. 12 ALABAMA AGRICULTURAL EXPERIMENT STATION APPENDIX C Program/Hardware Interfacing The BASIC program used for the simulation (Appendix D) was written to be used with a specific digitizer. Any digitizing tablet should work with the program. The digitizer must be able to physically connect to the computer (through a cable) and the computer must be able to understand the information sent by the digitizer. The statement in the program which allows connection of the computer to the digitizer is: 1235 OPEN "coml:300,o,7,2,rs,cs0,ds0,cd0" AS #1 The parameters of the OPEN"COM.. statement set the baud rate, parity, number of data bits, number of stop bits, and communications protocol for the communication between digitizer and computer. Refer to the BASIC manual for your computer for details. The owners manual for your digitizer should specify the values for these parameters. APPENDIX D Program Listing 10 15 20 30 35 ' Main program. KEY OFF: SCREEN 2: CLS: OPTION BASE 1 LOCATE 3,28: PRINT "AUBURN THINNING SIMULATOR" LOCATE 4,28: PRINT "----------- 40 50 60 70 80 90 LOCATE LOCATE LOCATE LOCATE LOCATE 6,28: PRINT "1 -- Run a simulation" 8,28: PRINT "2 -- Analyze data" 10,28: PRINT "3 -- Watch a simulation" 12,28: PRINT "4 -- Plotting" 14, 28: PRINT "5 -- Output data to printer" LOCATE 16,28: PRINT "6 -- EXIT" 100 110 120 130 LOCATE 22,32: PRINT "Make a Selection" LOCATE 22,48: A$= INKEY$: IF A$- ""THEN 110 IF ASC (A$) < 49 OR ASC (A$) > 54 THEN 110 A = ASC (A$)-48 140 1000 1005 1010 1015 1020 1025 1030 1035 1040 ON A GOSUB 1000,2000,4000,5000,6000,7000 ' 'Main subroutine #1 -- Perform a simulation. ' CLS: KEY OFF: SCREEN 2 LOCATE 2,30: PRINT "PERFORM A SIMULATION" LOCATE 3,30: PRINT "-LOCATE 5,30: INPUT "Run Name "; CODE$ LOCATE 7,30: INPUT "Stand File "; STAND$ PATH$= CODE$+".run": THIN$= CODE$+".map": STAND$= STAND$+".map" 1050 KEY 1, "move to tree"+ CHR$ (13): KEY 3, "shear" + CHR$ (13) 1055 KEY 5, "move to dump" + CHR$ (13): KEY 7, "dump" + CHR$ (13): KEY 9, "exit"+ CHR$ (13) AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS 13 1060 KEY 2, "": KEY 4, "": KEY 6, "": KEY 8,"": KEY 10,"" SYMBOL$ = "ne3 nf3 ng3 nh3" CT = 0: X0 = 0: YO= 0: PT = 0: XMAX = 132: YMAX= 132: SCALE= 10 OPEN STAND$ FOR INPUT AS #1 WHILE NOT EOF (1) CT = CT + 1 LINE INPUT#1, Z$ WEND CLOSE #1 DIM X (CT),Y (CT),DBH (CT),THT (CT),CUFT (CT), SDIA (CT), CC (CT),HT (9) 1110 CLS 1115 'Draw stand map on left of screen. side 1120 1125 OPEN STAND$ FOR INPUT AS #1 1130 LINE (404,0)- (404,199): LINE (404,100) - (639,100) 1135 WINDOW (0,0) - (XMAX,YMAX): VIEW (0,0) - (399,199) 1140 FOR I= iTO CT 1145 INPUT#1, TREE,X,Y, DBH,THT, SDIA,CUFT 1150 X (I) X: Y(I)= Y: DBH (I) DBH: THT (I)=THT: SDIA (I)= SDIA: CUFT = = 1065 1070 1075 1080 1085 1090 1095 1100 1105 1155 1160 1165 1170 1175 1180 1185 1190 1195 1200 1205 1210 1215 1220 1225 1230 1235 1240 1245 1250 1255 1260 1265 1270 1275 1280 1285 1290 1295 1300 (I)= CUFT: CC (I)= 1 R= DBH/24 : CIRCLE (X,Y),R NEXT I CLOSE #1: X = 0: = 0 Y 'Display summary information on screen. VIEW: WINDOW (0,0) - (639,199) LOCATE 1,58: PRINT "MACHINE SUMMARY" LOCATE 2,58: PRINT "----------GOSUB 1510 'Open files for storing machine path and thinned stand. ' OPEN PATH$ FOR OUTPUT AS #2 OPEN THIN$ FOR OUTPUT AS #3 'Open communications buffer to receive digitized points. ' OPEN "coml:300,o,7,2,rs,cs0,ds0,cd0" AS #1 COM (1) ON ON COM (1) GOSUB 1320 GOTO 1245 VIEW (407,103) - (639,199): CLS: LOCATE 19,60: PRINT "Please Wait" CLOSE#1: CLOSE#2 ' ' Store thinned stand. FOR I= 1TO CT IF CC (I)=0 THEN 1290 WRITE#3,I,X(I),Y(I), DBH(I),THT(I), SDIA(I),CUFT(I) NEXT I CLOSE #3 ' 14 ALABAMA AGRICULTURAL EXPERIMENT STATION 1305 ' Reset soft keys to defaults. 1310 KEY 1, "list": KEY 2, "run"+ CHR$ (13): KEY 3, "load"+ CHR$ (34): KEY 4, "save"+ CHR$ (34): KEY 5, "cont" + CHR$ (13): KEY 6, "," + CHR$ (34)+ "lptl:" + CHR$ (34)+ CHR$ (13): KEY 7, "tron" + CHR$ (13): KEY 8, "troff"+ CHR$ (13): KEY 9, "key": KEY 10, "screen 0,0,0" 1315 VIEW: CLS: CLEAR: GOTO 30 1320 1325 'Read communications buffer. 1330 INPUT#1,X,Y 1335 IF Y>YMAX/SCALE THEN RETURN 1340 PT= PT+ 1: X = X*SCALE: Y = Y*SCALE 1345 IF PT= 1 THEN D=0 ELSE D = INT (SQR ((X-X0)2 + (Y-Y0)2)) 1350 GOSUB 1370 ' Draw movement on screen. 1355 GOSUB 1390 'Update machine summary. 1360 RETURN 1365 1370 ' Draw movement on screen. 1375 VIEW (0,0) - (399,199) : WINDOW (0,0) - (XMAX, YMAX) 1380 IF PT= 1 THEN PSET (X,Y) ELSE LINE (XO,YO) - (X,Y) 1382 VIEW (407,103) - (639,199): CLS 1385 RETURN 1390 1395 'Update machine summary. 1400 VIEW (409,16) - (639,97): CLS: VIEW: WINDOW (0,0) - (639,199) 1405 LOCATE 3,55: PRINT " ACTION MENU" 1410 LOCATE 4,55: PRINT "------------ 1415 1420 1425 1430 1435 1440 1445 1450 1455 1460 1465 1470 1475 1480 1485 1490 1495 1500 1505 1510 1515 1520 1525 LOCATE 5,55: PRINT "Fl - move to tree" LOCATE 6,55: PRINT "F3 - shear" LOCATE 7,55: PRINT "F5 - move to dump" LOCATE 8,55: PRINT "F7 - dump" LOCATE 9,55: PRINT "F9 - EXIT" LOCATE 11,55: INPUT ACTION$ IF ACTION$<>"exit" THEN 1470 BEEP: BEEP: BEEP: BEEP VIEW (407,103) - (639,199): CLS: LOCATE 19,58: INPUT "Are You Sure"; E$ IF E$= "Y" OR E$= "y" THEN 1255 IF E$="N" OR E$ "n" THEN 1390 ELSE 1450 IF ACTION$ -"shear" THEN 1595 IF ACTION$ = "dump" THEN 1710 IF ACTION$= "move to tree" THEN A= 1 IF ACTION$ ="move to dump" THEN A= 3 'replace menu with updated machine summary ' X0= X:YO= Y WRITE#2,PT,X,Y,D,A VIEW (409,16) - (639,97): CLS VIEW: WINDOW (0,0) - (639,199) LOCATE 3,55: PRINT "Trees in head: "THD LOCATE 4,55 : PRINT "B.A. in head: " AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS 1530 LOCATE 4,70: PRINT USING "##.##"; BAHD 15 1535 LOCATE 5,55 : PRINT "C.E in head: " 1540 LOCATE 5,70: PRINT USING "##.##"; CFHD 1545 LOCATE 6,55 : PRINT " 1550 LOCATE 7,55 : PRINT "X Coordinate: " 1555 LOCATE 7,70: PRINT USING "###.##"; X 1560 LOCATE 8,55: PRINT " Y Coordinate: " 1565 LOCATE 8,70: PRINT USING "###.##"; Y 1570 LOCATE 9,55 : PRINT 1575 LOCATE 10,55: PRINT " Last Action " 1580 LOCATE 11,55: PRINT "-------------1585 LOCATE 12,55: PRINT "" ACTION$ 1590 1595 1600 1605 1610 1615 1620 1625 1630 1635 1640 RETURN ' Shear function just completed. A =2 VIEW (0,0) - (399,199): WINDOW (0,0) - (XMAX,YMAX) CC =0 'find cut tree, add tree to head, remove tree from stand FOR I =1 TO CT IF CC(I)= 0 THEN 1680 XCHK= X-X (I) IF (XCHK> = - 1.5) AND (XCHK< = 1.5) THEN 1640 ELSE 1680 YCHK= Y-Y (I) 1645 1650 1655 1660 1665 1670 1675 1680 1685 1690 1695 1700 1705 1710 1715 1720 1725 1730 1735 1740 1745 1750 1755 1760 1765 1770 IF (YCHK>-1.5) AND (YCHK< = 1.5) THEN 1650 ELSE 1680 CC= 1: CC(I)= 0: THD= THD+1 BAHD= BAHD+ .005454*(DBH(I)^2) CFHD = CFHD + CUFT(I) PSET (X(I), Y(I)): DRAW SYMBOL$ HT (THD)= THT(I): D = DBH(I) I = CT NEXT I IF CC= 1 THEN 1705 BEEP: BEEP: BEEP: BEEP VIEW (407,103) - (639,199): CLS: LOCATE 19,58: PRINT "Tree Not Found" ACTIONS$= "move to tree": D= INT (SQR ( (X-X0)^2 + (Y-Y0)^2)) GOTO 1490 ' Dump function just completed. A=4 R= SQR ((X-X0))^2 + (Y-Y0))^2) CS = (X-XO)/R : SN= (Y-YO)/R XB .5*CS+X: YB= .5*SN+Y VIEW (0,0) - (399,199): WINDOW (0,0) - (XMAX, YMAX) FORI = 1 TOTHD XI = HT(I)*CS + XB: YT= HT(I)*SN + YB LINE (XB, YB) - (XT, YT) XB=XB+1:YB=YB+1 NEXT I THD= 0: BAHD= 0: CFHD=0 GOTO 1490 2000 ' 16 ALABAMA AGRICULTURAL EXPERIMENT STATION 2005 2010 2015 2020 2025 2035 2040 2045 2050 2055 ' Main subroutine #2 - Analyze Data. KEY OFF: SCREEN 2 CLS: CLEAR LOCATE 2,34: PRINT "ANALYZE DATA" LOCATE LOCATE LOCATE LOCATE LOCATE 6,29: PRINT "1-Stand Data Only" 8,29: PRINT "2-Machine Path Only" 10,29: PRINT "3-Summarize a Run" 12,29: PRINT "4-EXIT" 15,32: PRINT "Make a Selection" 2030 LOCATE 3,34: PRINT "------------" 2060 LOCATE 15,48: A$ = INKEY$: IF A$= "" THEN 2060 2065 IF ASC (A$)<49 OR ASC(A$)>53 THEN 2060 2070 A = ASC(A$)-48 2075 2080 2085 2090 2095 2100 2105 2110 2115 ON A GOTO 2080, 2270, 2315, 30 'Analyze stand data. CLS: LOCATE 2,31: PRINT "Analyze Stand Data" LOCATE 3,31: PRINT "-----------------LOCATE 6,30: PRINT "1-Single Stand" LOCATE 8,30: PRINT "2-Compare Two Stands" LOCATE 10,30: PRINT "3-EXIT" LOCATE 12,1: A$ = INKEY$: IF A$ = "" THEN 2115 2120 IF ASC(A$)<49 OR ASC (A$)>51 THEN 2115 2125 A = ASC(A$)-48 2130 ON A GOTO 2135, 2185, 2020 2135 2140 ' Single stand. 2145 CLS: LOCATE 2,34: PRINT "Single Stand" 2150 LOCATE 3,34: PRINT "------------" 2155 2160 2165 2170 2175 2180 2185 2190 2195 2200 2205 2210 2215 2220 2225 2230 2235 2240 LOCATE 8,25: INPUT "Name of stand file"; STAND$ LOCATE 10,25: INPUT "Plot size (acres)"; PLOTSIZE LOCATE 15,34: PRINT "Please Wait" GOSUB 2390 GOTO 2020 ' 'Compare two stands. CLS: LOCATE 2,31: PRINT "Compare Two Stands" LOCATE 3,31: PRINT "-LOCATE 6,20: INPUT "Is this a before/after comparison (Y/N)" ; A$ IF A$= "Y" OR A$= "y" THEN 2240 LOCATE 8,30: INPUT "Name of stand file #1"; BEFORE$ LOCATE 10,30: INPUT "Name of stand file #2"; AFTER$ LOCATE 12,30: INPUT "Plot size (acres)"; PLOTSIZE LOCATE 15,34: PRINT "Please Wait" GOSUB 2390 GOTO 2020 LOCATE 8,30: INPUT "Name of stand file before"; BEFORE$ AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS 2245 2250 2255 2260 2265 2270 2275 2280 2285 2290 2295 2300 2305 2310 2315 2320 2325 2330 2335 2340 2345 2350 2355 2360 2365 2370 2375 2380 2385 2390 2395 2400 2405 2410 2415 2420 2425 2430 2435 2440 2445 2450 2455 2460 2465 2470 2475 2480 2485 2490 LOCATE 10,30: INPUT "Name of stand file after"; AFTER$ LOCATE 12,30: INPUT "Plot size (acres)"; PLOTSIZE LOCATE 15,34: PRINT "Please Wait" GOSUB 2390 GOTO 2020 'Analyze machine path. CLS: LOCATE 2,30: PRINT "Analyze Machine Path" LOCATE 3,30: PRINT "-------------------LOCATE 8,31: INPUT "Name of path file" ; PATH$ LOCATE 15,34: PRINT "Please Wait" GOSUB 2930 GOTO 2020 ' 'Summarize a run. CLS: LOCATE 2,32: PRINT "Summarize a Run" LOCATE 3,32: PRINT "--------------LOCATE 6,20: INPUT "Name of original stand file"; BEFORE$ LOCATE 8,20: INPUT "Name of residual stand file"; AFTER$ LOCATE 10,20: INPUT "Plot size (acres) "; PLOTSIZE LOCATE 12,20: INPUT "Name of machine path file ";PATH$ LOCATE 15,34: PRINT "Please Wait": A= 2 GOSUB 2390 LOCATE 15,34: PRINT "Please Wait" GOSUB 2930 GOTO 2020 ' Stand Analysis subroutines. 17 DIM N(A,18), SHT(A,18), SCF(A,18), XDBH(2), NDBH(2), TPA(2), BAPA(2), CDPA(2) AX = 1I IF A= 1 THEN 2410 IF AX= 1 THEN STAND$= BEFORE$ XDBH(AX) =0: NDBH (AX)= 12 OPEN STAND$ FOR INPUT AS #1 WHILE NOT EOF(1) INPUT#1, TREE, X, Y, DBH, THT, SDIA, CUFT DCL= INT(DBH + .49) N(AX, DCL)= N(AX, DCL) +1 SHT(AX, DCL)= SHT(AX, DCL)+ THT SCF(AX,DCL)= SCF(AX,DCL)+CUFT IF DCL > = NDBH(AX) THEN 2460 NDBH(AX)= DCL: GOTO 2470 IF DCL <- XDBH(AX) THEN 2470 XDBH(AX)= DCL WEND CLOSE #1 IF A= 1 THEN 2495 IF AX = 1THEN AX= 2 ELSE 2495 STAND$ AFTER$: GOTO 2410 18 ALABAMA AGRICULTURAL EXPERIMENT STATION 18 2495 2500 2505 2510 2515 2520 2525 2530 2535 ALABAMA AGRICULUA XEIMN TTO BEEP: CLS LINE (0,9)- (639,9): LINE (323,9)-(323,199): AX=1: Z0 IF A= ITHEN 2520 IF A$ - "N" OR A$ "n" THEN 2515 LOCATE 1,17: PRINT "BEFORE": LOCATE 1,57: PRINT "AFTER": GOTO 2520 LOCATE 1,15: PRINT "STAND #1": LOCATE 1,55: PRINT "STAND #2" LOCATE 4,11 + Z: PRINT "STAND/STOCK TABLE" LOCATE 6,2 + Z: PRINT "DBH": LOCATE 6,10 + Z: PRINT "T/Ac." LOCATE 6,18 + Z: PRINT "THT": LOCATE 6,24 + Z: PRINT "BA/Ac." LOCATE 6,33 + Z: PRINT "CD/Ac." = 2540 LOCATE 7,2 + Z: PRINT "--------------------- 2545 ROW-=8 2550 FOR DCL = NDBH (AX) TO XDBH(AX) 2555 LOCATE ROW,2 + Z: PRINT USING "###"; DCL 2560 MHT= SHT (AX, DCL)/N(AX, DCL) 2565 N (AX, DCL) - N(AX, DCL)/PLOTSIZE 2570 TPA(AX) = TPA(AX) + N(AX, DCL) 2575 LOCATE ROW, 11 + Z: PRINT USING "###"; N(AX, DCL) 2580 LOCATE ROW, 18 + Z: PRINT USING "###"; MHT 2585 BA = .0054542*DCL^2*N(AX, 2590 BAPA(AX)= BAPA(AX) + BA DCL) 2595 LOCATE ROW, 25+Z: PRINT USING "##.#"; BA 2600 CORDS = SCF(AX, DCL)/90/PLOTSIZE 2605 CDPA(AX) - CDPA(AX) + CORDS 2610 LOCATE ROW, 34+Z: PRINT USING "##.#"; CORDS 2615 ROW = ROW +1 2620 NEXT DCL 2625 LOCATE ROW, 2 + Z: PRINT "-----------2630 ROW = ROW +1 ----- 2635 LOCATE ROW, 2 + Z: PRINT "TOTAL" 2640 LOCATE ROW, 11 + Z: PRINT USING "###"; TPA(AX) 2645 LOCATE ROW, 24 + Z: PRINT USING "###.#"; BAPA(AX) 2650 2655 LOCATE ROW, THEN 2675 IF A- I 34+Z: PRINT USING "##.#"; C DPA(AX) (A=2) AND (AX= 2) THEN 2670 2660 2665 AX =2: THEN 2670 ELSE 2680 2670 IN INKEY$ 2675 AX-i S =2: GOTO 2685 IF Z-=40:GOTO02520 2680 2685 2690 2695 2700 2705 2710 AX1: S-1 ' Histogram plot. IF S =2THEN 2700 VIEW (0,15) - (319,199): CLS: WINDOW (0,0) - (311,183): GOTO 2705 VIEW (327,15) - (639,199): CLS: WINDOW (0,0) - (311,183) ' Draw axes. LINE (315, 27) - : =.". (35,27): LINE - (35,163) 2715 2720 2725 2730 2735 2740 IF AX - 2 THEN 2780 ' Scale x-axis. NB= XDBH(AX)-NDBH(AX) + 1 'Number of bars DBB - INT (280/NB) 'Distance between bar centers BW = INT(.5*DBB) 'Bar width ' Scale y-axis. AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS 19 2745 2750 2755 2760 2765 2770 2775 2780 2785 2790 2800 2805 2810 2815 2820 2825 2830 2835 2840 2845 2850 2855 2860 2865 2870 2875 2880 2890 2895 2900 2905 2910 3445 3450 3455 3460 3465 3470 3475 3480 3485 3495 3500 3505 3510 YMAX = 0 'Determine maximum y-value FOR DCL= NDBH(AX) TO XDBH(AX) IF YMAX>N(AX, DCL) THEN 2765 YMAX= N(AX,DCL) NEXT DCL DBT= 18 'Distance between tick marks (dots) YCL = INT(YMAX/6) 'Y-value increment on y-axis IF S= 1 THEN Z= 6 ELSE Z=47 FOR DCL= NDBH(AX) TO XDBH(AX) COL = Z + INT(DBB/8)*(DCL-NDBH(AX) ) NEXT DCL YTICK = 0 Y = 31 WHILE Y <= 175 ROW=26-(Y + 1)/8: LOCATE ROW, 1+ (S-1)*41: PRINT USING "###"; YTICK LINE (24,Y)-(27,Y) Y = Y +DBT: YTICK = YTICK + YCL WEND ' Label x-axis. LOCATE 24,20+ (S-1)*41: PRINT "DBH"; ' Label y-axis. LOCATE 3,1 + (S-1)*41: PRINT "T/Ac." ' Plot histogram bars FOR DCL = NDBH(AX) TO XDBH(AX) ) X = 55 + INT (DBB/8)*8*(DCL-NDBH(AX) HT= N(SX, DCL)/YMAX*128 TOP = 31 + HT RIGHT= LEFT + 2*INT(BW/2) LINE (LEFT,27)-(RIGHT,TOP), ,BF NEXT DCL S = S+ 1 IF S<>2 THEN 2920 IF INKEY$="" THEN 3445 CLEAR: SCREEN 2: GOTO 2370 ' ' A= 1- Move to tree element. T= D/SPEED(A) MBS = MBS + 1 DBS = DBS + D TBS= TBS + T TMBD= TMBD+1 TBD =TBD + T RETURN 2995 ' ' A = 2- Shear element. 2795 LOCATE 23,COL : PRINT USING "##"; DCL 2885 LEFT= X-INT(BW/2) 3435 LOCATE 7,50: PRINT USING "####.##"; TCF/RT*60 3440 LOCATE 9,50: PRINT USING "####.##"; TCF/RT/90*60 3490 DBD = DBD + D 20 20 ALABAMA AGRICULTURAL EXPERIMENT STATION 3515 IF D<8.5 THEN T=.1381 ELSE T=.1381 + .003*(D^2-72.25) 3520 SMBS = SMBS + MBS 3525 3530 3535 3540 3545 3550 3555 3560 3565 3570 3575 3580 3590 3595 3600 3605 3610 3615 3620 3625 3630 3635 3640 3645 3650 3655 3660 3665 3670 3675 3680 3685 3690 3695 3700 3705 3710 3715 3720 3725 3730 3735 3740 3745 3750 SSMBS = SSMBS + MBS^2 SDBS = SDBS + DBS SSDBS = SSDBS + DBS^2 STBS = STBS + TBS SSTBS - SSTBS + TBS^2 MBS = O: DBS =O: TBS = 0 TPH = TPH + 1 BA- .0054542* D^2 CF = -1.306 +.078*D +.1299* BAPH = BAPH + BA CFPH = CFPH + CF TCF-TCF+ CF - D^2 3585 TBD TBD + T RETURN 2995 A = -3 Move to dump element. T- D/SPEED(A) DMBD =DMBD + 1 DBD = DBD + D TBD = TBD + T RETURN 2995 A=4 - Dump element. IF 4 THEN T =.0569 + .0162*CFPH STMBD = STMBD + TMBD SSTMBD = SSTMBD +TMBD^2 SDMBD = SDMBD + DMBD SSDMBD = SSDMBD + DMBD2 STBD= STBD + TBD SSTBD - SSTBD + TBD ^2 SDBD - SDBD + DBD SSDBD= SSDBD +DBD^2 TM BD= 0: TBDI= 0: DBDO= : DMBD =0 STPH = STPH + TPH S STPH - S STPH ± TPH^2 S BAPH - S BAPH + BAPH SSBAPH= SSBAPH +BAPHI^2 SCFPH-=SCFPH +CFPH SSCFPH - SSCFPH + CFPH^2 TPH= 0: BAPH= 0: CFPH =0 RETURN 2995 A= 'Print information on screen #2. LOCATE ROW,50: PRINT USING LOCATE ROW,60: PRINT USING RETURN "####. ##"; "####. ##"; MEAN SDEV 4000 'Main subroutine #3. 4010 Observe a simulation. AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS 4020 CLS: KEY OFF: SCREEN 2: XMAX= 132: YMAX= 132 4030 LOCATE 2,29: PRINT "OBSERVE A SIMULATION" 4040 LOCATE 3,29: PRINT "-------------------- 21 4050 4060 4070 4080 4090 4100 4110 4120 4130 4140 4150 4160 4170 4180 4190 4200 4210 4220 4230 4240 4250 4260 4270 4280 4290 4300 4310 4320 4330 4340 4350 4360 4370 4380 4390 4400 4410 4420 4430 4440 4450 4460 LOCATE 6,20: INPUT "Machine path file"; PATH$ LOCATE 8,20: PRINT "Original stand file"; STAND$ LOCATE 12,35: PRINT "Please Wait" OPEN STAND$ FOR INPUT AS #1' Count number of trees in stand. WHILE NOT EOF (1) CT=CT+ 1: LINE INPUT#1,Z$ WEND CLOSE #1 DIM X(CT), Y(CT), DBH(CT), THT(CT), CUFT(CT), SDIA(CT), CC(CT), HT(9): CLS SYMBOL$ = "ne2 nf2 ng2 nh2" LINE (404,0) - (404,199)' LINE (404,100) - (639,100) WINDOW (0,0) - (XMAX, YMAX) : VIEW (0,0) - (399,199) OPEN STAND$ FOR INPUT AS #1 FOR I= 1 TO CT INPUT#1, TREE, X, Y, DBH, THT, SDIA, CUFT X(I)= X: Y(I)= Y: DBH(I)= DBH: THT(I)=THT: SDIA(I)=SDIA: CUFT(I)= CUFT: CC(I)= 1 R= DBH/24: CIRCLE (X,Y), R NEXT I CLOSE #1: X = 0: Y= 0 VIEW: WINDOW (0,0) - (639,199) LOCATE 1,58: PRINT "MACHINE SUMMARY": LOCATE 2,58: PRINT LOCATE 3,55: PRINT "Trees in head:' LOCATE 4,55: PRINT "B.A. in head:" LOCATE 5,55: PRINT "C.E in head:" LOCATE 7,55: PRINT "X Coordinate:" LOCATE 8,55: PRINT "Y Coordinate:" LOCATE 10,55: PRINT "Last Action" LOCATE 11,55: PRINT "------" OPEN PATH$ FOR INPUT AS #1 WHILE NOT EOF(1) WINDOW (0,0) - (XMAX,YMAX): VIEW (0,0) - (339,199) INPUT#1,PT,X,Y,D,A, 'IF PT= 1 THEN PSET (X,Y) ELSE LINE (XO,YO) - (X,Y) ON A GOSUB 4460, 4570, 4460, 4760 GOSUB 4480 FOR I= 1 TO 500: NEXT I XO= X: YO= Y WEND LOCATE 19,60: PRINT "Run ended" IF INKEY$ "" THEN 4430 CLS: GOTO 30 IF A= 1 THEN ACTION$= "move to tree" ELSE ACTION$= "move to dump" 4470 RETURN 4480 VIEW: WINDOW (0,0) - (639,199) 22 ALABAMA AGRICULTURAL EXPERIMENT STATION 4490 LOCATE 3,70: PRINT USING "##"; THD 4500 LOCATE 4,55 : PRINT "B.A. in head:" 4510 4520 4530 4540 LOCATE LOCATE LOCATE LOCATE 4,70: PRINT USING "##.##"; BAHD 5,70: PRINT USING "##.##"; CFHD 7,70 : PRINT USING "###. ##"; X 8,70: PRINT USING "###.##"; Y 4550 4560 4570 4580 4590 4600 4610 4620 4630 4640 4650 4670 4680 4690 4700 4710 4720 4730 4740 4750 4760 4770 4780 4790 4800 4810 4820 4830 4840 4850 4860 4870 4880 5000 5010 5020 5030 5040 5050 5060 5070 LOCATE 12,55: PRINT" ":LOCATE 12,55: PRINT ACTION$ RETURN ' Shear function just completed. ACTION$= "shear" VIEW (0,0) - (399,199): WINDOW (0,0) - (XMAX,YMAX) THD= THD + 1 ' Find cut tree in list, add tree to head, and remove tree from stand. FOR I= 1 TO CT IF CC(I)= 0 THEN 4740 XCHK= X-X(I) IF (XCHK > = -.15) AND (XCHK <= 1.5) THEN 4660 ELSE 4740 IF (YCHK > = -1.5) AND (YCHK <= 1.5) THEN 4680 ELSE 4740 CC(I)= 0 BAHD = BAHD + .005454*(DBH(I)^2) CFHD = CFHD + CUFT(I) PSET (X(I),Y(I)): DRAW SYMBOL$ HT(THD)= THT(I): D= DBH(I) I=CT NEXT I RETURN ' Dump function just completed. ACTION$ = "dump" R = SQR((X-X0)^2 + (Y-Y0)^2) CS = (X-X0)/R :SN = (Y-Y0)/R XB/= .5*CS+X:YB= .5*SN+ Y VIEW (0,0) - (399,199): WINDOW (0,0) - (XMAX,YMAX) FOR I= 1 TO THD XT= HT (I)*CS + XB : YT= HT (I)*SN + YB LINE (XB,YB) - (XT, YT) XB=XB+.5: YB YB+.5 NEXT I THD=0:BAHD= 0:CFHD=O0 RETURN ' 'Main subroutine #4 - Plotting. ' CLS: KEY OFF LOCATE 2,36: PRINT "PLOTI'ING": LOCATE 3,36: PRINT "--.. LOCATE 12,30: PRINT "NOT CURRENTLY ACTIVE" IN INKEY$="" THEN 5060 GOTO 30 4660 YCHK = Y-Y(I) 6000 ' AN INTERACTIVE SIMULATION PROGRAM TO MODEL FELLER-BUNCHERS 23 6010 ' Main subroutine #6 - Generate a data listing. 6020 6030 CLS: KEY OFF 6040 LOCATE 2,28: PRINT "GENERATE A DATA LISTING." 6050 LOCATE 3,28: PRINT "------------------------- 6060 6070 6080 6090 6100 LOCATE LOCATE LOCATE LOCATE 5,26: PRINT "1 - Output stand map data" 8,26: PRINT "2 -Output machine path data" 11,26: PRINT "3 - EXIT" 16,26: PRINT "Enter your selection" = LOCATE 16,48: A$ INKEY$: IF A$ = "" THEN 6100 6110 6130 6140 6150 6160 6170 6180 6190 6200 6210 6220 6230 6240 6250 6260 6270 IF ASC(A$)<49 OR ASC(A$)>51 THEN 6100 ON A GOSUB 6150, 6370, 6580 GOTO 6030 ' Output stand map data. CLS LOCATE 2,29: PRINT "Output stand map data." LOCATE 3,29: PRINT "-------------------LOCATE 5,29: INPUT "Enter stand file name:; STAND$ LOCATE 8,16: PRINT "Turn on printer.. Line up paper. Strike any key" IF INKEY$ ="" THEN 6230 OPEN STAND$ FOR INPUT AS #1 LPRINT "STAND MAP DATA" TAB (40) "FILE: " STAND$: LPRINT LPRINT "Tree #" TAB(10) "X-Coord." TAB(20) "Y-Cord." TAB(30) "DBH" TAB (40) "THT" TAB(50) "SDIA" TAB (60) "C.E Vol." LPRINT "------" TAB(10) "--------" TAB(20) "--------" TAB(30) "---" TAB(40)" -- " TAB(50) "----" TAB(60) "----------" 6120 A = ASC(A$)-48 6280 6290 6300 6310 6320 6330 6340 6350 6360 6370 6380 6390 6400 6410 FOR I= 1 TO 55 IF EOF(1) THEN 6350 INPUT#1, TREE,X,Y,DBH,THT,SDIA,CUFT LPRINT TREE TAB(10) X TAB (20) Y TAB (30) DBH TAB (40) THT TAB (50) SDIA TAB (60) CUFT NEXT I LPRINT CHR$(12) GOTO 6260 LPRINT CHR$(12) CLOSE#1: RETURN ' 'Output a machine path file. ' CLS: LOCATE 2,28: PRINT "Output machine path data." LOCATE 3,28: PRINT "-- ---- 6420 6430 6440 6450 6460 6470 LOCATE 5,28: INPUT "Enter machine path file"; PATH$ LOCATE 10,16: PRINT "Turn on printer. .Line up paper.. Strike any key" IF INKEY$="" THEN 6440 OPEN PATH$ FOR INPUT AS #1 LPRINT "MACHINE PATH DATA" TAB(40) "FILE: " PATH$: LPRINT LPRINT "Point #" TAB(10) "X-Coord." TAB(20) "Y-Coord." TAB(30) "Distance" TAB(45) "Action Taken" 6480 LPRINT"-------" TAB(10) "--------" TAB(20) "--------" TAB(30) "-TAB (42) "----------------- 6490 6500 6510 6520 6530 6540 6550 6560 6570 6580 FOR I= 1 TO 55 IF EOF(1) THEN 6560 INPUT#1,PT,X,Y, D,ACTION$ LPRINT PT TAB(10) X TAB(20) Y TAB(30) D TAB(42) ACTION$ NEXT I LPRINT CHR$(12) GOTO 6470 LPRINT CHR$(12) CLOSE #1: RETURN CLEAR: GOTO 30 7000 CLS: LOCATE 10,33: PRINT "SESSION ENDED": END