You are on page 1of 6

BASIC Soil Testing

J.P. Bardet
(1) Assistant University

(1) and Gunawan



professor, (2) Undergraduate student, Civil Engineering of Southern California, Los Angeles, USA

ABSTRACT soil testlrg. The A BASIC program has been developed for mini-computers to proces? data mea?ured ir laboratory ard adaptability to various computer code has been written in the programming language BASIC for the sake of simplicity operating systems. The main features of the code are: interactive irput through a screer editor, adaptabllltp to rew and various output devices (video screen, pen-plotter, and graphic prirter). Thlc computer program types of experiments, Each type of soil alms to help instructors teach soil testing to urdergraduate or graduate students in Civil Engireerlrg. experiment 1s a module within a library which car be expanded easily and modified with ever a ltmlted krowledge ir of the irput and output package. The structure programmirg. All the modules share the same screen editor and graphical data is flexible enough to be extended to most of the experimerts ir material testing.

1. INTRODUCTION In the last ten years, mini-computers have largely contributed to the improvement of measurement technfques in material testing. Many data acquisition packages, including hardware and software, have become commercially available to acquire and process data measured during laboratory testing. However these recent techniques St111 remain unaccesslble to most students in Geotechnlcal Engineering. Most of the laboratory manuals and textbooks r-1,2,3,4,5,6] present soil testing in a conventional way: they use data sheets to be filled out by hand during the laboratory session, which require tedious calculations on pocket calculators in order to process the raw data gathered during the experiment. It 1s only in one of the latest sol1 manual editions that Bowles [l] has added a few FORTRAN programs to process laboratory measurements. The computer code which 1s presented In this paper aims to help undergraduate and graduate students In Civil Engineering to become more famlllar with the computer processing of laboratory measurements. It represents an attempt to move away from the usual data sheet and number crunching with a hand calculator. The computer code, which is called SOILAB, has been developed for microcomputers to process data measured in laboratory soil testing. The code has been developed ln a simple programming language, BASIC, in order to be understood and adapted by most of the undergraduates students after only a few hours of training on the programming lnstructlons of BASIC. As it will be shown in a later section, new types of experiments can be added to the library of experiment with a limited knowledge of BASIC, without giving Up the advantages of graphic capabllltles and interactive screen input which are generally only accessible to advanced computer programmers. 2. DESCRIPTION OF PROGRAM Like most computer codes, SOILAB has been developed by retalnlng the most interesting and trial and error, convenient features while rejecting those judged unnecessary or too complex. SOILAB was made simply so that it would fit in the usual memory allocated by most of the BASIC languages, which rarely exceeds 64 Kbytes in size.

The code is composed of a modular library of experiments which share a package of input and output UtllltleS. The shareable input/output package includes many user friendly techniques which explain how to use the program, and avoid the loss of data when an input mistake is made. All input 1s controlled by using the INKEY$ command, which detects one by one the characters input from the keyboard before the code processes them. For inStance, when a real number 1s expected for input, the only characters accepted by SOIL&B are the + or - signs, the decimal point and the figures between 0 and 9. This rejection of unwanted characters has become quite common in interactlve programming. A good review of these techniques can be found in [7]. As a major departure from elementary BASIC code, the input package uses the entire video screen rather than a single line. The cursor 1s free to move on the video screen, which permits the display of a complete input page like a spreadsheet. The program will be described In the following sections by folIOwing its Step and illustrated with a particular by step progression, experiment: the drained triaxial test with meaSUrem!?nt Of volume change. The features of the code are summarized in the flow chart of Flg.1. 2.1 lkin menus

As shown in Flg.2, the first menu displayed by the program is a list of all the available experiments. All the experiment names are stored ln the ASCII file named LAB DAT.DAT. This file, which 1s only read when the code 1s called for the first time, can be modified or appended to accommodate up to 20 experiments. The user selects one experiment by moving the arrow pointer with the vertical arrow keys, then by pressing <return>. After the experiment selection, a second page 1s displayed and offers several options. As shown in Fig.1, the user may (1) return to the main menu to select another type of experiment, (2) create a file to forward all lnput data, (3) retrieve an old input data from a file previously defined, (10 print an empty data sheet. In the first option, the first menu is displayed again to change the experiment type. In the second and thlrd cases, a directory of all the datafiles related to the experlment selected in the first menu is listed to remlrd the user of all the data files wh!ch are stored on diskette.

02669463/86/020255 - 06 $2.00 8 COMPUTATIONAL. MECHANICS PUBLICATIONS 1986



1986, Vol. 2, No. 4.


BASIC Soil Testing: J.P. Bardet

and Gunawan



1. Structure

of the computer code SOILAB

Data is stored in ASCII characters for ease of eventual communication with other softwares. In the fourth case, an empty data sheet is printed on the line printer. The data during the laboratory sheet, which 1s to be filled session, calls for all the required data. An example of this empty data sheet is provided In Fig.3. for the case of the drained frlaxlal test. Figure 2. Selection of a type of experiment menu of S~ILAB. from the main

-:i Create :: Retrieve * Print

new data existing empty data

file data sheet file

by J. F.






I inputages ~~I._~~~ output page

t t
CONTROLLER * t page +e _ page * page * exit (go (save (next to page) page) page) menu) file) main data selected to input




