Skip to content

Commit

Permalink
Merge pull request #2219 from hstrey/parentscopedoc
Browse files Browse the repository at this point in the history
changed ParentScope docs to better reflect best usage
  • Loading branch information
YingboMa authored Aug 3, 2023
2 parents b9f285d + e411c8e commit 83cd859
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions docs/src/basics/Composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,15 @@ In a hierarchical system, variables of the subsystem get namespaced by the name

```julia
@parameters t a b c d e f
p = [a #a is a local variable
ParentScope(b) # b is a variable that belongs to one level up in the hierarchy
ParentScope(ParentScope(c))# ParentScope can be nested
DelayParentScope(d) # skips one level before applying ParentScope
DelayParentScope(e, 2) # second argument allows skipping N levels
GlobalScope(f)]

# a is a local variable
b = ParentScope(b) # b is a variable that belongs to one level up in the hierarchy
c = ParentScope(ParentScope(c)) # ParentScope can be nested
d = DelayParentScope(d) # skips one level before applying ParentScope
e = DelayParentScope(e, 2) # second argument allows skipping N levels
f = GlobalScope(f)

p = [a, b, c, d, e, f]

level0 = ODESystem(Equation[], t, [], p; name = :level0)
level1 = ODESystem(Equation[], t, [], []; name = :level1) level0
Expand Down

0 comments on commit 83cd859

Please sign in to comment.