summaryrefslogtreecommitdiff
path: root/src/hal/components/limit1.comp
blob: 875b62df94295c83b680c8c67dac32f892b99d0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
component limit1 "Limit the output signal to fall between min and max";
pin in float in;
pin out float out;
param rw float min_=-1e20;
param rw float max_=1e20;
function _;
license "GPL";
;;
FUNCTION(_) {
    double tmp = in;
    if(tmp < min_) tmp = min_;
    if(tmp > max_) tmp = max_;
    out = tmp;
}