c-----------------------------1. explaination-------------------------------- c c --- 1.test windgen direction c test windgen--| c --- 2.test windgen speed c c----------------------------------------------------------------------------- c c 2.test windgen speed c c source code output c c |--windgen_mid_speed.for -> windgen_mid_speed c test |--test_eachyear_speed.for -> test_eachyear_speed c windgen --|--test_allyear_speed.for -> test_allyear_speed c speed |--error_direction_speed.for -> error_direction_speed c |--error_month_speed.for -> error_month_speed c c c windgen_output ----| c | | |->error_direction_speed c v |->test_allyear_speed-| c windgen_mid_speed---| |->error_month_speed c | c --------------->test_eachyear_speed c c c 1)."windgen_output": output file generated by bin>wind_gen, c should be in bin subdirectory. c ex: c bin>wind_gen -v -D -f ../../db/wind_gen.wdb c -s 25704 -y 100 c -o windgen_output c c 2)."windgen_mid_speed.for": from the "windgen_output", the program c generated a output file c "windgen_mid_speed" which is used for c internal process output. c 3)."test_eachyear_speed.for": from the "windgen_mid_speed" file, c the program generated a output file c "test_eachyear_speed" which is c used for detail by month/dir of c each year. c 4)."test_allyear_speed.for": from the "windgen_mid_speed" file, c the program generated a output file c "test_allyear_speed" which is c used for detail by month/dir of c all year (5, 10, 15, ...100 ...). c 5)."error_direction_speed.for": from the "test_allyear_speed" file, c the program generated a output file c "error_direction_speed" which c is used for the summary error in c each direction of years. c 6)."error_month_speed.for": from the "test_allyear_speed" file, c the program generated a output file c "error_month_speed" which is used c for the summary error in each month c of years c---------------------------------------------------------------------------- c---------------------2.variable & i/o format-------------------------------- c for variable c count(16): counter for the appear times of wind speed in 16 c direction respectively c speed(16): counter for the appear times of urep >= specific wind c speed in 16 direction respectively c month, year: month and year in windgen_mid_speed c month0: used for a sign of month changing c pro(16): percent for the appear times of urep >= specific wind c in 16 direction respectively c v: specific wind speed (5, 8.5, 10,...) integer count(16), speed(16), month, year, month0 real dir, pro(16) real v c for output header 100 format(' 16 speed: 0 45 90 135 +180 225 270 315') 110 format(' 22.5 67.5 112.5 157.5 + 202.5 247.5 292.5 337.5') 120 format ('The amount & percent of 16 wind speed in each month') 130 format ('--------------------------------------------------------- +---------------------------------------------') 140 format ('========================================================= +=============================================') c for output format 200 format(3x, i2,',', i4, 4x,16(3x,i2)) 210 format(' >=',f4.1,4x,16(3x, i2)) 300 format(4x, 'percent ', 16(1x,f4.2)) c for input format 400 format(4x,i2,1x,i4,1x,f5.1,2x,f4.1) 500 format(1x) integer i real urep c--------------------3. read and write file----------------------------- c write record to 'windgen_mid_speed' file open (8, file = 'windgen_mid_speed') write(8,120) write(8,130) write(8,100) write(8,110) write(8,140) c read record from 'windgen_output' file open(1,file='../bin/windgen_output', status='old') do 10 i=1, 74 read(1, 500) 10 continue c initialize value month = 1 month0 = 1 year = 1900 do 20 i =1 ,16 count(i) = 0 speed(i) = 0 20 continue c count the appear times of 16 direction respectively in each month c count the appear times of urep>= v in 16 direction respectively c for each month print*, "enter the specific speed v (10):" read*, v 900 read(1, 400, end=999) month, year, dir, urep if (month0 .eq. month) then if (dir .eq. 0.0) then count(1) = count(1) + 1 if (urep .ge. v) then speed(1) = speed(1) + 1 endif else if (dir .eq. 22.5) then count(2) = count(2) + 1 if (urep .ge. v) then speed(2) = speed(2) + 1 endif else if (dir .eq. 45.0) then count(3) = count(3) + 1 if (urep .ge. v) then speed(3) = speed(3) + 1 endif else if (dir .eq. 67.5) then count(4) = count(4) + 1 if (urep .ge. v) then speed(4) = speed(4) + 1 endif else if (dir .eq. 90.0) then count(5) = count(5) + 1 if (urep .ge. v) then speed(5) = speed(5) + 1 endif else if (dir .eq. 112.5) then count(6) = count(6) + 1 if (urep .ge. v) then speed(6) = speed(6) + 1 endif else if (dir .eq. 135.0) then count(7) = count(7) + 1 if (urep .ge. v) then speed(7) = speed(7) + 1 endif else if (dir .eq. 157.5) then count(8) = count(8) + 1 if (urep .ge. v) then speed(8) = speed(8) + 1 endif else if (dir .eq. 180.0) then count(9) = count(9) + 1 if (urep .ge. v) then speed(9) = speed(9) + 1 endif else if (dir .eq. 202.5) then count(10) = count(10) + 1 if (urep .ge. v) then speed(10) = speed(10) + 1 endif else if (dir .eq. 225.0) then count(11) = count(11) + 1 if (urep .ge. v) then speed(11) = speed(11) + 1 endif else if (dir .eq. 247.5) then count(12) = count(12) + 1 if (urep .ge. v) then speed(12) = speed(12) + 1 endif else if (dir .eq. 270.0) then count(13) = count(13) + 1 if (urep .ge. v) then speed(13) = speed(13) + 1 endif else if (dir .eq. 292.5) then count(14) = count(14) + 1 if (urep .ge. v) then speed(14) = speed(14) + 1 endif else if (dir .eq. 315.0) then count(15) = count(15) + 1 if (urep .ge. v) then speed(15) = speed(15) + 1 endif else if (dir .eq. 337.5) then count(16) = count(16) + 1 if (urep .ge. v) then speed(16) = speed(16) + 1 endif endif goto 900 c calculate the percent of the appear times of urep>=v in 16 direction c respectively for each month else month0 = month backspace (1) backspace (1) read(1, 400) month, year, dir, urep write(8,200) month, year, (count(i), i=1,16) write(8,210) v,(speed(i), i=1,16) do 30 i= 1, 16 if (count(i).eq.0) then pro(i) = 0 else pro(i) = real(speed(i))/real(count(i)) endif 30 continue write(8,300) (pro(i), i=1,16) write(8,130) do 40 i =1, 16 count(i) = 0 speed(i) = 0 40 continue goto 900 endif 999 write(8,200) month,year,(count(i), i=1,16) write(8,210) v,(speed(i), i=1,16) do 50 i= 1, 16 if (count(i).eq.0) then pro(i) = 0 else pro(i) = real(speed(i))/real(count(i)) endif 50 continue write(8,300) (pro(i), i=1,16) write(8,130) close(1) close(8) end