Repository navigation
Expand file tree
/
Copy pathExample_script_grid.py
More file actions
58 lines (50 loc) · 3.61 KB
/
Copy pathExample_script_grid.py
File metadata and controls
58 lines (50 loc) · 3.61 KB
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
import time
import start_analysis
import hosting_capacity_variables
import os
if __name__=="__main__":
BASE_DIR=os.path.dirname(os.path.abspath(__file__))
os.chdir(BASE_DIR)
st=time.time()
####################################################
#Provide user input here
####################################################
mode='grid' #choose what model to use, use
#'Technical' for a more detailed analysis by region,
#'Market' to calculate the the potential by region (rule-of-thumb and uses inputs derived from the 'Technical' model),
#'grid' to calculate provincial values with a consideration for the hosting capacity (uses shading data from the detailed analysis)
scaling_option=False #set to False if coefficients should not be used to calculate the technical potential instead of the results from the inputted region
# i.e. if scaling up the results from the region used with lidar data to calculate a larger area
# Example: scaling up from the shaded POA calculated for Toronto,CA to calculate the province-wide results for Ontario
region_names=['Example1','Example2'] #should match the files names in the \batch_inputs\Grid folder
# region_names=['Example1'] #should match the files names in the \batch_inputs\Grid folder
starting_year=2022
ending_year=2050
file_location=r'C:\Users\user_name\Documents' #this is a pre-existing folder where outputs will be stored and read from, including shading data, mosaic files, segmentation file, and the rasterized segmentation file and output files (output data) as excel files with structure output_region_name.xlsx (same as the market mode)
shading_granularity='hourly' #options are hourly, or representative
u_c=20 #PVsyst Fayman temperature coefficient constant
u_v=0 #PVsyst Fayman temperature coefficient multiplying wind speed
lifetime_years=30
dc_to_ac_capacity_ratio = 1.25 #ratio of the total DC power capacity of the solar panels to the total AC power capacity of the inverters
inverter_efficiency_nominal = 0.99 #efficiency rating when operating at its maximum capacity or 100% load
hosting_limit=0.67 #limit of the hourly demand to compare to the generation to calculate the hosting capacity. Example: the generation should never exceed 67% of the demand on an hourly basis.
#parameters for the Bass Diffusion model
p_range=[10**(-6)]
q_range=[0.1,0.3,0.5,0.7]
####################################################
hourly_demand=[]
annual_demand=[]
current_directory=os.getcwd()
for region in region_names:
hourly_demand.append(os.path.join(BASE_DIR,"electricity_demand","Hourly", region+'.csv'))
annual_demand.append(os.path.join(BASE_DIR,"electricity_demand", region+'.csv'))
resolution=1
hosting_capacity=hosting_capacity_variables.hosting_capacity(inverter_efficiency_nominal,dc_to_ac_capacity_ratio,lifetime_years,
u_v,u_c,hosting_limit)
if len(region_names)>1:
start_analysis.calculate_all_regions_grid(file_location,resolution,mode,p_range,q_range,region_names,hosting_capacity,hourly_demand,annual_demand,starting_year,ending_year,scaling_option,shading_granularity)
else:
start_analysis.calculate_one_region_grid(region_names[0],file_location,resolution,hosting_capacity,mode,p_range,q_range,hourly_demand[0],annual_demand[0],starting_year,ending_year,scaling_option,shading_granularity)
et =time.time()
elapsed_time=round((et-st)/60,2)
print("Run time in minutes: ",elapsed_time)