Description Usage Arguments Details Value See Also Examples
This collection of functions retrieves data from the processed PLEXOS solutions and returns it in a convenient format.
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 | query_master(db, time, col, prop, columns = "name", time.range = NULL,
filter = NULL, phase = 4)
query_interval(db, ...)
query_day(db, ...)
query_week(db, ...)
query_month(db, ...)
query_year(db, ...)
sum_master(db, time, col, prop, columns = "name", time.range = NULL,
filter = NULL, phase = 4, multiply.time = FALSE)
sum_interval(db, ...)
sum_day(db, ...)
sum_week(db, ...)
sum_month(db, ...)
sum_year(db, ...)
|
db |
PLEXOS database object |
time |
character. Table to query from (interval, day, week, month, year) |
col |
character. Collection to query |
prop |
character vector. Property or properties to query |
columns |
character. Data columns to query or aggregate by (defaults to |
time.range |
POSIXt or character. Range of dates of length 2 (given as date, datetime or character in 'ymdhms' or 'ymd' format). The Plexos data is assumed to be in UTC so providing a POSIXt vector in a different timezone might cause conflicts. Character vectors are also converted to the UTC format, so here there is not issue. |
filter |
list. Used to filter by data columns (see details) |
phase |
integer. PLEXOS optimization phase (1-LT, 2-PASA, 3-MT, 4-ST) |
... |
parameters passed from shortcut functions to master (all except |
multiply.time |
boolean. When summing interval data, provide the value multiplied by interval duration (See details). |
The family query_*
returns the raw data in the databases, while sum_*
aggregates the data according to columns
.
The functions *_day
, *_week
, *_month
and *_year
are
shortcuts for the corresponding, *_master
function.
The following is a list of valid items for columns
and filtering. Additionally,
time
can be specified for summary data (interval data always includes time
).
category
property
name
(default for columns)
parent
(automatically selected when name
is selected)
category
region
(only meaningful for generators)
zone
(only meaningful for generators)
period_type
band
sample
timeslice
If defined, the filter
parameter must be a list
. The elements must be chracter
vectors and need to have a valid column name (see previous bullet points). For example, one
could define it as follows:
filter = list(name = c("Generator1", "Generator2"), region = "Region1")
To filter by time use the time.range
parameter, instead of adding it as an entry in the
filter
parameter. For example use c("2015-03-14", "2015-03-15")
in your query.
Please note that the year/month/date starts at midnight (00:00:00).
If a scenario has multiple databases, the data will be aggregated automatically. If two or more
databases within the same scenario have overlapping time periods, the default is to select the
data from the last database (execute summary(db)
so see the order). To change this behavior
set the global option rplexos.tiebreak
to first
, last
, or all
to
select data from the first database, the last one or keep all of them.
Multiple properties can be queried within a collection. If prop
equals the widcard
"*"
, all the properties within a collection are returned.
The parameter multiply.time
allows to multiply values by interval duration (in hours) when
doing the sum of interval data. This can be used, for example, to obtain total energy (in MWh)
from power time series (in MW).
A data frame that contains data summarized/aggregated by scenario.
plexos_open
to create the PLEXOS database object
query_sql
to perform custom queries
1 2 3 4 5 6 7 8 9 | # Process the folder with the solution file provided by rplexos
location <- location_solution_rplexos()
process_folder(location)
# Query data
db <- plexos_open(location)
query_day(db, "Generator", "Generation")
query_day(db, "Region", "*")
query_interval(db, "Generator", "Generation")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.