Creating user-defined attributes

You can create a user-defined attribute in the Base data menu or the Attribute selection window (Selecting attributes and subattributes for columns of a list).

Creating a user-defined attribute in the Base data menu

1.  On the Base Data menu, click > User-Defined attributes.

The User-Defined Attributes list opens. If no user-defined attribute is defined, only the column titles are displayed.

2.  In the list, on the toolbar, click the Add button .

The User-Defined Attribute window opens.

Tip: Alternatively, you can also open the User-Defined Attribute window via the following functions: When doing so, you adopt the network object type as the object type of the user-defined attribute.

  • On the network object sidebar, on the shortcut menu of the desired network object type, click Create User-Defined Attribute.
  • In the Attributes list of the desired network object type, right-click the row header of the desired network object. Then on the shortcut menu, click User-Defined Attribute.
  • In the Attributes list of the desired network object type, on the toolbar, click the Create User-Defined Attribute button .

Note: In lists, you can use the  Attribute selection icon to show and hide attribute values (Selecting attributes and subattributes for columns of a list).

3.  Make the desired changes:

Element Description
Object type

Object type of user-defined attribute (mandatory field)

In addition to the network object types, you can select other object types, such as Network settings (NETPARA). For NETPARA, choose the data source type Formula to enter a formula value that you can use as a user-defined constant. Select TableLookup to access NETPARA.

Short name

Abbreviated name of user-define attribute (mandatory field)

LongName

Full name

Comment

Optional comment

 

Element Description

Data type

A user-defined attribute must have a data type. Select the desired entry.

Data types allowed:

Acceleration

Acceleration

Bool

Enables logical statements for a user-defined attribute that can be assigned 0, 1, or no value:

  • Yes: true, 1
  • No: false, 0
  • Empty: Empty value, no value

Filename

Filename: Reference to a file, for example for a user-defined attribute, which lists where to find further information.

Duration (integer)

Time [s] without decimal separator

Duration (floating-point number)

Time [s] with decimal separator

Color

Set a color value. Instances where you might want to do this include:

  • A user-defined attribute determining the color of a vehicle or pedestrian.
  • A user-defined attribute that dynamically establishes a color value in response to an attribute change.

You can adjust the color value in the formula editor using the Color (a; r; g; b) function. The formula editor is useful for defining a user-defined attribute or implementing an attribute change.

Area (km2)

Square kilometers

Area (m2)

Square meters

Integer

Integer without decimal separators

Speed (km/h)

Speed (km/h)

Speed (m/s)

Speed (m/s)

Floating-point number

Floating-point number with decimal separators

Length (km)

Length (km)

Length (m)

Length (m)

Length (mm)

Length (mm)

Text

String

Currency

Currency

Time

Time in format hh:mm:ss (12:23:12) or hh:mm (12:23)

 

Element Description

Subattributes

  • Simulation run: only for the following objects:
  • User-defined attributes of network objects of the data source type Data that have result attributes and can have user-defined data attributes. The values of these attributes can only be changed during the simulation run and are saved to the evaluation database (*.db).
  • User-defined attributes of the data source type Formula

The values of the user-defined attribute are recorded for each simulation run. When you show the user-defined attribute in an attributes list, the attribute values are listed per column for each simulation run.

  • Time interval: For user-defined attribute consider time intervals of network object type. The network object type must be assigned time intervals (Defining time intervals for a network object type). When you show the user-defined attribute in an attributes list, the attribute values are listed per column for each time interval.

4.  Select the desired data source type.

  • Data: You can set the following attribute values and options. Depending on the data selected, different boxes and options are displayed in the section on the right.
    ElementDescription

    Allow empty value

     If the option is selected, no value may be specified for the user-defined attribute. By default, the option is not selected and the default value is NULL.

    Default value

    Optional entry of a default value

    Minimum

     If this option is selected, choose the smallest possible value as default.

    Maximum

     If this option is selected, choose the largest possible value as default.

    Decimal places

    Number of decimal places for a value with decimal separator

  • Formula: You can create a formula in the section on the right (Creating formulas). To do so, you also specify the number of decimal places:
    ElementDescription

    Decimals

    Number of decimal places for a value with decimal separator

If the attributes selected for the formula are based on dynamic data that can change during a simulation run, the values of the user-defined attribute displayed in a results or attribute list can also change during the simulation run.

Syntax errors are highlighted in red:

Vissim highlights formula syntax errors in red. Below the entry box for the formula, a message is displayed with information on the possible cause of the syntax error.

5.  Confirm with OK.

The User-Defined Attribute window closes. The user-defined attribute is displayed in the User-Defined Attributes list.

Example of a user-defined attribute

The user-defined attribute ConflGap will calculate the gap in front for the two links of a conflict area, if Link1 has the Status2 and Link2 has Status1.

For this example the following data are selected or entered:

  • Object type: Links
  • Short name: ConflGap
  • Long name: ConflAreaFrontGap
  • Comment: Front gap of a conflict area of this link, where vehicles need to observe the right of way
  • Data type: Entry floating point number
  • Data source type: Formula option

In the Insert TableLookup window:

  • Object type: Conflict areas
  • Variable name: ca

In the Formula entry box, change entry TableLookup(CONFLICTAREA ca; ; ) to:

TableLookup(CONFLICTAREA ca; ca[LINK1\NO]=[NO] & ca[STATUS]=2 | ca[LINK2\NO]=[NO] & ca[STATUS]=1;ca[FRONTGAPDEF])

The user-defined attribute ConflGap is then available as an attribute of the network object type Link. In the Links list, you can show ConflGap as a column. Additionally, you can show the calculated Front gap attribute value for each link in the list that has conflict areas with the two statuses defined.

Superordinate topic:

Using user-defined attributes