J
jimzat
I am trying to simulate the execution of some PLC ladder logic in
python.
I manually modified the rungs and executed this within python as a
proof of concept, but I'd like to be able to skip the modification
step. My thought was that this might be able to be completed via
overloading, but I am not sure if (or how) it could be done.
overloadings:
+ ==> OR
* ==> AND
/ ==> NOT
Example original code:
A=/B+C*D
translates to:
A=not B or C and D
I tried
def __add__ (a,b):
return (a or b)
which gives me this:
2
How can this be done?
python.
I manually modified the rungs and executed this within python as a
proof of concept, but I'd like to be able to skip the modification
step. My thought was that this might be able to be completed via
overloading, but I am not sure if (or how) it could be done.
overloadings:
+ ==> OR
* ==> AND
/ ==> NOT
Example original code:
A=/B+C*D
translates to:
A=not B or C and D
I tried
def __add__ (a,b):
return (a or b)
which gives me this:
2
How can this be done?