74 lines
1.7 KiB
Python
74 lines
1.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Run an example recompression CO2 Brayton cycle sweep."""
|
|
|
|
from brayton_cycle import (
|
|
BraytonCycle,
|
|
plot_sweep_optimization_results,
|
|
sweep_and_optimize_rc,
|
|
)
|
|
|
|
|
|
def run_rc_sweep():
|
|
brayton = BraytonCycle(name="simple brayton cycle test")
|
|
|
|
T_high = 650 + 273.15
|
|
T_low = 42 + 273.15
|
|
p_high = 20.0e6
|
|
p_low = 9.09e6
|
|
ploss = 0.01
|
|
|
|
fixed_var = {
|
|
"T_high": T_high,
|
|
"T_low": T_low,
|
|
"p_high": p_high / 1e3,
|
|
"p_low": 8.16e3,
|
|
"ploss": ploss,
|
|
}
|
|
param = {
|
|
"x": 0.279,
|
|
"compressor_eff": 0.9,
|
|
"recompressor_eff": 0.9,
|
|
"turbine_eff": 0.93,
|
|
"recuperator_eff": 0.94,
|
|
"highT_recuperator_eff": 0.96,
|
|
}
|
|
|
|
brayton.RC(T_low, T_high, p_low / 1e3, p_high / 1e3, ploss, param)
|
|
|
|
Wc = (
|
|
brayton.compressor[0].variables["Wc"]
|
|
+ brayton.compressor[1].variables["Wc"]
|
|
)
|
|
Wt = brayton.turbine.variables["Wt"]
|
|
Q_input = brayton.heater.variables["Q_in"]
|
|
Q_output = brayton.condenser.variables["Q_out"]
|
|
|
|
print(Q_input + Wc - (Q_output + Wt))
|
|
print((Wt - Wc) / Q_input)
|
|
|
|
x_vals, eff_vals, opt_vals, failures = sweep_and_optimize_rc(
|
|
fixed_params=fixed_var,
|
|
params=param,
|
|
sweep_var="T_low",
|
|
sweep_bounds=(30 + 273.15, 60 + 273.15),
|
|
opt_var="x",
|
|
opt_bounds=(0.1, 0.5),
|
|
num_points=30,
|
|
)
|
|
if failures:
|
|
print(f"Skipped {len(failures)} invalid sweep points.")
|
|
|
|
plot_sweep_optimization_results(
|
|
"T_low",
|
|
x_vals,
|
|
eff_vals,
|
|
"x",
|
|
opt_vals,
|
|
)
|
|
|
|
return brayton, x_vals, eff_vals, opt_vals
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run_rc_sweep()
|