<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Better Bus Modeling (How to remove Bus/Mux confusion)</title>
	<atom:link href="http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/</link>
	<description>This blog is about Simulink.</description>
	<lastBuildDate>Sat, 11 Feb 2012 11:34:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Renish</title>
		<link>http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-817</link>
		<dc:creator>Renish</dc:creator>
		<pubDate>Fri, 31 Jul 2009 08:30:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-817</guid>
		<description>clc;
clear all;
% To Open a new model file the Existing Model
% new_system(&#039;Chaining_Diagram&#039;,&#039;Model&#039;)

% To Open the Existing Model 
open_system(&#039;Chaining_Diagram&#039;) 
Pos = [115, 88, 155, 122];
for i = 1:3
    % To add a block to the model
    h = add_block(&#039;simulink/Ports &amp; Subsystems/Subsystem&#039;, &#039;Chaining_Diagram/Subsystem&#039;, &#039;MakeNameUnique&#039;, &#039;on&#039;);
    if i == 1
            add_block(&#039;simulink/Sources/In1&#039;,&#039;Chaining_Diagram/Subsystem/In1&#039;, &#039;MakeNameUnique&#039;, &#039;on&#039;);
            add_block(&#039;simulink/Sinks/Out1&#039;, &#039;Chaining_Diagram/Subsystem/In1&#039;, &#039;MakeNameUnique&#039;, &#039;on&#039;);
    else
            path = strcat(&#039;Chaining_Diagram/Subsystem&#039;,num2str(i-1),&#039;/In1&#039;);
            add_block(&#039;simulink/Sources/In1&#039;, path, &#039;MakeNameUnique&#039;, &#039;on&#039;);
            add_block(&#039;simulink/Sinks/Out1&#039;, path, &#039;MakeNameUnique&#039;, &#039;on&#039;);
    end
    % To set the Dimension of the block
    set_param(h, &#039;Position&#039;, Pos)
    set_param(h, &#039;ShowPortLabels&#039;,&#039;off&#039;) 
    BlkName = strcat(&#039;disp(&#039;,num2str(i),&#039;)&#039;);
    set_param(h, &#039;MaskDisplay&#039;,BlkName)
    set_param(h, &#039;ShowName&#039;,&#039;off&#039;)
    set_param(h, &#039;Mask&#039;,&#039;on&#039;)
    Pos = Pos + [0, 100, 0, 100];
end
add_line(&#039;Chaining_Diagram&#039;,&#039;Subsystem/1&#039;,&#039;Subsystem2/2&#039;,&#039;autorouting&#039;,&#039;on&#039;)
add_line(&#039;Chaining_Diagram&#039;,&#039;Subsystem/2&#039;,&#039;Subsystem1/1&#039;,&#039;autorouting&#039;,&#039;on&#039;)
add_line(&#039;Chaining_Diagram&#039;,&#039;Subsystem1/1&#039;,&#039;Subsystem2/1&#039;,&#039;autorouting&#039;,&#039;on&#039;)
add_line(&#039;Chaining_Diagram&#039;,&#039;Subsystem1/2&#039;,&#039;Subsystem/2&#039;,&#039;autorouting&#039;,&#039;on&#039;)
add_line(&#039;Chaining_Diagram&#039;,&#039;Subsystem2/1&#039;,&#039;Subsystem/1&#039;,&#039;autorouting&#039;,&#039;on&#039;)
add_line(&#039;Chaining_Diagram&#039;,&#039;Subsystem2/2&#039;,&#039;Subsystem1/2&#039;,&#039;autorouting&#039;,&#039;on&#039;)

% To save the open System
save_system(&#039;Chaining_Diagram&#039;)

*******************************************
when this piece of code which i wrote is executed, connecting lines are getting overlapped. Any help to make it non Overlapping?
Thanks in advance</description>
		<content:encoded><![CDATA[<p>clc;<br />
clear all;<br />
% To Open a new model file the Existing Model<br />
% new_system(&#8216;Chaining_Diagram&#8217;,'Model&#8217;)</p>
<p>% To Open the Existing Model<br />
open_system(&#8216;Chaining_Diagram&#8217;)<br />
Pos = [115, 88, 155, 122];<br />
for i = 1:3<br />
    % To add a block to the model<br />
    h = add_block(&#8216;simulink/Ports &amp; Subsystems/Subsystem&#8217;, &#8216;Chaining_Diagram/Subsystem&#8217;, &#8216;MakeNameUnique&#8217;, &#8216;on&#8217;);<br />
    if i == 1<br />
            add_block(&#8216;simulink/Sources/In1&#8242;,&#8217;Chaining_Diagram/Subsystem/In1&#8242;, &#8216;MakeNameUnique&#8217;, &#8216;on&#8217;);<br />
            add_block(&#8216;simulink/Sinks/Out1&#8242;, &#8216;Chaining_Diagram/Subsystem/In1&#8242;, &#8216;MakeNameUnique&#8217;, &#8216;on&#8217;);<br />
    else<br />
            path = strcat(&#8216;Chaining_Diagram/Subsystem&#8217;,num2str(i-1),&#8217;/In1&#8242;);<br />
            add_block(&#8216;simulink/Sources/In1&#8242;, path, &#8216;MakeNameUnique&#8217;, &#8216;on&#8217;);<br />
            add_block(&#8216;simulink/Sinks/Out1&#8242;, path, &#8216;MakeNameUnique&#8217;, &#8216;on&#8217;);<br />
    end<br />
    % To set the Dimension of the block<br />
    set_param(h, &#8216;Position&#8217;, Pos)<br />
    set_param(h, &#8216;ShowPortLabels&#8217;,'off&#8217;)<br />
    BlkName = strcat(&#8216;disp(&#8216;,num2str(i),&#8217;)');<br />
    set_param(h, &#8216;MaskDisplay&#8217;,BlkName)<br />
    set_param(h, &#8216;ShowName&#8217;,'off&#8217;)<br />
    set_param(h, &#8216;Mask&#8217;,'on&#8217;)<br />
    Pos = Pos + [0, 100, 0, 100];<br />
end<br />
add_line(&#8216;Chaining_Diagram&#8217;,'Subsystem/1&#8242;,&#8217;Subsystem2/2&#8242;,&#8217;autorouting&#8217;,'on&#8217;)<br />
add_line(&#8216;Chaining_Diagram&#8217;,'Subsystem/2&#8242;,&#8217;Subsystem1/1&#8242;,&#8217;autorouting&#8217;,'on&#8217;)<br />
add_line(&#8216;Chaining_Diagram&#8217;,'Subsystem1/1&#8242;,&#8217;Subsystem2/1&#8242;,&#8217;autorouting&#8217;,'on&#8217;)<br />
add_line(&#8216;Chaining_Diagram&#8217;,'Subsystem1/2&#8242;,&#8217;Subsystem/2&#8242;,&#8217;autorouting&#8217;,'on&#8217;)<br />
add_line(&#8216;Chaining_Diagram&#8217;,'Subsystem2/1&#8242;,&#8217;Subsystem/1&#8242;,&#8217;autorouting&#8217;,'on&#8217;)<br />
add_line(&#8216;Chaining_Diagram&#8217;,'Subsystem2/2&#8242;,&#8217;Subsystem1/2&#8242;,&#8217;autorouting&#8217;,'on&#8217;)</p>
<p>% To save the open System<br />
save_system(&#8216;Chaining_Diagram&#8217;)</p>
<p>*******************************************<br />
when this piece of code which i wrote is executed, connecting lines are getting overlapped. Any help to make it non Overlapping?<br />
Thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guy</title>
		<link>http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-816</link>
		<dc:creator>Guy</dc:creator>
		<pubDate>Wed, 29 Jul 2009 17:54:35 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-816</guid>
		<description>@Angelo: The function “busCreatorddg” is an undocumented internal function. I recommend not using this function. It can change without advice in a future release of MATLAB. If you use it you will face problem when upgrading. 

As I mentioned previously, I would like to better understand the issue. I am not sure what you mean by “to understand that the first 3 signals are indeed just one”. When looking at a bus creator block configured as you mention, It is possible to obtain the handle to the 4 input ports of the bus creator (using get_param(gcb,&#039;PortHandles&#039;)) and obtain their dimension from the CompiledPortDimensions property. In that case the first signal (the one created by a mux) has a dimension of 3 and the other ports a dimension of 1.

Maybe you could send me example model and script by email so that I could better understand what you are looking for and propose a more appropriate solution.  

Finally, I apologize for not being clear, but the Vector Concatenate block would not add blocks to your model, it would replace the mux block.

Guy</description>
		<content:encoded><![CDATA[<p>@Angelo: The function “busCreatorddg” is an undocumented internal function. I recommend not using this function. It can change without advice in a future release of MATLAB. If you use it you will face problem when upgrading. </p>
<p>As I mentioned previously, I would like to better understand the issue. I am not sure what you mean by “to understand that the first 3 signals are indeed just one”. When looking at a bus creator block configured as you mention, It is possible to obtain the handle to the 4 input ports of the bus creator (using get_param(gcb,&#8217;PortHandles&#8217;)) and obtain their dimension from the CompiledPortDimensions property. In that case the first signal (the one created by a mux) has a dimension of 3 and the other ports a dimension of 1.</p>
<p>Maybe you could send me example model and script by email so that I could better understand what you are looking for and propose a more appropriate solution.  </p>
<p>Finally, I apologize for not being clear, but the Vector Concatenate block would not add blocks to your model, it would replace the mux block.</p>
<p>Guy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Angelo</title>
		<link>http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-815</link>
		<dc:creator>Angelo</dc:creator>
		<pubDate>Wed, 29 Jul 2009 07:42:52 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-815</guid>
		<description>@Guy: Unfortunately, as you said, I can&#039;t switch on &quot;error&quot; the “Mux blocks used to create bus signals” diagnostic so I&#039;m looking for different solutions. I have found that the Mathworks &#039;busCreatorddg&#039; function, called with a double click on bus creator, gathers all the entering signal&#039;s structure in the &#039;UserData&#039; field, exactly as I need. What I don&#039;t understand is how can I call this function by command (or better by callback considering I created one for other reasons) and more in detail which arguments (&#039;source&#039; and &#039;block&#039;) should I have to pass for run the function and extract the &quot;precious&quot; data. For the &#039;block&#039; argument it should be the Bus Creator block (Name? Handle?) but what about &#039;source&#039;?

Do you have any clue about that?

PS I&#039;m trying to avoid add simulink blocks but extracting these data by command, this is why didn&#039;t considerate the Vector Concatenate block.

Thank you.

angelo</description>
		<content:encoded><![CDATA[<p>@Guy: Unfortunately, as you said, I can&#8217;t switch on &#8220;error&#8221; the “Mux blocks used to create bus signals” diagnostic so I&#8217;m looking for different solutions. I have found that the Mathworks &#8216;busCreatorddg&#8217; function, called with a double click on bus creator, gathers all the entering signal&#8217;s structure in the &#8216;UserData&#8217; field, exactly as I need. What I don&#8217;t understand is how can I call this function by command (or better by callback considering I created one for other reasons) and more in detail which arguments (&#8216;source&#8217; and &#8216;block&#8217;) should I have to pass for run the function and extract the &#8220;precious&#8221; data. For the &#8216;block&#8217; argument it should be the Bus Creator block (Name? Handle?) but what about &#8216;source&#8217;?</p>
<p>Do you have any clue about that?</p>
<p>PS I&#8217;m trying to avoid add simulink blocks but extracting these data by command, this is why didn&#8217;t considerate the Vector Concatenate block.</p>
<p>Thank you.</p>
<p>angelo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guy</title>
		<link>http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-814</link>
		<dc:creator>Guy</dc:creator>
		<pubDate>Tue, 28 Jul 2009 23:31:35 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-814</guid>
		<description>@Angelo, The situation you describe seems exactly the kind of situation where the &quot;Mux blocks used to create bus signals&quot; diagnostic should be set to error. This should change the dimension &quot;3{3}&quot; to &quot;3&quot;. If it does not I would be very interested to get a model and reproduce. If setting this diagnostic to error is not possible for you because of other reasons, probably the Vector Concatenate block could help. This block generates a contiguous output signal.</description>
		<content:encoded><![CDATA[<p>@Angelo, The situation you describe seems exactly the kind of situation where the &#8220;Mux blocks used to create bus signals&#8221; diagnostic should be set to error. This should change the dimension &#8220;3{3}&#8221; to &#8220;3&#8243;. If it does not I would be very interested to get a model and reproduce. If setting this diagnostic to error is not possible for you because of other reasons, probably the Vector Concatenate block could help. This block generates a contiguous output signal.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Angelo</title>
		<link>http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-812</link>
		<dc:creator>Angelo</dc:creator>
		<pubDate>Tue, 28 Jul 2009 13:25:58 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/seth/2009/07/25/better-bus-modeling-how-to-remove-busmux-confusion/#comment-812</guid>
		<description>Hi Seth,

I&#039;m fighting with a problem involving what you described above and maybe you can suggest me some solution.
In the attempt of assign names by command to signals entering in a block (only by accident a bus creator) I&#039;m not able to distinguish between 2 kind of signals. For example soppose you have these signals:
- a 3{3} signal created by a mux as you explained above
- three scalar signals (1 1 1)
So you have 4 signals (1+3) requiring to be named whereas counting them (for example by means of the CompiledPortDimensions parameter of the Inport of the bus creator) 6 signals (3+3) are tallied up.
Do you know any more parameter (or way) to understand that the first 3 signals are indeed just one (it correspond only one name to them)?

Thanks.

angelo</description>
		<content:encoded><![CDATA[<p>Hi Seth,</p>
<p>I&#8217;m fighting with a problem involving what you described above and maybe you can suggest me some solution.<br />
In the attempt of assign names by command to signals entering in a block (only by accident a bus creator) I&#8217;m not able to distinguish between 2 kind of signals. For example soppose you have these signals:<br />
- a 3{3} signal created by a mux as you explained above<br />
- three scalar signals (1 1 1)<br />
So you have 4 signals (1+3) requiring to be named whereas counting them (for example by means of the CompiledPortDimensions parameter of the Inport of the bus creator) 6 signals (3+3) are tallied up.<br />
Do you know any more parameter (or way) to understand that the first 3 signals are indeed just one (it correspond only one name to them)?</p>
<p>Thanks.</p>
<p>angelo</p>
]]></content:encoded>
	</item>
</channel>
</rss>

