You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea on this code is to make a graphic where the price for the RT is given as $/MWh and not as, for example, $/MW-5min (because on this example the RT prices are evaluated for 5 in 5 minutes). To do that, the idea is to sum all the evaluated prices for each hour and to plot it.
Plot the simulation prices over the time period covered by the results. The bus_names
control which buses we want to include the plot. It evaluates the prices for a Real Time (RT)
example and sums the prices so that it is on $/MWh.
"""
@userplot plot_prices_RT
@recipe function f(p::plot_prices_RT; bus_names::AbstractArray=[])
market_simulator, system_results, = p.args
prices = evaluate_prices(market_simulator, system_results)
values = select(prices, Not(:DateTime))
n_prev, n_bus = size(values)
intervals = get_time_series_params(market_simulator.system_rt).interval
n_prev_hour = Int(60/intervals.value)
n_days = Int(n_prev/n_prev_hour)
names_bus = names(values)
prices_rt = zeros(n_days,n_bus)
i = 1
while i < n_days
for j in 1:(n_prev_hour):n_prev
prices_hour = prices[prices[j,:DateTime] .<= prices.DateTime .< prices[j,:DateTime]+Hour(1), :]
prices_hour = select(prices_hour, Not(:DateTime))
prices_rt[i,:] = sum(Matrix(prices_hour), dims = 1)
i = i + 1
end
end
times = prices[1:n_prev_hour:n_prev, 1]
dictionary = Dict()
n_row, n_col = size(prices_rt)
for price in 1:n_col
if !haskey(dictionary, names_bus[price])
dictionary[names_bus[price]] = prices_rt[:,price]
else
dictionary[names_bus[price]] = dictionary[names_bus[price]] + prices_rt[:,price]
end
end
plot_data = DataFrame(dictionary)
# select rows for the given bus names, default to all buses.
if !isempty(bus_names)
bus_names = String.(bus_names)
@assert issubset(bus_names, names(plot_data))
select!(plot_data, bus_names)
end
label --> reduce(hcat, names(plot_data))
yguide --> "Prices (\$/MWh)"
legend --> :outertopright
seriestype --> :line
xrotation --> 45
for i in Base.axes(plot_data, 2)
@series begin
times, plot_data[:, i]
end
end
end
When it is called as plot_prices_RT(market_simulator, results; xtickfontsize=8, size=(800, 600)) it seems that it does not work because of the the extra arguments (xtickfontsize and size).
ERROR: got unsupported keyword arguments "xtickfontsize", "size"
When it is called as plot_prices_RT(market_simulator, results;) it still does not work.
For now, this graphic was made in the example file using the plot function.
The text was updated successfully, but these errors were encountered:
rafaelamaribeiro
changed the title
Create a new plot that plots the RT prices in MWh
Create a new plot recipe that plots the RT prices in MWh
Jun 18, 2021
The idea on this code is to make a graphic where the price for the RT is given as$/MWh and not as, for example, $ /MW-5min (because on this example the RT prices are evaluated for 5 in 5 minutes). To do that, the idea is to sum all the evaluated prices for each hour and to plot it.
"""
plot_prices_RT(
market_simulator::MarketSimulator,
results::SimulationResults;
bus_names::AbstractArray=[])
Plot the simulation prices over the time period covered by the
results
. Thebus_names
control which buses we want to include the plot. It evaluates the prices for a Real Time (RT)
example and sums the prices so that it is on $/MWh.
"""
When it is called as
plot_prices_RT(market_simulator, results; xtickfontsize=8, size=(800, 600))
it seems that it does not work because of the the extra arguments (xtickfontsize and size).ERROR:
got unsupported keyword arguments "xtickfontsize", "size"
When it is called as
plot_prices_RT(market_simulator, results;)
it still does not work.For now, this graphic was made in the example file using the
plot
function.The text was updated successfully, but these errors were encountered: