Skip to contents

named(sys <- Constructor(...)) (or named(sys = Constructor(...))) calls Constructor(..., name = "sys") and assigns the result to sys in the calling environment, as the @named macro of ModelingToolkit. Named arguments whose values are symbolic expressions have their variables wrapped in ParentScope(), so a symbolic default passed into a component refers to the variables of the enclosing system.

Usage

named(...)

Arguments

...

One assignment sys <- Constructor(...) or one named argument sys = Constructor(...).

Value

Invisibly, the constructed object.

Examples

t <- t_nounits; D <- D_nounits
decay <- function(name, k = 1) {
  x <- Variable("x", t)
  System(list(D(x) ~ -k * x), t, name = name)
}
named(sys <- decay(k = 2))
nameof(sys)
#> [1] "sys"