Skip to content

Commit 3e87e24

Browse files
committed
handle missing constraint for generator; handle no RE generation in Summary
1 parent 593900a commit 3e87e24

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

powermatch.py

+18-14
Original file line numberDiff line numberDiff line change
@@ -1834,17 +1834,20 @@ def pmClicked(self):
18341834
except:
18351835
pass
18361836
for i in range(self.order.count()):
1837-
if self.generators[self.order.item(i).text()].capacity > 0:
1838-
gen = self.order.item(i).text()
1839-
try:
1840-
if self.generators[gen].constraint in self.constraints and \
1841-
self.constraints[self.generators[gen].constraint].category == 'Generator':
1842-
typ = 'G'
1843-
else:
1844-
typ = 'S'
1845-
except:
1846-
continue
1847-
datain.append([gen, typ, self.generators[gen].capacity])
1837+
try:
1838+
if self.generators[self.order.item(i).text()].capacity > 0:
1839+
gen = self.order.item(i).text()
1840+
try:
1841+
if self.generators[gen].constraint in self.constraints and \
1842+
self.constraints[self.generators[gen].constraint].category == 'Generator':
1843+
typ = 'G'
1844+
else:
1845+
typ = 'S'
1846+
except:
1847+
continue
1848+
datain.append([gen, typ, self.generators[gen].capacity])
1849+
except:
1850+
pass
18481851
adjust = Adjustments(self, datain, self.adjustto, self.adjust_cap, self.results_prefix,
18491852
show_multipliers=self.show_multipliers, save_folder=self.scenarios)
18501853
adjust.exec_()
@@ -2966,9 +2969,10 @@ def format_period(per):
29662969
cp = '${:.2f}'.format(self.carbon_price)
29672970
sp_data.append(['Carbon Price', self.carbon_price, '', '', '', cc, cs])
29682971
# sp_data.append(['RE %age', round(re_sum * 100. / gen_sum, 1)])
2969-
sp_data.append(['RE %age', '{:.1f}%'.format((tml_sum - sto_sum - ff_sum) * 100. / tml_sum)])
2970-
if sto_sum > 0:
2971-
sp_data.append(['Storage %age', '{:.1f}%'.format(sto_sum * 100. / tml_sum)])
2972+
if tml_sum > 0:
2973+
sp_data.append(['RE %age', '{:.1f}%'.format((tml_sum - sto_sum - ff_sum) * 100. / tml_sum)])
2974+
if sto_sum > 0:
2975+
sp_data.append(['Storage %age', '{:.1f}%'.format(sto_sum * 100. / tml_sum)])
29722976
# sp_data.append(['RE %age of Total Load', round((sp_load - sf_sums[0] - ff_sum) * \
29732977
# 100. / sp_load, 1)])
29742978
sp_data.append(' ')

0 commit comments

Comments
 (0)