Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Set Attribute

Assign data to entity

Library

Attributes

Description

This block accepts an entity, assigns data to it, and then outputs it. Assigned data is stored in entity attributes. Each attribute has a name and a value that you specify. You can specify up to 32 attributes in the block. To learn about the kind of data an attribute can store, see Attribute Value Support.

Dialog Box

Set Attribute Tab

Available Attributes

Use the Available Attributes controls to:

  • Select the attributes from incoming entity paths that you want to access on the departing entity.

  • Add the attributes to the Set Attribute table, where you can modify them.

The list displays all the attributes on all the incoming entities. (If the entity paths entering the Set Attribute block do not have any attributes, the Available Attributes list is empty).

If the attribute list is long, you can type the attribute name in the text box to filter the list.

Use the buttons in the Available Attributes section to help build the attributes table. The buttons perform these actions:

ButtonAction

Refresh the Available Attributes list. This action updates the list with any upstream model changes you make while the block dialog box is open.

Add the selected attribute to the Set Attribute table.

Move the selected attribute from the Set Attribute table to the Available Attributes list.

Note: If the selected attribute is one you added manually, this button appears dimmed.

The message area below the available attributes list displays additional messages about the attributes, as they apply.

MessageMeaning

> Attribute already selected

You have already added the attribute to the Set Attribute table. You cannot add the attribute to the table again.

* Attribute may not be present

When multiple entity paths enter the block, all entities might not have the same attributes. Attributes that are not on all entering entities display an asterisk in the list, and this message appears. If you add such an attribute to the Set Attribute table, the behavior depends on how the Create attribute if not present check box is set.

Create attribute if not present

Check box that enables the block to define new attributes when an attribute in the table is not present in the current entity. If the check box is deselected, the simulation issues an error if an attribute named in the table does not already exist.

Select the check box if you want to:

  • Set an attribute on each departing entity that previously existed on only certain incoming entity paths.

  • Set a new attribute that you manually defined in the table on each departing entity.

Clear the check box if you want to:

  • Protect against scenarios in which you add an attribute to the table from the Available Attributes list and later rename the attribute. When the check box is not selected, the renamed attribute causes an error because it no longer matches one present in the current entity.

Set Attribute

Use the controls under Set Attribute to build and manage the list of attributes to attach to each departing entity. Each attribute appears as a row in a table.

Using these controls, you can:

  • Add an attribute manually to attach to the entity.

  • Modify an attribute that you added to the table from the Available Attributes list to attach to the entity.

The buttons under Set Attribute perform these actions:

ButtonActionNotes

Add a template attribute to the table.

Rename the attribute and specify its properties.

Add a copy of the selected attribute to the table to use as the basis of a new attribute.

Rename the copy. Two attributes cannot have the same name.

Remove the selected attribute from the Set Attribute table.

When you delete an attribute this way, no confirmation appears and you cannot undo the operation.

    Note:   If you delete a row and apply the change, the deletion can affect signal output ports corresponding to other attributes. For example, if the block has a signal output port A2 and you delete the attribute with a port marked A1, the block relabels A2 as A1. Verify that any signal that connects to the relabeled port is still connected as you expect.

The table displays the attributes you added from the Available Attributes list or added manually. Use it to set these four attribute properties:

PropertySpecifyUse

Attribute Name

The name of the attribute. Each attribute must have a unique name.

Double-click the existing name, and then type the new name.

Value From

Whether the data for the attribute value comes from the dialog box or a signal.

Select Dialog or Signal port. If you select Signal port, an input port with the name specified is added to the block after you apply your changes. When you connect a signal to the input port, the block assigns the value of the signal to the attribute during simulation.

Value

The value to assign to the attribute (when the attribute comes from the dialog box).

Double-click the value, and then type the value you want to assign.

Vector Is 1-D

Whether the block assigns the attribute as a vector of length N or as a multidimensional array when the Value evaluates to an N-element row or column vector. This property applies only to values that come from the dialog box when the value evaluates to an N-element row or column vector.

Select the check box to assign the attribute as a vector of length N. Clear it to assign the attribute as a multidimensional array.

Statistics Tab

These parameters determine whether the block produces data at signal output ports or omits those ports. For descriptions of the data and ports, see Signal Output Ports.

Number of entities departed

Allows you to use the signal output port labeled #d.

Ports

Entity Input Ports

LabelDescription
INPort for arriving entities

Signal Input Ports

LabelDescription
Attribute nameData to assign to the attribute specified in each row of the table. The signal must be a fixed-size, event-based signal. You see this port only if you set Value From to Signal port. The default Name that corresponds to each row is Attributex, where x = 1, 2, 3, etc.

Entity Output Ports

LabelDescription
OUTPort for departing entities, with data assigned to them.

Signal Output Ports

LabelDescriptionTime of Update When Statistic Is On
#dNumber of entities that have departed from this block since the start of the simulation.After entity departure

The initial output value is 0. This value is in effect from the start of the simulation until the first update by the block.

Was this topic helpful?