diff --git a/doc/revpimodio2.app.html b/doc/revpimodio2.app.html index e6a1b6e..e96c636 100644 --- a/doc/revpimodio2.app.html +++ b/doc/revpimodio2.app.html @@ -39,7 +39,7 @@ object

Class Attributes

- +
None
__slots__

Class Methods

diff --git a/doc/revpimodio2.device.html b/doc/revpimodio2.device.html index f3894a6..3e1d92a 100644 --- a/doc/revpimodio2.device.html +++ b/doc/revpimodio2.device.html @@ -58,7 +58,7 @@ Core

Class Attributes

- +
A3
wdautotoggle
A3
__slots__
wdautotoggle

Class Methods

@@ -176,7 +176,7 @@ Device

Class Attributes

- +
A1
A2
status
A1
A2
__slots__
status

Class Methods

@@ -496,7 +496,7 @@ object

Class Attributes

- +
length
name
offset
position
producttype
__slots__
length
name
offset
position
producttype

Class Methods

@@ -1024,7 +1024,7 @@ Device

Class Attributes

- +
None
__slots__

Class Methods

@@ -1093,7 +1093,7 @@ Gateway

Class Attributes

- +
None
__slots__

Class Methods

diff --git a/doc/revpimodio2.helper.html b/doc/revpimodio2.helper.html index ee90dfb..4868bdb 100644 --- a/doc/revpimodio2.helper.html +++ b/doc/revpimodio2.helper.html @@ -26,6 +26,9 @@ Classes ProcimgWriter Klasse fuer Synchroniseriungs-Thread. + +Var +

@@ -65,7 +68,7 @@ None

Class Attributes

- +
None
__slots__

Class Methods

@@ -351,7 +354,7 @@ Thread

Class Attributes

- +
None
__slots__

Class Methods

@@ -426,7 +429,7 @@ Thread

Class Attributes

- +
ioerrors
maxioerrors
refresh
__slots__
ioerrors
maxioerrors
refresh

Class Methods

@@ -587,6 +590,35 @@ ProcimgWriter.stop

Beendet die automatische Prozessabbildsynchronisierung.

+
Up
+

+ +

Var

+ +

+Derived from

+None +

+Class Attributes

+ + +
None
+

+Class Methods

+ + +
None
+

+Methods

+ + +
None
+

+Static Methods

+ + +
None
+
Up

\ No newline at end of file diff --git a/doc/revpimodio2.io.html b/doc/revpimodio2.io.html index 19eb3b7..7892835 100644 --- a/doc/revpimodio2.io.html +++ b/doc/revpimodio2.io.html @@ -54,7 +54,7 @@ object

Class Attributes

- +
_parentdevice
__slots__
_parentdevice

Class Methods

@@ -124,7 +124,7 @@ object

Class Attributes

- +
address
byteorder
defaultvalue
length
name
type
value
__slots__
address
byteorder
defaultvalue
length
name
type
value

Class Methods

@@ -520,7 +520,7 @@ object

Class Attributes

- +
None
__slots__

Class Methods

@@ -752,7 +752,7 @@ IOBase

Class Attributes

- +
byteorder
defaultvalue
signed
value
__slots__
byteorder
defaultvalue
signed
value

Class Methods

@@ -889,7 +889,7 @@ IOBase

Class Attributes

- +
defaultvalue
frm
signed
value
__slots__
defaultvalue
frm
signed
value

Class Methods

diff --git a/doc/revpimodio2.modio.html b/doc/revpimodio2.modio.html index 80b6568..0086303 100644 --- a/doc/revpimodio2.modio.html +++ b/doc/revpimodio2.modio.html @@ -54,7 +54,7 @@ object

Class Attributes

- +
configrsc
cycletime
ioerrors
length
maxioerrors
monitoring
procimg
simulator
__slots__
configrsc
cycletime
ioerrors
length
maxioerrors
monitoring
procimg
simulator

Class Methods

@@ -557,7 +557,7 @@ RevPiModIOSelected

Class Attributes

- +
None
__slots__

Class Methods

@@ -617,7 +617,7 @@ RevPiModIO

Class Attributes

- +
None
__slots__

Class Methods

diff --git a/doc/revpimodio2.netio.html b/doc/revpimodio2.netio.html index 4e6ebc1..8c1caa9 100644 --- a/doc/revpimodio2.netio.html +++ b/doc/revpimodio2.netio.html @@ -54,7 +54,7 @@ Thread

Class Attributes

