Main Content

Design Custom Rotary Switches

An engine order telegraph (EOT) is a device used on ships to communicate the commanded speed and direction of travel from the bridge to the engine room. Personnel on the bridge use the EOT to control the velocity of the ship from outside the engine room.

This example shows how to use the customizable Rotary Switch block to design two EOTs that look like controls in real systems:

  • A traditional EOT

  • A modern EOT

Each switch consists of a stationary component and a movable component. The stationary component is the mounting, and the movable component is the handle that you turn to set the value of the parameter that the switch controls.

The blocks in the model use PNG images to define the shapes of these components. You can find all images used to create the switches in the example directory.

Each switch has multiple states. A state pairs a State Value with a customizable State Label, a handle orientation, and a click area.

You can activate a state by clicking its click area or by dragging the handle and releasing it over the click area. When you activate the state, the State Value is assigned to the Simulink® block diagram element to which the switch block is connected.

You can specify the arc angle the handle traverses when it moves from the first state to the last state. The state labels are evenly spaced over the arc length. The edges of the click areas bisect the angular distance between labels.

Design Traditional EOT

To design the traditional EOT, add a customizable Rotary Switch block to the model using the Simulink quick insert menu:

  1. To open the quick insert menu, double-click in the canvas.

  2. To search for the customizable Rotary Switch block, type Rotary Switch.

  3. Select the search result with the library path Simulink/Dashboard/Customizable Blocks.

To modify the design of the Rotary Switch block, enter design mode:

  1. In the model canvas, select the Rotary Switch block.

  2. In the Simulink Toolstrip, click the Switch tab.

  3. On the Switch tab, click Edit. A toolbar appears above the Rotary Switch block.

  4. To open the Property Inspector, in the toolbar, click Open Design Tab. In design mode, the Design tab of the Property Inspector is active.

You can design a custom rotary switch using the toolbar or using the Design tab of the Property Inspector. This example uses both.

Add the background image for the traditional EOT:

  1. In the toolbar, click Replace Background Image.

  2. In the CustomRotarySwitchImages folder, select the eot-1-background.png file.

Resize the block to make the text on the EOT in the background image large enough to read:

  1. Make the full background image visible by deleting the handle image. On the Design tab of the Property Inspector, click the Handle component. Then, in the Handle component, underneath the handle image, click the X button.

  2. To resize the block, exit design mode. In the Property Editor, on the Design tab, click Edit.

  3. Click and drag one of the corners of the block outwards until the text on the background image is large enough to read.

To continue modifying the design of the Rotary Switch block, enter design mode again.

Add the handle image for the traditional EOT:

  1. On the Design tab, select the Handle component.

  2. In the Select Image section, click the plus button.

  3. In the CustomRotarySwitchImages folder, select the eot-1-handle.png file. Note that the handle in the PNG file points to the right.

The states of the traditional EOT Rotary Switch block have this layout:

  • The background image shows nine labels spaced at 30 degree intervals. Each label corresponds to an EOT state. The traditional EOT Rotary Switch block is split into nine corresponding state sections, shown in yellow.

  • State 1 is the FULL ahead command on the background image.

  • The Arc is the arc length the rotary switch handle traverses when it moves from the first state to the last state. For the traditional EOT Rotary Switch block, the arc length spans from the middle of the FULL ahead section to the middle of the FULL astern section, which is an angular distance of 240 degrees.

  • The Start Angle is the angular location of the end of the arc length that is in State 1, measured clockwise from the positive horizontal axis pointing right. For the traditional EOT Rotary Switch block, the Start Angle is the angular location of the middle of the FULL ahead section relative to the positive horizontal axis, which is 150 degrees.

  • Since the background image already has the labels for each section marked, the Rotary Switch block state labels are hidden.

Implement the state layout:

  1. In the Property Inspector, on the Design tab, select the Rotary Switch component.

  2. In the Range section, set Arc to 240 degrees.

  3. In the Range section, set Start Angle to 150 degrees.

  4. To hide the Rotary Switch blocks state labels, make the label radius large enough to move the labels out of view. In the Range section, set Label Radius to 1.

