Range
Last updated
Last updated
Use a Range node in your Flow to linearly scale a numeric value in one range, to its corresponding value in a separate range that you specify.
To configure a Range node in the Flow Editor, drag it from the Palette to the Workspace canvas, then double-click the node to open and configure its behavior.
Specify the path to the msg. Property that contains the numeric value that you want to scale.
Choose the Action you want to perform
Scale the message property: This action linearly scales the input value from the specified input range to the output range without any restrictions or modifications. Values outside the input range are still processed and scaled according to the same ratio.
Scale and limit to the target range: This action scales the input value like the first option but adds a limitation such that any scaled value that falls outside the output range is clamped to the nearest boundary of the output range.
Scale and wrap within the target range: This action scales the input and then applies wrapping within the output range. If the scaled value exceeds the output range, it wraps around within this range, similar to how a circular buffer works.
Scale but drop msg if outside input range: In this action, the input value is scaled only if it falls within the specified input range. If the input value is outside this range, the message is dropped and no output is produced.
Specify the input range by setting a minimum and maximum numeric value.
Specify the target range by settng a minimum and maximum numeric value.
Optionally, choose to round the result to the nearest integer.
Provide an optional Name for the node.
By default a Range node will be shown with a label of "n-n" using the target range values that you set for the node, the value you provide will be used instead.
The Range node is incredibly useful for scaling or translating values from one range to another, adapting data to fit the expected input range of downstream nodes, devices, or systems. Here are some practical purposes and scenarios where such a node can be highly beneficial:
Different devices often require input values within specific ranges. For example, if a sensor outputs a voltage range from 0 to 5 volts, but a motor controller expects a control signal from 0 to 1 volt, a Range node can be used to correctly scale the sensor output to suit the motor controller's input requirements.
In data processing and machine learning applications, it's common to normalize data to a range that optimizes algorithm performance. For instance, scaling feature values to a range of 0 to 1 can help improve the convergence speed and stability of neural networks.
When creating user interfaces, such as dashboards for monitoring or controlling devices, input elements like sliders might have a different value range than the actual control parameters of the devices. A Range node can adjust these user inputs to match the required operational parameters of the devices being controlled.
In audio applications, scaling audio signals to fit within the bounds acceptable to different audio processing units or hardware interfaces is necessary. For instance, mapping a raw microphone input range to a normalized audio processing range can help in maintaining sound quality and reducing noise.
In climate control applications, sensor readings like temperature or humidity often need to be mapped to control ranges for HVAC systems. For example, converting a temperature sensor reading from a Celsius range to a PWM signal range for a fan speed controller ensures that the fan operates correctly based on the current room temperature.
In smart lighting systems, light intensity levels might need to be adjusted based on ambient light conditions. A Range node can convert ambient light sensor readings into appropriate dimming levels for lights, enhancing energy efficiency and comfort.