hawkr
Using the tutorial program of PB1, PB2, and LAMP. Running on Debian 11 with Python Submodule for hardware.

Have the PLC hooked to ScadaBR over ModBus and it works flawlessly. So program logic should not be an issue.
However, when using the psm.set_var command, I find the value (in this case QX0.0) is updated until while loop occurs, and then the value is reset. Logs below for proof.

Before update_inputs: QX0.0 False
Updating QX0.0 to True
Value is now True
Before update_outputs: QX0.0 True
After update_outputs: QX0.0 True
WHILE LOOP CYCLE
Before update_inputs: QX0.0 False


When using the ScadaBR HMI, there is no issue. I disabled the HMI connection to make sure the HMI wasn't sending constant write commands or otherwise locking the coil to false.

I also reverted back to the default main.py (so default tutorial program with variables renamed to QX0.0 0.1 and 0.2 plus default main.py with variables adjusted accordingly) and encountered the same issue.

EDIT:
Keeping this all here for future reference to my stupidity. Changed PB1 and PB2 back to IX instead of QX and it works. I assume that the PSM can only update Input Coils?

EDIT:
To all who wander here, let it be known. Python Submodule will only save changes to Input Coils and Registers. Loaded up my program again with changes made to make PB1 and PB2 to IX and it works like a charm.
Reply 0 0
thiagoralves
There is a major flaw in your understanding of PSM. PSM is supposed to be a hardware driver, which means it can write to inputs and read from outputs. That's what a driver does. Writing to outputs would conflict with the behavior of the PLC program, making the driver collide with the logic on your program.
Reply 0 0
Reply