The Rotary Switch block for the traditional EOT has nine states:

  • In State 1, the bridge orders the engine to travel ahead at the full engine speed. The Rotary Switch block has a State Value of 100 and the State Label Full Speed, Ahead.

  • In State 2, the bridge orders the engine to travel ahead at 50 percent of the full engine speed. The Rotary Switch block has a State Value of 50 and the State Label Half Speed, Ahead.

  • In State 3, the bridge orders the engine to travel ahead at 25 percent of the full engine speed. The Rotary Switch block has a State Value of 25 and the State Label Slow Speed, Ahead.

  • In State 4, the bridge orders the engine to stand by. The Rotary Switch block has a State Value of 1 and the State Label Stand By.

  • In State 5, the bridge orders the engine to stop, and the engine speed is 0. The Rotary Switch block has a State Value of 0 and the State Label Stop.

  • In State 6, the bridge is finished with the main engine. The Rotary Switch block has a State Value of -1 and the State Label Finished with Engine.

  • In State 7, the bridge orders the engine to travel astern at 25 percent of the full engine speed. The Rotary Switch block has a State Value of -25 and the State Label Slow Speed, Astern.

  • In State 8, the bridge orders the engine to travel astern at 50 percent of the full engine speed. The Rotary Switch block has a State Value of -50 and the State Label Half Speed, Astern.

  • In State 9, the bridge orders the engine to travel astern at the full engine speed. The Rotary Switch block has a State Value of -100 and the State Label Full Speed, Astern.

In the Property Inspector, on the Design tab, for each state:

  1. In the States component, in the Select State section, expand the drop-down list. If the state number is listed, select the corresponding state. If not, click the plus button to add a new state.

  2. In the Value section, enter the State Value.

  3. To make the state identifiable in the Select State section drop-down list, in the Label section, enter the State Label in the Text field. When you click out of the Text field, the label appears in the Select State section drop-down list.

Note that the handle orientation for a given state not be correct until all nine states have been added because the Rotary Switch block does not recognize the labels on the background image. The Rotary Switch block spaces state labels at equal angular intervals, so the angular locations to which the handle snaps depend on the number of states. When there are nine states, the angular locations of the Rotary Switch block state labels coincide with the angular locations of the labels on the background image, and the handle takes on the correct orientation for all states.

When you finish adjusting the design for the traditional EOT, to exit design mode, in the Property Inspector, on the Design tab, click Edit.

You can use the finished EOT to control a parameter. In the model, a Constant block represents the EOT signal that is sent to the engine room. The Rotary Switch block controls the value of the constant.

Connect the Rotary Switch block to the Value parameter of the Constant block:

  1. Select the Rotary Switch block.

  2. Click the Connect button that appears above the block.

  3. Select the Constant block named Const1.

  4. In the table that appears below the selected signal, select the Const1:Value.

  5. Click the X in the upper right corner of the Simulink window.

To use the traditional EOT:

  1. Simulate the model. This model uses simulation pacing to slow model execution so you can interact with the model during simulation. For more information about simulation pacing, see Simulation Pacing Options.

  2. During simulation, click and drag the handle. To change the State Value of the Rotary Switch block, release the handle over any of the labels on the background image.

  3. See the effect on the EOT signal in the Dashboard Scope block.

Design Modern EOT

To design the modern EOT, add a customizable Rotary Switch block to the model.

If the Property Inspector is not open to the Design tab with the Edit button pressed:

  1. In the model canvas, select the Rotary Switch block.

  2. In the Simulink Toolstrip, click the Switch tab.

  3. On the Switch tab, click Edit. A toolbar appears above the Rotary Switch block.

  4. To open the Property Inspector, in the toolbar, click Open Design Tab.

Add the background image for the modern EOT:

  1. In the toolbar, click Replace Background Image.

  2. In the CustomRotarySwitchImages folder, select the eot-2-background.png file.

Resize the block to make the text on the EOT in the background image large enough to read:

  1. Make the full background image visible by deleting the handle image. On the Design tab of the Property Inspector, click the Handle component. Then, in the Handle component, underneath the handle image, click the X button.

  2. To resize the block, exit design mode. In the Property Editor, on the Design tab, click Edit.

  3. Click and drag one of the corners of the block outwards until the text on the background image is large enough to read.

To continue modifying the design of the Rotary Switch block, enter design mode again.

Add the handle image for the modern EOT:

  1. On the Design tab, select the Handle component.

  2. In the Select Image section, click the plus button.

  3. In the CustomRotarySwitchImages folder, select the eot-2-handle.png file. Note that the handle in the PNG file points to the right.

  4. In the Size section, set the Width and Height to 1.

The states of the modern EOT Rotary Switch block have this layout:

  • The background image shows eleven labels spaced at 30 degree intervals. Each label corresponds to an EOT state. The modern EOT Rotary Switch block is split into eleven corresponding state sections, shown in yellow.

  • State 1 is the FULL astern command on the background image.

  • The Arc is the arc length the rotary switch handle traverses when it moves from the first state to the last state. For the modern EOT Rotary Switch block, the arc length spans from the middle of the FULL ahead section to the middle of the FULL astern section, which is an angular distance of 300 degrees.

  • The Start Angle is the angular location of the end of the arc length that is in State 1, measured clockwise from the positive horizontal axis pointing right. For the modern EOT Rotary Switch block, the Start Angle is the angular location of the middle of the FULL ahead section relative to the positive horizontal axis, which is 120 degrees.

  • Since the background image already has the labels for each section marked, the Rotary Switch block state labels are hidden.

Arc is 300 degrees by default. Start Angle is 120 degrees by default.

To hide the Rotary Switch blocks state labels, make the label radius large enough to move the labels out of view:

  1. In the Property Inspector, on the Design tab, select the Rotary Switch component.

  2. In the Range section, set Label Radius to 1.

The Rotary Switch block for the traditional EOT has eleven states:

  • In State 1, the bridge orders the engine to travel astern at the full engine speed. The Rotary Switch block has a State Value of -100 and the State Label Full Speed, Astern.

  • In State 2, the bridge orders the engine to travel astern at 50 percent of the full engine speed. The Rotary Switch block has a State Value of -50 and the State Label Half Speed, Astern.

  • In State 3, the bridge orders the engine to travel astern at 25 percent of the full engine speed. The Rotary Switch block has a State Value of -25 and the State Label Slow Speed, Astern.

  • In State 4, the bridge orders the engine to travel astern at 12.5 percent of the full engine speed. The Rotary Switch block has a State Value of -12.5 and the State Label Dead Slow Speed, Astern.

  • In State 5, the bridge is finished with the main engine. The Rotary Switch block has a State Value of -1 and the State Label Finished with Engine.

  • In State 6, the bridge orders the engine to stop, and the engine speed is 0. The Rotary Switch block has a State Value of 0 and the State Label Stop.

  • In State 7, the bridge orders the engine to stand by. The Rotary Switch block has a State Value of 1 and the State Label Stand By.

  • In State 8, the bridge orders the engine to travel ahead at 12.5 percent of the full engine speed. The Rotary Switch block has a State Value of 12.5 and the State Label Dead Slow Speed, Ahead.

  • In State 9, the bridge orders the engine to travel ahead at 25 percent of the full engine speed. The Rotary Switch block has a State Value of 25 and the State Label Slow Speed, Ahead.

  • In State 10, the bridge orders the engine to travel ahead at 50 percent of the full engine speed. The Rotary Switch block has a State Value of 50 and the State Label Half Speed, Ahead.

  • In State 11, the bridge orders the engine to travel ahead at the full engine speed. The Rotary Switch block has a State Value of 100 and the State Label Full Speed, Ahead.

In the Property Inspector, on the Design tab, for each state:

  1. In the States component, in the Select State section, expand the drop-down list. If the state number is listed, select the corresponding state. If not, click the plus button to add a new state.

  2. In the Value section, enter the State Value.

  3. To make the state identifiable in the Select State section drop-down list, in the Label section, enter the State Label in the Text field. When you click out of the Text field, the label appears in the Select State section drop-down list.

Note that the handle orientation for a given state not be correct until all eleven states have been added because the Rotary Switch block does not recognize the labels on the background image. The Rotary Switch block spaces state labels at equal angular intervals, so the angular locations to which the handle snaps depend on the number of states. When there are eleven states, the angular locations of the Rotary Switch block state labels coincide with the angular locations of the labels on the background image, and the handle takes on the correct orientation for all states.

Add the foreground image for the modern EOT:

  1. On the Design tab, select the Foreground Image component.

  2. In the Select Image section, click the plus button.

  3. In the CustomRotarySwitchImages folder, select the eot-2-foreground.png file.

When you finish adjusting the design for the modern EOT, to exit design mode, in the Property Inspector, on the Design tab, click Edit.

Use the finished EOT to control a parameter. In the model, a Constant block represents the EOT signal that is sent to the engine room, and the Rotary Switch block controls the value of the constant.

Connect the Rotary Switch block to the Value parameter of the Constant block:

  1. Select the Rotary Switch block.

  2. Click the Connect button that appears above the block.

  3. Select the Constant block named Const2.

  4. In the table that appears below the selected signal, select Const2:Value.

  5. Click the X in the upper right corner of the Simulink window.

To use the modern EOT:

  1. Simulate the model. This model uses simulation pacing to slow model execution so you can interact with the model during simulation. For more information about simulation pacing, see Simulation Pacing Options.

  2. During simulation, click and drag the handle. To change the State Value of the Rotary Switch block, release the handle over any of the labels on the background image.

  3. See the effect on the EOT signal in the Dashboard Scope block.

See Also

Related Topics