1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
\r
6 <title>Loop 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 { font-family:'Times New Roman' , serif; }
\r
18 img_whs2 { border:none; width:30px; height:30px; float:none; border-style:none; }
\r
19 p.whs3 { font-family:'Times New Roman' , serif; }
\r
20 p.whs4 { font-family:'Times New Roman' , serif; font-style:italic; }
\r
21 img_whs5 { border:none; width:775px; height:360px; float:none; border-style:none; }
\r
22 ul.whs6 { list-style:disc; }
\r
23 p.whs7 { font-family:'Times New Roman' , serif; background-image:url('../texture_horiz_ltbluebubbles.jpg'); }
\r
24 img_whs8 { border:none; float:none; width:36px; height:38px; border-style:none; }
\r
25 img_whs9 { border:none; width:404px; height:297px; float:none; border-style:none; }
\r
26 p.whs10 { font-family:'Courier New' , monospace; }
\r
28 </style><script type="text/javascript" language="JavaScript" title="BSSC Special Effects" src="../ehlpdhtm.js"></script><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
\r
31 if (innerWidth != origWidth || innerHeight != origHeight)
\r
34 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
\r
35 origWidth = innerWidth;
\r
36 origHeight = innerHeight;
\r
42 <style type="text/css">
\r
44 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
\r
45 p.WebHelpNavBar { text-align:right; }
\r
47 </style><script type="text/javascript" language="javascript1.2" src="../whmsg.js"></script>
\r
48 <script type="text/javascript" language="javascript" src="../whver.js"></script>
\r
49 <script type="text/javascript" language="javascript1.2" src="../whproxy.js"></script>
\r
50 <script type="text/javascript" language="javascript1.2" src="../whutils.js"></script>
\r
51 <script type="text/javascript" language="javascript1.2" src="../whtopic.js"></script>
\r
52 <script type="text/javascript" language="javascript1.2">
\r
54 if (window.gbWhTopic)
\r
56 if (window.setRelStartPage)
\r
58 addTocInfo("SUPERVISOR module\nEditing graphs\nNodes in the graph\nLoop nodes");
\r
59 addButton("show",BTN_IMG,"Show","","","","",0,0,"../whd_show0.gif","../whd_show2.gif","../whd_show1.gif");
\r
60 addButton("hide",BTN_IMG,"Hide","","","","",0,0,"../whd_hide0.gif","../whd_hide2.gif","../whd_hide1.gif");
\r
65 if (window.setRelStartPage)
\r
67 setRelStartPage("../index.htm");
\r
77 document.location.reload();
\r
81 <body><script type="text/javascript" language="javascript1.2">
\r
83 if (window.writeIntopicBar)
\r
87 <h1 class="whs1">Loop nodes</h1>
\r
89 <p><span style="font-weight: bold;"><B><img src="../i_blue.jpg" x-maintain-ratio="TRUE" width="30px" height="30px" border="0" class="img_whs2">Loop node</B></span> is a
\r
90 kind of Control nodes. In fact two nodes represent Loop: <span style="font-weight: bold;"><B>start
\r
91 loop</B></span> and <span style="font-weight: bold;"><B>end loop</B></span> nodes.
\r
92 Nodes of such type are always InLine nodes. User have to supply this type
\r
93 of node by service, which will check conditions of end of loop. </p>
\r
95 <p class="whs3"><span style="font-family: 'Times New Roman', serif;">With
\r
96 that kind of nodes you may define all kinds of loops:</span></p>
\r
98 <p class="whs4">
\93for(
\r
99 initial condition(s) ; end condition(s) ; end loop code )
\94 or </p>
\r
101 <p class="whs4">
\93while(
\r
102 end condition )
\94</p>
\r
104 <p class="whs4">etc
\85</p>
\r
106 <p class="whs3"> </p>
\r
108 <p class="whs3"><img src="../loop1.jpg" x-maintain-ratio="TRUE" width="775px" height="360px" border="0" class="img_whs5"></p>
\r
110 <p class="whs3"> </p>
\r
112 <ul type="disc" class="whs6">
\r
114 <li class=kadov-p><p class="whs3"><span
\r
115 style="font-weight: bold;"><B>Titles of the nodes.</B></span> By default the
\r
116 name of the service is used. You can change only the name of the Start
\r
117 Loop node - the name of the End Loop node will be automatically created
\r
118 as follows: EndOf + "Name of the Start Loop node" .</p></li>
\r
120 <li class=kadov-p><p class="whs3"><span
\r
121 style="font-weight: bold;"><B>Status of execution</B></span> shows the state
\r
122 of the loop. It can be: <span style="font-weight: bold;"><B>Not Started</B></span>,
\r
123 <span style="font-weight: bold;"><B>Running</B></span>, <span style="font-weight: bold;"><B>Finished</B></span>.</p></li>
\r
125 <li class=kadov-p><p class="whs3"><span
\r
126 style="font-weight: bold;"><B>InGate/OutGate</B></span> - control ports of the
\r
127 loop execution. </p></li>
\r
129 <li class=kadov-p><p class="whs3"><span
\r
130 style="font-weight: bold;"><B>Time of execution </B></span>is a time of node
\r
131 execution in a launched dataflow.</p></li>
\r
133 <li class=kadov-p><p class="whs3"><span
\r
134 style="font-weight: bold;"><B>Input/Output ports</B></span>
\96 are BusPorts, which
\r
135 are processed by Python function. Input ports of the Start Loop node will
\r
136 get the initial values, which can be processed by underlying function
\r
137 and will be transferred inside of the loop. Last calculation node of the
\r
138 loop will put these values to the input port of the End Loop node. If
\r
139 loop continues then this value will be copied to the Input port of the
\r
140 Start Loop node, otherwise into output port of the End Loop node.</p></li>
\r
142 <li class=kadov-p><p class="whs3"><span
\r
143 style="font-weight: bold;"><B>Control loop ports</B></span>
\96 Control ports of
\r
144 the loop nodes manage the functioning of the loop and they are not accessible
\r
145 for the user. <span style="font-weight: bold;"><B>InitLoop</B></span> port launches
\r
146 the loop. <span style="font-weight: bold;"><B>DoLoop</B></span> port of the Start
\r
147 Loop node checks whether the end loop condition set in <span style="font-weight: bold;"><B>More
\r
148 </B></span><span>function of the Loop node</span> has been achieved or not.
\r
149 The value in this ports is of boolean type. It can be 0 or 1. </p></li>
\r
152 <p class="whs3"> </p>
\r
154 <p class="whs7"><img src="../note1.gif" x-maintain-ratio="TRUE" width="36px" height="38px" border="0" class="img_whs8">To create a Loop node you have to define three python functions
\r
155 which will manage the loop with all input and output arguments (ports)
\r
159 <p class="whs3"> </p>
\r
161 <ul type="disc" class="whs6">
\r
163 <li class=kadov-p><p class="whs3"> <span
\r
164 style="font-weight: bold;"><B>INIT: </B></span>An
\r
165 Initialization function which will be executed only when we enter in the
\r
166 loop for the first time.</p></li>
\r
169 <p class="whs3"> </p>
\r
171 <ul type="disc" class="whs6">
\r
173 <li class=kadov-p><p class="whs3"> <span
\r
174 style="font-weight: bold;"><B>MORE: </B></span>A
\r
175 \93More
\94 function which is executed at each execution of the LoopNode even
\r
176 for the first time. That function will have to return as first output
\r
177 argument a boolean before output arguments (ports) defined by the user
\r
178 in the node. If that function value is true the body of the loop will
\r
179 automatically be executed. If it is false, Supervisor component will resume
\r
180 execution after the end of the loop. That first output argument will not
\r
181 be represented as an output port and will not be used in the graph.</p></li>
\r
184 <p class="whs3"> </p>
\r
186 <ul type="disc" class="whs6">
\r
188 <li class=kadov-p><p class="whs3"><span
\r
189 style="font-weight: bold;"><B>NEXT: </B></span>A
\93Next
\94 function which is executed
\r
190 each time that Supervisor component resume the execution from the end
\r
191 of the loop to the beginning.</p></li>
\r
194 <p class="whs3"> </p>
\r
196 <p class="whs3">Setting of these functions
\r
197 is possible from the standard <span style="font-weight: bold;"><B>Add Node</B></span>
\r
198 dialog box (<a href="adding_nodes.htm">see also Adding nodes</a>):</p>
\r
200 <p class="whs3"> </p>
\r
202 <p class="whs3"> <img src="../pics/loopfunctions.jpg" x-maintain-ratio="TRUE" width="404px" height="297px" border="0" class="img_whs9"></p>
\r
204 <p class="whs3"> </p>
\r
206 <p class="whs3">Here you can see a simple
\r
207 example of Python functions set in a Loop node:</p>
\r
209 <p class="whs3"> </p>
\r
211 <p class="whs10">def <span style="font-weight: bold;"><B>Init</B></span>(Index,Min,Max,Incr)
\r
214 <p class="whs10"> if
\r
215 Min <= Max : </p>
\r
217 <p class="whs10"> Index
\r
220 <p class="whs10"> else
\r
223 <p class="whs10"> Index
\r
226 <p class="whs10"> return
\r
227 Index,Min,Max,Incr </p>
\r
229 <p class="whs10"> </p>
\r
231 <p class="whs10">def <span style="font-weight: bold;"><B>More</B></span>(Index,Min,Max,Incr)
\r
234 <p class="whs10"> if
\r
235 Index < Max : </p>
\r
237 <p class="whs10"> DoLoop
\r
240 <p class="whs10"> else
\r
243 <p class="whs10"> DoLoop
\r
246 <p class="whs10"> return
\r
247 DoLoop,Index,Min,Max,Incr </p>
\r
249 <p class="whs10"> </p>
\r
251 <p class="whs10">def <span style="font-weight: bold;"><B>Next</B></span>(Index,Min,Max,Incr)
\r
254 <p class="whs10"> Index
\r
255 = Index + Incr </p>
\r
257 <p class="whs10"> return
\r
258 Index,Min,Max,Incr</p>
\r
260 <p class="whs3"> </p>
\r
262 <p class="whs7"><img src="../note1.gif" x-maintain-ratio="TRUE" width="36px" height="38px" border="0" class="img_whs8">Loop nodes have the following particularities:</p>
\r
264 <p class="whs3"> </p>
\r
266 <ul type="disc" class="whs6">
\r
268 <li class=kadov-p><p class="whs3">You
\r
269 may create <span style="font-weight: bold;"><B>only input ports</B></span> in
\r
270 the Loop node.</p></li>
\r
272 <li class=kadov-p><p class="whs3">The
\r
273 input ports, which have been created in the Start Loop node are automatically
\r
274 duplicated by Supervisor component as output ports of this node.</p></li>
\r
276 <li class=kadov-p><p class="whs3">Supervisor
\r
277 component automatically adds
\r
278 the same input and output ports in the End
\r
279 Loop node as in the Start Loop node.</p></li>
\r
281 <li class=kadov-p><p class="whs3">If
\r
282 an output port of the Start Loop node has no link and if the corresponding
\r
283 input port of the End Loop node has no link, Supervisor component automatically
\r
284 transmits its value to the corresponding End Loop node during execution.
\r
285 You shouldn't define such links.</p></li>
\r
287 <li class=kadov-p><p class="whs3">When
\r
288 Supervisor component executes the End Loop node, it automatically transmits
\r
289 the actual values of the
\r
290 output ports of the End Loop node to the input ports of the Start Loop
\r
293 <li class=kadov-p><p class="whs3">In
\r
294 the body of a loop, an input port of a calculation node may not be linked
\r
295 from an output port of a node which is not in the body of a loop. That
\r
296 output port <span style="font-weight: bold;"><B>must be linked</B></span> to
\r
297 an input port of the Start Loop node. So its value will be available through
\r
298 the corresponding output port of the Start Loop node.</p></li>
\r
301 <p class="whs3"> </p>
\r
303 <p class="whs3"> </p>
\r
305 <p class="whs3"> </p>
\r
308 <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
313 <p class="whs3"> </p>
\r
315 <p class="whs3"> </p>
\r
317 <p class="whs3"> </p>
\r
319 <p class="whs3"> </p>
\r
321 <script type="text/javascript" language="JavaScript" title="WebHelpRelatedTopics"><!--
\r
322 if (parseInt(navigator.appVersion) >= 3 && typeof (WritePopupMenuLayer) == "function")
\r
323 WritePopupMenuLayer();
\r
324 //--></script><script type="text/javascript" language="javascript1.2">
\r
326 if (window.writeIntopicBar)
\r
327 writeIntopicBar(0);
\r