MATLAB: Do I get a translation error when doing a compatibility check on a model that uses enumerated types using Simulink Design Verifier 2.0 (R2011a)

compatibilitydatadesignenumeratedmodelsimulinkSimulink Design Verifiertypeverifier

I am using the Simulink Design Verifier on a model that uses enumerated types. Two types happen to have identical enumeration members. During the compatibility check of Simulink Design Verifier, this leads to an error message given below.
Errors occurred during translation:
Please refer to the diagnostics window for more information.
'Model1' is incompatible with Simulink Design Verifier.
Translation failed: Potential conflicting usages of identifier 'X': an enumeration string in data type 'Model1', and an enumeration string in data type 'Model2'
Reproduction Steps:
•Add the following files to the current working directory:
DIL_CubeDefinitions.m
GBL_Arbitration_Cmd.mdl
GBL_Arbitration_OneCntrl.mdl
GBL_Definitions_DigitalCommand.m
GBL_Definitions_DigitalControl.m
GBL_Definitions_DigitalState.m
•Open the model : 'GBL_Arbitration_OneCntrl'
•Using Design Verifier, check model compatibility for the model 'GBL_Arbitration_OneCntrl'.

Best Answer

The ADDCLASSNAMETOENUMNAMES method in the enumerated class definition can be used to specify class name prefixing.
By default, enumerated values in generated code have the same names that they have in the enumerated class definition. Alternatively, the code can prefix every enumerated value in an enumerated class with the name of the class. This technique can be useful for preventing identifier conflicts or improving the clarity of the code. To specify class name prefixing, include the following method in an enumerated class's ‘methods’ section:
methods (Static = true)
function retVal = addClassNameToEnumNames()
% ADDCLASSNAMETOENUMNAMES Specify if class name is added
% as a prefix to enumerated names in the generated code.
% By default we do not add the prefix.
retVal = true;
end
end
Now the model will be compatible with Simulink Design Verifier.
For more information on this topic, please refer to the following links: