File Exchange Pick of the Week

Our best user submissions

Make Simulink Line Crossing More Distinct

Greg's pick this week is Better line crossings in Simulink models by Josef Rieger,

Contents

Make It Easier to Follow Signal Lines that Cross

For those of you who have developed electrical circuit schematics, you are no doubt familiar with the concept of “line hops”. You apply these to distinctly demonstrate that two wires that may cross on the schematic do not represent an electrical connection.

Josef applies the same concept to Simulink diagrams.

But Doesn’t Simulink Already Distinguish Between Line Connections and Crossings?

Simulink does distinctly show when two signal lines are connected by the use of a “solder joint”. Many people who develop electrical schematics apply this syntax as well to signify an electrical connection.

However, it is possible to have two signal lines meet, to look like a line crossing, but do not actually cross, making it difficult to distinguish which path goes where.

The use of line hops would prevent confusion in cases like this. Having said that, you should probably avoid these types of potential confusing diagrams in the first place.

In the latest version of Simulink in Release R2012b, the new line routing algorithms are much better at avoiding these types of potentially confusing depictions. For this example I had to explicitly modify the lines so they appear to cross.

So How Does Josef Do It?

Josef relies on the default grid size used when drawing out Simulink signal lines as a means to distinguish between line hops and other types of line crossings. That way it is possible to:

  • Toggle line hops “on” and “off”
  • Prevent the creation of line hops on top of existing line hops

He applies the use of the MATLAB application programming interface (API) for Simulink to determine what lines exist in Simulink, their respective coordinates on the Simulink diagram, and to apply the line hops to the existing Simulink signals.

For more information on the MATLAB API for Simulink, see the documentation for get_param and set_param.

Comments

If you would like to leave any comments regarding this post, please click here.




Published with MATLAB® 8.0

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.