(previous (return

--* --* ,,

* save
print plot * data + insert * delete

(input (insert (delete

data) . . . line) . . . line)

command IPlot select 7 s: :i go +* change i exit




FOR ENQINEERS, 1986, Vol. 2, No. 4.

BASIC Soil Testing: J.P. Bardet

and Gunawan


2.2 Data


The most important step in the conception of the program was the selection of a data structure which 1s general enough to be compatible With most types of laboratory measurement. After comparing various possible formats of data provided by various laboratory manuals cl .2,3,4,5,6], tt was decided to divide the data tnto input and output data. Input and output data are subdivided into three and two main types, respectively. The first input type 1s made of general information such as titleof experiment, name of operator, date, remarks and comments taken during the experiment session. This type of data, Which has a format independent of the kind Of experiment, 1s stored In the character array DATAO$. The second type of input data 1s made of a series of numbers stored in the one-dimensional array DATAl. Soil specific gravity, initial sample diameter, and inltlal sample Weight are examples of such data in the case of input for the drained trlaxlal test. The third and last type of input data Is made of readings stored in the two-dimensional array DATA2. This last set of data is composed of values of the various quantltles measured at simultaneous time during a given experiment. Values of axial displacement. axial force, and volume change are examples of such a data during a drained triaxlal compressfon test. In contrast to DATAO$, DATA1 and DATA2 have a format de endent on the type of experiment. As shown in the 11s e lng in appendix, the names of the quantities stored in DATA1 and DATA2 are defined by the user in the one-dimensional string arrays LABELl$ and LABEL26 between lines 10000 and 11000 of the computer code. LABELl$. LABEL2$; DATA1 andDATA2 are dimensioned according to the number of quantltles ln each types, LABELlI and LABEL21 respectively. NPTMAX the maximum 1s number of experimental points for DATA2. Similarly to the input data, the output data Is stored after being calculated in the one-dimensional and two-dimensional arrays, DATA3 and DATA4, with names defined by the one dlrenslonal string array LABEL3$ and LABEL4$, and dlensfon LABEL3%and LABELII%,respectively. An example of the definition of variables can be found in the appendix. It a module corresponding to a new type of experiment is to be added to the present library of experiments, input and output variables must be speclfled in a similar way. A particular group of data, e.g. DATAl, may be omitted by specifying a zero dimension, e.g. LABELlJ-0. as show in Table 1, the output data is structured in a similar way as the input data. After the calculation phase, the output values are stored In the arrays DATA3 and DATA4 to be accessible to the shareable printing and plotting package. Table 1: Summary of input and output variables

of the input 1 the As show in Fig.4 , the location datasheet is indicated by a wide cursor which can be displaced vertically and/or horlzontaliy by using the arrow keys. Data is entered by preeslng either the arrow keys or the <return> key. Pages are turned by using the alternate command menu which 1s called by pressing the escape key. Depending upon the page number the input is stored in arrays DATAO$, DATA1, or DATA2. The entire input phase 1s controlled by the input package shared by all types of experiments. Figure 4. Input spreadsheet displayed case of the drained trlaxial by SOILAB in the test.




All the commands are accessible by pressing the ESC key. Once in the command menu, the user selects a fuCtl0 using the horizontal arrow keys (-> or <-). The commands are listed in the flow chart of Flg.1. One can turn pages one by one forwards or backwards, orone can jump directly to a selected page. The insert or delete commands permit one to insert or delete a selected range of data point In DATA2. The command SAVE is used to save from time to time the data on the file which has been defined in the second menu. The Plot and Print commands, which are selected to plot or print the input or output data, branches to two different menus. Additional quantltles may be stored in DATA2 after the last input points. The end of the input data point to be processed by the calculation module must be specified by jumping a blank line. All the data entered after thls blank line 1s stored in DATA2 but ignored definition of during the calculation phase. This optional addltlonal data Is especially useful to analyze particular output results with the plot command. 2.5 Output commands The input and output data, which 1s stored in arrays DATA1 to DATA4, can be displayed and analyzed using the plot and print commands. Plot command The variables to be plotted are contained in the two-dimensional arrays DATA2 or DATA4. They are selected by using the select command and typing the letter A, B, C, etc. corresponding to the selected variables. In the ta?e of the drained trlaxial test, the first input variable (displacement dial reading) 1s noted by the letter A, and the seventh and last output variable (Void ratlo) by the letter G. The range of points to be plotted is also selected by typing the number of the first and last data points. The addftional points, which are separated from the input points with a blank line, may also be selected. 2.5.1






Input General information ~ LABEL~$() 1st group (1D array) LABEL~ ) $( 2nd group (2D array) LABELP$()
output tst group



(7D array) group (2D array)





A data sheet similar to the one which was generated in the second menu (see Fig.3) and completed during the laboratory session 1s displayed on the computer screen.



1986, Vol. 2, No. 4.


BASIC Soil Testing: J.P. Bardet

and Gunawan


The cormsand CHANGE calls the plotter menu to alter various characteristics of the plot. By using this menu, the plot may be directed either on the screen, a graphics printer or a pen plotter. The length of the vertical or horizontal axis, the titles and the number of divisions along an axis can also be modified. Linear, semi-logarithmic, or logarithmic axis, point or line plcttlng may also be In the plot example shown in Flg.5, the axis selected. title, minimum and maximumalong axis, length and orlgln of vertical and horizontal axis. which the code defines by default, have been changed using this menu so that the stress-strain and volume change curves may be drawn on the same piece of paper. Figure 5. An example of stress-strain curve and volume change curve plotted by SOILAB in the case of the drained trlaxial test.

Figure 6. An example of printout of input data in the case of the drained trlaxlal test. r








Figure 7. An example of printout of processed in the case of the drained trlaxial test.




The print command allows to print the input and/or output data. An example of the printed report of input and output data 1s given in Figs. 6 and 7. 2.6 Calculation wdules




As shown in the computer listing in appendix, all the calculations specific to an experiment are contained in the calculation module between line 15000 and 20000.



FOR ENGINEERS, 1986, Vol. 2, No. 4.

BASIC Soil Testing: J.P. Bardet

and Gunawan


The output arrays DATA3 and DATA4 are filled in this section which 1s defined by the user. In the case of the trlaxial test, the input variable are first transferred from the input arrays DATA1 and DATA2 to some other variables which have a more convenient notation. The initial dry unit weight, axial strain and stress, lnltlal Young modulus, maximum friction angle are calculated in a conventional way C1,2,3.4,5,61 and transferred in the output arrays DATA3 and DATA4 at the end of the calculation for the results to be displayed in the output pages. 2.7 Mxllflcatlon
Calculation of library of experiments


Computer listing of the calculation module for the drained trlaxlal test with measurement of volume change.


modules similar to the one shown in appendix have been created for the following experiments: sieve and hydrometer analysis, liquid and plastic limits, unified soil claszlflcatlon, compaction test, constant and falling head permeability tests, unconfined compression test, direct shear test, consolidation test, and drained and undrained triaxlal tests. This library can be extended or modified by adopting the same convention than the drained trlaxlal test. Once the new module has been created using the BASIC editor, the file should be saved as LABi.BAS where 1 1s the lab number in the first menu. Then the main input/output package may be loaded and executed. This input/output package shareable by all experiments keeps the coding zlmple while maintaining an input with advanced user friendly technique in BASIC far beyond the scope of a undergraduate course in Ceotechnical Engineering.

10010 10020 10030 10040 10041 10042

*+***++*+***********4+************ 46 DRAINED TRInXIaL. ~x**~***+***xx*x+*+~****~***~**~~ ------------_---------------! Definition of all


I ------------_---------------man number



loos0 10061




10062 10063 10070






10000 1ABELl%< 1 )=Weight


