Guy on Simulink

Simulink & Model-Based Design

Smart Signal Routing 20

Posted by Guy Rouleau,

This week guest blogger Michael Carone is here to talk about improvements to signal routing in Simulink R2012b.

Smart Signal Routing

Has this ever happened to you: You have two blocks that you connect together and the signal line doesn’t show up where you want it to go? It overlaps a block or some text in the model, and then you have to move sections of the signal around in order to get it just right. It can get pretty frustrating – you start thinking “Why do I have to spend all this time fiddling around with signal lines just to make my model look good? Simulink should do this automatically!”

Line routing with an optimal path

Well, I have good news! The new Simulink Editor in R2012b does a much better job of drawing signal lines with one of my favorite new features, smart signal routing. What’s smart signal routing? Basically, it means that when you draw a signal line, Simulink will automatically find the “optimal path” so that the new signal line is as short as possible, has minimal 90 degree turns, and doesn’t overlap other blocks and text. Not only that, as you draw the signal line, Simulink lets you know exactly what the path is going to look like before you release the mouse button. So there are no surprises! (in this case, that’s a good thing).

Line routing with an optimal path

Drawing custom paths

You might be thinking, “Automatic signal line? What if I want to create my own signal line paths?” The good thing is that there’s a new way to create your own custom signal line path too. Here’s how it works: Draw a signal line like you normally would. Then release the mouse button when you want to create a bend in the line. You’ll see three blue arrows appear: one to keep going straight and two to make a left or right turn. Choose the arrow that you want and repeat until you’ve created your own signal path. Here’s a little video to show how this works:

Drawing custom paths

Minimum disturbance

Now what’s neat about this new signal line is that it won’t get blown away if you move some blocks around as you continue building up the model. Part of the smartness of the smart signal routing algorithm is to know when to leave a signal alone. It’s what we call “minimum disturbance.” In other words, the signal lines that already exist will be disturbed as little as possible as you move blocks around. Here’s another clip to show how this works:

Minimum disturbance


Smart signal routing is just one of the many features added to the new Simulink Editor to make modeling easier.

Now it's your turn

Have you tried out the new Simulink Editor yet? What do you think of the new smart signal routing algorithm? Let us know by leaving a comment here!

20 CommentsOldest to Newest

KE replied on : 1 of 20

Good, eliminates a time waster and makes diagrams more legible. Maybe in the future there can be “smart” arrangements of the blocks as well.

Jason S replied on : 4 of 20

Good to see this; thanks Mathworks!

Could you comment about signal routing w/r/t nodes that connect an output O1 to more than one input (I1, I2, I3), so that there are branches in the routing?

One of my pet peeves is if I need to disconnect the node from the output O1 and connect it to another output O2, I can’t seem to do it without deleting the entire node.

Also the junction dot has been a pain to move around to keep it at the “obvious” place. Hard to describe this without a picture, but a junction should look like a T with the dot where the three lines meet. Instead the dot is often somewhere else to the side, and it’s cumbersome to move it to the proper place.

Jason G replied on : 5 of 20

Hi Jason,

The line routing is much better. For your scenario, you can now just grab the line at O1 and move it to O2. As you get the mouse close to the Output O1 the mouse cursor turns to a circle and you can grab the line and move it to somewhere else.
You should look at this post to help answer your question on junction dot. This too have been vastly improved in 12b:
Blog Post: You say “sȯ-dər”, I say “sōl-dər”

Kristian replied on : 6 of 20

Is it possible to switch the new “intelligent” routing off? Actually it´s much more annoying than helpful and creates more work than less.

See example:

I had disconnected the bus creators in order to add 2 inputs. When I now reconnect them by just moving them back to the original position, the signal lines become connected again. But see how … it´s unusable! And this is one example only. It´s so nasty!


Kumar replied on : 7 of 20

