c-----------------------------1. explaination-------------------------------- c c --- 1.test windgen direction c test windgen--| c --- 2.test windgen speed c c----------------------------------------------------------------------------- c c 1.test windgen direction c c source code output c c |--windgen_mid_direction.for -> windgen_mid_direction c test |--test_eachyear_direction.for -> test_eachyear_direction c windgen --|--test_allyear_direction.for -> test_allyear_direction c direction |--error_direction_direction.for -> error_direction_direction c |--error_month_direction.for -> error_month_direction c c c windgen_output ----| c | |->test_eachyear_direction c | | c | | |->error_direction_direction c v |->test_allyear_direction-| c windgen_mid_direction-| |->error_month_direction c 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_direction.for": from the "windgen_output", the program c generated a output file c "windgen_mid_direction" which is used c for internal process output. c 3)."test_eachyear_direction.for": from the "windgen_mid_direction" file, c the program generated a output file c "test_eachyear_direction" which is c used for detail by month/dir of c each year. c 4)."test_allyear_direction.for": from the "windgen_mid_direction" file, c the program generated a output file c "test_allyear_direction" which is c used for detail by month/dir of c all year (5, 10, 15, ...100...). c 5)."error_direction_direction.for": from the "test_allyear_direction" file, c the program generated a output file c "error_direction_direction" which c is used for the summary error in c each direction of years. c 6)."error_month_direction.for": from the "test_allyear_direction" file, c the program generated a output file c "error_month_direction" 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 pro: wind direction & calm in simulation database c percent(12): wind direction & calm in simulation database c sum_percent(12): the sum of percent(12) of all years c ave_percent(12): the average of percent(12) of all years c dir(17,12): wind direction & calm in master database integer no_years real pro, percent(12), sum_percent(12), ave_percent(12) real dir(17,12) c for output header 81 format ( 'No.1 "0" direction from wind_gen.wdb') 82 format ( 'No.2 "22.5" direction from wind_gen.wdb') 83 format ( 'No.3 "45" direction from wind_gen.wdb') 84 format ( 'No.4 "67.5" direction from wind_gen.wdb') 85 format ( 'No.5 "90" direction from wind_gen.wdb') 86 format ( 'No.6 "112.5" direction from wind_gen.wdb') 87 format ( 'No.7 "135" direction from wind_gen.wdb') 88 format ( 'No.8 "157.5" direction from wind_gen.wdb') 89 format ( 'No.9 "180" direction from wind_gen.wdb') 90 format ( 'No.10 "202.5" direction from wind_gen.wdb') 91 format ( 'No.11 "225" direction from wind_gen.wdb') 92 format ( 'No.12 "247.5" direction from wind_gen.wdb') 93 format ( 'No.13 "270" direction from wind_gen.wdb') 94 format ( 'No.14 "292.5" direction from wind_gen.wdb') 95 format ( 'No.15 "315" direction from wind_gen.wdb') 96 format ( 'No.16 "337.5" direction from wind_gen.wdb') 97 format ( 'No.17 "Calm" from wind_gen.wdb') 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.1)) 210 format ('simulation', 12(1x,f4.1)) c for read format in 'windgen_mid_direction' file 401 format (16x, f4.1) 402 format (21x, f4.1) 403 format (26x, f4.1) 404 format (31x, f4.1) 405 format (36x, f4.1) 406 format (41x, f4.1) 407 format (46x, f4.1) 408 format (51x, f4.1) 409 format (56x, f4.1) 410 format (61x, f4.1) 411 format (66x, f4.1) 412 format (71x, f4.1) 413 format (76x, f4.1) 414 format (81x, f4.1) 415 format (86x, f4.1) 416 format (91x, f4.1) 417 format (96x, f4.1) c for read format in 'windgen_output' file 420 format (12(f5.2, 1x)) 500 format (1x) integer i, j, k, m c------------------3. read and write file-------------------------- print*, "enter the number of years to simulate:" read*, no_years c read record from 'windgen_output' file c for master database information open (2, file = '../bin/windgen_output') do 10 i = 1, 6 read (2,500) 10 continue do 20 i =1, 16 read (2, 420) (dir(i,j), j=1,12) 20 continue read(2,500) read(2,500) read(2,420) (dir(17,j), j=1, 12) c write record to 'test_allyear_direction' file open (8, file = 'test_allyear_direction') do 30 k =1, 17 if (k .eq. 1) then write(8,500) write(8,500) 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) else if (k .eq. 17) then write(8,97) endif write(8,105) write(8,110) write(8,200) (dir(k,j), j=1,12) do 40 i=1, 12 sum_percent(i) = 0 ave_percent(i) = 0 40 continue c read record from 'windgen_mid_direction' file c for simulation database information open(1,file='windgen_mid_direction', status='old') do 50 i=1, 6 read(1,500) 50 continue do 60 m = 1 ,no_years do 70 i = 1,12 if (k .eq. 1) then read (1, 401) pro else if (k .eq. 2) then read (1, 402) pro else if (k .eq. 3) then read (1, 403) pro else if (k .eq. 4) then read (1, 404) pro else if (k .eq. 5) then read (1, 405) pro else if (k .eq. 6) then read (1, 406) pro else if (k .eq. 7) then read (1, 407) pro else if (k .eq. 8) then read (1, 408) pro else if (k .eq. 9) then read (1, 409) pro else if (k .eq. 10) then read (1, 410) pro else if (k .eq. 11) then read (1, 411) pro else if (k .eq. 12) then read (1, 412) pro else if (k .eq. 13) then read (1, 413) pro else if (k .eq. 14) then read (1, 414) pro else if (k .eq. 15) then read (1, 415) pro else if (k .eq. 16) then read (1, 416) pro else if (k .eq. 17) then read (1, 417) pro endif read(1,500) read(1,500) percent(i) = pro sum_percent(i) = sum_percent(i) + percent(i) 70 continue 60 continue do 80 i=1, 12 ave_percent(i) = sum_percent(i)/100 80 continue write (8,210) (ave_percent(i), i=1,12) write (8,105) write (8,500) close(1) 30 continue close(1) close(2) close(8) end