]> SALOME platform Git repositories - modules/superv.git/blob - doc/salome/gui/SUPERV/files/switch_nodes.htm
Salome HOME
SMH: 3.0.0 preparation = merged version (POLYWORK + RTVDEBUG01) + adopation for new GUI
[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 <head>\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
10 <!--\r
11 if (navigator.appName !="Netscape")\r
12 {   document.write("<link rel='stylesheet' href='../default.css'>");}\r
13 //-->\r
14 </script>\r
15 <style type="text/css">\r
16 <!--\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
30 -->\r
31 </style><script type="text/javascript" language="JavaScript">\r
32 <!--\r
33 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
34 {\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
39 }\r
40 //-->\r
41 </script>\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
43 <!--\r
44 function reDo() {\r
45   if (innerWidth != origWidth || innerHeight != origHeight)\r
46      location.reload();\r
47 }\r
48 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
49         origWidth = innerWidth;\r
50         origHeight = innerHeight;\r
51         onresize = reDo;\r
52 }\r
53 onerror = null; \r
54 //-->\r
55 </script>\r
56 <style type="text/css">\r
57 <!--\r
58 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }\r
59 -->\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
65 </head>\r
66 <body><script type="text/javascript" language="javascript1.2">\r
67 <!--\r
68 if (window.gbWhTopic)\r
69 {\r
70         if (window.addTocInfo)\r
71         {\r
72         addTocInfo("SUPERVISION module\nEditing graphs\nNodes in the graph\nSwitch nodes");\r
73 addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");\r
74 \r
75         }\r
76         if (window.writeBtnStyle)\r
77                 writeBtnStyle();\r
78 \r
79         if (window.writeIntopicBar)\r
80                 writeIntopicBar(1);\r
81 \r
82         if (window.setRelStartPage)\r
83         {\r
84         setRelStartPage("../supervision.htm");\r
85 \r
86                 autoSync(1);\r
87                 sendSyncInfo();\r
88                 sendAveInfoOut();\r
89         }\r
90 }\r
91 else\r
92         if (window.gbIE4)\r
93                 document.location.reload();\r
94 //-->\r
95 </script>\r
96 <h1 class="whs1">Switch nodes</h1>\r
97 \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 &quot;True&quot; 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
105 \r
106 <p class="whs4">\93if( condition ) ; \r
107  else if( condition ) \85 ; else\94 or</p>\r
108 \r
109 <p class="whs4">\93switch( variable ) \r
110  ; case value \85; default\94.</p>\r
111 \r
112 <p class="whs4">Etc\85</p>\r
113 \r
114 <p class="whs4">&nbsp;</p>\r
115 \r
116 <p class="whs2"><img src="../switch.jpg" x-maintain-ratio="TRUE" width="751px" height="332px" border="0" class="img_whs5"></p>\r
117 \r
118 <p class="whs2">&nbsp;</p>\r
119 \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 + &quot;Name of the \r
124  Start Switch node&quot; .</p>\r
125 \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
128  Finished.</p>\r
129 \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
132 \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
137 \r
138 <p class="whs2"><span style="font-weight: bold;"><B>Input/Output \r
139  ports</B></span> \96 &nbsp;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
144 \r
145 <p class="whs2">&nbsp;</p>\r
146 \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
150  function:</p>\r
151 \r
152 <p class="whs2">&nbsp;</p>\r
153 \r
154 <p class="whs6">def \r
155  Switch(x): &nbsp;&nbsp;&nbsp;</p>\r
156 \r
157 <p class="whs7">i1=0 &nbsp;&nbsp;&nbsp;</p>\r
158 \r
159 <p class="whs7">i2=0 &nbsp;&nbsp;&nbsp;</p>\r
160 \r
161 <p class="whs7">i3=0 &nbsp;&nbsp;&nbsp;</p>\r
162 \r
163 <p class="whs7">if x&gt;13: &nbsp;&nbsp;&nbsp;</p>\r
164 \r
165 <p class="whs8">i1=1 &nbsp;&nbsp;&nbsp;</p>\r
166 \r
167 <p class="whs7">elif x==13: &nbsp;&nbsp;&nbsp;</p>\r
168 \r
169 <p class="whs8">i2=1 &nbsp;&nbsp;&nbsp;</p>\r
170 \r
171 <p class="whs7">else: &nbsp;&nbsp;&nbsp;</p>\r
172 \r
173 <p class="whs8">i3=1 &nbsp;&nbsp;&nbsp;</p>\r
174 \r
175 <p class="whs9"><span style="font-family: 'Courier New', monospace;">return \r
176  i1,i2,i3</span> </p>\r
177 \r
178 <p class="whs9">&nbsp;&nbsp;&nbsp;</p>\r
179 \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 &nbsp;to \r
186  the corresponding node. </p>\r
187 \r
188 <p class="whs2">&nbsp;</p>\r
189 \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
191 \r
192 <p class="whs2">&nbsp;</p>\r
193 \r
194 <ul type="disc" class="whs13">\r
195         \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
199  </p></li>\r
200         \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
204         \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
208         \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
214         \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
217         \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
220         \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
223  of nodes.</p></li>\r
224 </ul>\r
225 \r
226 <p class="whs2">&nbsp;</p>\r
227 \r
228 <p class="whs2">&nbsp;</p>\r
229 \r
230 <p class="whs2">\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
232 \r
233 \r
234  </p>\r
235 \r
236 <p class="whs2">&nbsp;</p>\r
237 \r
238 <p class="whs2">&nbsp;</p>\r
239 \r
240 <p class="whs2">&nbsp;</p>\r
241 \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
246 <!--\r
247 if (window.writeIntopicBar)\r
248         writeIntopicBar(0);\r
249 //-->\r
250 </script>\r
251 </body>\r
252 </html>\r