Setup and run sample project

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.

Setup

Setup environment

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.

Setup a new project version

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

Configuration

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.

Principle course of configuration

  1. Copy CSV templates
  2. Edit CSV tables (manual!)
  3. Market-Backend Warm-up/initialisation
  4. Configure market products and clients in DB
  5. Generate EMG XML configuration

Copy CSV templates

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:

Configuration within dexR

Default Configuration

The file (./dexr_params.R` contains all defined dexr parameters and its defaults:

wzxhzdk:8

DB configuration

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"

Start parameters

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.



UniK-INES/dexR documentation built on June 30, 2021, 11:05 p.m.