Guy and Seth on Simulink

Smart Signal Routing 14

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

Conclusion

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!

14 CommentsOldest to Newest

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

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.

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”

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:

http://krza.de/Simulink_before_after.png

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!

Kristian

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.

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

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.
-Will

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.

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!

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.

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…

Add A Comment

What is 2 + 9?

Preview: hide

These postings are the author's and don't necessarily represent the opinions of MathWorks.