2 # Generated python file of Graph GraphStreams
6 GraphStreams = StreamGraph( 'GraphStreams' )
7 GraphStreams.SetStreamParams( 1000 , SUPERV.SummaryTrace , 1.5 )
8 GraphStreams.SetName( 'GraphStreams' )
9 GraphStreams.SetAuthor( 'JR' )
10 GraphStreams.SetComment( 'Graph with DataStreamPorts CEA/EDF : Calcium' )
11 GraphStreams.Coords( 0 , 0 )
13 # Creation of Factory Nodes
15 Add = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Add' )
18 Add.SetContainer( 'FactoryServer' )
19 Add.SetComment( 'Add from DataStreamFactory' )
20 Add.Coords( 255 , 171 )
21 IAddx = Add.GetInPort( 'x' )
22 IAddy = Add.GetInPort( 'y' )
23 IAddGate = Add.GetInPort( 'Gate' )
24 OAddz = Add.GetOutPort( 'z' )
25 OAddGate = Add.GetOutPort( 'Gate' )
26 IAddistream = Add.GetInStreamPort( 'istream' )
27 IAddistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
28 OAddostream = Add.GetOutStreamPort( 'ostream' )
29 OAddostream.SetNumberOfValues( 0 )
30 OAddOStream = Add.GetOutStreamPort( 'OStream' )
31 OAddOStream.SetNumberOfValues( 10 )
33 Sub = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Sub' )
36 Sub.SetContainer( 'FactoryServer' )
37 Sub.SetComment( 'Sub from DataStreamFactory' )
38 Sub.Coords( 519 , 48 )
39 ISubx = Sub.GetInPort( 'x' )
40 ISuby = Sub.GetInPort( 'y' )
41 ISubGate = Sub.GetInPort( 'Gate' )
42 OSubz = Sub.GetOutPort( 'z' )
43 OSubGate = Sub.GetOutPort( 'Gate' )
44 ISubistream = Sub.GetInStreamPort( 'istream' )
45 ISubistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
46 ISubIstream = Sub.GetInStreamPort( 'Istream' )
47 ISubIstream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
49 Mul = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Mul' )
52 Mul.SetContainer( 'FactoryServer' )
53 Mul.SetComment( 'Mul from DataStreamFactory' )
54 Mul.Coords( 724 , 142 )
55 IMulx = Mul.GetInPort( 'x' )
56 IMuly = Mul.GetInPort( 'y' )
57 IMulGate = Mul.GetInPort( 'Gate' )
58 OMulz = Mul.GetOutPort( 'z' )
59 OMulGate = Mul.GetOutPort( 'Gate' )
61 Div = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Div' )
64 Div.SetContainer( 'FactoryServer' )
65 Div.SetComment( 'Div from DataStreamFactory' )
66 Div.Coords( 935 , 48 )
67 IDivx = Div.GetInPort( 'x' )
68 IDivy = Div.GetInPort( 'y' )
69 IDivGate = Div.GetInPort( 'Gate' )
70 ODivz = Div.GetOutPort( 'z' )
71 ODivGate = Div.GetOutPort( 'Gate' )
72 ODivostream = Div.GetOutStreamPort( 'ostream' )
73 ODivostream.SetNumberOfValues( 0 )
75 Add_1 = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Add' )
76 Add_1.SetName( 'Add_1' )
78 Add_1.SetContainer( 'localhost/FactoryServer' )
79 Add_1.SetComment( 'Add from DataStreamFactory' )
80 Add_1.Coords( 252 , 499 )
81 IAdd_1x = Add_1.GetInPort( 'x' )
82 IAdd_1y = Add_1.GetInPort( 'y' )
83 IAdd_1Gate = Add_1.GetInPort( 'Gate' )
84 OAdd_1z = Add_1.GetOutPort( 'z' )
85 OAdd_1Gate = Add_1.GetOutPort( 'Gate' )
86 IAdd_1istream = Add_1.GetInStreamPort( 'istream' )
87 IAdd_1istream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
88 OAdd_1ostream = Add_1.GetOutStreamPort( 'ostream' )
89 OAdd_1ostream.SetNumberOfValues( 0 )
90 OAdd_1OStream = Add_1.GetOutStreamPort( 'OStream' )
91 OAdd_1OStream.SetNumberOfValues( 0 )
93 Sub_1 = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Sub' )
94 Sub_1.SetName( 'Sub_1' )
96 Sub_1.SetContainer( 'localhost/FactoryServer' )
97 Sub_1.SetComment( 'Sub from DataStreamFactory' )
98 Sub_1.Coords( 516 , 385 )
99 ISub_1x = Sub_1.GetInPort( 'x' )
100 ISub_1y = Sub_1.GetInPort( 'y' )
101 ISub_1Gate = Sub_1.GetInPort( 'Gate' )
102 OSub_1z = Sub_1.GetOutPort( 'z' )
103 OSub_1Gate = Sub_1.GetOutPort( 'Gate' )
104 ISub_1istream = Sub_1.GetInStreamPort( 'istream' )
105 ISub_1istream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
106 ISub_1Istream = Sub_1.GetInStreamPort( 'Istream' )
107 ISub_1Istream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
109 Mul_1 = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Mul' )
110 Mul_1.SetName( 'Mul_1' )
111 Mul_1.SetAuthor( '' )
112 Mul_1.SetContainer( 'localhost/FactoryServer' )
113 Mul_1.SetComment( 'Mul from DataStreamFactory' )
114 Mul_1.Coords( 731 , 487 )
115 IMul_1x = Mul_1.GetInPort( 'x' )
116 IMul_1y = Mul_1.GetInPort( 'y' )
117 IMul_1Gate = Mul_1.GetInPort( 'Gate' )
118 OMul_1z = Mul_1.GetOutPort( 'z' )
119 OMul_1Gate = Mul_1.GetOutPort( 'Gate' )
121 Div_1 = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Div' )
122 Div_1.SetName( 'Div_1' )
123 Div_1.SetAuthor( '' )
124 Div_1.SetContainer( 'localhost/FactoryServer' )
125 Div_1.SetComment( 'Div from DataStreamFactory' )
126 Div_1.Coords( 931 , 385 )
127 IDiv_1x = Div_1.GetInPort( 'x' )
128 IDiv_1y = Div_1.GetInPort( 'y' )
129 IDiv_1Gate = Div_1.GetInPort( 'Gate' )
130 ODiv_1z = Div_1.GetOutPort( 'z' )
131 ODiv_1Gate = Div_1.GetOutPort( 'Gate' )
132 ODiv_1ostream = Div_1.GetOutStreamPort( 'ostream' )
133 ODiv_1ostream.SetNumberOfValues( 0 )
135 # Creation of Loop Nodes
137 PyLoop.append( 'import time ' )
138 PyLoop.append( 'def Init(Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub) : ' )
139 PyLoop.append( ' if Min <= Max : ' )
140 PyLoop.append( ' Index = Min ' )
141 PyLoop.append( ' else : ' )
142 PyLoop.append( ' Index = Max ' )
143 PyLoop.append( ' time.sleep( 1 ) ' )
144 PyLoop.append( ' return Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub ' )
146 PyMoreLoop.append( 'import time ' )
147 PyMoreLoop.append( 'def More(Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub) : ' )
148 PyMoreLoop.append( ' if Index < Max : ' )
149 PyMoreLoop.append( ' DoLoop = 1 ' )
150 PyMoreLoop.append( ' else : ' )
151 PyMoreLoop.append( ' DoLoop = 0 ' )
152 PyMoreLoop.append( ' time.sleep( 1 ) ' )
153 PyMoreLoop.append( ' return DoLoop,Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub ' )
155 PyNextLoop.append( 'import time ' )
156 PyNextLoop.append( 'def Next(Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub) : ' )
157 PyNextLoop.append( ' Index = Index + Incr ' )
158 PyNextLoop.append( ' time.sleep( 1 ) ' )
159 PyNextLoop.append( ' return Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub ' )
160 Loop,EndLoop = GraphStreams.LNode( 'Init' , PyLoop , 'More' , PyMoreLoop , 'Next' , PyNextLoop )
161 EndLoop.SetName( 'EndLoop' )
162 EndLoop.SetAuthor( '' )
163 EndLoop.SetComment( '' )
164 EndLoop.Coords( 1158 , 393 )
166 EndLoop.SetPyFunction( 'EndInit' , PyEndLoop )
167 ILoopInitLoop = Loop.GetInPort( 'InitLoop' )
168 ILoopIndex = Loop.InPort( 'Index' , 'long' )
169 ILoopMin = Loop.InPort( 'Min' , 'long' )
170 ILoopMax = Loop.InPort( 'Max' , 'long' )
171 ILoopIncr = Loop.InPort( 'Incr' , 'long' )
172 ILoopz_Div = Loop.InPort( 'z_Div' , 'double' )
173 ILoopz_Div_1 = Loop.InPort( 'z_Div_1' , 'double' )
174 ILoopy_Add = Loop.InPort( 'y_Add' , 'double' )
175 ILoopx_Sub = Loop.InPort( 'x_Sub' , 'double' )
176 ILoopGate = Loop.GetInPort( 'Gate' )
177 OLoopDoLoop = Loop.GetOutPort( 'DoLoop' )
178 OLoopIndex = Loop.GetOutPort( 'Index' )
179 OLoopMin = Loop.GetOutPort( 'Min' )
180 OLoopMax = Loop.GetOutPort( 'Max' )
181 OLoopIncr = Loop.GetOutPort( 'Incr' )
182 OLoopz_Div = Loop.GetOutPort( 'z_Div' )
183 OLoopz_Div_1 = Loop.GetOutPort( 'z_Div_1' )
184 OLoopy_Add = Loop.GetOutPort( 'y_Add' )
185 OLoopx_Sub = Loop.GetOutPort( 'x_Sub' )
186 IEndLoopDoLoop = EndLoop.GetInPort( 'DoLoop' )
187 IEndLoopIndex = EndLoop.GetInPort( 'Index' )
188 IEndLoopMin = EndLoop.GetInPort( 'Min' )
189 IEndLoopMax = EndLoop.GetInPort( 'Max' )
190 IEndLoopIncr = EndLoop.GetInPort( 'Incr' )
191 IEndLoopz_Div = EndLoop.GetInPort( 'z_Div' )
192 IEndLoopz_Div_1 = EndLoop.GetInPort( 'z_Div_1' )
193 IEndLoopy_Add = EndLoop.GetInPort( 'y_Add' )
194 IEndLoopx_Sub = EndLoop.GetInPort( 'x_Sub' )
195 IEndLoopGate = EndLoop.GetInPort( 'Gate' )
196 OEndLoopDoLoop = EndLoop.GetOutPort( 'DoLoop' )
197 OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
198 OEndLoopMin = EndLoop.GetOutPort( 'Min' )
199 OEndLoopMax = EndLoop.GetOutPort( 'Max' )
200 OEndLoopIncr = EndLoop.GetOutPort( 'Incr' )
201 OEndLoopz_Div = EndLoop.GetOutPort( 'z_Div' )
202 OEndLoopz_Div_1 = EndLoop.GetOutPort( 'z_Div_1' )
203 OEndLoopy_Add = EndLoop.GetOutPort( 'y_Add' )
204 OEndLoopx_Sub = EndLoop.GetOutPort( 'x_Sub' )
205 Loop.SetName( 'Loop' )
207 Loop.SetComment( '' )
208 Loop.Coords( 5 , 391 )
211 LAddzSuby = GraphStreams.Link( OAddz , ISuby )
212 LAddzSuby.AddCoord( 1 , 448 , 143 )
213 LAddzSuby.AddCoord( 2 , 449 , 237 )
215 LAddzMuly = GraphStreams.Link( OAddz , IMuly )
216 LAddzMuly.AddCoord( 1 , 708 , 237 )
217 LAddzMuly.AddCoord( 2 , 708 , 270 )
218 LAddzMuly.AddCoord( 3 , 449 , 270 )
219 LAddzMuly.AddCoord( 4 , 448 , 238 )
221 LAddostreamSubistream = GraphStreams.StreamLink( OAddostream , ISubistream )
222 LAddostreamSubistream.AddCoord( 1 , 474 , 175 )
223 LAddostreamSubistream.AddCoord( 2 , 474 , 297 )
225 LAddOStreamSubIstream = GraphStreams.StreamLink( OAddOStream , ISubIstream )
226 LAddOStreamSubIstream.AddCoord( 1 , 497 , 207 )
227 LAddOStreamSubIstream.AddCoord( 2 , 498 , 328 )
229 LSubzMulx = GraphStreams.Link( OSubz , IMulx )
230 LSubzMulx.AddCoord( 1 , 706 , 207 )
231 LSubzMulx.AddCoord( 2 , 706 , 114 )
233 LSubzDivx = GraphStreams.Link( OSubz , IDivx )
235 LMulzDivy = GraphStreams.Link( OMulz , IDivy )
236 LMulzDivy.AddCoord( 1 , 912 , 143 )
237 LMulzDivy.AddCoord( 2 , 911 , 208 )
239 LDivzEndLoopz_Div = GraphStreams.Link( ODivz , IEndLoopz_Div )
240 LDivzEndLoopz_Div.AddCoord( 1 , 1147 , 537 )
241 LDivzEndLoopz_Div.AddCoord( 2 , 1148 , 113 )
243 LDivostreamAdd_1istream = GraphStreams.StreamLink( ODivostream , IAdd_1istream )
244 LDivostreamAdd_1istream.AddCoord( 1 , 233 , 626 )
245 LDivostreamAdd_1istream.AddCoord( 2 , 232 , 763 )
246 LDivostreamAdd_1istream.AddCoord( 3 , 1126 , 763 )
247 LDivostreamAdd_1istream.AddCoord( 4 , 1125 , 175 )
249 LAdd_1zSub_1y = GraphStreams.Link( OAdd_1z , ISub_1y )
250 LAdd_1zSub_1y.AddCoord( 1 , 445 , 478 )
251 LAdd_1zSub_1y.AddCoord( 2 , 444 , 566 )
253 LAdd_1zMul_1y = GraphStreams.Link( OAdd_1z , IMul_1y )
254 LAdd_1zMul_1y.AddCoord( 1 , 703 , 582 )
255 LAdd_1zMul_1y.AddCoord( 2 , 703 , 677 )
256 LAdd_1zMul_1y.AddCoord( 3 , 445 , 678 )
257 LAdd_1zMul_1y.AddCoord( 4 , 444 , 567 )
259 LAdd_1ostreamSub_1istream = GraphStreams.StreamLink( OAdd_1ostream , ISub_1istream )
260 LAdd_1ostreamSub_1istream.AddCoord( 1 , 473 , 511 )
261 LAdd_1ostreamSub_1istream.AddCoord( 2 , 473 , 627 )
263 LAdd_1OStreamSub_1Istream = GraphStreams.StreamLink( OAdd_1OStream , ISub_1Istream )
264 LAdd_1OStreamSub_1Istream.AddCoord( 1 , 498 , 543 )
265 LAdd_1OStreamSub_1Istream.AddCoord( 2 , 497 , 658 )
267 LSub_1zMul_1x = GraphStreams.Link( OSub_1z , IMul_1x )
268 LSub_1zMul_1x.AddCoord( 1 , 708 , 552 )
269 LSub_1zMul_1x.AddCoord( 2 , 707 , 450 )
271 LSub_1zDiv_1x = GraphStreams.Link( OSub_1z , IDiv_1x )
273 LMul_1zDiv_1y = GraphStreams.Link( OMul_1z , IDiv_1y )
274 LMul_1zDiv_1y.AddCoord( 1 , 913 , 479 )
275 LMul_1zDiv_1y.AddCoord( 2 , 913 , 551 )
277 LDiv_1zEndLoopz_Div_1 = GraphStreams.Link( ODiv_1z , IEndLoopz_Div_1 )
278 LDiv_1zEndLoopz_Div_1.AddCoord( 1 , 1138 , 567 )
279 LDiv_1zEndLoopz_Div_1.AddCoord( 2 , 1138 , 449 )
281 LDiv_1ostreamAddistream = GraphStreams.StreamLink( ODiv_1ostream , IAddistream )
282 LDiv_1ostreamAddistream.AddCoord( 1 , 229 , 297 )
283 LDiv_1ostreamAddistream.AddCoord( 2 , 229 , 426 )
284 LDiv_1ostreamAddistream.AddCoord( 3 , 475 , 425 )
285 LDiv_1ostreamAddistream.AddCoord( 4 , 475 , 352 )
286 LDiv_1ostreamAddistream.AddCoord( 5 , 1110 , 352 )
287 LDiv_1ostreamAddistream.AddCoord( 6 , 1111 , 512 )
289 LLoopIndexEndLoopIndex = GraphStreams.Link( OLoopIndex , IEndLoopIndex )
291 LLoopIndexAddx = GraphStreams.Link( OLoopIndex , IAddx )
292 LLoopIndexAddx.AddCoord( 1 , 201 , 236 )
293 LLoopIndexAddx.AddCoord( 2 , 202 , 420 )
295 LLoopIndexAdd_1x = GraphStreams.Link( OLoopIndex , IAdd_1x )
296 LLoopIndexAdd_1x.AddCoord( 1 , 201 , 562 )
297 LLoopIndexAdd_1x.AddCoord( 2 , 202 , 422 )
299 LLoopMinEndLoopMin = GraphStreams.Link( OLoopMin , IEndLoopMin )
301 LLoopMaxEndLoopMax = GraphStreams.Link( OLoopMax , IEndLoopMax )
303 LLoopIncrEndLoopIncr = GraphStreams.Link( OLoopIncr , IEndLoopIncr )
305 LLoopy_AddEndLoopy_Add = GraphStreams.Link( OLoopy_Add , IEndLoopy_Add )
307 LLoopy_AddAddy = GraphStreams.Link( OLoopy_Add , IAddy )
308 LLoopy_AddAddy.AddCoord( 1 , 183 , 266 )
309 LLoopy_AddAddy.AddCoord( 2 , 182 , 593 )
311 LLoopy_AddAdd_1y = GraphStreams.Link( OLoopy_Add , IAdd_1y )
313 LLoopx_SubEndLoopx_Sub = GraphStreams.Link( OLoopx_Sub , IEndLoopx_Sub )
315 LLoopx_SubSubx = GraphStreams.Link( OLoopx_Sub , ISubx )
316 LLoopx_SubSubx.AddCoord( 1 , 167 , 113 )
317 LLoopx_SubSubx.AddCoord( 2 , 167 , 625 )
319 LLoopx_SubSub_1x = GraphStreams.Link( OLoopx_Sub , ISub_1x )
320 LLoopx_SubSub_1x.AddCoord( 1 , 167 , 450 )
321 LLoopx_SubSub_1x.AddCoord( 2 , 168 , 624 )
324 ILoopIndex.Input( 0 )
328 ILoopz_Div.Input( 0 )
329 ILoopz_Div_1.Input( 0 )
330 ILoopy_Add.Input( 4.5 )
331 ILoopx_Sub.Input( 1.5 )
333 # Output Ports of the graph
334 #OLoopz_Div = Loop.GetOutPort( 'z_Div' )
335 #OLoopz_Div_1 = Loop.GetOutPort( 'z_Div_1' )
336 #OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
337 #OEndLoopMin = EndLoop.GetOutPort( 'Min' )
338 #OEndLoopMax = EndLoop.GetOutPort( 'Max' )
339 #OEndLoopIncr = EndLoop.GetOutPort( 'Incr' )
340 #OEndLoopz_Div = EndLoop.GetOutPort( 'z_Div' )
341 #OEndLoopz_Div_1 = EndLoop.GetOutPort( 'z_Div_1' )
342 #OEndLoopy_Add = EndLoop.GetOutPort( 'y_Add' )
343 #OEndLoopx_Sub = EndLoop.GetOutPort( 'x_Sub' )
350 GraphStreams.PrintPorts()
352 subgraphs = GraphStreams.SubGraphsNumber()
354 while i <= subgraphs :
355 nodes = GraphStreams.SubGraphsNodes( i )
357 while j < len(nodes) :
358 print 'SubGraph',i,nodes[j].Name()
363 substreamgraphs = GraphStreams.SubStreamGraphsNumber()
365 while i <= substreamgraphs :
366 nodes = GraphStreams.SubStreamGraphsNodes( i )
368 while j < len(nodes) :
369 print 'SubStreamGraph',i,nodes[j].Name()
374 GraphStreams.Export('/tmp/GraphStreams.xml')
376 GraphStreams = StreamGraph( '/tmp/GraphStreams.xml' )
379 GraphStreams.PrintPorts()
380 print GraphStreams.State()
382 GraphStreams.IsExecutable()
384 subgraphs = GraphStreams.SubGraphsNumber()
386 while i <= subgraphs :
387 nodes = GraphStreams.SubGraphsNodes( i )
389 while j < len(nodes) :
390 print 'SubGraph',i,nodes[j].Name()
395 substreamgraphs = GraphStreams.SubStreamGraphsNumber()
397 while i <= substreamgraphs :
398 nodes = GraphStreams.SubStreamGraphsNodes( i )
400 while j < len(nodes) :
401 print 'SubStreamGraph',i,nodes[j].Name()