File Exchange Pick of the Week

Our best user submissions

Clean Up Your Simulink Model

Greg's pick this week is BOT by Joerg Buchholz. Have you ever received a Simulink model that looked more like a bowl of spaghetti than a useful diagram where you could tell what was going on? Better yet, have you built such a Simulink model, and then regretted it later when you tried to make a change to the model? If this is the case, I bet you wished there was a button you could press to clean up and reorganize the model so it would be easier to read and understand. Joerg's entry, BOT, attempts to provide such a solution. Plus it has a nice App and animation feature to go with it. Organize Layout of Simulink Model In essence, BOT works by resizing blocks according to number of ports, move blocks, and adjust signal lines to simplify the interpretation of the Simulink model diagram: This is a screen capture of the animation feature provided by BOT. The animation gives a nice sense of progress to the results of the optimization. For the screen capture, I sped up the video by 3x. The various options for the block diagram layout optimization routine are made accessible through a nice, simple user interface: BOT is an excellent attempt at a hard problem Optimizing the layout of a block diagram, especially for visual interpretation is a non-trivial task. There are a large number of competing constraints, with potentially different priorities. Not to mention the difficulty in determining quantitatively if the diagram is in fact "cleaned up". For example, the elimination of overlapping blocks might have higher priority than intersecting lines. But should elimination of co-linear Simulink signals (i.e. Simulink signals that overlap by laying one on top of another) have higher or lower priority than elimination of overlapping blocks? Should block size be a function of just the number of ports, or also the size of the blocks from which the signals originated? This might make the diagram simpler to interpret, but could result in model diagrams exploding in the screen area. Is BOT always successful? No. In short BOT cannot always improve a Simulink model's layout. I tried a couple of models that I downloaded from the File Exchange, and BOT had a tough time resolving line crossings which would involve moving blocks from one side of a Simulink signal line to the other side. However, this entry has inspired me personally. I have spent long hours, way more than one probably should, thinking about this type of problem: how to measure things like how understandable a block diagram is; how the various constraints should be weighted; etc. A few others have looked at this too. In general our customers have built their own tools to deal with this class of problem. Comments This is already a great start. Anyone up for a challenge to extend it by adding some of the priorities I talked about above? Or simply give this a try and let us know what you think here and leave a comment for Joerg.

Published with MATLAB® R2014a

  • print


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