Courses: Introduction to GoldSim:

Unit 9 - Building Hierarchical Models

Lesson 2 - Understanding Containers

As pointed out in the previous Lesson, in its simplest sense, a Container is simply a "box" or “folder” into which other elements can be placed. It is similar in many respects to a directory folder on your computer. Containers can be placed inside other Containers, and any number of levels of containment can be created.

The quickest way to start to understand Containers is to first look at a GoldSim model that uses Containers (after we explore this model, we will create one of our own in the next Lesson). To do so, go to the “Examples” subfolder of the “Basic GoldSim Course” folder you should have downloaded and unzipped to your Desktop, and open a model file named Example9_Containers.gsm.  The model will look like this:

This is the model we created in Exercise 5 (in Unit 7, Lesson 7). Just as a reminder, here is how the model looked without Containers:

So what have we done here? We have simply separated the model into three different groups (in three different Containers): one for the model inputs, one for the model itself, and one for the model results. The simplest way to see this is to look at the browser window.  You will see each Container listed there. If you left-click on the arrow next to a Container, the browser will expand to show the Container’s contents. Do this for all three Containers, and it will look like this:

Now let’s “look inside” one of the Containers.  We will talk in detail about how we can navigate into and out of Containers in the next Lesson.  For now we will just cover the basics. You can "enter" a particular Container (view its contents) by clicking on the arrow in the upper left-hand corner of the Container. In fact, if you simply hold your cursor over that arrow, the cursor will change to indicate to you that clicking it will “jump” you into the Container:

You can also enter a Container via a Crtl+double-click on the element (holding the Ctrl key down while double-clicking the left mouse button).  Let’s “enter” the “Pond_Model” Container.  It looks like this:

Now let’s return to the top level of the model.  You can jump back to the top of the model by pressing this button at the top of the graphics pane:

What should be apparent now is what we are actually looking at in the graphics pane: the graphics pane in GoldSim shows the elements inside a single Container. The top level of the model is the “Model” Container (it exists by default and is what you are looking at when you create a new model). This is analogous to the top-most directory on your computer. You can then subsequently add as many Containers as you want.  Moreover, you can “nest” Containers within Containers, building a true hierarchy of Containers.  For example, consider this model:

At the highest level, this model has three Containers: Earnings, Expenses and Revenues.  We are looking inside the Revenues Container, which itself has three Containers: Consulting, Software_Sales and Training.  And these Containers could in turn consist of additional Containers.

In the next Lesson we will discuss the details of creating and navigating Containers. However, we have learned enough in this Lesson to start to better understand why Containers are so important.

First and foremost, Containers allow you to build “top-down”, hierarchical model structures, in which the level of detail increases as you “drill down” deeper into the model.  Models that are organized hierarchically are much easier to explain, understand and maintain. In fact, if you give it any thought at all, you will realize that in the absence of Containers it would be impossible to create a model of any complexity at all! How would you manage and understand a model that had hundreds or thousands of elements all on one “page” or level of the model?  As you know from looking at any type of complex diagram, once the diagram has more than 20 or 30 objects, it can become very difficult to follow and understand.  Our minds like to organize things into small coherent “chunks” of structured information.  That is precisely what Containers do.

In the example model we opened, recall that the model specifically had Containers collecting all of the inputs and outputs into once place.  Although this is not necessary, it is quite common and allows you to quickly find/edit key inputs and display key outputs.  It also points out one of the powerful advantages of Result elements (discussed in detail in Unit 6, Lesson 12). By placing Result elements in Containers at the “top” of a model, we can easily access key results from deep within a hierarchical model (without having to “drill down” and find the actual elements of interest).

The example shown above (showing different revenue streams organized into various Containers) illustrates that Containers can be thought of as “sub-systems” of the total system you are modeling. And the ability to create sub-systems using Containers provides a powerful capability: the reuse of sub-systems. That is, you can create a complex sub-system, and then document and save it, such that a subsequent user could simply drop the sub-system into a new model. Alternatively, you could reuse that sub-system multiple times within the same model (e.g., if you were modeling five different companies, or four different ponds, all which had very similar structures and equations, but different inputs). This facilitates the creation of a library of documented and verified sub-systems. Such a library could be used to quickly and efficiently build complex models.

Developing a complex model in this way also has the advantage of allowing multiple people to simultaneously work on the model, with different people assigned different sub-systems (i.e., Containers) based on their particular expertise.

Finally, it is important to point out that in their simplest form, the use of Containers does not have any impact on how the model does its calculations.  That is, if Containers are simply used to organize and structure models, where an element is within the model hierarchy has no impact on how the calculations are carried out (and hence the results that are computed).  However, Containers have several advanced features that do in fact have an impact on how model calculations are carried out. We will discuss the most important of these later in this Unit.