07-19-2017 02:10 PM
A novice at SAS Simulation studio, I'm trying to learn what the difference is between a SWITCH BLOCK and a SELECTOR BLOCK. They both seem to do similar things, but there may be reasons to use one over the other. Thanks.
07-24-2017 08:40 AM
When an entity enters a Switch block, a switch value will be determined (either through the InSwitchValue port or by an attribute value on the entity). Based on that switch value, an output port will be selected from the cases defined in the Switch block. If the switch value does not match any of the case values, then the entity will flow out of the OutDefault port of the Switch block. In summary, the Switch block is used to route entities down different paths, based on a switch value (where the switch value can be computed dynamically by using the InSwitchValue port on the Switch block or by using an entity attribute value). For example, you can use a Switch block to route an entity to the shortest of a series of queues (see docQueueRouting in the projects\examples folder where Simulation Studio is installed). The Switch block is widely used in Simulation Studio models.
The Selector block pulls entities from upstream from one of its defined input entity ports based on a case value that is pulled from the InCaseValue port. When the Selector block receives a message from downstream to output an entity, it checks its InCaseValue port to determine which input entity port to pull an entity from. Also, when an entity arriving to the Selector block attempts to enter the block, the current case value is checked to see if the incoming entity's input port matches the value. If it doesn't, it will not flow through the Selector. One example where the Selector block is useful is when you have multiple queues feeding into another queue with fixed capacity. You can use the Selector block to determine which queue should have priority when a space opens up in the fixed capacity queue. See the attached figure.
07-25-2017 09:20 AM
Thanks to Emily for the response on the SAS Simulation Module. Unfortunately, I felt that the answer was a mere copying of the SAS manual on the subject and not a comparison of the Switch and Selector blocks. It was difficult to ascertain that the Switch block can do these things whereas the Selector cannot, or vice versa. That is what I was searching for. This may be due to my lack of understanding of the explanation; I'll study the matter further. Again, please do not think I'm ungrateful for the help.
07-25-2017 11:09 AM
Entities enter a Switch block from a single input port, but may flow out from different output ports, and the output path will be determined using the switch cases. If no switch case matches, the entity flows out the OutDefault port. The Switch block is used to route entities to different paths in the model.
On the otherhand, the Selector block chooses which entites may pass through it based on a condition (it chooses which entity input port to pull the next entity from). But all entities entering a Selector block leave from the same output port.
Said a different way, the cases in the Selector block define entity input ports, while the cases in a Switch block define entity output ports.
Hopefully this helps a bit more!