LABEL1%=9 : DIM DATA 1( L-ABEL 1% )






10120 10130

The interactive computer code SOILAB which processes testing measurement has been briefly presented. The computer code has been written in the programming language BASIC for the sake of simplicity and adaptability to various computers and output devices. The main features of the code are: interactive input through a screen editor, adaptability to new types of experiments, and various output devices (video screen, pen-plotter, and graphic printer). This computer program alms to help instructors teach soil testing to undergraduate or graduate students in Civil Engineering. Each type of soil experiment 1s a module within a library which can be eazlly expanded and modified even with a limited skill in programming. All modules share the same screen editor and graphical package. The structure of the input and output data 1s flexible enough to be extended to most of the experiments in material testing. The code still needs to be improved in various ways. Future verzlons will include linear and nonlinear regression analysis and error calculation, and will be compatible with an A/D converter.


10150 10160 10161 10162 10163 10170 10180 10190 10200

LABEL1%(7)=Volume change consolidation DVW cm3 LAEiELl%(S)=Back pressure Ii0 psi

LABEL1%(9)=Saturation B Second

gram WO LABELl%(2)=Initial average sample height Ho cm L_ABEL1%(3)=Initial average sample. diameter DO crn~~ LABELl%(4)=Soil specific gravity Gs LABEL1%(5)=Load ring calibration factotF lb/lo-4 LABELl%(b)=Constant confining pressure Sig3 psi








LABEL2%=3 : DIM LABEL2%(LABEL2%): DhTA2(NPTMAX.L0BEL2%) L ABEL2%( 1 )=displacement dial reading lo-3in LABEL2%(2)=Ioad dial reading lo-4in LABEL2%(3)=volume reading on burette cm3 First I group of output variables



2. 3. 4. 5.

6. 7.

of Soils and Bowles, J.E., Engineering Properties their Measurement, McGraw-Hill, Inc., 1986. Daz, B., Sol1 Mechanics Laboratory Manual, Engineering Press, Inc., 1986. Laboratory Soils Testing, U.S. Army Engineer Waterways Experiment Station, 1970 Lambe, T.W., Sol1 Testing for Engineers, John Wiley % Sons, 1951. Llu, C;, and J.i. Evett, Soil Properties, Testing, Measurement and Evaluation, Prentice-Hall, Inc., Englewood Cliffs, 1984. Wray, W.K., Measuring Engineering PPOpertfaS of Soil, Prentice-Hall, Inc., Englewood Cliffs, 1986. Cuellar, C., Advanced Programming Techniques in Microsoft BASIC, Reston Computer Croup Book, Prentice-Hall, Inc., 1984.

10201 10202 10203 10210 10220 10230

LABEL.3%=7 : DIM DATA3(LABEL3%) L.ABEL3%(l)=Initial eo )b LABEL3%(2)=Initial

LABEL36cLABEL3Y.j: void dry ratio unit weight



