getModel {openMpp} | R Documentation |
Find model in database and return OpenM++ model definition (input parameters and output tables)
getModel(dbCon, modelName, modelDigest = NA)
dbCon |
database connection |
modelName |
model name, ie: "modelOne" |
modelDigest |
(optional) model digest, ie: "_201208171604590148_" if digest is NA or NULL then first model with min(model_id) is used |
Find model in database and return OpenM++ model definition (input parameters and output tables).
Model can be identified by by name and model digest string, which serves as model version. If you have only one version of the model in database then you can omit digest argument. If there are multiple models with same name in database and digest is NA or NULL then first model with min(model_id) is used.
List of database rows describing model parameters:
modelDic |
model_dic row |
langLst |
list of languages (lang_lst table rows) |
typeDic |
type_dic rows of the model |
typeEnum |
type_enum_lst rows of the model, optional, can be empty |
paramDic |
parameter_dic rows of the model |
paramDims |
parameter_dims rows of the model, optional, can be empty |
tableDic |
table_dic rows of the model |
tableDims |
table_dims rows of the model, optional, can be empty |
tableAcc |
table_acc rows of the model |
tableExpr |
table_expr rows of the model |
To run examples you must have modelOne database modelOne.sqlite in current directory
amc1999
OpenM++ documentation: https://github.com/openmpp/openmpp.github.io/wiki
theDb <- dbConnect(RSQLite::SQLite(), "modelOne.sqlite", synchronous = "full") invisible(dbGetQuery(theDb, "PRAGMA busy_timeout = 86400")) # recommended # find the model: get model definition from database # # model can be found by name and (optional) digest # digest is used to identify exact version of the model # if digest is missing or NA or NULL # and there are multiple versions of the model with the same name # then first model with min(model_id) is used # # get model by name: use such call if you have only one version of the model defRs <- getModel(theDb, "modelOne") # use model digest to identify exact version of the model def2012August17 <- getModel(theDb, "modelOne", "_201208171604590148_") dbDisconnect(theDb)