Skip to contents

isolate_subsystem(sys, input_aps, output_aps) returns the part of the unsimplified hierarchical model sys bounded by the input and output analysis points: the components reachable from the inside faces of those points without crossing them, with the connections among them. All other components and all equations involving them are removed. The analysis points are given as sys$name or by name, singly or in a list.

Usage

isolate_subsystem(sys, input_aps, output_aps)

Arguments

sys

A hierarchical System that has not been completed or compiled.

input_aps, output_aps

Analysis points bounding the subsystem.

Value

A list with the isolated system sys, the variables input_vars at the inside face of each input point and output_vars at the inside face of each output point.

Examples

t <- t_nounits; D <- D_nounits
block <- function(name, eq) {
  u <- Variable("u", t, input = TRUE); y <- Variable("y", t, output = TRUE)
  System(list(eq(u, y)), t, name = name)
}
P <- block("P", function(u, y) D(y) ~ u - y)
C <- block("C", function(u, y) y ~ -u)
cl <- System(list(connect(C$y, "u", P$u), connect(P$y, "y", C$u)), t,
  systems = list(P, C), name = "cl")
iso <- isolate_subsystem(cl, "u", "y")
vapply(get_systems(iso$sys), nameof, "")
#> [1] "P"
iso$input_vars; iso$output_vars
#> [[1]]
#> P₊u(t)
#> 
#> [[1]]
#> P₊y(t)
#>