26 |
26 |
27 from graphics.GraphicCommons import * |
27 from graphics.GraphicCommons import * |
28 from graphics.DebugDataConsumer import DebugDataConsumer |
28 from graphics.DebugDataConsumer import DebugDataConsumer |
29 from plcopen.structures import * |
29 from plcopen.structures import * |
30 |
30 |
|
31 |
31 def GetWireSize(block): |
32 def GetWireSize(block): |
32 if isinstance(block, SFC_Step): |
33 if isinstance(block, SFC_Step): |
33 return SFC_WIRE_MIN_SIZE + block.GetActionExtraLineNumber() * SFC_ACTION_MIN_SIZE[1] |
34 return SFC_WIRE_MIN_SIZE + block.GetActionExtraLineNumber() * SFC_ACTION_MIN_SIZE[1] |
34 else: |
35 else: |
35 return SFC_WIRE_MIN_SIZE |
36 return SFC_WIRE_MIN_SIZE |
36 |
37 |
37 #------------------------------------------------------------------------------- |
38 #------------------------------------------------------------------------------- |
38 # Sequencial Function Chart Step |
39 # Sequencial Function Chart Step |
39 #------------------------------------------------------------------------------- |
40 #------------------------------------------------------------------------------- |
40 |
41 |
41 """ |
|
42 Class that implements the graphic representation of a step |
|
43 """ |
|
44 |
42 |
45 class SFC_Step(Graphic_Element, DebugDataConsumer): |
43 class SFC_Step(Graphic_Element, DebugDataConsumer): |
|
44 """ |
|
45 Class that implements the graphic representation of a step |
|
46 """ |
46 |
47 |
47 # Create a new step |
48 # Create a new step |
48 def __init__(self, parent, name, initial = False, id = None): |
49 def __init__(self, parent, name, initial = False, id = None): |
49 Graphic_Element.__init__(self, parent) |
50 Graphic_Element.__init__(self, parent) |
50 DebugDataConsumer.__init__(self) |
51 DebugDataConsumer.__init__(self) |
569 |
570 |
570 #------------------------------------------------------------------------------- |
571 #------------------------------------------------------------------------------- |
571 # Sequencial Function Chart Transition |
572 # Sequencial Function Chart Transition |
572 #------------------------------------------------------------------------------- |
573 #------------------------------------------------------------------------------- |
573 |
574 |
574 """ |
|
575 Class that implements the graphic representation of a transition |
|
576 """ |
|
577 |
575 |
578 class SFC_Transition(Graphic_Element, DebugDataConsumer): |
576 class SFC_Transition(Graphic_Element, DebugDataConsumer): |
|
577 """ |
|
578 Class that implements the graphic representation of a transition |
|
579 """ |
579 |
580 |
580 # Create a new transition |
581 # Create a new transition |
581 def __init__(self, parent, type = "reference", condition = None, priority = 0, id = None): |
582 def __init__(self, parent, type = "reference", condition = None, priority = 0, id = None): |
582 Graphic_Element.__init__(self, parent) |
583 Graphic_Element.__init__(self, parent) |
583 DebugDataConsumer.__init__(self) |
584 DebugDataConsumer.__init__(self) |
1038 |
1039 |
1039 #------------------------------------------------------------------------------- |
1040 #------------------------------------------------------------------------------- |
1040 # Sequencial Function Chart Divergence and Convergence |
1041 # Sequencial Function Chart Divergence and Convergence |
1041 #------------------------------------------------------------------------------- |
1042 #------------------------------------------------------------------------------- |
1042 |
1043 |
1043 """ |
|
1044 Class that implements the graphic representation of a divergence or convergence, |
|
1045 selection or simultaneous |
|
1046 """ |
|
1047 |
1044 |
1048 class SFC_Divergence(Graphic_Element): |
1045 class SFC_Divergence(Graphic_Element): |
|
1046 """ |
|
1047 Class that implements the graphic representation of a divergence or convergence, |
|
1048 selection or simultaneous |
|
1049 """ |
1049 |
1050 |
1050 # Create a new divergence |
1051 # Create a new divergence |
1051 def __init__(self, parent, type, number = 2, id = None): |
1052 def __init__(self, parent, type, number = 2, id = None): |
1052 Graphic_Element.__init__(self, parent) |
1053 Graphic_Element.__init__(self, parent) |
1053 self.Type = type |
1054 self.Type = type |
1500 |
1501 |
1501 #------------------------------------------------------------------------------- |
1502 #------------------------------------------------------------------------------- |
1502 # Sequencial Function Chart Jump to Step |
1503 # Sequencial Function Chart Jump to Step |
1503 #------------------------------------------------------------------------------- |
1504 #------------------------------------------------------------------------------- |
1504 |
1505 |
1505 """ |
|
1506 Class that implements the graphic representation of a jump to step |
|
1507 """ |
|
1508 |
|
1509 class SFC_Jump(Graphic_Element): |
1506 class SFC_Jump(Graphic_Element): |
|
1507 """ |
|
1508 Class that implements the graphic representation of a jump to step |
|
1509 """ |
1510 |
1510 |
1511 # Create a new jump |
1511 # Create a new jump |
1512 def __init__(self, parent, target, id = None): |
1512 def __init__(self, parent, target, id = None): |
1513 Graphic_Element.__init__(self, parent) |
1513 Graphic_Element.__init__(self, parent) |
1514 self.SetTarget(target) |
1514 self.SetTarget(target) |
1776 |
1776 |
1777 #------------------------------------------------------------------------------- |
1777 #------------------------------------------------------------------------------- |
1778 # Sequencial Function Chart Action Block |
1778 # Sequencial Function Chart Action Block |
1779 #------------------------------------------------------------------------------- |
1779 #------------------------------------------------------------------------------- |
1780 |
1780 |
1781 """ |
|
1782 Class that implements the graphic representation of an action block |
|
1783 """ |
|
1784 |
1781 |
1785 class SFC_ActionBlock(Graphic_Element): |
1782 class SFC_ActionBlock(Graphic_Element): |
|
1783 """ |
|
1784 Class that implements the graphic representation of an action block |
|
1785 """ |
1786 |
1786 |
1787 # Create a new action block |
1787 # Create a new action block |
1788 def __init__(self, parent, actions = [], id = None): |
1788 def __init__(self, parent, actions = [], id = None): |
1789 Graphic_Element.__init__(self, parent) |
1789 Graphic_Element.__init__(self, parent) |
1790 self.Id = id |
1790 self.Id = id |