Tip:
Highlight text to annotate it
X
In this video, we're going to show you how to send a simple message.
We'll begin by creating our model in FlexSim. We will need a source, which will produce
the items in our system; a queue, which will queue our items before they enter the processors;
two processor objects to process the items; and a sink, which will allow our items to
leave the system. The final step is to connect our objects.
Objects can be connected in one of two ways: by clicking the "Connect Objects" button on
the toolbar, connecting the objects, and then using the "Escape" key to leave connection
mode; or by holding the "A" key. Using your preferred method, start with the source and
click to connect each object downstream toward the sink. We will also need one center port
connection, a reference connection that can be done by holding the "S" key or by choosing
"Connect Center Ports" by clicking the arrow next to the "Connect Objects" button. Choose
your preferred method and click to make a center port connection between the two processors.
Now that our model is ready, let's adjust the parameters of the source so we control
its item output. Double-click on the source to bring up its properties window, check the
box for "Arrival at time 0" and change the "Inter-Arrivaltime" to "15". Click "OK" to
save and close the window. While we're at it, double-click on the queue and change its
"Maximum Content" to "20", which limits how many items can stack up in the queue.
Now we're ready to add the simple message logic. Double-click on the first processor,
click on the "Triggers" tab, and click the green plus sign to add an "OnEntry" trigger.
Select "Close and Open Ports" from the drop-down list, and use the default settings, which
close the processor's input port. The "OnEntry" trigger means each time an item enters this
processor, the input port is closed so that the processor no longer accepts items for
processing. Click "OK" to save and close. Next, we'd like the input port that we just
closed to open back up again once an item leaves the second processor. To do this we'll
need an "OnExit" trigger, so double-click on the second processor, go to the "Triggers"
tab, and click the green plus sign to add one. This time select "Send Message" from
the drop-down list, and use the default settings again; by default, the message will be sent
from "current" with is the current processor, to "centerobject(current,1)", which is the
object on the other side of that center port connection we made earlier, and just so happens
to be the first processor. Finally, we need to go back to the properties
of our first processor and add one more trigger that accounts for the message we're sending.
Add an "OnMessage" trigger, select "Conditionally Close and Open Ports" from the drop-down list,
and change the "Action" to "openinput". This trigger will reopen the processor's input
port each time we receive a message. Let's click reset and run the model. Boxes
will be created by the source and will begin to be processed. Notice that the input port
of the first processor closes as soon as an item enters, and it doesn't accept anything
else for processing until that item finishes at the second processor.
We can also send messages without using a center port connection. Stop the model and
delete the center port connect between the processors, either by holding the "W" key
or by choosing "Disconnect Center Ports" by clicking the arrow next to the "Disconnect
Objects" button. Click between the processors to delete the connections, and then double-click
on the second processor. Go to the "Triggers" tab, click the button where the green plus
sign used to be next to our "OnExit" trigger, and click the white arrow to see our "Send
Message" trigger settings. We want to adjust where the message is sending "To:", so type
"inobject(current,1)". This refers to the object that is connected to our processor's
input port, which happens to be the first processor.
If you reset and run the model again, the processors will behave exactly as they did
when they were linked by a center port connection. Thank you for watching. For more information
on FlexSim products or to view more tips and tricks for successful modeling, please visit
www.flexsim.com.