module: gain_w_limits
description: 
parameters:  double gain, double max
             double min, double offset
inputs:  double a
outputs:  double y
classes:  
static_variables:  
init:  
end:  
code:  
y=(a-offset)*gain;
if (y > max)
   y = max;
else if (y < min)
   y = min;