- +
closed
name
timeout
__slots__
closed
name
timeout

Class Methods

@@ -323,7 +323,7 @@ _RevPiModIO

Class Attributes

- +
None
__slots__

Class Methods

@@ -448,7 +448,7 @@ RevPiNetIOSelected

Class Attributes

- +
None
__slots__

Class Methods

@@ -511,7 +511,7 @@ RevPiNetIO

Class Attributes

- +
None
__slots__

Class Methods

diff --git a/doc/revpimodio2.summary.html b/doc/revpimodio2.summary.html index 194214e..dd61e6e 100644 --- a/doc/revpimodio2.summary.html +++ b/doc/revpimodio2.summary.html @@ -39,7 +39,7 @@ object

Class Attributes

- +
None
__slots__

Class Methods

diff --git a/revpimodio2.e4p b/revpimodio2.e4p index 4223e53..9b5037a 100644 --- a/revpimodio2.e4p +++ b/revpimodio2.e4p @@ -1,7 +1,7 @@ - + en_US @@ -9,7 +9,7 @@ Python3 Console Das Modul stellt alle Devices und IOs aus der piCtory Konfiguration in Python3 zur Verfügung. Es ermöglicht den direkten Zugriff auf die Werte über deren vergebenen Namen. Lese- und Schreibaktionen mit dem Prozessabbild werden von dem Modul selbst verwaltet, ohne dass sich der Programmierer um Offsets und Adressen kümmern muss. Für die Gatewaymodule wie ModbusTCP oder Profinet sind eigene 'Inputs' und 'Outputs' über einen bestimmten Adressbereich definierbar. Auf diese IOs kann mit Python3 über den Namen direkt auf die Werte zugegriffen werden. - 2.2.2 + 2.2.3 Sven Sager akira@narux.de diff --git a/revpimodio2/__init__.py b/revpimodio2/__init__.py index ce1eff2..3f1af8c 100644 --- a/revpimodio2/__init__.py +++ b/revpimodio2/__init__.py @@ -22,7 +22,7 @@ __author__ = "Sven Sager " __copyright__ = "Copyright (C) 2018 Sven Sager" __license__ = "LGPLv3" __name__ = "revpimodio2" -__version__ = "2.2.2" +__version__ = "2.2.3" # Global package values OFF = 0 diff --git a/revpimodio2/app.py b/revpimodio2/app.py index 010c437..19389f2 100644 --- a/revpimodio2/app.py +++ b/revpimodio2/app.py @@ -9,6 +9,8 @@ class App(object): """Bildet die App Sektion der config.rsc ab.""" + __slots__ = "name", "version", "language", "layout" + def __init__(self, app): """Instantiiert die App-Klasse. @param app piCtory Appinformationen""" diff --git a/revpimodio2/device.py b/revpimodio2/device.py index 7754ecc..72b0d6a 100644 --- a/revpimodio2/device.py +++ b/revpimodio2/device.py @@ -106,6 +106,13 @@ class Device(object): """ + __slots__ = "_ba_devdata", "_ba_datacp", \ + "_dict_events", "_filelock", "_length", "_modio", "_name", "_offset", \ + "_position", "_producttype", "_selfupdate", "_slc_devoff", \ + "_slc_inp", "_slc_inpoff", "_slc_mem", "_slc_memoff", \ + "_slc_out", "_slc_outoff", "bmk", "catalognr", "comment", "extend", \ + "guid", "id", "inpvariant", "outvariant", "type" + def __init__(self, parentmodio, dict_device, simulator=False): """Instantiierung der Device-Klasse. @@ -122,24 +129,24 @@ class Device(object): self._selfupdate = False # Wertzuweisung aus dict_device - self._name = dict_device.pop("name") - self._offset = int(dict_device.pop("offset")) - self._position = int(dict_device.pop("position")) - self._producttype = int(dict_device.pop("productType")) + self._name = dict_device.get("name") + self._offset = int(dict_device.get("offset")) + self._position = int(dict_device.get("position")) + self._producttype = int(dict_device.get("productType")) # IOM-Objekte erstellen und Adressen in SLCs speichern if simulator: self._slc_inp = self._buildio( - dict_device.pop("out"), INP) + dict_device.get("out"), INP) self._slc_out = self._buildio( - dict_device.pop("inp"), OUT) + dict_device.get("inp"), OUT) else: self._slc_inp = self._buildio( - dict_device.pop("inp"), INP) + dict_device.get("inp"), INP) self._slc_out = self._buildio( - dict_device.pop("out"), OUT) + dict_device.get("out"), OUT) self._slc_mem = self._buildio( - dict_device.pop("mem"), MEM + dict_device.get("mem"), MEM ) # SLCs mit offset berechnen @@ -162,7 +169,15 @@ class Device(object): self._ba_datacp = bytearray() # Alle restlichen attribute an Klasse anhängen - self.__dict__.update(dict_device) + self.bmk = dict_device.get("bmk", "") + self.catalognr = dict_device.get("catalogNr", "") + self.comment = dict_device.get("comment", "") + self.extend = dict_device.get("extend", {}) + self.guid = dict_device.get("GUID", "") + self.id = dict_device.get("id", "") + self.inpvariant = dict_device.get("inpVariant", 0) + self.outvariant = dict_device.get("outVariant", 0) + self.type = dict_device.get("type", "") # Spezielle Konfiguration von abgeleiteten Klassen durchführen self._devconfigure() @@ -398,6 +413,10 @@ class Core(Device): """ + __slots__ = "_iocycle", "_ioerrorcnt", "_iostatusbyte", "_iotemperature", \ + "_ioerrorlimit1", "_ioerrorlimit2", "_iofrequency", "_ioled", \ + "a1green", "a1red", "a2green", "a2red" + def _devconfigure(self): """Core-Klasse vorbereiten.""" # Eigene IO-Liste aufbauen @@ -647,6 +666,9 @@ class Connect(Core): """ + __slots__ = "__evt_wdtoggle", "__th_wdtoggle", "a3green", "a3red", "wd", \ + "x2in", "x2out" + def __wdtoggle(self): """WD Ausgang alle 10 Sekunden automatisch toggeln.""" while not self.__evt_wdtoggle.wait(10): @@ -754,6 +776,8 @@ class Gateway(Device): """ + __slots__ = "_dict_slc" + def __init__(self, parent, dict_device, simulator=False): """Erweitert Device-Klasse um get_rawbytes-Funktionen. @see #Device.__init__ Device.__init__(...)""" @@ -783,6 +807,8 @@ class Virtual(Gateway): """ + __slots__ = () + def writeinputdefaults(self): """Schreibt fuer ein virtuelles Device piCtory Defaultinputwerte. diff --git a/revpimodio2/helper.py b/revpimodio2/helper.py index b79c2df..b48ea94 100644 --- a/revpimodio2/helper.py +++ b/revpimodio2/helper.py @@ -37,6 +37,8 @@ class EventCallback(Thread): """ + __slots__ = "daemon", "exit", "func", "ioname", "iovalue" + def __init__(self, func, name, value): """Init EventCallback class. @@ -85,6 +87,11 @@ class Cycletools(): """ + __slots__ = "__cycle", "__cycletime", "__ucycle", \ + "__dict_ton", "__dict_tof", "__dict_tp", "first", \ + "flag1c", "flag5c", "flag10c", "flag15c", "flag20c", \ + "flank5c", "flank10c", "flank15c", "flank20c", "var" + def __init__(self, cycletime): """Init Cycletools class.""" self.__cycle = 0 @@ -108,6 +115,11 @@ class Cycletools(): self.flank15c = True self.flank20c = True + # Benutzerdaten + class Var: + pass + self.var = Var() + def _docycle(self): """Zyklusarbeiten.""" # Einschaltverzoegerung @@ -277,6 +289,10 @@ class ProcimgWriter(Thread): """ + __slots__ = "__dict_delay", "__eventth", "__eventqth", "__eventwork", \ + "_adjwait", "_eventq", "_ioerror", "_maxioerrors", "_modio", \ + "_refresh", "_work", "daemon", "lck_refresh", "newdata" + def __init__(self, parentmodio): """Init ProcimgWriter class. @param parentmodio Parent Object""" diff --git a/revpimodio2/io.py b/revpimodio2/io.py index 839efe3..b100cd4 100644 --- a/revpimodio2/io.py +++ b/revpimodio2/io.py @@ -14,6 +14,8 @@ class IOEvent(object): """Basisklasse fuer IO-Events.""" + __slots__ = "as_thread", "delay", "edge", "func", "overwrite" + def __init__(self, func, edge, as_thread, delay, overwrite): """Init IOEvent class.""" self.as_thread = as_thread @@ -220,6 +222,8 @@ class DeadIO(object): """Klasse, mit der ersetzte IOs verwaltet werden.""" + __slots__ = "__deadio" + def __init__(self, deadio): """Instantiierung der DeadIO-Klasse. @param deadio IO, der ersetzt wurde""" @@ -248,6 +252,10 @@ class IOBase(object): """ + __slots__ = "_bitaddress", "_bitlength", "_byteorder", "_defaultvalue", \ + "_iotype", "_length", "_name", "_parentdevice", \ + "_signed", "_slc_address", "bmk" + def __init__(self, parentdevice, valuelist, iotype, byteorder, signed): """Instantiierung der IOBase-Klasse. @@ -767,6 +775,8 @@ class IntIO(IOBase): """ + __slots__ = () + def __int__(self): """Gibt IO-Wert zurueck mit Beachtung byteorder/signed. @return IO-Wert als """ @@ -844,6 +854,9 @@ class StructIO(IOBase): """ + __slots__ = "__frm", "_parentio_address", "_parentio_defaultvalue", \ + "_parentio_length" + def __init__(self, parentio, name, frm, **kwargs): """Erstellt einen IO mit struct-Formatierung. diff --git a/revpimodio2/modio.py b/revpimodio2/modio.py index 737ac5b..2d73bac 100644 --- a/revpimodio2/modio.py +++ b/revpimodio2/modio.py @@ -31,6 +31,13 @@ class RevPiModIO(object): """ + __slots__ = "__cleanupfunc", "_autorefresh", "_buffedwrite", \ + "_configrsc", "_exit", "_imgwriter", "_ioerror", "_length", \ + "_looprunning", "_lst_devselect", "_lst_refresh", "_maxioerrors", \ + "_myfh", "_monitoring", "_procimg", "_simulator", "_syncoutputs", \ + "_th_mainloop", "_waitexit", \ + "core", "app", "device", "exitsignal", "io", "summary" + def __init__( self, autorefresh=False, monitoring=False, syncoutputs=True, procimg=None, configrsc=None, simulator=False): @@ -796,6 +803,8 @@ class RevPiModIOSelected(RevPiModIO): """ + __slots__ = () + def __init__( self, deviceselection, autorefresh=False, monitoring=False, syncoutputs=True, procimg=None, configrsc=None, simulator=False): @@ -860,6 +869,8 @@ class RevPiModIODriver(RevPiModIOSelected): """ + __slots__ = () + def __init__( self, virtdev, autorefresh=False, monitoring=False, syncoutputs=True, procimg=None, configrsc=None): diff --git a/revpimodio2/netio.py b/revpimodio2/netio.py index 43325b9..29a558a 100644 --- a/revpimodio2/netio.py +++ b/revpimodio2/netio.py @@ -34,6 +34,12 @@ class NetFH(Thread): """ + __slots__ = "__by_buff", "__int_buff", "__dictdirty", "__flusherr", \ + "__position", "__sockact", "__sockerr", "__sockend", "__socklock", \ + "__timeout", "__trigger", "__waitsync", \ + "_address", "_slavesock", \ + "daemon" + def __init__(self, address, timeout=500): """Init NetFH-class. @param address IP Adresse des RevPi @@ -379,6 +385,8 @@ class RevPiNetIO(_RevPiModIO): """ + __slots__ = "_address" + def __init__( self, address, autorefresh=False, monitoring=False, syncoutputs=True, simulator=False): @@ -530,6 +538,8 @@ class RevPiNetIOSelected(RevPiNetIO): """ + __slots__ = () + def __init__( self, address, deviceselection, autorefresh=False, monitoring=False, syncoutputs=True, simulator=False): @@ -595,6 +605,8 @@ class RevPiNetIODriver(RevPiNetIOSelected): """ + __slots__ = () + def __init__( self, address, virtdev, autorefresh=False, monitoring=False, syncoutputs=True): diff --git a/revpimodio2/summary.py b/revpimodio2/summary.py index 9bdc72a..361f5fa 100644 --- a/revpimodio2/summary.py +++ b/revpimodio2/summary.py @@ -9,6 +9,8 @@ class Summary(object): """Bildet die Summary-Sektion der config.rsc ab.""" + __slots__ = "inptotal", "outtotal" + def __init__(self, summary): """Instantiiert die RevPiSummary-Klasse. @param summary piCtory Summaryinformationen""" diff --git a/setup.py b/setup.py index 0ec5220..320a416 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ setup( license="LGPLv3", name="revpimodio2", - version="2.2.2", + version="2.2.3", packages=["revpimodio2"], python_requires="~=3.2",