Working Directory

Top  Previous  Next

By default your data, solutions and projects are in the project simplacerun within the folder simulation. The system will search in this folder for the files if you use relative paths like:

 

      <filename>gk/data/gecros/GecrosSensitivityStartDateNPL.csv</filename>

 

To make your solutions/projects more flexible / independent from simplacerun (because you want to run them with the GUI or the console mode or because you want to keep them in another place) you can specify a working and an output directory.

 

How to use working directories

 

First, you have to change the paths in your solutions and projects:

 

 <filename>${_WORKDIR_}/gk/data/gecros/GecrosSensitivityStartDateNPL.csv</filename>

 ...

 <filename>${_OUTPUTDIR_}/gk/gecros/sens_npl_sumyieldout.csv</filename>

 

For running the solution, you have to specify the two directories:

 

GUI

 

Set the path for working and output directories by selecting in the menu Extras -> Options

 

Console

 

run simplace.exe with the options -workdir=<MY_WORK_DIR> and -outputdir=<MY_OUTPUT_DIR>

 

UnitTest

 

For the solutions in simplacerun: extend the test class from SimplacerunStandardUnitTest

 

 public class MyTest  extends SimplacerunStandardUnitTest

 

and remove the methods setUp() and tearDown() (remove also @Before and @After annotations)

 

For solutions in other locations: add/change the method setUp

 

 @Before

 public void setUp() throws Exception

 {

         FWSimEngine.getInstance().setAppMode(APPLICATION_MODE.UNIT_TEST);

         Logger.setLogLevel(LOGLEVEL.INFO);

         FWSimEngine.setWorkDir("path/to/my/workdir");

         FWSimEngine.setOutputDir("path/to/my/outputdir");

 }

 

Wrapper

 

When using the wrapper, instantiate the class with WorkDir and OutputDir

 new SimplaceWrapper(WorkDir,OutputDir)

 

Example when using rJava for R:

.jnew("net/simplace/simulation/wrapper/SimplaceWrapper", "D:/Simplace/simplacerun/simulation/", "D:/Output")