-
Notifications
You must be signed in to change notification settings - Fork 18
/
2.CALCULATE.R
89 lines (61 loc) · 2.35 KB
/
2.CALCULATE.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
##########################
## ##
## GENERAL OPTIONS ##
## ##
##########################
# our wind farms file with coordinates, turbine models, etc.
farmOptionsFile = 'Q:/VWF/data/INPUT_CH.R'
# our base options file with model parameters, etc.
baseOptionsFile = 'Q:/VWF/data/BASE.OPTIONS.R'
##########################
## ##
## PREPARE ##
## ##
##########################
# load the VWF model and required libraries
#
source('Q:/VWF/lib/VWF.R')
# prepare the VWF model with your parameters
# check ability to save output files
# read in wind farms and power curves
# prep the merra data for reading in
# launch multi-core cluster
# establish spatial interpolation and bias correction code
#
source(baseOptionsFile)
source('Q:/VWF/lib/VWF.MAIN.PREP.R')
# key things you now have:
# windFarms - dataframe containing our wind farms
# farmCurve - dataframe containing our power curves
# merra_wind - object holding our merra filenames
# nc_wind - object for handling netcdf files
# cl - multicore cluster object
##########################
## ##
## GET WIND SPEED ##
## ##
##########################
# read in pre-calculated speeds if we have them, otherwise go and interpolate & extrapolate them
# this is a very slow stage - go fire up 3.PERFORMANCE.MONITOR.R to see how it's going..
source('Q:/VWF/lib/VWF.MAIN.WINDSPEED.R')
# key things you now have:
# windSpeed - dataframe containing hourly wind speeds for each farm
# this is also saved into baseSaveFolder
##########################
## ##
## GET WIND POWER ##
## ##
##########################
source('Q:/VWF/lib/VWF.MAIN.WINDPOWER.R')
# key things you now have:
# windSpeed - now modified for bias correction
# loadFactor - dataframe containing the hourly capacity factors for each farm
# powerMW - dataframe containing the hourly power output for each farm
# parms - dataframe containing the parameters used for each farm
##########################
## ##
## SAVE RESULTS ##
## ##
##########################
source('Q:/VWF/lib/VWF.MAIN.RESULTS.R')
flush('\n\nFLAWLESS\n\n')