Die Implementierung ist recht billig. Ich glaube, dass die Resultate auch richtig sind.
Jemand der den Code verwendet, sollte erstmal mit einer Wahrheitstabelle prüfen ob das überhaupt stimmt
Code: Alles auswählen
In [4]: flipflop1 = SR()
In [5]: flipflop1
Out[5]: SR(state=False)
In [6]: flipflop1(in_set=True, in_reset=True)
Out[6]: False
In [7]: flipflop1(in_set=True, in_reset=False)
Out[7]: True
In [8]: flipflop1
Out[8]: SR(state=True)
In [9]: bool(flipflop1)
Out[9]: True
In [10]: int(flipflop1)
Out[10]: 1
In [11]: flipflop1 << 2
Out[11]: 4
Sind hier eigentlich noch Menschen unterwegs, die SPS programmieren?