Nesting Localized Containers
Localized Containers can be nested, so that a localized Container An element that acts like a "box" or a "folder" into which other elements can be placed. It can be used to create hierarchical models. (referred to here as the parent) can itself contain a localized Container (referred to here as the child). In such a case, the scope The portion of a model from which an element's output can be referenced. You cannot reference an element in a different scope unless that output is specifically exposed. of the parent localized Container does not extend into the child localized Container.
To illustrate this, consider the following example. Suppose you had a localized Container L1, containing a second localized Container L2. A Reservoir A stock element that integrates and conserves flows of materials. element named R1, with an output (among others) called Overflow_Rate, exists in L2. Because this Reservoir is within a localized Container, a second Reservoir element with the same name could exist in L1.
If the Overflow_Rate for the Reservoir in L2 was exposed on L2, and the Overflow_Rate for the Reservoir in L1 was exposed on L1, these outputs would be referenced as shown schematically below:
As indicated in the diagram,
- The Overflow_Rate
for the Reservoir within L2 would be referenced as:
- R1.Overflow_Rate from within L2; and
- L2.Overflow_Rate from within L1 (but outside of L2).
- The Overflow_Rate
for the Reservoir within L1 would be referenced as:
- R1.Overflow_Rate from within L1 (but outside of L2); and
- L1.Overflow_Rate outside of L1.
Hence, if you were to reference R1.Overflow rate from an expression within L1, it would link to a different element than if you were to do the same from an expression within L2.
Note: In the example shown above, it is not possible to reference the Overflow_Rate for the Reservoir within L1 from within L2. In order to do so, you would need to first rename one of the two Reservoir elements.