In addition to cloning individual elements, you can also clone an entire Container. Before cloning a Container, it must first be localized. Once a Container is cloned, it cannot be globalized.
When you clone a Container, all of its contents are also automatically cloned. Any change you make to any element within one cloned Container is made to all of the clones. In particular,
• When you create, paste or delete an element in one cloned Container, it is automatically created, pasted or deleted in all of the cloned Containers.
• When you move an element between Containers inside of a cloned Container, it is automatically moved within all of the cloned Containers.
• When you move an element into a cloned Container, the element is replicated and moved into all of the cloned Containers.
• When you move an element out of a cloned Container, that copy is moved and all of the clones of the element in the other cloned Containers are deleted.
Several other points regarding cloned Containers should also be noted:
• The names of all elements within a cloned Container are also cloned. (Recall that cloned elements which are not inside a cloned Container can have different names).
• You cannot declone an element which is inside a cloned Container.
• When you declone a Container, the elements inside the formerly cloned Containers remain clones. Once the Container is decloned, however, you can individually declone elements within the Container.
• Some elements cannot be cloned (e.g., Dashboards, Scripts, SubModels, Files, Results). As a result, GoldSim prevents your from adding these to a cloned Container, and prevents a Container that contains such elements from being cloned.
• If graphic images are present inside a Container when it is cloned, these are copied to the cloned Containers. If they are subsequently edited, however, the changes are not propagated to the other cloned Containers.
• When you change the positions of elements within a cloned Container (e.g., by dragging an element from one part of the screen to another), the new position is not propagated to the other cloned Containers.
The key to using cloned Containers is to provide unique inputs to them from elements that are outside of them (otherwise, all of the cloned Containers would behave identically and produce exactly the same results). This can be done by placing the cloned Containers within separate localized Containers:
In the example shown above, the two cloned Containers (Clone1 and Clone2) are within two separate localized Containers (L1 and L2). Within the cloned Containers, all the equations and elements are, by definition, identical. In this example, it is assumed that within each cloned Container, an element references Data1. Since the clones are in different localized Containers, however, they each link to a different Data1 element.
The example model CloningContainers.gsm in the General Examples/Containers folder of your GoldSim directory (accessed by selecting File | Open Example... from the main menu) contains an example of the use of cloned Containers.
Learn more about: