1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
\r
5 <!--(==============================================================)-->
\r
6 <!--(Document created with RoboEditor. )============================-->
\r
7 <!--(==============================================================)-->
\r
11 <title>Switch nodes</title>
\r
13 <!--(Meta)==========================================================-->
\r
15 <meta http-equiv=content-type content="text/html; charset=windows-1252">
\r
16 <meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">
\r
17 <meta name=generator-major-version content=0.1>
\r
18 <meta name=generator-minor-version content=1>
\r
19 <meta name=filetype content=kadov>
\r
20 <meta name=filetype-version content=1>
\r
21 <meta name=page-count content=1>
\r
22 <meta name=layout-height content=1670>
\r
23 <meta name=layout-width content=773>
\r
26 <!--(Links)=========================================================-->
\r
28 <link rel='stylesheet' href='../default_ns.css'>
\r
29 <script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">
\r
31 if (navigator.appName !="Netscape")
\r
32 { document.write("<link rel='stylesheet' href='../default.css'>");}
\r
35 <style type="text/css">
\r
37 h1.whs1 {text-align: justify;}
\r
38 p.whs2 {text-align: justify;}
\r
39 img_whs3 {border-style: none; border: none; width: 30px; height: 30px; float: none;}
\r
40 p.whs4 {font-style: italic; text-align: justify;}
\r
41 img_whs5 {border-style: none; border: none; width: 751px; height: 332px; float: none;}
\r
42 p.whs6 {font-family: 'Courier New', monospace; text-align: justify;}
\r
43 p.whs7 {margin-left: 40px; font-family: 'Courier New', monospace; text-align: justify;}
\r
44 p.whs8 {margin-left: 80px; font-family: 'Courier New', monospace; text-align: justify;}
\r
45 p.whs9 {margin-left: 40px; text-align: justify;}
\r
46 p.whs10 {margin-left: 0px; text-align: justify;}
\r
47 p.whs11 {background-image:url(../texture_horiz_ltbluebubbles.jpg); text-align:justify; }
\r
48 img_whs12 {border-style: none; border: none; float: none; width: 36px; height: 38px;}
\r
49 ul.whs13 {list-style: disc;}
\r
52 <script type="text/javascript" language="JavaScript">
\r
54 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
\r
56 var strNSS = "<style type='text/css'>";
\r
57 strNSS += "p.whs10 {margin-left:1; }";
\r
58 strNSS +="</style>";
\r
59 document.write(strNSS);
\r
63 <script type="text/javascript" language="JavaScript" title="BSSC Special Effects" src="../ehlpdhtm.js"></script><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
\r
66 if (innerWidth != origWidth || innerHeight != origHeight)
\r
69 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
\r
70 origWidth = innerWidth;
\r
71 origHeight = innerHeight;
\r
77 <style type="text/css">
\r
79 div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}
\r
82 <script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>
\r
83 <script type="text/javascript" language="javascript" src="../whver.js"></script>
\r
84 <script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>
\r
85 <script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>
\r
86 <script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>
\r
89 <!--(Body)==========================================================-->
\r
94 <script type="text/javascript" language="javascript1.2">
\r
96 if (window.gbWhTopic)
\r
98 if (window.addTocInfo)
\r
100 addTocInfo("SUPERVISION module\nEditing graphs\nNodes in the graph\nSwitch nodes");
\r
101 addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");
\r
104 if (window.writeBtnStyle)
\r
107 if (window.writeIntopicBar)
\r
108 writeIntopicBar(1);
\r
110 if (window.setRelStartPage)
\r
112 setRelStartPage("../supervision.html");
\r
120 document.location.reload();
\r
123 <h1 class="whs1">Switch nodes</h1>
\r
125 <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
126 nodes present Switch: start Switch and end Switch. Nodes of such type
\r
127 are always InLine nodes. You have to supply this type of node by service,
\r
128 which will perform switching. That's why nodes of such type can have at
\r
129 least two or more switch ports (Boolean), but only one switch port can
\r
130 have "True" value at a definite moment of graph execution. With
\r
131 that kind of node you can define all kinds of tests or switches :</p>
\r
133 <p class="whs4">
\93if( condition ) ;
\r
134 else if( condition )
\85 ; else
\94 or</p>
\r
136 <p class="whs4">
\93switch( variable )
\r
137 ; case value
\85; default
\94.</p>
\r
139 <p class="whs4">Etc
\85</p>
\r
141 <p class="whs4"> </p>
\r
143 <p class="whs2"><img src="../switch.jpg" x-maintain-ratio="TRUE" width="751px" height="332px" border="0" class="img_whs5"></p>
\r
145 <p class="whs2"> </p>
\r
147 <p class="whs2"><span style="font-weight: bold;"><B>Titles
\r
148 of the nodes.</B></span> By default the name of the service is used. You can
\r
149 change only the name of the Start Switch node - the name of the End Switch
\r
150 node will be automatically created as follows: EndOf + "Name of the
\r
151 Start Switch node" .</p>
\r
153 <p class="whs2"><span style="font-weight: bold;"><B>Status
\r
154 of execution</B></span> shows state of the loop. It can be: Not Started, Running,
\r
157 <p class="whs2"><span style="font-weight: bold;"><B>InGate/OutGate</B></span>
\r
158 - control ports of the loop execution. </p>
\r
160 <p class="whs2"><span style="font-weight: bold;"><B>SwitchPort</B></span>
\r
161 \96 ports for control management of the Switch. The values in this ports
\r
162 are of boolean type and can be 0 or 1. They must be connected to InGate
\r
163 ports of the correspondent computation nodes.</p>
\r
165 <p class="whs2"><span style="font-weight: bold;"><B>Input/Output
\r
166 ports</B></span>
\96 Input
\r
167 port of the Start Switch node will get the initial value, which can be
\r
168 processed by underlying Python function and will be transferred inside
\r
169 of the switch. The last computation node of the switch will put this value
\r
170 to the input port of the End Switch node. </p>
\r
172 <p class="whs2"> </p>
\r
174 <p class="whs2">The associated Python function will have
\r
175 all input ports of the Switch node as input arguments. And that function
\r
176 must return a value for all output ports. A simple example of this Python
\r
179 <p class="whs2"> </p>
\r
181 <p class="whs6">def
\r
182 Switch(x): </p>
\r
184 <p class="whs7">i1=0 </p>
\r
186 <p class="whs7">i2=0 </p>
\r
188 <p class="whs7">i3=0 </p>
\r
190 <p class="whs7">if x>13: </p>
\r
192 <p class="whs8">i1=1 </p>
\r
194 <p class="whs7">elif x==13: </p>
\r
196 <p class="whs8">i2=1 </p>
\r
198 <p class="whs7">else: </p>
\r
200 <p class="whs8">i3=1 </p>
\r
202 <p class="whs9"><span style="font-family: 'Courier New', monospace;">return
\r
203 i1,i2,i3</span> </p>
\r
205 <p class="whs9"> </p>
\r
207 <p class="whs10">In this example <span
\r
208 style="font-weight: bold;"><B>i1, i2, i3</B></span> parameters of the function
\r
209 correspond to Switch ports of the node. So, depending on the result of
\r
210 execution of the initial condition (in our case it's a comparison of the
\r
211 input parameter with an integer 13), one of the switch ports will get
\r
212 the value 1. And this port will transmit further dataflow to
\r
213 the corresponding node. </p>
\r
215 <p class="whs2"> </p>
\r
217 <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
219 <p class="whs2"> </p>
\r
221 <ul type="disc" class="whs13">
\r
223 <li class=kadov-p><p class="whs2">You must define at
\r
224 first boolean output ports which correspond to cases of the switch. They
\r
225 must be connected to Input Gates of head nodes of each branch of switch.
\r
228 <li class=kadov-p><p class="whs2"><span style="font-family: 'Times New Roman', serif;">A
\r
229 branch of condition may begin with one or some nodes if there is parallelism
\r
230 of execution of nodes.</span></p></li>
\r
232 <li class=kadov-p><p class="whs2">During execution
\r
233 of the Switch there can be <span style="font-weight: bold;"><B>one and only
\r
234 one</B></span> such boolean output port with a
\93true
\94 value.</p></li>
\r
236 <li class=kadov-p><p class="whs2">The input ports created
\r
237 by the user in an End Switch node are automatically duplicated by the
\r
238 SuperVision component as output ports of the End Switch node. That component
\r
239 will fill the value of such output ports with the corresponding values
\r
240 of such input ports at execution time.</p></li>
\r
242 <li class=kadov-p><p class="whs2">Each branch of the
\r
243 switch must have links to all input ports of the End Switch node.</p></li>
\r
245 <li class=kadov-p><p class="whs2">But at execution
\r
246 time, there will be only one branch executed.</p></li>
\r
248 <li class=kadov-p><p class="whs2">The end of branch
\r
249 of a switch may have one or some nodes if there is parallelism of execution
\r
253 <p class="whs2"> </p>
\r
255 <p class="whs2"> </p>
\r
258 <a href="javascript:void(0);" onClick="var e; if (parseInt(navigator.appVersion)>=4){e=event;} if (parseInt(navigator.appVersion) >=2 && typeof(PopupMenu_Invoke) == 'function') PopupMenu_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></p>
\r
260 <p class="whs2"> </p>
\r
262 <p class="whs2"> </p>
\r
264 <p class="whs2"> </p>
\r
266 <script type="text/javascript" language="JavaScript" title="WebHelpRelatedTopics"><!--
\r
267 if (parseInt(navigator.appVersion) >= 3 && typeof (WritePopupMenuLayer) == "function")
\r
268 WritePopupMenuLayer();
\r
269 //--></script><script type="text/javascript" language="javascript1.2">
\r
271 if (window.writeIntopicBar)
\r
272 writeIntopicBar(0);
\r