tests/canopen_master/plc.xml
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 10 Aug 2018 17:45:33 +0300
changeset 2278 a3ac46366b86
parent 436 c926a8037adc
child 2346 ac16bad593cf
permissions -rw-r--r--
Dirty fix for error '_object_has_no_attribute_'getSlave' in EtherCAT extension

traceback:
File "/home/developer/WorkData/PLC/beremiz/beremiz/IDEFrame.py", line 1433, in OnPouSelectedChanged
window.RefreshView()
File "/home/developer/WorkData/PLC/beremiz/beremiz/etherlab/ConfigEditor.py", line 837, in RefreshView
self.RefreshProcessVariables()
File "/home/developer/WorkData/PLC/beremiz/beremiz/etherlab/ConfigEditor.py", line 886, in RefreshProcessVariables
slaves = self.Controler.GetSlaves(**self.CurrentNodesFilter)
File "/home/developer/WorkData/PLC/beremiz/beremiz/etherlab/EthercatMaster.py", line 341, in GetSlaves
for slave in self.Config.getConfig().getSlave():
<type 'exceptions.AttributeError'>:_'lxml.etree._Element'_object_has_no_attribute_'getSlave'

Steps to reproduce problem:

- Add new EtherCAT master
- Add new EthercatNode to the master
- double click on


this is looks like dirty hack to fix strange problem with initial[0]
changing its type after returning from _init_ method to lxml.etree._Element
As a result all methods generated by class factory are lost.

For example, in function initMethod initial[0].__class__ points to
xmlclass.xmlclass.Config. After map(self.append, initial)
self.Config.__class__ is 'xmlclass.xmlclass.Config' as well.
But after returning from initMethod (_init) in CreateElement
self.Config.__class__ has changed to lxml.etree._Element.


I've noticed similar behavior if copy/deepcopy is used for any child
of etree.ElementBase. See simple example below.
[-------------------------------------------------------------]
#!/usr/bin/python

from __future__ import print_function
from lxml import etree
import copy

class DefaultElementClass(etree.ElementBase):
def getLocalTag(self):
return etree.QName(self.tag).localname


def printInformation(x):
print(x, x.__class__, "getLocalTag" in dir(x))


a = DefaultElementClass()
printInformation(a)

#
printInformation(copy.copy(a))
printInformation(copy.deepcopy(a))
[-------------------------------------------------------------]
411
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
     1
<?xml version="1.0" encoding="UTF-8"?>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
     2
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
     3
         xmlns="http://www.plcopen.org/xml/tc6.xsd"
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
     4
         xmlns:xhtml="http://www.w3.org/1999/xhtml"
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
     5
         xsi:schemaLocation="http://www.plcopen.org/xml/tc6.xsd">
436
c926a8037adc Wiped out references to Lolitech
edouard
parents: 411
diff changeset
     6
  <fileHeader companyName="beremiz"
411
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
     7
              productName="beremiz"
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
     8
              productVersion="1"
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
     9
              creationDateTime="2008-06-24T18:44:00"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    10
  <contentHeader name="canopen_master"
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    11
                 modificationDateTime="2009-10-07T18:45:11"
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    12
                 language="en-US">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    13
    <coordinateInfo>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    14
      <fbd>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    15
        <scaling x="0" y="0"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    16
      </fbd>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    17
      <ld>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    18
        <scaling x="0" y="0"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    19
      </ld>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    20
      <sfc>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    21
        <scaling x="0" y="0"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    22
      </sfc>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    23
    </coordinateInfo>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    24
  </contentHeader>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    25
  <types>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    26
    <dataTypes/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    27
    <pous>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    28
      <pou name="test_main" pouType="program">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    29
        <interface>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    30
          <localVars>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    31
            <variable name="PLC_OUT" address="%QW0.0.2.8193.0">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    32
              <type>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    33
                <INT/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    34
              </type>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    35
            </variable>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    36
            <variable name="PLC_IN" address="%IW0.0.2.8192.0">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    37
              <type>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    38
                <INT/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    39
              </type>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    40
            </variable>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    41
          </localVars>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    42
        </interface>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    43
        <body>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    44
          <FBD>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    45
            <outVariable localId="1" height="29" width="80">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    46
              <position x="362" y="140"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    47
              <connectionPointIn>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    48
                <relPosition x="0" y="14"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    49
                <connection refLocalId="4" formalParameter="OUT">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    50
                  <position x="362" y="154"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    51
                  <position x="330" y="154"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    52
                  <position x="330" y="153"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    53
                  <position x="299" y="153"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    54
                </connection>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    55
              </connectionPointIn>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    56
              <expression>PLC_OUT</expression>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    57
            </outVariable>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    58
            <inVariable localId="2" height="29" width="20">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    59
              <position x="100" y="115"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    60
              <connectionPointOut>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    61
                <relPosition x="20" y="14"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    62
              </connectionPointOut>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    63
              <expression>1</expression>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    64
            </inVariable>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    65
            <block localId="4" width="75" height="60" typeName="ADD">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    66
              <position x="224" y="123"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    67
              <inputVariables>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    68
                <variable formalParameter="IN1">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    69
                  <connectionPointIn>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    70
                    <relPosition x="0" y="30"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    71
                    <connection refLocalId="2">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    72
                      <position x="224" y="153"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    73
                      <position x="183" y="153"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    74
                      <position x="183" y="129"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    75
                      <position x="120" y="129"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    76
                    </connection>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    77
                  </connectionPointIn>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    78
                </variable>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    79
                <variable formalParameter="IN2">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    80
                  <connectionPointIn>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    81
                    <relPosition x="0" y="50"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    82
                    <connection refLocalId="5">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    83
                      <position x="224" y="173"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    84
                      <position x="199" y="173"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    85
                      <position x="199" y="201"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    86
                      <position x="174" y="201"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    87
                    </connection>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    88
                  </connectionPointIn>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    89
                </variable>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    90
              </inputVariables>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    91
              <inOutVariables/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    92
              <outputVariables>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    93
                <variable formalParameter="OUT">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    94
                  <connectionPointOut>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    95
                    <relPosition x="75" y="30"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    96
                  </connectionPointOut>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    97
                </variable>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    98
              </outputVariables>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
    99
            </block>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   100
            <inVariable localId="5" height="29" width="70">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   101
              <position x="104" y="187"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   102
              <connectionPointOut>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   103
                <relPosition x="70" y="14"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   104
              </connectionPointOut>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   105
              <expression>PLC_IN</expression>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   106
            </inVariable>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   107
          </FBD>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   108
        </body>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   109
      </pou>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   110
    </pous>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   111
  </types>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   112
  <instances>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   113
    <configurations>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   114
      <configuration name="conf">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   115
        <resource name="res">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   116
          <task name="tache" interval="t#50ms" priority="0">
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   117
            <pouInstance name="toto" typeName="test_main"/>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   118
          </task>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   119
        </resource>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   120
      </configuration>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   121
    </configurations>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   122
  </instances>
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents:
diff changeset
   123
</project>