Page 158 - ExtendSim User Guide
P. 158

132 Items, Properties, and Values
Item properties
Modifying attribute values
The most flexible way to modify the value of an item’s attribute or other property is with the Equation(I) block (Item library). This block can look up property information and modify it by applying some mathematical formula, then use the result as the new attribute value for the item. For example, if an item arrives with a value of 5 for the attribute “nextRecord”, you could add a 1 to the 5 and create a new attribute value of 6 for that item’s nextRecord attribute. The Air Freight model discussed on page 228 is an example of this.
Another way to modify properties is to connect from a Get block’s value output to a Math or Equation block (both from the Value library). Then have that block apply some mathematical formula and output the results to a value input on a Set block. The property must be selected in the dialogs of the Get and Set blocks, and the value connectors must be for that property.
Attribute arrays
Attribute names and values are stored in a pair of dynamic global arrays:
• Theone-dimensionalNamesarraystoresthenameofeachattributecurrentlyusedinthe model. Attribute names can be up to 15 characters long. You will receive an error message if you attempt to give an attribute a name greater than 15 characters. Attribute names are not case-sensitive.
• Thetwo-dimensionalValuesarraystoresthevalueofeachattributeforeachiteminthe form of real numbers.
The following picture represents the attribute arrays:
As new attribute names are added to the model, new cells (array elements) are appended to the Names array and new columns are appended to the Values arrays, up to a maximum of 500.
As new items are created during the simulation run, new rows are added to the Values array. The number of rows in the Values array is unlimited and will be the same as the number of items in the model. As shown in the above picture, item A has an attribute named “type” that has an attribute value of 2 and item B has an attribute named “size” with a value of 6.01.
Note that each attribute named in the model causes a cell to be reserved in the Values array for every item. However, not every item uses every attribute. To allow an item to use an attribute, you must assign a value to the attribute using one of the attribute-handling blocks (such as the Set block). If there is no value assigned, the attribute is not used by that item. This is shown in the figure above, where item B has no assigned value for the attribute name “color” and item C does not have a value for the attribute “size”.
Discrete Event

   156   157   158   159   160