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 -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 no_years: number of years to simulate c urep: representative wind speed c speed: speed >= specific speed(5, 8.5, 10,...) c surep(12): representative wind speed c sspeed(12): speed >= specific speed(5, 8.5, 10,...) c sum_surep(12): the sum of representative wind speed c sum_sspeed(12): the sum of speed >= specific speed(5, 8.5, 10,...) c ave_surep(12): sum_sspeed(12)/sum_surep(12) c scale(16,12): wind scale factor c shape(16,12): wind shape factor c f(16,12): f(i,j) = exp(-((v/scale(i,j))**shape(i,j))) c v: specific speed(5, 8.5, 10,...) integer no_years integer urep, speed, surep(12), sspeed(12), sum_surep(12) integer sum_sspeed(12) real ave_surep(12), scale(16,12), shape(16,12), f(16,12) real v c for output header 80 format ('The percent of speed >= specific speed') 81 format ( 'No.1 "0" direction from windgen_output') 82 format ( 'No.2 "22.5" direction from windgen_output') 83 format ( 'No.3 "45" direction from windgen_output') 84 format ( 'No.4 "67.5" direction from windgen_output') 85 format ( 'No.5 "90" direction from windgen_output') 86 format ( 'No.6 "112.5" direction from windgen_output') 87 format ( 'No.7 "135" direction from windgen_output') 88 format ( 'No.8 "157.5" direction from windgen_output') 89 format ( 'No.9 "180" direction from windgen_output') 90 format ( 'No.10 "202.5" direction from windgen_output') 91 format ( 'No.11 "225" direction from windgen_output') 92 format ( 'No.12 "247.5" direction from windgen_output') 93 format ( 'No.13 "270" direction from windgen_output') 94 format ( 'No.14 "292.5" direction from windgen_output') 95 format ( 'No.15 "315" direction from windgen_output') 96 format ( 'No.16 "337.5" direction from windgen_output') 105 format ('--------------------------------------------------------- +---------------') 110 format (' 1 2 3 4 5 6 7 8 9 +10 11 12') c for output percent 200 format ('database: ', 12(1x,f4.2)) 210 format ('simulation', 12(1x,f4.2)) 220 format ('No. obs. ', 12(1x,i4)) 230 format ('Total obs.', 12(1x,i4)) c for read format in "windgen_mid_speed' file 401 format (16x, i4) 402 format (21x, i4) 403 format (26x, i4) 404 format (31x, i4) 405 format (36x, i4) 406 format (41x, i4) 407 format (46x, i4) 408 format (51x, i4) 409 format (56x, i4) 410 format (61x, i4) 411 format (66x, i4) 412 format (71x, i4) 413 format (76x, i4) 414 format (81x, i4) 415 format (86x, i4) 416 format (91x, i4) 417 format (96x, i4) c for read format in 'windgen_output' file 420 format (1x,12(f4.2, 2x)) 500 format (1x) integer i, j, k, m c------------------3. read and write file-------------------------- print*, "enter the number of years to simulate(100):" read*, no_years print*, "enter the specific speed(10):" read*, v c read record from 'windgen_output' file c for master database information open (2, file = '../bin/windgen_output') do 10 i = 1, 27 read (2,500) 10 continue do 20 i =1, 16 read (2, 420) (scale(i,j), j=1,12) 20 continue do 21 i = 1, 2 read (2,500) 21 continue do 22 i = 1, 16 read (2, 420) (shape(i,j), j=1,12) 22 continue do 23 i= 1, 16 do 23 j =1, 12 f(i,j) = exp(-((v/scale(i,j))**shape(i,j))) 23 continue c write record to 'test_allyear_speed' file open (8, file = 'test_allyear_speed') write(8,500) write(8,500) write (8,80) write(8,500) do 30 k =1, 16 if (k .eq. 1) then write(8,81) else if (k .eq. 2) then write(8,82) else if (k .eq. 3) then write(8,83) else if (k .eq. 4) then write(8,84) else if (k .eq. 5) then write(8,85) else if (k .eq. 6) then write(8,86) else if (k .eq. 7) then write(8,87) else if (k .eq. 8) then write(8,88) else if (k .eq. 9) then write(8,89) else if (k .eq. 10) then write(8,90) else if (k .eq. 11) then write(8,91) else if (k .eq. 12) then write(8,92) else if (k .eq. 13) then write(8,93) else if (k .eq. 14) then write(8,94) else if (k .eq. 15) then write(8,95) else if (k .eq. 16) then write(8,96) endif write(8,105) write(8,110) write(8,200) (f(k,j), j=1,12) do 40 i=1, 12 sum_sspeed(i) = 0 sum_surep(i) = 0 ave_surep(i) = 0 40 continue c read record from 'windgen_mid_speed' file c for simulation database information open(1,file='windgen_mid_speed', status='old') do 50 i=1, 5 read(1,500) 50 continue do 60 m = 1 ,no_years do 70 i = 1,12 if (k .eq. 1) then read (1, 401) urep read (1, 401) speed else if (k .eq. 2) then read (1, 402) urep read (1, 402) speed else if (k .eq. 3) then read (1, 403) urep read (1, 403) speed else if (k .eq. 4) then read (1, 404) urep read (1, 404) speed else if (k .eq. 5) then read (1, 405) urep read (1, 405) speed else if (k .eq. 6) then read (1, 406) urep read (1, 406) speed else if (k .eq. 7) then read (1, 407) urep read (1, 407) speed else if (k .eq. 8) then read (1, 408) urep read (1, 408) speed else if (k .eq. 9) then read (1, 409) urep read (1, 409) speed else if (k .eq. 10) then read (1, 410) urep read (1, 410) speed else if (k .eq. 11) then read (1, 411) urep read (1, 411) speed else if (k .eq. 12) then read (1, 412) urep read (1, 412) speed else if (k .eq. 13) then read (1, 413) urep read (1, 413) speed else if (k .eq. 14) then read (1, 414) urep read (1, 414) speed else if (k .eq. 15) then read (1, 415) urep read (1, 415) speed else if (k .eq. 16) then read (1, 416) urep read (1, 416) speed endif read(1,500) read(1,500) surep(i) = urep sspeed(i) = speed sum_surep(i) = sum_surep(i) + surep(i) sum_sspeed(i) = sum_sspeed(i) + sspeed(i) 70 continue 60 continue do 75 i=1, 12 ave_surep(i) = real(sum_sspeed(i))/real(sum_surep(i)) 75 continue write (8,210) (ave_surep(i), i=1,12) write (8,220) (sum_sspeed(i), i=1,12) write (8,230) (sum_surep(i), i=1,12) write (8,105) write (8,500) close(1) 30 continue close(1) close(2) close(8) end