1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
\r
6 <title>Switch nodes</title>
\r
7 <meta http-equiv="content-type" content="text/html; charset=windows-1252">
\r
8 <meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com">
\r
9 <link rel="stylesheet" href="../default_ns.css"><script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">
\r
11 if (navigator.appName !="Netscape")
\r
12 { document.write("<link rel='stylesheet' href='../default.css'>");}
\r
15 <style type="text/css">
\r
17 h1.whs1 { text-align:justify; }
\r
18 p.whs2 { text-align:justify; }
\r
19 img_whs3 { border:none; width:30px; height:30px; float:none; }
\r
20 p.whs4 { font-style:italic; text-align:justify; }
\r
21 img_whs5 { border-style:none; border:none; width:751px; height:332px; float:none; }
\r
22 p.whs6 { font-family:'Courier New' , monospace; text-align:justify; }
\r
23 p.whs7 { margin-left:40px; font-family:'Courier New' , monospace; text-align:justify; }
\r
24 p.whs8 { margin-left:80px; font-family:'Courier New' , monospace; text-align:justify; }
\r
25 p.whs9 { margin-left:40px; text-align:justify; }
\r
26 p.whs10 { margin-left:0px; text-align:justify; }
\r
27 p.whs11 { background-image:url('../texture_horiz_ltbluebubbles.jpg'); text-align:justify; }
\r
28 img_whs12 { border-style:none; border:none; float:none; width:36px; height:38px; }
\r
29 ul.whs13 { list-style:disc; }
\r
31 </style><script type="text/javascript" language="JavaScript">
\r
33 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
\r
35 var strNSS = "<style type='text/css'>";
\r
36 strNSS += "p.whs10 {margin-left:1pt; }";
\r
37 strNSS +="</style>";
\r
38 document.write(strNSS);
\r
42 <script type="text/javascript" language="JavaScript" title="BSSC Special Effects" src="../ehlpdhtm.js"></script><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
\r
45 if (innerWidth != origWidth || innerHeight != origHeight)
\r
48 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
\r
49 origWidth = innerWidth;
\r
50 origHeight = innerHeight;
\r
56 <style type="text/css">
\r
58 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
\r
60 </style><script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>
\r
61 <script type="text/javascript" language="javascript" src="../whver.js"></script>
\r
62 <script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>
\r
63 <script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>
\r
64 <script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>
\r
66 <body><script type="text/javascript" language="javascript1.2">
\r
68 if (window.gbWhTopic)
\r
70 if (window.addTocInfo)
\r
72 addTocInfo("SUPERVISION module\nEditing graphs\nNodes in the graph\nSwitch nodes");
\r
73 addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");
\r
76 if (window.writeBtnStyle)
\r
79 if (window.writeIntopicBar)
\r
82 if (window.setRelStartPage)
\r
84 setRelStartPage("../supervision.htm");
\r
93 document.location.reload();
\r
96 <h1 class="whs1">Switch nodes</h1>
\r
98 <p class="whs2"><span style="font-weight: bold;"><B><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs3">Switch node</B></span> is a kind of Control node. In fact two
\r
99 nodes present Switch: start Switch and end Switch. Nodes of such type
\r
100 are always InLine nodes. You have to supply this type of node by service,
\r
101 which will perform switching. That's why nodes of such type can have at
\r
102 least two or more switch ports (Boolean), but only one switch port can
\r
103 have "True" value at a definite moment of graph execution. With
\r
104 that kind of node you can define all kinds of tests or switches :</p>
\r
106 <p class="whs4">
\93if( condition ) ;
\r
107 else if( condition )
\85 ; else
\94 or</p>
\r
109 <p class="whs4">
\93switch( variable )
\r
110 ; case value
\85; default
\94.</p>
\r
112 <p class="whs4">Etc
\85</p>
\r
114 <p class="whs4"> </p>
\r
116 <p class="whs2"><img src="../switch.jpg" x-maintain-ratio="TRUE" width="751px" height="332px" border="0" class="img_whs5"></p>
\r
118 <p class="whs2"> </p>
\r
120 <p class="whs2"><span style="font-weight: bold;"><B>Titles
\r
121 of the nodes.</B></span> By default the name of the service is used. You can
\r
122 change only the name of the Start Switch node - the name of the End Switch
\r
123 node will be automatically created as follows: EndOf + "Name of the
\r
124 Start Switch node" .</p>
\r
126 <p class="whs2"><span style="font-weight: bold;"><B>Status
\r
127 of execution</B></span> shows state of the loop. It can be: Not Started, Running,
\r
130 <p class="whs2"><span style="font-weight: bold;"><B>InGate/OutGate</B></span>
\r
131 - control ports of the loop execution. </p>
\r
133 <p class="whs2"><span style="font-weight: bold;"><B>SwitchPort</B></span>
\r
134 \96 ports for control management of the Switch. The values in this ports
\r
135 are of boolean type and can be 0 or 1. They must be connected to InGate
\r
136 ports of the correspondent computation nodes.</p>
\r
138 <p class="whs2"><span style="font-weight: bold;"><B>Input/Output
\r
139 ports</B></span>
\96 Input
\r
140 port of the Start Switch node will get the initial value, which can be
\r
141 processed by underlying Python function and will be transferred inside
\r
142 of the switch. The last computation node of the switch will put this value
\r
143 to the input port of the End Switch node. </p>
\r
145 <p class="whs2"> </p>
\r
147 <p class="whs2">The associated Python function will have
\r
148 all input ports of the Switch node as input arguments. And that function
\r
149 must return a value for all output ports. A simple example of this Python
\r
152 <p class="whs2"> </p>
\r
154 <p class="whs6">def
\r
155 Switch(x): </p>
\r
157 <p class="whs7">i1=0 </p>
\r
159 <p class="whs7">i2=0 </p>
\r
161 <p class="whs7">i3=0 </p>
\r
163 <p class="whs7">if x>13: </p>
\r
165 <p class="whs8">i1=1 </p>
\r
167 <p class="whs7">elif x==13: </p>
\r
169 <p class="whs8">i2=1 </p>
\r
171 <p class="whs7">else: </p>
\r
173 <p class="whs8">i3=1 </p>
\r
175 <p class="whs9"><span style="font-family: 'Courier New', monospace;">return
\r
176 i1,i2,i3</span> </p>
\r
178 <p class="whs9"> </p>
\r
180 <p class="whs10">In this example <span
\r
181 style="font-weight: bold;"><B>i1, i2, i3</B></span> parameters of the function
\r
182 correspond to Switch ports of the node. So, depending on the result of
\r
183 execution of the initial condition (in our case it's a comparison of the
\r
184 input parameter with an integer 13), one of the switch ports will get
\r
185 the value 1. And this port will transmit further dataflow to
\r
186 the corresponding node. </p>
\r
188 <p class="whs2"> </p>
\r
190 <p class="whs11"><img src="../note1.gif" x-maintain-ratio="TRUE" width="36px" height="38px" border="0" class="img_whs12">Switch nodes have the following particularities:</p>
\r
192 <p class="whs2"> </p>
\r
194 <ul type="disc" class="whs13">
\r
196 <li class=kadov-p><p class="whs2">You must define at
\r
197 first boolean output ports which correspond to cases of the switch. They
\r
198 must be connected to Input Gates of head nodes of each branch of switch.
\r
201 <li class=kadov-p><p class="whs2"><span style="font-family: 'Times New Roman', serif;">A
\r
202 branch of condition may begin with one or some nodes if there is parallelism
\r
203 of execution of nodes.</span></p></li>
\r
205 <li class=kadov-p><p class="whs2">During execution
\r
206 of the Switch there can be <span style="font-weight: bold;"><B>one and only
\r
207 one</B></span> such boolean output port with a
\93true
\94 value.</p></li>
\r
209 <li class=kadov-p><p class="whs2">The input ports created
\r
210 by the user in an End Switch node are automatically duplicated by the
\r
211 SuperVision component as output ports of the End Switch node. That component
\r
212 will fill the value of such output ports with the corresponding values
\r
213 of such input ports at execution time.</p></li>
\r
215 <li class=kadov-p><p class="whs2">Each branch of the
\r
216 switch must have links to all input ports of the End Switch node.</p></li>
\r
218 <li class=kadov-p><p class="whs2">But at execution
\r
219 time, there will be only one branch executed.</p></li>
\r
221 <li class=kadov-p><p class="whs2">The end of branch
\r
222 of a switch may have one or some nodes if there is parallelism of execution
\r
226 <p class="whs2"> </p>
\r
228 <p class="whs2"> </p>
\r
231 <a href="javascript:void(0);" onClick="var e; if (parseInt(navigator.appVersion)>=4){e=event;} if (parseInt(navigator.appVersion) >=2 && typeof(PickupDialog_Invoke) == 'function') PickupDialog_Invoke(e,'','About nodes','about_nodes.htm','Adding nodes','adding_nodes.htm');return false;" title="Related Topics"><img src="../ss_btn_related_topics.gif" border=0 height=17 width=82 alt="Related Topics"></a>
\r
236 <p class="whs2"> </p>
\r
238 <p class="whs2"> </p>
\r
240 <p class="whs2"> </p>
\r
242 <script type="text/javascript" language="JavaScript" title="WebHelpRelatedTopics"><!--
\r
243 if (parseInt(navigator.appVersion) >= 3 && typeof (WritePopupMenuLayer) == "function")
\r
244 WritePopupMenuLayer();
\r
245 //--></script><script type="text/javascript" language="javascript1.2">
\r
247 if (window.writeIntopicBar)
\r
248 writeIntopicBar(0);
\r