Wrapper client methods in R

Top  Previous  Next

Here you can find the list of the wrapper client methods with explanations.

 

simplacehandle <- initSimplace(InstallationDir,WorkDir,OutputDir) - starts Simplace, instead of InstallationDir one could use

a more generic parameter, e.g. Location, which could also be an URL it returns a handle to the running simplace instance which is used by subsequent functions.

 

openProject(simplacehandle, Solution, Project) - prepare a Session (formerly project) with associated solution and project file.

 

simid <- createSimulation(simplacehandle, parameterList, queue) - creates a Simulation and substitutes solution/project parameters

by the parameters in the parameterList; if queue is true, then the simulation is put into a queue, so one can run a couple of simulations at one time.

 

simlist <- getSimulationIDs(simplacehandle) - get the list of simulation ids of the current queue.

 

runSimulations(simplacehandle) - runs all the simulations in the queue.

 

result <- getResult(simplacehandle, outputId, simulationId) - fetches the result from the previous simulation run;

gets only the result for the specified simulation and the (memory) output id.

 

resultToDataframe(result, from, to), resultToList(result,expand,from, to) - converts the result to either a dataframe or a list.

Its possible to retrieve only the from to part of the result. If expand is true, then doublearrays are expanded to vectors, otherwise they remain just references to java objects.

If doublearrays are not needed, it saves time and space if not expanded.

 

resetSimulationQueue(simplacehandle) - resets the simulation queue.

 

closeProject(simplacehandle) - close the project.

 

runProject(simplacehandle) - runs the solution/project as defined in the original solution/projectfile; no data is kept in memory, it has to be fetched from the .csv outputs.

 

result<- stepSimulation(simplacehandle, count, filter) - runs the simulation stepwise; returns the whole varmap or only part of it defined by filter.

 

For example a calibration script in R would look like this:

       simplace <- initSimplace(loc, wd, od)

       openProject(simplace, mysolution)

 

       ready <- false

 

       parameters <- getSomeInitialParameters()

 

       while (!ready)

       {

        id <- createSimulation(simplace,parameters,false)

        runSimulations(simplace)

       result <- getResult(simplace,"biomass",id)

       df <- resultToDataframe(result)

       parameters <- calculateSomehowParametersFromResults(df)

        ready< <- isGoodEnough(df)

       }