Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / newsupervisionexample.py
1 #  Copyright (C) 2003  CEA/DEN, EDF R&D
2 #
3 #
4 #
5 #  File   : newsupervisionexample.py
6 #  Module : SuperVisionTest
7
8 from SuperV import *
9 # Graph creation 
10 newsupervisionexample = Graph( 'newsupervisionexample' )
11 newsupervisionexample.SetName( 'newsupervisionexample' )
12 newsupervisionexample.SetAuthor( '' )
13 newsupervisionexample.SetComment( '' )
14 newsupervisionexample.Coords( 0 , 0 )
15
16 # Creation of Computing Nodes
17 Add = newsupervisionexample.Node( 'AddComponent' , 'AddComponent' , 'Add' )
18 Add.SetName( 'Add' )
19 Add.SetAuthor( '' )
20 Add.SetContainer( 'FactoryServer' )
21 Add.SetComment( '' )
22 Add.Coords( 15 , 241 )
23 Sub = newsupervisionexample.Node( 'SubComponent' , 'SubComponent' , 'Sub' )
24 Sub.SetName( 'Sub' )
25 Sub.SetAuthor( '' )
26 Sub.SetContainer( 'FactoryServer' )
27 Sub.SetComment( '' )
28 Sub.Coords( 227 , 99 )
29 Mul = newsupervisionexample.Node( 'MulComponent' , 'MulComponent' , 'Mul' )
30 Mul.SetName( 'Mul' )
31 Mul.SetAuthor( '' )
32 Mul.SetContainer( 'FactoryServer' )
33 Mul.SetComment( '' )
34 Mul.Coords( 443 , 278 )
35 Div = newsupervisionexample.Node( 'DivComponent' , 'DivComponent' , 'Div' )
36 Div.SetName( 'Div' )
37 Div.SetAuthor( '' )
38 Div.SetContainer( 'FactoryServer' )
39 Div.SetComment( '' )
40 Div.Coords( 634 , 97 )
41
42 # Creation of intermediate Output variables and of Computing Links
43 Addz = Add.Port( 'z' )
44 Suby = newsupervisionexample.Link( Addz , Sub.Port( 'y' ) )
45 Muly = newsupervisionexample.Link( Addz , Mul.Port( 'y' ) )
46 Subz = Sub.Port( 'z' )
47 Mulx = newsupervisionexample.Link( Subz , Mul.Port( 'x' ) )
48 Divx = newsupervisionexample.Link( Subz , Div.Port( 'x' ) )
49 Mulz = Mul.Port( 'z' )
50 Divy = newsupervisionexample.Link( Mulz , Div.Port( 'y' ) )
51
52 # Creation of Input datas
53 Addx = Add.Input( 'x' , 3)
54 Addy = Add.Input( 'y' , 4.5)
55 Subx = Sub.Input( 'x' , 1.5)
56
57 # Creation of Output variables
58 AddFuncValue = Add.Port( 'FuncValue' )
59 Divz = Div.Port( 'z' )
60
61 newsupervisionexample.Run()
62
63 newsupervisionexample.DoneW()
64
65 newsupervisionexample.State()
66
67 newsupervisionexample.PrintPorts()
68