user:r [Promethee]

[R] user interface

,
This section presents the usage of Promethee (1.1) environment through [R]. In other words, how can you call any Promethee code or algorithm direclty from your R command line.
Note: we recommend to use a good frontend for [R], like RStudio in order to make the most of R/Promethee coupling.
It is also possible to use this wrapper through the web version of Rstudio, so you can access Promethee environment from a web browser.

Here is few examples of what you can do after having loaded the wrapper and initialized the environment:
source("C:\Program Files\Promethee\promethee.R")
Promethee.init(PROMETHEE_HOME="C:\Program Files\Promethee\")

Example

  • Create a R function calling an external Monte Carlo code of neutronic launched (remotely) on Promethee grid (Suppose you have installed and configured MCNP in Promethee environment before):
  godiva = function(r) {
    Promethee.run(model = "MCNP_5",input.files = file.path(PROMETHEE_HOME,"samples","godiva.p"),input.design = r)$mean_keff
  }
  • Now, try this function for an arbitrary “r” value:
  godiva(data.frame(r=9.0))
Result:
 [1] 1.02042
  • Again, try this function, but for many arbitrary “r” radius values: (Note that MCNP calculations are launched in parallel, thanks to Promethee environment)
  godiva(data.frame(r=1:10))
Result:
  [1] 0.11860 0.23928 0.36149 0.48200 0.59928 0.71293 0.82090 0.92365 1.02042
 [10] 1.11112
  • Let's search the radius leading to keff = 1.0 +/- 0.001
  d = Promethee.design(design="Dichotomy",input.variables=list(r="[1,20]"),fun=godiva,options=list(Output_precision=0.001,Output_target_value=1.0))
Result:
 $r
 [1] "8.776501196538314"
 
 $data
 [1] "| r\t| Output\t|\n| 1.0\t| 0.1186\t|\n| 20.0\t| 1.69179\t|\n| 10.5\t| 1.15292\t|\n| 8.754169698698966\t| 0.99702\t|\n| 8.743348751168663\t| 0.99634\t|\n| 8.764997608766679\t| 0.99798\t|\n| 8.787778157176508\t| 0.99989\t|\n| 8.776501196538314\t| 1.00007\t|\n| 8.799054062084672\t| 1.00265\t|\n"
 
 $`Input parameter value`
 [1] "<br/>r = 8.776501196538314<br/>Output = 1.00007<br/><img src='././dichotomy.png' width='400' height='400'/>"
 
 $information
 [1] "  Output precision:\t0.001\n  Output target value:\t1\n"
In details:
  cat(d$data)
 | r                 | Output    |
 | 1.0               | 0.1186    |
 | 20.0              | 1.69179   |
 | 10.5              | 1.15292   |
 | 8.754169698698966 | 0.99702   |
 | 8.743348751168663 | 0.99634   |
 | 8.764997608766679 | 0.99798   |
 | 8.787778157176508 | 0.99989   |
 | 8.776501196538314 | 1.00007   |
 | 8.799054062084672 | 1.00265   |

"promethee.R" documentation

The R/Promethee wrapper does not provide a regular Sweave documentation. Nevertheless, Roxygen doc is available within the promethee.R file:

Promethee.init(...)

Promethee.design(...)

Promethee.design.info(...)

Promethee.run(...)

Promethee.run.info(...)

Promethee.grid.info(...)

© IRSN - All right reserved - Legal information