tutorials:sensitivity-analysis-using-grolink-and-gror
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:sensitivity-analysis-using-grolink-and-gror [2025/06/06 15:29] – [Parameter File] t | tutorials:sensitivity-analysis-using-grolink-and-gror [2025/06/06 17:11] (current) – [Example: Morris Screening using the sensitivity package] t | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Sensitivity analysis on GroIMP models using GroR ====== | ====== Sensitivity analysis on GroIMP models using GroR ====== | ||
- | This wiki explains how to do a sensitivity analysis on GroIMP models using the GroR interface using a Morris screening over input parameters of the [[http://134.76.18.36/ | + | This wiki explains how to do a sensitivity analysis on GroIMP models using the GroR interface using a Morris screening over input parameters of the [[https://gallery.grogra.de/project_gallery/67053a3f256715cda41c867f |
===== Prerequisites ===== | ===== Prerequisites ===== | ||
Make sure to [[: | Make sure to [[: | ||
Line 98: | Line 98: | ||
library(sensitivity) | library(sensitivity) | ||
- | wb1 <- GroLink.open(" | + | # copy groimp model gsz to groimp path to open it like this: |
+ | wb1 <- GroLink.open(" | ||
+ | # push model gsz to groimp | ||
+ | wb1 <- GroLink.open(" | ||
</ | </ | ||
Line 123: | Line 126: | ||
</ | </ | ||
+ | When you run the while loop, in the end, the '' | ||
Line 153: | Line 156: | ||
<code R> | <code R> | ||
- | executeModel <- function(params, | + | executeModel <- function(params, |
- | wb1 <- GroLink.open(" | + | timeout = 200 # max. number of grow function executions |
+ | ){ | ||
+ | # Open workbench with model | ||
+ | wb1 <- GroLink.open(" | ||
+ | # Override parameters.rgg with new values from params vector | ||
WBRef.updateFile(wb1, | WBRef.updateFile(wb1, | ||
| | ||
Line 163: | Line 170: | ||
";", | ";", | ||
sep = "" | sep = "" | ||
+ | # Compile the workbench | ||
WBRef.compile(wb1) | WBRef.compile(wb1) | ||
model_output <- "" | model_output <- "" | ||
n_grows <- 0 | n_grows <- 0 | ||
+ | # Execute the grow function for as long as there are no flowers | ||
while (!(is.numeric(model_output)) && (n_grows < timeout)) { | while (!(is.numeric(model_output)) && (n_grows < timeout)) { | ||
result <- WBRef.runRGGFunction(wb1," | result <- WBRef.runRGGFunction(wb1," | ||
Line 176: | Line 184: | ||
n_grows <- n_grows + 1 | n_grows <- n_grows + 1 | ||
} | } | ||
+ | # Retrun NA in case of timeout | ||
if (n_grows == timeout) { | if (n_grows == timeout) { | ||
model_output <- NA | model_output <- NA | ||
} | } | ||
+ | # Close workbench in the end | ||
WBRef.close(wb1) | WBRef.close(wb1) | ||
return(model_output) | return(model_output) |
tutorials/sensitivity-analysis-using-grolink-and-gror.1749216596.txt.gz · Last modified: 2025/06/06 15:29 by t