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, ...)
name
)time
)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).
plexos_open
to create the PLEXOS database objectquery_sql
to perform custom queries
# 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")
Run the code above in your browser using DataLab