Closed rysson closed 1 year ago
Hi rysson, it's a good feature idea - the thing is I'd like to keep the "API" quite general, so that people can do their own logic, and experiment with the PLC features. So, the TP timer is implemented like the PLC TP (e.g.: https://www.youtube.com/watch?v=8aRXSWvhycI), and we can e.g. apply instant logic to the output variable ET (elapsed time).
As a one-liner, the off-on control could be done using:
R = TP1(Y, 60) AND TP1.ET>40
On-off would be then:
R = TP1(Y, 60) AND TP1.ET<40
(This is no different from a normal TP, except that the timer now ignores inputs for 20t after switching the output off).
Would that already resolve the TP timer shortage in your setup with the current implementation?
Cheers,-
Would that already resolve the TP timer shortage in your setup with the current implementation?
Sure, you shot me :-D
It's so easy now, thanks a lot. I've forgot, then TP.ET
is available :-)
EDIT: Nice video, I remember one of my university of technology lab and programming Simens PLCs! But we skipped timer :-/
Awesome mod, thanks a lot!
Description
I want to propose TP extension. Add optional delay:
TPx(input[, delay], pulse)
TP1( Y, 40)
– current behavior, 2 sec pulse, started by raising edge of Y (default delay is zero)TP1(Y, 60, 40)
– 2 sec pulse (on) after 3 seconds (off), started by raising edge of YThe new Pulse Timer has two phases
delay
–TP1.ET
from- TP1.DT
to zero, output is0
pulse
–TP1.ET
from0
toTP1.PT
, output is15
If delay (
TP1.DT
) is zero, than timer starts from phase 2 immediately (current behavior).Motivation
R = TP1(Y, 60, 40)
works like a two timer combinationNew version is easier to code, and uses less timers. Even in the implementation one timer is enough. An extra delay (
.DT
) value is needed.Than, instead:![redstonepen-tp12](https://user-images.githubusercontent.com/5898312/203345749-c67808c7-9aa1-44f0-ac6a-b5bdc5f28588.png)
we could use:![redstonepen-tp1d](https://user-images.githubusercontent.com/5898312/203344623-877db993-e7c5-4078-9fef-3494654bf223.png)