article

Paul Toone avatar image
0 Likes"
Paul Toone posted

Itemtype   

Itemtype is a value that is stored on every flowitem that travels through a FlexSim model. This value can be accessed and/or changed at any point in the flowitem's progress through the model. Every single flowitem has its own unique itemtype value, meaning that if you change the itemtype of one flowitem, it will only change the value for that specific flowitem, and the itemtype of other flowitems will not be changed. The meaning of the itemtype value is completely up to you the modeller. In general it is meant to be a value that describes a product type or category.

Example

Take for example a post office where customers come in to either have a package sent or to have copies made. In this model the flowitems, or customers, are separated into two general categories, namely those who need a package sent and those who need copies made. The itemtype value can be used to make this designation. For example, customers, or flowitems, who need a package sent can be given the itemtype value 1, and customers who need copies made can be given the itemtype value 2. In FlexSim, you will usually set the itemtype value in the Source object when the flowitem is first created. In our example let us say that 60% of arriving customers are "package" customers, and 40% are "copy" customers. To do this in FlexSim we would go to the Source's OnExit trigger and access the Code Editor by clicking the . Then add the command:

setitemtype(item, bernoulli(60, 1, 2));

Alternatively, there is a picklist option available for setting the itemtype by pressing thenext to the OnExit trigger and selecting Set Type, Name or Label, or Set Item Type and Color.

This command will randomly set the itemtype value of the flowitem that is exiting to 1 60% of the time and to 2 40% of the time. The setitemtype command sets the itemtype value of an object. It takes two parameters. The first parameter is a reference to the flowitem that you want to set the itemtype value on, and the second parameter is the value to set it to. In this example, the first parameter is "item", or the flowitem that is currently exiting the Source, since we are in the Source's exit trigger (the reference "item" will be discussed in more detail later).

Notice that for setitemtype's second parameter, the bernoulli command is used. This command takes 3 parameters and returns one of two possible values. The first parameter is a percentage value between 0 and 100. The second and third parameters are "success" and "failure" values, and represent the two possible values to be returned. In this case, 60% of the time the bernoulli command will return a 1 (parameter 2) and the rest of the time it will return a 2 (parameter 3). Since the bernoulli command is the second parameter of the setitemtype command, the itemtype value will be set to whatever is returned by the bernoulli command, namely the 1 or 2 value. The exit trigger of the Source is executed every time a flowitem is created and exits the Source. This means that the setitemtype command will be executed many times over the course of the simulation, and each execution will be associated with exactly one flowitem. Items exiting the Source will thus be split 60/40 for itemtypes 1 and 2 respectively. Since bernoulli is a stochastic, or random, command, the bernoulli will not always keep a perfect 60/40 ratio. You may have several consecutive customer arrivals whose itemtype value is set to 1, and vice versa. But over time the ratio will equalize out to 60/40.

Once you have initialized the itemtype value, logic in your model can then be implemented based on the itemtype value of each customer going through the model. In the example, a "package" customer may take 3 minutes to service, whereas a "copy" customer may take 5 minutes to service. In FlexSim, you would implement this difference by writing FlexScript code in the Process Time picklist of a Processor object. The code would look like this:

if (getitemtype(item) == 1) return 3;  else return 5;

This code basically says: if the itemtype value of the flowitem that is currently being serviced (getitemtype(item)) is equal to 1 (it is a "package" customer), then return 3 as the process time. Otherwise (it is a "copy" customer) return 5 as the process time.

Again, this example can be done without writing any code, using FlexSim's pick-lists to define your logic. Nevertheless, the key concept to understand here is that every flowitem can have an itemtype value whose meaning is up to you, and that you can use the itemtype value to make decisions in your model.

Note on FlexSim objects: Every flowitem in a model has an itemtype. However, FlexSim objects like Sources, Queues and Processors do not have an itemtype.

Note on the itemtype value: The itemtype is a double precision floating point number. This means that the itemtype can not only hold integer values like, 1,2,3, etc., it can also hold floating point values like 1.5 or 99.9. However, the itemtype cannot hold string values like "package".

Note on flowitem appearance: The itemtype value will not define the visual appearance of the flowitem. This can be set by choosing the flowitem class in the Source's Parameters window, such as box, tote, or pallet.



flexsim users manual
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Article

Contributors

paul.t contributed to this article

Navigation

FlexSim 2016.1