Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[modules/superv.git] / doc / salome / gui / SUPERV / files / switch_nodes.htm
1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
2 \r
3 <html>\r
4 \r
5 <!--(==============================================================)-->\r
6 <!--(Document created with RoboEditor. )============================-->\r
7 <!--(==============================================================)-->\r
8 \r
9 <head>\r
10 \r
11 <title>Switch nodes</title>\r
12 \r
13 <!--(Meta)==========================================================-->\r
14 \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
24 \r
25 \r
26 <!--(Links)=========================================================-->\r
27 \r
28  <link rel='stylesheet' href='../default_ns.css'>\r
29 <script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">\r
30 <!--\r
31 if (navigator.appName !="Netscape")\r
32 {   document.write("<link rel='stylesheet' href='../default.css'>");}\r
33 //-->\r
34 </script>\r
35 <style type="text/css">\r
36 <!--\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
50 -->\r
51 </style>\r
52 <script type="text/javascript" language="JavaScript">\r
53 <!--\r
54 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
55 {\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
60 }\r
61 //-->\r
62 </script>\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
64 <!--\r
65 function reDo() {\r
66   if (innerWidth != origWidth || innerHeight != origHeight)\r
67      location.reload();\r
68 }\r
69 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
70         origWidth = innerWidth;\r
71         origHeight = innerHeight;\r
72         onresize = reDo;\r
73 }\r
74 onerror = null; \r
75 //-->\r
76 </script>\r
77 <style type="text/css">\r
78 <!--\r
79   div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}\r
80 -->\r
81 </style>\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
87 </head>\r
88 \r
89 <!--(Body)==========================================================-->\r
90 \r
91 \r
92 <body>\r
93 \r
94 <script type="text/javascript" language="javascript1.2">\r
95 <!--\r
96 if (window.gbWhTopic)\r
97 {\r
98         if (window.addTocInfo)\r
99         {\r
100         addTocInfo("SUPERVISION module\nEditing graphs\nNodes in the graph\nSwitch nodes");\r
101 addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
102 \r
103         }\r
104         if (window.writeBtnStyle)\r
105                 writeBtnStyle();\r
106 \r
107         if (window.writeIntopicBar)\r
108                 writeIntopicBar(1);\r
109 \r
110         if (window.setRelStartPage)\r
111         {\r
112         setRelStartPage("../supervision.html");\r
113 \r
114                 autoSync(0);\r
115                 sendSyncInfo();\r
116                 sendAveInfoOut();\r
117         }\r
118 }\r
119 else\r
120         document.location.reload();\r
121 //-->\r
122 </script>\r
123 <h1 class="whs1">Switch nodes</h1>\r
124 \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 &quot;True&quot; 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
132 \r
133 <p class="whs4">\93if( condition ) ; \r
134  else if( condition ) \85 ; else\94 or</p>\r
135 \r
136 <p class="whs4">\93switch( variable ) \r
137  ; case value \85; default\94.</p>\r
138 \r
139 <p class="whs4">Etc\85</p>\r
140 \r
141 <p class="whs4">&nbsp;</p>\r
142 \r
143 <p class="whs2"><img src="../switch.jpg" x-maintain-ratio="TRUE" width="751px" height="332px" border="0" class="img_whs5"></p>\r
144 \r
145 <p class="whs2">&nbsp;</p>\r
146 \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 + &quot;Name of the \r
151  Start Switch node&quot; .</p>\r
152 \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
155  Finished.</p>\r
156 \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
159 \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
164 \r
165 <p class="whs2"><span style="font-weight: bold;"><B>Input/Output \r
166  ports</B></span> \96 &nbsp;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
171 \r
172 <p class="whs2">&nbsp;</p>\r
173 \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
177  function:</p>\r
178 \r
179 <p class="whs2">&nbsp;</p>\r
180 \r
181 <p class="whs6">def \r
182  Switch(x): &nbsp;&nbsp;&nbsp;</p>\r
183 \r
184 <p class="whs7">i1=0 &nbsp;&nbsp;&nbsp;</p>\r
185 \r
186 <p class="whs7">i2=0 &nbsp;&nbsp;&nbsp;</p>\r
187 \r
188 <p class="whs7">i3=0 &nbsp;&nbsp;&nbsp;</p>\r
189 \r
190 <p class="whs7">if x&gt;13: &nbsp;&nbsp;&nbsp;</p>\r
191 \r
192 <p class="whs8">i1=1 &nbsp;&nbsp;&nbsp;</p>\r
193 \r
194 <p class="whs7">elif x==13: &nbsp;&nbsp;&nbsp;</p>\r
195 \r
196 <p class="whs8">i2=1 &nbsp;&nbsp;&nbsp;</p>\r
197 \r
198 <p class="whs7">else: &nbsp;&nbsp;&nbsp;</p>\r
199 \r
200 <p class="whs8">i3=1 &nbsp;&nbsp;&nbsp;</p>\r
201 \r
202 <p class="whs9"><span style="font-family: 'Courier New', monospace;">return \r
203  i1,i2,i3</span> </p>\r
204 \r
205 <p class="whs9">&nbsp;&nbsp;&nbsp;</p>\r
206 \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 &nbsp;to \r
213  the corresponding node. </p>\r
214 \r
215 <p class="whs2">&nbsp;</p>\r
216 \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
218 \r
219 <p class="whs2">&nbsp;</p>\r
220 \r
221 <ul type="disc" class="whs13">\r
222         \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
226  </p></li>\r
227         \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
231         \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
235         \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
241         \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
244         \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
247         \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
250  of nodes.</p></li>\r
251 </ul>\r
252 \r
253 <p class="whs2">&nbsp;</p>\r
254 \r
255 <p class="whs2">&nbsp;</p>\r
256 \r
257 <p class="whs2">\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
259 \r
260 <p class="whs2">&nbsp;</p>\r
261 \r
262 <p class="whs2">&nbsp;</p>\r
263 \r
264 <p class="whs2">&nbsp;</p>\r
265 \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
270 <!--\r
271 if (window.writeIntopicBar)\r
272         writeIntopicBar(0);\r
273 //-->\r
274 </script>\r
275 </body>\r
276 \r
277 </html>\r