Go g/cm3 LABEL3%(3)=Void ratio after consol idat ion ec 88 LAEEL3%(4)=Dry unit weight consolidation




1986, Vol. 2, No. 4.


BASIC Soil Testing: J.P. Bardet

and Gunawan



L ABEL3%(5)=Peak Ptlimax LABEL3%(6)=Ultimate Phiult LABEL3%(7)=Initial Ei Second group of

friction degree friction degree young psi




angle 15010 15020 15030 15040 15050 1SO60 15070 I 5080 15085 15090 15100 isios 15110 15115 15120 15125 15130 15140 15145 15150 15160 15170

10280 10281 102B2 10283 10290 10300 10310 10320 10330 11000 11500 12000 12500 13000 13010 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029




WO= DATAI( HO= DATAl(2): DO= DATAI( GS= DATAl(4): F = DATAl(5): S3= DATAl(6): DVW=DATA1(7): UO=DATAl(B) B= DATAI VO= HOx(3.14159*D02/4! 1 GO= #O/V0 EB= GS/GO-1 ! UC= VO-DVW GC= WO/VC EC= GS/GC-l! HC= HO+(l!-DVW/V0/3!) FOR I= 1 TO NPT%-1 axial strain in % DATA4(I,l)=DATA2(1,1)+0.254/HC A= (VC-DATA2(1,3))/(HC-DATA2tI.l) + .00254 ) deviatoric stress in psi DATA4(I,2)=DATA2(1,2)*F/(A/6.451.5) volumetric strain in % DATA4(1,3)=DATA2(1,3)/VC*lOO! void ratio DATA4(1,4)=(1!+EO)x(VC-DATA2(1,3)) /vo-l! NEXT I maximum deviatori, c stress RMAX= O! FOR I= 1 TO NPT%-1 RATIO= DATA4(1,2)/( DATA4(1,2)+2! *S3) IF ( RATIO >= RMAX

LABEL4%=4 : DIM LABEL4%(LABEL4%): DATA4(NPTMAX,LABEL4%) LABEL4%(1)=axial strain % LABEL4%(2)=deviatoric stress psi LABEL4%(3)=volumetric strain % LABEL4%(4)=void ratio GOTn 1300 2 !----~~i~~i~Ti~~-P~~~~---! * ~_____________________---_! ) Definition of all variables WO ., = weight of dry sample HO = initial average sample height DO = initial average sample dimeter GS = soil specific gravity F = load ring calibration factor VO = initial volume (cm3) GO = initial dry unit weight (g/cm3) EO = initial void ratio VC = volume after istropic consolidation (cm3) GC = dry unit weight after isotropic consolidation (g/cm3) EC = void ratio after isotropic consolidation HC = sample height after isotropic consolidation (cm) DVW = volume change during consolidation (cm3) 53 = constant confining pressure (psi ) (JO = back pressure (psi) B = saturation coefficient A = corrected area (cm21 RMAX = maximum deviatoric stress (psi) , PHIMAX = peak friction angle (degree 1 ElMAX = maximum axial strain (%) PHILILT = ultimate friction angle (degree) S13 = average of deviatoric stress (psi) El = average of axial strain (%) Ei = irliti&l Young modulus (psi) NPT% = rlttmbrr of input data points



15190 15200 15205 15210 15220 15230 15240 15250 15260 15265 15270 I 5280 15285 15290 15310 15320 15330

ATN(RMAX/SQR(l-RMAX+RMAX)) +iao!/3.14159






13030 13031 13032 13033 13034 13035 13036 13037 13030 13039 13040 13041 13042 13043 13051


ElMAX=DATA4(1,1) =



(DATA4(1,1) IMAX=I I



ang le !SS3) -RAT IO+ 14159



initial Young modulus S13= (DATA4(2,2)+DATA4(3,2)) /2!-DATA4(1,2) El=(DATA4(2,l)+DATA4(3,1)) /2!-DATA4tl.l) IF El<>O! THEN EI=S13/El ELSE EI=O. transfer output data



15360 20000




FOR ENGINEERS, 1986, Vol. 2, No. 4.