@@ -12,18 +12,16 @@ def add_curtailment_columns(filename, curtailment_tolerance):
12
12
df ["PVSystems__Curtailment__residential (kWh)" ] = 0.0
13
13
columns = ["substation" , "feeder" , "placement" , "sample" , "penetration_level" ]
14
14
15
- def calc_curtailment (pf1 , control_mode ):
15
+ def calc_energy_curtailed (pf1 , control_mode ):
16
16
"""Calculate curtailment."""
17
17
if pf1 == 0 :
18
18
return 0
19
-
20
- # We may need to consider using this tolerance in the future.
21
- # if pf1 < curtailment_tolerance:
22
- # return 0
19
+ if pf1 < curtailment_tolerance :
20
+ return 0
23
21
diff = pf1 - control_mode
24
- # if diff < 0 and abs(diff) < curtailment_tolerance:
25
- # return 0
26
- return diff / pf1
22
+ if diff < 0 and abs (diff ) < curtailment_tolerance :
23
+ return 0
24
+ return diff
27
25
28
26
for (substation , feeder , placement , sample , penetration_level ), tdf in df .groupby (by = columns ):
29
27
for customer_type in ("commercial" , "residential" ):
@@ -33,7 +31,7 @@ def calc_curtailment(pf1, control_mode):
33
31
if sim_vals .empty :
34
32
continue
35
33
pf1 = tdf .query ("scenario == 'pf1'" )[power_col ]
36
- curtailment = pf1 .combine (sim_vals , calc_curtailment )
34
+ curtailment = pf1 .combine (sim_vals , calc_energy_curtailed )
37
35
cond = lambda x : (
38
36
(x ["substation" ] == substation )
39
37
& (x ["feeder" ] == feeder )
@@ -50,15 +48,13 @@ def calc_curtailment(pf1, control_mode):
50
48
51
49
@click .command ()
52
50
@click .argument ("output_dir" )
53
- # This is disabled because we don't know the best tolerance for these customer-type
54
- # aggregations. Leaving it in the code in case we need it in the future.
55
- # @click.option(
56
- # "-d", "--curtailment-tolerance",
57
- # default=0.0001,
58
- # show_default=True,
59
- # help="Set curtailment to 0 if the diff is less than this value.",
60
- # )
61
- def cba_post_process (output_dir , curtailment_tolerance = 0.0001 ):
51
+ @click .option (
52
+ "-d" , "--curtailment-tolerance" ,
53
+ default = 0.001 ,
54
+ show_default = True ,
55
+ help = "Set curtailment to 0 if the diff is less than this value." ,
56
+ )
57
+ def cba_post_process (output_dir , curtailment_tolerance = 0.001 ):
62
58
"""Perform post-processing of CBA tables."""
63
59
add_curtailment_columns (output_dir , curtailment_tolerance )
64
60
0 commit comments