This week, we will look at using labels to dictate what image they should be within the simulation, without the use of Visual Logic. Let’s take a basic 4 object simulation as an example.
The Start Point has a label actioned to it. This can be called anything, and we can choose to name it lbl_For_Image. To do this, select the Start Point, select Actions from the Properties tab, and then select “Add a label to change”. You can then create a new label called lbl_For_Image. Then for the action, you want to select Set to: , and then set it to a rounded uniform distribution between 1 and 2.
Now we will create our distribution for the image. To do this, navigate to the Data and Rules tab, and select Create Distribution. Here, we want to use a Label Based distribution, and we will base it on the label lbl_For_Image. We can call this distribution dist_Color.
To add images to SIMUL8’s image library:
1) Select the View Tab
2) Select Image Library
3) Here is the list of your images. To add images from your computer, select Add from Library.
4) You can now search your machine for images. There are some default images you can work with. Note how they are all named like ball1, ball2, ball3, etc.
You can find work item images in SIMUL8’s directory at: C:\Program Files\SIMUL8\Examples\Images\WorkItems
On our Activity, we also want to set a label action. Do the same as we did for the Start Point earlier: Select the Activity > Properties > Actions > Add a label to change. Here is the important part. This label name must be in the form of image:filename. So if your images are called RoundBall1 and RoundBall2, the label will need to be called image:RoundBall. You must then have an image in your library called RoundBall1 and RoundBall2. Once you have created this label, you will want to choose Set To: and set this to the distribution dist_Color.
Now when the work items arrive, they will be given a value of either 1 or 2. When they hit the activity, the activity will then look at this value, and set it to either RoundBall1 or RoundBall2.