Skip to content

Commit

Permalink
Merge pull request #54 from NREL-Sienna/jd/add_thermal_cost_function_…
Browse files Browse the repository at this point in the history
…testing

Jd/add thermal cost function testing
  • Loading branch information
jd-lara authored May 13, 2024
2 parents 56cbd25 + e3dd116 commit d545471
Showing 1 changed file with 336 additions and 0 deletions.
336 changes: 336 additions & 0 deletions psy_data/generation_cost_function_data.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,336 @@
################# Fixed Cost values ####################
thermal_generator_linear_cost(node) =
ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(CostCurve(LinearCurve(10.23)),
0.0,
1.5,
0.75,
),
base_power=100.0,
)

thermal_generator_linear_fuel(node) =
ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(FuelCurve(LinearCurve(1.023), 10.0),
0.0,
1.5,
0.75,
),
base_power=100.0,
)

thermal_generator_pwl_io_fuel(node) =
ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(FuelCurve(PiecewisePointCurve([(50.0, 30.0), (80.0, 48.91), (120.0, 88.181), (170.0, 139.319)]), 10.0),
0.0,
1.5,
0.75,
),
base_power=100.0,
)

thermal_generator_pwl_io_cost(node) =
ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(CostCurve(PiecewisePointCurve([(50.0, 300.0), (80.0, 489.1), (120.0, 881.81), (170.0, 1393.19)])),
0.0,
1.5,
0.75,
),
base_power=100.0,
)

thermal_generator_pwl_incremental_cost(node) =
ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(CostCurve(
PiecewiseIncrementalCurve(300.0, [50.0, 80.0, 120.0, 170.0], [6.337, 9.8155, 10.2276]),
),
0.0,
1.5,
0.75,
),
base_power=100.0,
)

thermal_generator_pwl_incremental_fuel(node) =
ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(FuelCurve(
PiecewiseAverageCurve(30.0, [50.0, 80.0, 120.0, 170.0], [0.6337, 0.98155, 1.02276]),
10.0),
0.0,
1.5,
0.75,
),
base_power=100.0,
)

thermal_generator_quad_cost(node) =
ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(CostCurve(QuadraticCurve(0.0205, 4.708, 3.5509)),
0.0,
1.5,
0.75,
),
base_power=100.0,
)

thermal_generator_quad_fuel(node) =
ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(FuelCurve(QuadraticCurve(0.0021, 0.4708, 0.35509), 10.0),
0.0,
1.5,
0.75,
),
base_power=100.0,
)

thermal_generator_pwl_io_cost_nonconvex(node) =
ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(CostCurve(PiecewisePointCurve([(50.0, 300.0), (80.0, 489.1), (120.0, 871.81), (170.0, 1093.19)])),
0.0,
1.5,
0.75,
),
base_power=100.0,
);

################# Time Variable Fuel Costs ####################
function _get_fuel_cost_time_series()
fuel_price_forecast = SortedDict{Dates.DateTime,TimeSeries.TimeArray}()
ini_time = DateTime("1/1/2024 0:00:00", "d/m/y H:M:S")
fuel_price = [[10.0, 3.0, 10.0, 1.0, 1000.0], [10.0, 3.0, 10.0, 1.0, 1000.0]]
for (ix, date) in enumerate(range(ini_time; length=2, step=Hour(1)))
fuel_price_forecast[date] =
TimeSeries.TimeArray(
range(ini_time; length=5, step=Hour(1)),
fuel_price[ix],
)
end
return PSY.Deterministic("fuel_price", fuel_price_forecast)
end

function thermal_generator_linear_fuel_ts(sys, node)
gen = ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(FuelCurve(LinearCurve(1.023), 10.0),
0.0,
1.5,
0.75,
),
base_power=100.0,
)
add_component!(sys, gen)
set_fuel_cost!(sys, gen, _get_fuel_cost_time_series())
return gen
end

function thermal_generator_pwl_io_fuel_ts(sys, node)
gen = ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(FuelCurve(PiecewisePointCurve([(50.0, 30.0), (80.0, 48.91), (120.0, 88.181), (170.0, 139.319)]), 10.0),
0.0,
1.5,
0.75,
),
base_power=100.0,
)
add_component!(sys, gen)
set_fuel_cost!(sys, gen, _get_fuel_cost_time_series())
return gen
end

function thermal_generator_pwl_incremental_fuel_ts(sys, node)
gen = ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(FuelCurve(
PiecewiseAverageCurve(30.0, [50.0, 80.0, 120.0, 170.0], [0.6337, 0.98155, 1.02276]),
10.0),
0.0,
1.5,
0.75,
),
base_power=100.0,
)
add_component!(sys, gen)
set_fuel_cost!(sys, gen, _get_fuel_cost_time_series())
return gen
end

function thermal_generator_quad_fuel_ts(sys, node)
gen = ThermalStandard(
name="Test Unit",
available=true,
status=true,
bus=node,
active_power=1.70,
reactive_power=0.20,
rating=2.2125,
prime_mover_type=PrimeMovers.ST,
fuel=ThermalFuels.COAL,
active_power_limits=(min=0.5, max=1.70),
reactive_power_limits=(min=-1.275, max=1.275),
ramp_limits=(up=0.02 * 2.2125, down=0.02 * 2.2125),
time_limits=(up=2.0, down=1.0),
operation_cost=ThermalGenerationCost(FuelCurve(QuadraticCurve(0.0021, 0.4708, 0.35509), 10.0),
0.0,
1.5,
0.75,
),
base_power=100.0,
)
add_component!(sys, gen)
set_fuel_cost!(sys, gen, _get_fuel_cost_time_series())
return gen
end

0 comments on commit d545471

Please sign in to comment.