c c subroutine doproc (sr) c c + + + PURPOSE + + + c Dooper is called when an operation line is found by the prfind c subroutine. Dooper reads in any coefficients associated with the c operation. Dooper then makes a call to a subroutine which, in turn, c modifies the state variables to mimic the processes of doing the c operation. C C Edit History C 18-Feb-99 wjr changed prcode to select statement C 19-Feb-99 wjr removed iunit from param C 19-Feb-99 wjr added error stops on reads C 20-Feb-99 wjr used skpnam to parse tbl lines c c + + + KEYWORDS + + + c tillage, operation, management c c + + + PARAMETERS AND COMMON BLOCKS + + + *$noereference include 'p1werm.inc' include 'm1flag.inc' include 's1layr.inc' include 'c1db1.inc' include 'manage/man.inc' include 'manage/mproc.inc' include 'manage/oper.inc' *$reference c c + + + ARGUMENT DECLARATIONS + + + integer sr c c + + + ARGUMENT DEFINITIONS + + + c iunit - management file handle c sr - the subregion number c c + + + ACCESSED COMMON BLOCK VARIABLE DEFINITIONS + + + c cropno - number that identifies the crop to be grown c tarea - tillage area (not implement but field?) (m*m) c tdepth - tillage depth (m) c tdir - tillage direction (degrees from NORTH) c trdflg - tillage ridge flag c tspeed - tillage speed (m/s) c ti - tillage intensity (fraction) c c + + + LOCAL VARIABLES + + + character*80 line character*1 prdumy c c + + + SUBROUTINES CALLED + + + c c + + + FUNCTION DECLARATONS + + + integer tillay integer skpnam integer lentrm c c + + + DATA INITIALIZATIONS + + + c c + + + END SPECIFICATIONS + + + C line = mtbl(mcur(sr)) read(line, 1001, err=901) prdumy, prcode, prname 1001 format(a1,1x,i2,1x,a) print*, 'SR',sr,' Processing process:', prcode,' ',prname c select case (prcode) c case (1) c-----START tillage process (process code 01) c get process parameters read(line(skpnam(line):lentrm(line)), *, err=901) tdepth, * tspeed, tdir, ti, tarea C c rtn=getr(iunit, sr, trdflg,trdflg,trdflg,1,'i') c expected last parameter for process, thus mlpos==0 C *** if (getr(iunit, sr, tarea,tarea,tarea,1,'r').gt.0) then C *** print*,'ERROR in doproc ',prcode C *** stop C *** endif c pre-process stuff tlayer = tillay(tdepth, aszlyt(1,sr), nslay(sr)) c do process (usually just processes or other operations) c post-process stuff c-----END tillage process (process code 01) case (2) c-----START biomass manipulation process (process code 02) c get process parameters c rtn = getr(iunit, sr, bioflg,bioflg,bioflg,1,'i') c expected last parameter for process, thus mlpos==0 read(line(skpnam(line):lentrm(line)), *, err=901) barea C *** if (getr(iunit, sr, barea,barea,barea,1,'r').gt.0) then C *** print*,'ERROR in doproc ',prcode C *** stop C *** endif c pre-process stuff c do process (should include a tillage operation) c post-process stuff c-----END biomass manipulation process (process code 02) case (3) c-----START grow process (process code 03) c get process parameters c expected last parameter for process, thus mlpos==0 read(line(skpnam(line):lentrm(line)),1101,err=901) * cropno, cropname 1101 format(i3,1x,a) C *** if (getr(iunit, sr, cropname,cropname,cropname,1,'c').gt.0) then C *** print*,'ERROR in doproc ',prcode C *** stop C *** endif c pre-process stuff c do process (should include a tillage operation) c post-process stuff c-----END grow process (process code 03) case (4) c-----START ammend process (process code 04) C *** 04 continue c get process parameters c expected last parameter for process, thus mlpos==0 read(line(skpnam(line):lentrm(line)), *, err=901) amdname C *** if (getr(iunit, sr, amdname,amdname,amdname,1,'c').gt.0) then C *** print*,'ERROR in doproc ',prcode C *** stop C *** endif c pre-process stuff c do process (could include a tillage operation) c post-process stuff c-----END ammend process (process code 04) case default goto 902 end select return C C Error stops C 901 write(*, 9901) line 9901 format('Error in procedure line ', a) stop 1004 902 write(*, 9902) line 9902 format('Bad procedure type ', a) stop 1004 end