subSysD: subSysD : Sub-systems Disentangling

Description Usage Arguments Author(s) See Also Examples

View source: R/subSysD.R

Description

Detect, disentangle and reformulate Sub-systems from an ensemble of equations.

Usage

1
subSysD(inK, inXnote = NULL)

Arguments

inK

A list of models, each provided as a matrix. A single matrix can also be provided, it will be transformed into a list containing a single matrix.

inXnote

A vector with the names of the input variables. If not provided, default notation is used: "X1", "X2", etc.

Author(s)

Sylvain Mangiarotti

See Also

gPoMo, poLabs, combiEq

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Load models
data("allMod_nVar3_dMax2")
# Display equations of system 1
visuEq(nVar = 3, dMax = 2, K = allMod_nVar3_dMax2$NH86, substit = 1)
# Display equations of system 2
visuEq(nVar = 3, dMax = 2, K = allMod_nVar3_dMax2$R76, substit = 1)
# put the two systems in a list
allK <- list()
allK[[1]] <- allMod_nVar3_dMax2$NH86
allK[[2]] <- allMod_nVar3_dMax2$R76

# Example 1 (two independant subsystems)
# take two separate systems and mix them
inXnote = list()
inXnote[[1]] <- c('u', 'v', 'w')
inXnote[[2]] <- c('X', 'Y', 'Z')
visuEq(K = allK[[1]], substit = inXnote[[1]])
visuEq(K = allK[[2]], substit = inXnote[[2]])
XnoteOut = c('u', 'X', 'v', 'Y', 'w', 'Z')
Knew3 <- combiEq(allK, inXnote = inXnote, XnoteOut = XnoteOut, dMaxOut = 3)
visuEq(K = Knew3, substit = XnoteOut)
# Disentangle the subsystems from the mixed equations
dstgl <- subSysD(Knew3, inXnote = XnoteOut)
## Optional
# library(igraph)
# g1<-graph.adjacency(dstgl$FM);
# l <- layout_with_fr(g1)
# plot(g1, edge.arrow.siez = .4, edge.curved=.4, vertex.label=XnoteOut, layout = l)

# Example 2 (one subsystem included in the other)
Kduff <- matrix(0, ncol = 4, nrow = 35)
Kduff[11,1] <- Kduff[5,2] <- Kduff[2,3] <- 1
Kduff[35,2] <- -1
Kduff[11,2] <- -0.05
Kduff[5,4] <- 2 * acos(-1) / 6.2
Xnote <- c("x", "y", "u", "v")
visuEq(Kduff, substit = Xnote)
dstgl2 <- subSysD(Kduff, inXnote = Xnote)

GPoM documentation built on Feb. 18, 2020, 5:08 p.m.