--- a/PLCGenerator.py Wed Jan 11 14:15:45 2017 +0300
+++ b/PLCGenerator.py Thu Jan 12 14:37:55 2017 +0300
@@ -1387,6 +1387,10 @@
def GenerateSFCJump(self, jump, pou):
jump_target = jump.gettargetName()
+ if not pou.hasstep(jump_target): + msg = _("SFC jump in pou \"{a1}\" refers to non-existent SFC step \"{a2}\"").format( a1 = pname, a2 = jump_target) + raise PLCGenException, msg if jump.connectionPointIn is not None:
connections = jump.connectionPointIn.getconnections()
--- a/plcopen/plcopen.py Wed Jan 11 14:15:45 2017 +0300
+++ b/plcopen/plcopen.py Thu Jan 12 14:37:55 2017 +0300
@@ -1245,6 +1245,14 @@
self.interface.remove(varlist)
setattr(cls, "removepouVar", removepouVar)
+ def hasstep(self, name=None): + if self.getbodyType() in ["SFC"]: + for instance in self.getinstances(): + if isinstance(instance, PLCOpenParser.GetElementClass("step", "sfcObjects")) and TextMatched(instance.getname(), name): + setattr(cls, "hasstep", hasstep) def hasblock(self, name=None, block_type=None):
if self.getbodyType() in ["FBD", "LD", "SFC"]: