Salome HOME
Update copyrights 2014.
[samples/datafiles.git] / Superv / Python / newsupervisionexample.py
1 # Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 #  File   : newsupervisionexample.py
23 #  Module : SuperVisionTest
24 #
25 from SuperV import *
26 # Graph creation 
27 newsupervisionexample = Graph( 'newsupervisionexample' )
28 newsupervisionexample.SetName( 'newsupervisionexample' )
29 newsupervisionexample.SetAuthor( '' )
30 newsupervisionexample.SetComment( '' )
31 newsupervisionexample.Coords( 0 , 0 )
32
33 # Creation of Computing Nodes
34 Add = newsupervisionexample.Node( 'AddComponent' , 'AddComponent' , 'Add' )
35 Add.SetName( 'Add' )
36 Add.SetAuthor( '' )
37 Add.SetContainer( 'FactoryServer' )
38 Add.SetComment( '' )
39 Add.Coords( 15 , 241 )
40 Sub = newsupervisionexample.Node( 'SubComponent' , 'SubComponent' , 'Sub' )
41 Sub.SetName( 'Sub' )
42 Sub.SetAuthor( '' )
43 Sub.SetContainer( 'FactoryServer' )
44 Sub.SetComment( '' )
45 Sub.Coords( 227 , 99 )
46 Mul = newsupervisionexample.Node( 'MulComponent' , 'MulComponent' , 'Mul' )
47 Mul.SetName( 'Mul' )
48 Mul.SetAuthor( '' )
49 Mul.SetContainer( 'FactoryServer' )
50 Mul.SetComment( '' )
51 Mul.Coords( 443 , 278 )
52 Div = newsupervisionexample.Node( 'DivComponent' , 'DivComponent' , 'Div' )
53 Div.SetName( 'Div' )
54 Div.SetAuthor( '' )
55 Div.SetContainer( 'FactoryServer' )
56 Div.SetComment( '' )
57 Div.Coords( 634 , 97 )
58
59 # Creation of intermediate Output variables and of Computing Links
60 Addz = Add.Port( 'z' )
61 Suby = newsupervisionexample.Link( Addz , Sub.Port( 'y' ) )
62 Muly = newsupervisionexample.Link( Addz , Mul.Port( 'y' ) )
63 Subz = Sub.Port( 'z' )
64 Mulx = newsupervisionexample.Link( Subz , Mul.Port( 'x' ) )
65 Divx = newsupervisionexample.Link( Subz , Div.Port( 'x' ) )
66 Mulz = Mul.Port( 'z' )
67 Divy = newsupervisionexample.Link( Mulz , Div.Port( 'y' ) )
68
69 # Creation of Input datas
70 Addx = Add.Input( 'x' , 3)
71 Addy = Add.Input( 'y' , 4.5)
72 Subx = Sub.Input( 'x' , 1.5)
73
74 # Creation of Output variables
75 AddFuncValue = Add.Port( 'FuncValue' )
76 Divz = Div.Port( 'z' )
77
78 newsupervisionexample.Run()
79
80 newsupervisionexample.DoneW()
81
82 newsupervisionexample.State()
83
84 newsupervisionexample.PrintPorts()
85