rixmp¶
ixmp.Platform {rixmp} | R Documentation |
Class ixmp.Platform
Description
The class 'ixmp.Platform' is the central access point to and accessing dataobjects (timeseries and reference data) and scenarios (structured model input data and results).
Fields
.jobj
"jobjRef"
Methods
close_db()
close the database connection of the platform instance this is important when working with local database files ('HSQLDB')
initialize(dbprops = NULL, dbtype = NULL)
launch the Platform
open_db()
(re-)open the database connection of the platform instance, e.g., to continue working after using 'close_db()
Scenario(model, scen, version = NULL, scheme = NULL, annotation = NULL)
initialize a new Scenario (structured model input data and solution) or get an existing Scenario from the IXMP database
scenario_list(default = TRUE, model = NULL, scenario = NULL)
Get a list of all dataobjects (timeseries) and scenarios initialized in the IX Modeling Platform
units()
units function
ixmp.Scenario {rixmp} | R Documentation |
Class ixmp.Scenario
Description
The class 'ixmp.Scenario' is a generic collection of all data for a model instance (sets and parameters), as well as the solution of a model run (levels/marginals of variables and equations).
The class includes functions to make changes to the data, export all data to and import a solution from GAMS gdx, and save the scenario to the IXMP database. All changes are logged to facilitate version control.
Fields
.jobj
"jobjRef"
.platform
"jobjRef"
model
A character string.
scenario
A character string.
scheme
A character string.
Methods
add_cat(name, cat, keys, is_unique = FALSE)
add a set element key to the respective category mapping
add_par(name, key, val, unit, comment = NULL)
add set elements
add_set(name, key, comment = NULL)
add set elements
cat(name, cat)
return a list of all set elements mapped to a category
cat_list(name)
return a list of all categories for a set
change_scalar(name, val = NULL, unit = NULL, comment = NULL)
change the value or unit of a scalar
check_out(timeseries_only = FALSE)
check out the scenario from the database for making changes
clone(new_model = model, new_scen = scenario, annotation, keep_sol = TRUE, shift_fyear = 0)
clone the the given scenario and return the new scenario
commit(annotation)
commit all changes made to the scenario to the database
discard_changes()
discard all changes, reload all items of the scenario from database
element(ix_type, name, filters)
internal function to retrieve a dataframe of item elements
equ(name, filters = NULL)
return a dataframe with equation elements (optional: filtered by index names)
equ_list()
return a list of equations initialized in the scenario
has_equ(name)
check whether the scenario has a equation with that name
has_par(name)
check whether the scenario has a parameter with that name
has_set(name)
check whether the scenario has a set with that name
has_var(name)
check whether the scenario has a variable with that name
idx_names(name)
return the list of index names for an item (set, par, var, equ)
idx_sets(name)
return the list of index sets for an item (set, par, var, equ)
init_equ(name, idx_sets = NULL, idx_names = NULL)
initialize a new equation in the scenario
init_par(name, idx_sets, idx_names = NULL)
initialize a new parameter or scalar
init_scalar(name, val, unit, comment = NULL)
initialize a new scalar and assign the value/unit
init_set(name, idx_sets = NULL, idx_names = NULL)
initialize a new set in the scenario
init_var(name, idx_sets = NULL, idx_names = NULL)
initialize a new variable in the datastrucutre
initialize(platform, model, scen, javaobj)
initialize a new R-class Scenario object (via the ixmp.Platform class)
is_default()
check whether this scenario is set as default in the database
item(ix_type, name)
get an item from the scenario
last_update()
get the timestamp of the last update/edit of this scenario
par(name, filters = NULL)
return a dataframe of (optionally filtered by index name) elements for a specific parameter
par_list()
return list of all parameters initialized in the scenario
read_sol_from_gdx(path, filename, comment = NULL, var_list = NULL, equ_list = NULL, check_sol = TRUE)
read solution from GAMS gdx
remove_par(name, key = NULL)
delete a parameter from the scenario or remove an element from a parameter (if key is specified)
remove_set(name, key = NULL)
remove set or remove a specific element (or list of elements) from a set (if key is specified)
remove_sol()
remove solution from run
run_id()
get the run id of this scenario
scalar(name)
return a dictionary of the value and unit for a scalar
set(name, filters = NULL)
return a dataframe of (filtered) elements for a specific set
set_as_default()
set this instance of a model scenario as default version
set_list()
get list of all sets in the scenario
solve(model = "MESSAGE", case = NULL, model_file = NULL, in_file = NULL, out_file = NULL, solve_args = NULL, comment = NULL, check_sol = TRUE)
solve the model (export to gdx, execute GAMS, import the solution)
to_gdx(path, filename, include_var_equ = FALSE)
write the scenario to GAMS gdx
var(name, filters = NULL)
return a dataframe with variable elements (optional: filtered by index names)
var_list()
return a list of variables initialized in the scenario
version()
get the version number of this scenario
years_active(node, tec, yr_vtg)
return a list of years in which a technology of certain vintage at a specific node can be active
run_gams {rixmp} | R Documentation |
Auxiliary functions for executing GAMS
Description
Auxiliary functions for executing GAMS
Usage
run_gams(model_file, args, gams_args = "LogOption=4")
Arguments
model_file |
the path to the gams file |
args |
arguments related to the GAMS code (input/output gdx paths, etc.) |
gams_args |
additional arguments for the CLI call to gams 'LogOption=4' prints output to stdout (not console) and the log file |