node-red-contrib-timeprop 2.0.0
Time proportion power generator for Node-RED
node-red-contrib-timeprop
A Node-RED node that generates a time proportioned output from a linear input.
Possible breaking change in V2.0.0
Version 2.0.0 introduces a change to bring the node into line with current node-red conventions, that a node should pass on all message properties that are not relevant to its operation. It is unlikely, but possible, that existing flows will be affected by the extra properties that may now exist in the messages output.
Install
The usual method of installing is to use Manage Palette in the node red editor and search for node-red-contrib-timeprop and install it.
Using npm directly, cd into your node red user directory (usually .node-red in your home folder) and from there run
npm install node-red-contrib-timeprop
Usage
Given a required power value in msg.payload in the range 0.0 to 1.0 this node generates a time proportioned 0/1 output (representing OFF/ON) which averages to required power value. The signal is output in msg.payload. The message will also include all other properties from the most recent message passed to the node.
The node uses a configurable cycle time, so if, for example, the period is set to 10 minutes and the power input is 0.2 then the output would be on for two minutes in every ten minutes.
Configuration
Cycle time - This is the cycle time of the time proportioned output as described above.
Actuator dead time - This can be used to specify the time (in seconds) that the actuator or other device takes to respond when told to go from ON to OFF or vice versa. The algorithm allows for this and will not ask the device to open/close for too short a time, in order to avoid it being told to open and then close again before it has responded to the first request. If the time to switch on is different to that switching off again then add the two times together and divide by two to get the value to enter. Set this to 0 to disable this feature.
Trigger period - This tells the node how often to determine what state the output should be set to. I generally set this to about 1% of the cycle time, so for a 10 minute cycle time I would set this to around 6 seconds.
Invert - This allows the output to be inverted, so that a 0 output indicates full power, and 1 indicates no power. This is useful if, for example, the output is connected to an active low signal such as that used to drive a relay connected to a GPIO pin on a Raspberry Pi