Cloning Elements

In some situations, you may wish to have elements in your model that always have identical definitions. You could accomplish this by copying an element to various locations in your model, but if you ever needed to change the definition of the element, you would need to make the change to all the copies, and this could be time-consuming and error-prone.

GoldSim addresses this issue by allowing you to create multiple clones of an element. When you create clones of an element, all of the clones behave identically: if you change one of the inputs to a clone, the same input is automatically changed for all of the other clones.

Clones are often used in conjunction with localized Containers. For example, suppose that you wished to model the salmon populations in each of ten streams. To do this, you might create ten parallel (adjacent) localized Containers, each of which represented a different stream. Although the inputs differ, let's assume that the basic algorithm used to compute the salmon population as a function of time was the same for each of the ten streams.

One way to build this model would be to create the elements representing the algorithm and copy them to each of the ten Containers. If, however, you were expecting to frequently change and modify the algorithm (e.g., as more data became available), it would become cumbersome (and error-prone) to edit the elements in all ten Containers whenever you wanted to make a change.

Clones provide an easier way to build and maintain such a model: You would simply create ten sets of clones (rather than copies) of the elements defining the algorithm and place them in each of the ten localized Containers. Then if you wanted to modify the algorithm, you would need only to change the elements in one of the Containers and the corresponding clones of those elements would automatically be changed in all of the others.

Note that use of clones does not imply that all clones produce the same output result; it only implies that they have the same definition. For example, a cloned Expression element might have the definition 2*A. All clones of the element would indeed have the same definition, but if the clones were each located in a different localized Container, then A in one Container could have a different value than A in another Container (i.e., each localized Container could have its own element A). As a result, the output of the Expression would be different in each Container.

Related Topics…

Learn more about: