Threshold function or node

Hi dear forum, I am stuck on a topic concerning whether to use a function or just nodes. I would like to create a threshold with damping as we use it in PLC programming (just because I´m used to it). If there is any easier way please comment. Ok I try to explain what I would like to do: if a value reaches a threshold I would like a time to be startet (damping time). If this time has expired and the threshold is still reached, a message is fired (setpoint). if the has expired and the threshold is nomore reached, do nothing exept reset time. I would suggest something like:
if (value >= threshold)
{
pause(30s);
if (value >= threshold)
{
send setpoint
}
}

Something like this maybe?

Click 11 and then within 5 seconds click 7 and no message is sent.
Click 11 and leave it and the original message is passed on.

[{"id":"f12e995f99b648f6","type":"inject","z":"bdd7be38.d3b55","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"num","x":90,"y":1960,"wires":[["b05c1acd8f3a75c4"]]},{"id":"98d36c5f4eb1c9cf","type":"trigger","z":"bdd7be38.d3b55","name":"","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":660,"y":1980,"wires":[["44a02c445dc6616b"]]},{"id":"02f8941a9fc9d306","type":"inject","z":"bdd7be38.d3b55","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11","payloadType":"num","x":90,"y":2040,"wires":[["b05c1acd8f3a75c4"]]},{"id":"34edf617dd1f3e6b","type":"switch","z":"bdd7be38.d3b55","name":">10?","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"10","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":1980,"wires":[["98d36c5f4eb1c9cf"],["b27136cd4ae17ec5"]]},{"id":"b27136cd4ae17ec5","type":"change","z":"bdd7be38.d3b55","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":2040,"wires":[["98d36c5f4eb1c9cf"]]},{"id":"44a02c445dc6616b","type":"debug","z":"bdd7be38.d3b55","name":"debug 98","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":840,"y":1980,"wires":[]},{"id":"b05c1acd8f3a75c4","type":"junction","z":"bdd7be38.d3b55","x":240,"y":1980,"wires":[["34edf617dd1f3e6b"]]}]

Hi Colin, Thank you very much....a completely different approach for me. Think that should work. I still am thinking to much in other struktures. But it tells me again, that most problems can be solved by using standard nodes. Have a nice weekend.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.