First, in case you checked out the enavi project from the git repository, you should have the system environment variable GIT_DIR
point to your local git repository which contains enavi, if it doesn't do already:
Sys.getenv("GIT_DIR") Sys.setenv("GIT_DIR"="<path to git repositry including enavi projeckt, eg. ~/git>")
To create a sample project, execute:
demo(config, package="dexR", echo=F)
Follow the instruction printed on the command line (after NOTE:)! Furthermore, running the sample project assumes the following parameters are correct:
dexpa$db$host <- "localhost" dexpa$db$port <- "5432" dexpa$db$dbname <- "enavi" dexpa$db$username <- "enavi" dexpa$db$password <- "enavi!" dexpa$db$suname <- "postgres" dexpa$db$supassword <- "supassword"
If one if these is not correct, set the corresponding parameter in ./Testproject/scripts/dexpa-project.R
or assign them to preserve
:
preserve <- list() preserve$dexpa$db$supassword <- "anotherSUpassword"
(setting via command line directly does not help as this is overridden by importing the dexpa parameter files afterwards).
To run the sample project, call:
demo(run, package="dexR", echo=F)
NOTE: The demo files reside in the R session's temporary folder and will be removed after closing R.
As explained in Intro, configuration of dexR is done on four levels (project > machine > project version > simulation). Files for the first two levels need to be copied to a project-specifc location once for a project:
dexpa <- dexR::param_getDefaultDexpa() dexpa$dirs$project <- "<substitute by path to project>/project" dexpa$dirs$config <- "<substitute by path to project>/project/config" dexR::setup_environment(dexpa)
After execution of dexR::setup_environment(dexpa)
the config folder should contain two config files (machine-specific and project-specific). It creates the folder as possible if not existing.
Now it's time to adapt dexpa-project.R
and dexpa-machine_machine.R
to your needs.
For a given project version, dexR reads pointers to specific CSV config files from DEX_Param_Configs.ods
(or alternatively DEX_Param_Configs.csv
) and a run information is stored in DEX_Runs.csv
. These two file and the version-specifc configuration file are copied to the specified locations by calling the following code:
source("/home/USER/dexr/scripts/dexpa-machine_machine.R") dexpa$sim$version <- "TestA dexpa <- dexR::setup_project_version(dexpa)
After execution of dexR::setup_project_version(dexpa)
the config folder should contain a version-specific config file, DEX_Param_Configs.ods
and DEX_Param_Configs.csv
in folder dexpa$dirs$config
. dexpa$files$runinfos
contains the file DEX_Runinfos.csv
(folders are created if non-existing). You can now adapt <your project name>/scripts/<your version>/dexpa-pversion_<<our version>.R
After setting up the environment one needs to configure the simulation by following the course of configuration, which is explained in more detail during the next sections.
The EMG uses XML configurations to initialise resources. To facilitate the creation of XML of many entities, configurations can be defined in CSV tables, which are then tranfered to XML by using the Java tool EmgConfigTool
.
Adapt and exute the following to copy CSV templates to the specified location:
source("/home/USER/dexr/scripts/dexpa-machine_machine.R") dexpa$sim$version <- "TestA" dexpa$sim$id <- "Testrun01" dexR::hl_config_copycsvtemplates(dexpa)
Then, add the configuration to dedicated CSV files. These tables should be considered:
The CSV file for MarketProducts
ist required for teh configuration of the market server.
The version-specific file DEX_Param_Configs.ods
defines for each simulation ID the CSV tables to apply as sources for the XML configuration.
The following figure shows which table information goes to which EMG XML configuration, and a suggested order of editing the CSV files:
The file (./dexr_params.R` contains all defined dexr parameters and its defaults:
Requires a PostgreSQL-DB with following configuration (or changed parameters accordingly in <project>/scripts/<version>/dexpa-pversion_<version>.R
) and extension pgcrypto (see documentation "Market Server DEX" > "Installation and Configuration" > "DB").
dexpa$db$host <- "localhost" dexpa$db$port <- "5432" dexpa$db$dbname <- "dexr" dexpa$db$username <- "username" dexpa$db$password <- "password"
There are a few parameters that configure the start-up process. The following figure illustrates their links and how they should be defined.
For instructions to run a simulation see Run.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.