From 5eb92c74dbf33a025b233d42b754a950c99fe57e Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 19 Dec 2023 18:55:11 -0500 Subject: [PATCH] Workarounds for missing Generator --- omf/models/microgridDesign.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/omf/models/microgridDesign.py b/omf/models/microgridDesign.py index 3c4c5689e..de7acccf0 100644 --- a/omf/models/microgridDesign.py +++ b/omf/models/microgridDesign.py @@ -965,7 +965,7 @@ def makeGridLine(x,y,color,name): powerWindToLoad = makeGridLine(x_values,outData['powerWindToLoad' + indexString],'purple','Load met by Wind') plotData.append(powerWindToLoad) - if results['Generator']['size_kw'] > 0: + if 'Generator' in results and results['Generator']['size_kw'] > 0: powerDieselToLoad = makeGridLine(x_values,outData['powerDieselToLoad' + indexString],'brown','Load met by Fossil Gen') plotData.append(powerDieselToLoad) @@ -1018,7 +1018,7 @@ def makeGridLine(x,y,color,name): outData["windData" + indexString] = json.dumps(plotData, cls=plotly.utils.PlotlyJSONEncoder) plotData = [] - if results['Generator']['size_kw'] > 0: + if 'Generator' in results and results['Generator']['size_kw'] > 0: powerDieselToLoad = makeGridLine(x_values,outData['powerDieselToLoad' + indexString],'brown','Fossil Gen used to meet Load') plotData.append(powerDieselToLoad) @@ -1048,7 +1048,7 @@ def makeGridLine(x,y,color,name): powerWindToBattery = makeGridLine(x_values,outData['powerWindToBattery' + indexString],'purple','Wind') plotData.append(powerWindToBattery) - if results['Generator']['size_kw'] > 0: + if 'Generator' in results and results['Generator']['size_kw'] > 0: powerDieselToBattery = makeGridLine(x_values,outData['powerDieselToBattery' + indexString],'brown','Fossil Gen') plotData.append(powerDieselToBattery)