Components
Components are new simulation objects built to any specification and added to Simul8's standard objects. Components consist of one or more existing objects (either the standards or other Components) that are tailored in some way then saved as a single new object for future use. They can be left open, so you or other users can re-tailor them, or they can be sealed up and password protected so their internal information is safe from adjustment.
Creating a Component
To create a Component, define a collection of other objects that work the way required or load a simulation that contains the combination of objects you require. Highlight all of the objects by dragging a box around them. Right-click on the screen and select the option “Create Component Type”.
The new Component has been created and the objects that make up the component are wrapped up behind the component image. It can now be copied, moved, linked to other objects etc within the current simulation.
To change the name of the Component, double-click on the object to open its properties box.
To be able to reuse the object in other simulations and to add it to the Simulation Drawing Panel for easy re-use in other simulations, double click on the Component to open its properties box and click the Toolbar tab. Select the option “Save As Reusable Component”.
This saves the Component in Simul8's Object Repository directory. Any objects in this directory automatically appear on Simul8's Component Palette when Simul8 opens.
To customize the dialog that appears when the component is clicked see Custom Dialogs.
Component Palette
The Component Palette is a repository that is displayed down the left hand side of the simulation window.
There are a number of steps to go through to create the Component Palette.
First, navigate to the Object Repository folder (usually in Simul8 application folder). Within this folder create another folder called “Component Palette”. Within the new Component Palette folder create one or more sub folders. These sub folders will create tabs in the palette so that the Components can be organized, for example, by type of operation.
Save some Components to the Component Palette folders and ensure that the Component Palette is switched on via the Toolbars dialog. The Components can be dragged and dropped on screen in the usual way from the Component Palette.
Components with Labels and Distributions
Components that contain Labels and Distributions may be designed to keep these items “Private”, meaning that when the Component is introduced to a new simulation the Distribution is kept unique to the Component.
If a Private Distribution or Label is introduced to a simulation then Simul8 checks if the name is already used. If it already exists, perhaps because the Component has been used previously in this session, then the Distribution or Label is renamed.
To define a Distribution or Label as private, place the suffix “Private_” before the name.
This means that a Label called “Label 1” when designated as private should be called “Private_Label 1”. The first time the Component is used with in simulation “Private_Label 1” will be used, the second time the Component is used it will be named “Private_Label 2”.
Components and Visual Logic
Similar to the above section on usign Components that contain Labels or distributions, Components that contain Visual Logic can use a special reserved prefix for Global Data Item names.
If a component contains Labels or Visual Logic code, certain elements may be “Private” and for use in the Component only, other items may be “Public”, and used elsewhere in the simulation.
By default Distribution names, Labels, and Global Data Items are considered to be Public, and are not renamed when a Component is created. On occasions this will not be desirable. To allow Distributions names, Labels, and Global Data Items to be Private, the text “Private_” should be added to the name.
This structure allows separate Distributions to be used in otherwise identical components, Labels to be used to identify the instance of a Component that an item came from, and Global Data Items used to collect separate results for copies of otherwise identical Components.
Unpacking Components
Components can be “unpacked” when they are introduced to a new simulation.
To unpack a Component drag and drop it from the toolbar to the simulation window, then double-click on the icon to open it. Select the Toolbar tab and select to Remove Component Layer from the drop-down list.
There is also an option in this list to remove the layer into a sub-window.
If a Component uses Dialogs then the Component Properties box is not directly displayed. To open the Component Properties, click on the Component to open the dialog then hold the Shift and Ctrl keys down (at the same time) and then click on the Cancel option button on the dialog.