Hi, I think this is a good addition for simulink. This will make my life easier now. Also, other softwares based on block diagrams have a feature which you can use to make the lines and the blocks auto arrange itself to let the user have a better view of the diagram. For example, in labview, if you press ctl+u the block diagrams will be auto arranged. May be this is a feature that will be really useful for simulink.

Will replied on : 8 of 20

I have a problem with the smart routing, and I’d like to know if I can temporarily turn it off (or change its behavior). I have a top level model with my signal lines arranged in a particular way (in this case SimPowerSystems connections), and if I delete a subsystem and replace it with another one, all of the connections change (supposedly in the smart way), and I have to manually change them back again how I want them. Any idea how to work through this scenario?

Will replied on : 9 of 20

Mathworks support helped me with my problem, and I’d like to pass the info along to others. There is no way right now to disable smart routing or paste/replace a block without smart routing re-drawing all of your manually routed signals. However, the workaround is to use the “replace_block” command.

If you have a model called “ReplaceBlockExample” with two subsystems “Subsystem1” and “Subsystem2”, and you want to replace “Subsystem1” with a copy of “Subsystem2” without changing the signal routing, the command would be as follows:

>> replace_block(‘ReplaceBlockExample’,’Name’,’Subsystem1′,’ReplaceBlockExample/Subsystem2′)

There is a Guy and Seth on Simulink post about this “replace_block” command, but it isn’t clear on how to do subsystems, not just blocks, so I hope this helps.

desai priyanka replied on : 11 of 20

All the signal line in Simulink model should be placed in such a way that they should not overlap with each other ,they can only cross at single point. I want scripting assignment for this.

Frank replied on : 12 of 20

Back at my former company, I had to use Simulink 2010b. Signal routing was not superb but reproducable. Now, I have 2013b and 2014a and it has become *really* awfull. The new router does a decent job in straight-forward cases but it massively fails when rearranging some blocks without disconnecting all signals (which is a very common use-cas for me). In addition, it does not always seem to be possible to align signals.

Is there any option (which I might have missed) to switch off the smart routing? If not: Please consider making it optional. It drives me crazy!

Kyle replied on : 13 of 20

I don’t know if this is the correct location but I would like to see the ability to disable this “smart” function in a future release. It causes much more rework than it saves. In my personal experience working in 2012b and R13 concurrently, R13 does a significantly better job routing large numbers of lines than 2012b.

None replied on : 14 of 20

I wish I could disable this too. I hate to say it, but this autorouting is the biggest POS to come out of MathWorks in years…

JW Harris replied on : 15 of 20

Auto routing is a disaster that is destroying my models. It might work fine for students drawing simple models from scratch, but obioulsly the kids that came up with this one didn’t understand all the editing use cases. PLEASE GIVE US A WAY TO TRUN IT OFF and enable what worked in ’12 and back. I need to be able to use cursors to jog signals, also.

LC replied on : 17 of 20

I also join to the rest of the users feedback here. We really need an option to turn this feature OFF. It works for simple cases, but for replacing blocks, or when I actually want the line to go across a given block (i.e. subsystem) the routing always does a terrible job. I need for those cases to be able to turn it OFF, and then turn it back on whenever I need it.

Radek replied on : 18 of 20

I can’t believe you didn’t fix this algorithm for 3 years (2015b) . That thing doesn’t consider other lines when routing. In result we have a net of crossing lines. They were being routed better in old version.

DJB replied on : 19 of 20

I have to agree with some of the other people who posted a response. Autorouting needs to have an option to turn it off. It’s making a complete disaster out of my models which are all rather large and complicated. Instead of saving time it’s costing me many hours of additional pointless labor to clean up what were once neat, clean diagrams. I like the toolset but deploying a feature before it’s ready seems to happen too often. Disappointing.

Matt replied on : 20 of 20

I agree with the most recent responders. I want a way to disable this “feature”. I spend more time fixing the automatic line routing than any other activity I perform in Simulink. Please, let me turn this off.

Add A Comment

Your email address will not be published. Required fields are marked *


Preview: hide