EnumSet

In C or C++, an Enum is used to define a list of labels that are used in place of integral values.  A simple example for a variable called TransmissionState would be Park = 1, Reverse = 2, Neutral = 3, Drive = 4, and Low = 5.  Similarly you can define Enums and Enum sets in MxVDev. In this example, TransmissionState is the Enum set, Park is an Enum label, and 1 is its value.

When you define Enums for a Signal, you will see the label in MxVDev instead of just seeing the numeric value.  Enum labels are presented in TestCases, in the Status Bar across the bottom of the MxVDev main window, in the View Details form, and in other places.

Enum sets are stored in a file named <project name>.mxenum. This file is shared by MxVDev and MxTransIt. By default, this file is in the Project Folder. You can change the location in the Project Settings.

There are two steps to associate Enums with a Signal:

hmtoggle_plus11. Create an Enum Set
hmtoggle_plus12. Associate the Enum Set with a Signal

Definitions:

An Enumeration Set enumerates the entities in a set (of states, outcomes, conditions, etc.). Each entity is called an Enum.

An Enum has a Label string.

An Enum has a Value. (The Value can be positive or negative Integer.)

An Enum must to be part of an Enumeration Set.

An Enumeration Set cannot have more than one Enum with the same Value.

An Enumeration Set cannot have more than one Enum with the same Label.

Labels are useful because:

They make sense to the human. - We prefer to have TestCases use labels for this reason.

Values are useful because:

They imply an order (which may be useful if the set is ordered).

They can be plotted graphically (although this is useful only if the Values are close together).

They can have a one to one correspondence to the enumeration in 'C' code.

Notes:

Since an Enum set is a set of discrete values, it should be used with discrete or event Signals.

Enums may be associated with stimulus or response Signals.

A discrete MxSuite Signal can have zero or one Enumeration Sets associated with it.

Several Signals can be associated with the same Enumeration Set.

An Enum Set must have a Name. Enum Labels are prefixed by the name of the Enumeration Set as a means to ensure all Enum Labels are unique.

When a DBC file is parsed by a CAN Transform, all Enums in the DBC file are loaded into the mxenum file.

When importing Enums from a DBC file or MxTransIt, by default the Enumeration Set is named the same as the Signal Name.

By default Enumeration Sets and Enums have GUIDs. This is to facilitate linking after renaming Signals, Enumeration Sets, and Enums.

When an Enum is used in a TestCase, the value of the Enum is stored in the TestCase so it will be available if the Enum set is deleted or cannot be found. (For example, if the TestCase is copied to another project.)

Enum values stored in a TestCase are updated when the TestCase is loaded.

 

Related Topics:

Importing Enums

Editing Message Fields

Project Settings (location of the .mxenum file)

Signal Dictionary

Editing Ports (Enums in MxTransIt)