Skip to contents

Verify that a compartment would be new to the model

Usage

assertCompartmentNew(ui, x)

Arguments

ui

is the model to test that a model paramet exists

x

The value to test

Value

The value or an error

Author

Matthew Fidler & Bill Denney

Examples

# \donttest{
mod <- function() {
  ini({
    tcl <- log(3)
    tv <- log(30)
  })
  model({
    cl <- exp(tcl)
    v <- exp(tv)
    d/dt(central) <- -cl / v * central
  })
}
assertCompartmentNew(mod, "peripheral")
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
try(assertCompartmentNew(mod, "central")) # already a compartment
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> Error : compartment 'central' already exists in the model
# }