scale(duty)

koadrobot/aritmatics/scale(duty)

Scale input duty (0..1) to value by Tmin..Tmax (map) with ensure (min<max).
scale(duty)
@/scale(duty)
Scale input duty (0..1) to value by Tmin..Tmax (map) with ensure (min<max).
DUTYnumber
Value to map
STARTnumber
Target range lower bound
STOPnumber
Tartger range upper bound
scale(duty)
DUTY
START
STOP
X
Xnumber
Mapped value
To use the node in your project you should have the koadrobot/aritmatics library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD dirtieness disable

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    Number duty = getValue<input_DUTY>(ctx);
    Number start = getValue<input_START>(ctx);
    Number stop = getValue<input_STOP>(ctx);
    Number out = start + (duty * (stop-start));
    emitValue<output_OUT>(ctx, out);
}