-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPlotResults.py
332 lines (150 loc) · 16.1 KB
/
PlotResults.py
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
###############################################################################
###############################################################################
#Copyright (c) 2016, Andy Schroder
#See the file README.md for licensing information.
###############################################################################
###############################################################################
from Plotters import CreateFigure,SaveTheFigure,ComputeLevels,AddMultiAxisLegend,PlotParameterSweep,PlotCycle
from helpers import SmartDictionary,WriteBinaryData
import cPickle
BaseInputFilePath='outputs/'
#single cycle
BaseOutputFilePath='/tmp/'
CaseName='CO2Cycle-NotOptimizedParameterSweep-PowerTurbineEfficiency'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-MaxPressure'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-MaxPressure-ExtendedRange'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Overall Pressure Ratio')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalOverallPressureRatio.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Main Compressor Pressure Ratio')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalMainCompressorPressureRatio.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='PreCompressor Pressure Ratio')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalPreCompressorPressureRatio.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Recompression Fraction')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalRecompressionFraction.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-RecompressionFraction'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Overall Pressure Ratio')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalOverallPressureRatio.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Main Compressor Pressure Ratio')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalMainCompressorPressureRatio.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='PreCompressor Pressure Ratio')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalPreCompressorPressureRatio.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-ReHeat'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',HorizontalAxisLabel='Number of ReHeat Stages',VerticalAxisMin=46,VerticalAxisMax=51.5)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-ReHeat-ElectricalMainCompressor'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',HorizontalAxisLabel='Number of ReHeat Stages',VerticalAxisMin=46,VerticalAxisMax=51.5)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-PressureRatios'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',ContourLevelMin=30,ContourLevelMax=51)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',PlotSecondAxisAsLines=True)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-Lines.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-PressureRatios-SlightlyHigherPreCompressorPressureRatio'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',ContourLevelMin=30,ContourLevelMax=51)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Recompression Fraction',ContourLevelRoundTo=.1)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalRecompressionFraction-Contour.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-PressureRatios-WithZeroMinDeltaT'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',ContourLevelMin=30,ContourLevelMax=51)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-PressureRatios-WithZeroMinDeltaT-SlightlyHigherPreCompressorPressureRatio'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',ContourLevelMin=30,ContourLevelMax=51)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-RegularAndElectricalMainCompressorEfficiency'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',PlotSecondAxisAsLines=True,SecondAxisLineLabel=['Dedicated Turbine Powered','Power Turbine/Electrically Powered'])
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Recompression Fraction',PlotSecondAxisAsLines=True,SecondAxisLineLabel=['Dedicated Turbine Powered','Power Turbine/Electrically Powered'])
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalRecompressionFraction.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Main Compressor Pressure Ratio',PlotSecondAxisAsLines=True,SecondAxisLineLabel=['Dedicated Turbine Powered','Power Turbine/Electrically Powered'])
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalMainCompressorPressureRatio.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='PreCompressor Pressure Ratio',PlotSecondAxisAsLines=True,SecondAxisLineLabel=['Dedicated Turbine Powered','Power Turbine/Electrically Powered'])
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalPreCompressorPressureRatio.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-MinDeltaTAndPressureDrop'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',PlotSecondAxisAsLines=True,SecondAxisLineLabelSuffix='Pa/K')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-Lines.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-MinDeltaTAndPressureDrop-RefinedLowDeltaT'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',PlotSecondAxisAsLines=True,SecondAxisLineLabelSuffix='Pa/K')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-Lines.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-MinDeltaTAndPressureDrop-RefinedLowDeltaT-WithAnotherLowPressureDrop'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',PlotSecondAxisAsLines=True,SecondAxisLineLabelSuffix='Pa/K')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-Lines.pdf')
#this plot is not very interesting, so decided not to use it
#CaseName='CO2Cycle-OptimizedParameterSweep-MinDeltaTAndPressureDrop'
#TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',PlotSecondAxisAsLines=False)
#SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-Contour.pdf')
CaseName='CO2Cycle-Optimized'
CycleParameters=cPickle.load(open(BaseInputFilePath+'/'+CaseName+'/Results.p', 'rb'))[0]
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Temperature',ContourLevel=None,HorizontalAxisMaxOverride=3100,VerticalAxisMaxOverride=1100,ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTs.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Temperature',ContourLevel='cp',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTscp.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Temperature',ContourLevel='Density',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTsrho.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Temperature',ContourLevel='gamma',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTsgamma.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Temperature',ContourLevel='CompressibilityFactor',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTsCompressibilityFactor.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Temperature',ContourLevel='Enthalpy',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTsEnthalpy.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Enthalpy',ContourLevel='Temperature',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CyclehsT.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='SpecificVolume',VerticalAxis='Pressure',ContourLevel='cp',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CyclePvcp.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='SpecificVolume',VerticalAxis='Pressure',ContourLevel='Entropy',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CyclePvs.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='SpecificVolume',VerticalAxis='Pressure',ContourLevel='Temperature',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CyclePvT.pdf')
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Pressure',VerticalAxis='Temperature',ContourLevel='cp',ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTPcp.pdf')
CaseName='CO2Cycle-Optimized-ReHeat-0'
CycleParameters=cPickle.load(open(BaseInputFilePath+'/'+CaseName+'/Results.p', 'rb'))[0]
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Temperature',ContourLevel=None,HorizontalAxisMaxOverride=3100,VerticalAxisMaxOverride=1100,ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTs.pdf')
CaseName='CO2Cycle-Optimized-ReHeat-3'
CycleParameters=cPickle.load(open(BaseInputFilePath+'/'+CaseName+'/Results.p', 'rb'))[0]
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Temperature',ContourLevel=None,HorizontalAxisMaxOverride=3100,VerticalAxisMaxOverride=1100,ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTs.pdf')
CaseName='CO2Cycle-Optimized-ReHeat-6'
CycleParameters=cPickle.load(open(BaseInputFilePath+'/'+CaseName+'/Results.p', 'rb'))[0]
WriteBinaryData(PlotCycle(CycleParameters,HorizontalAxis='Entropy',VerticalAxis='Temperature',ContourLevel=None,HorizontalAxisMaxOverride=3100,VerticalAxisMaxOverride=1100,ImageFileType='pdf'),BaseOutputFilePath+'/'+CaseName+'-CycleTs.pdf')
CaseName='CO2Cycle-OptimizedParameterSweep-MaxMinTemperatures'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',PlotSecondAxisAsLines=True,SecondAxisLineLabelSuffix='K')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-Lines.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Exergy Efficiency [%]',PlotSecondAxisAsLines=True,SecondAxisLineLabelSuffix='K')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-ExergyEfficiency-Lines.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',ContourLevelRoundTo=1)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-Contour.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Recompression Fraction',ContourLevelRoundTo=.1)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalRecompressionFraction-Contour.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Main Compressor Outlet Pressure [Pa]',ContourLevelRoundTo=.1)
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-OptimalMainCompressorOutletPressure-Contour.pdf')
############################
#combined cycle
############################
#note, these cases are all commented out since they were added to the paper and don't want to overwrite that with some slightly different plots
#when this script is re-run to create the rest of the plots specified in it, if some changes are made to the plotting functions.
#note, this folder path has also been changed slightly after the creation of these plots has been commented out.
#BaseOutputFilePath='/tmp/'
#CaseName='CombinedCycle-OptimizedParameterSweep-GasTurbineCompressorIsentropicEfficiency'
#TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',HorizontalAxisMin=0.8,HorizontalAxisMax=0.9)
#SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
#CaseName='CombinedCycle-OptimizedParameterSweep-MaxCO2CyclePressure'
#TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]')
#SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
#CaseName='CombinedCycle-OptimizedParameterSweep-NumberOfEngines'
#TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]')
#SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
#CaseName='CombinedCycle-OptimizedParameterSweep-MaxTemperature'
#TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]')
#SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
############################
BaseOutputFilePath='/tmp/'
CaseName='CombinedCycle-OptimizedParameterSweep-MaxMinTemperatures'
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]',PlotSecondAxisAsLines=True,SecondAxisLineLabelSuffix='K')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-Lines.pdf')
TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Exergy Efficiency [%]',PlotSecondAxisAsLines=True,SecondAxisLineLabelSuffix='K')
SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'-ExergyEfficiency-Lines.pdf')
#fuel cell combined cycle
#BaseOutputFilePath='./scratch/'
#decided to not actually include this one in the dissertation
#CaseName='FuelCellCombinedCycle-OptimizedParameterSweep-FuelUtilization'
#TheFigure,ThePlot,TheLines=PlotParameterSweep(BaseInputFilePath,CaseName,PlotMagnitudeDescription='Cycle Efficiency [%]')
#SaveTheFigure(TheFigure,FileName=BaseOutputFilePath+'/'+CaseName+'.pdf')
#need to make horizontal axis multiplied by 100 or take away the % unit