Changing Attribute Values in a Queue or Group
By Melanie Barker, Arena Simulation Consultant
Published: January 23, 2017
Categories: Tips & Tricks
Welcome to the Arena Tips and Tricks column! We’ll be using this section of the newsletter to highlight features of Arena that we want to call to your attention – either they may not be as well known, or they’re very valuable and deserve a second glance. For our first column, we’ll be starting with the A() Variable.
You’ve probably used the Assign module to change the value of an entity’s attribute. But what if you need to change the attribute value of an entity that’s in a queue or group and you can’t remove it? That’s where the A() Variable can come in handy. The A() Variable is a General Attribute Variable; every attribute value for every entity can be accessed and changed using this variable. For entities in queues and groups, you can look up their attribute values with the AQUE() or AG() variables. However, these only return the value; you can’t change the attribute value with them. To change the value, that’s where you’ll need to use the A() Variable.
The A() Variable has two parameters: the attribute number and the entity number. The attribute number is the value that Arena uses to reference that particular construct. You can either explicitly set the attribute numbers yourself using the Attributes Element in the Element panel, or you can ask Arena to look it up for you with the NSYM() function. To use the NSYM() function, you’ll use the attribute name as its parameter. For example, if your attribute is called a DueDate, you can use NSYM (a DueDate) to find the internal number for the a DueDate attribute.
Now you need the entity number. If you don’t know the entity number, you can use the ENTATRANK() or ENTINGROUP() to find the entity number of an entity in a queue or group, respectively. Once you have those two pieces of information, you can use them as the parameters in your A() Variable to assign a new value to that entity’s attribute. Let’s say that you need to change the due date of entity 15 to be time 20. See the dialog box below for the right way to define that assignment in the Assign module.
Since you’re using an Assign module, you still need an entity to make this change to the other entity. This will typically be done using an entity as a control entity to make changes to your system.
If you’d like to see an example of the A() Variable in use, you can take a look under the Smarts Advanced Concepts models; the “Advanced Concept Change Attribute with A Variable.doe” model shows you how to search a queue and assign a new value to the queued entity’s attribute.
Sign up for the Blog
Arena User Group
Arena has a very active user community on LinkedIn. Ask questions, learn about best practices and connect with other simulation professionals.