I want to map 2 enumeration lists in simulink in a way that it is easy to see the connection between the 2 maps using their names instead of their values. How can this be done?
Thank you!
Example:
Actions:
classdef(Enumeration) Actions < Simulink.IntEnumType
enumeration
Off(1)
PowerOn(2)
PowerOff(3)
end
end
States:
classdef(Enumeration) States < Simulink.IntEnumType
enumeration
START(1000)
RUNNING(1002)
STOPPED(1003)
OFF(1004)
end
end
The connections would be like this:
States.START -> Actions.PowerOn
States.RUNNING -> Actions.PowerOn
States.STOPPED -> Actions.PowerOff
States.OFF -> Actions.Off
To achieve this the common practice is to use a Multiport Switch. Use the values for States
as data port indices and the Actions
as Enumerated Constants like this:
The settings for the Multiport Switch should look like this:
I have made the data types of signals visible to see that we map a signal of data type States
to a signal of data type Actions
.