module: var_res_cpp
description: 
timing_sensitivity: 
parameters:  double res_per_v, double r_fixed
inputs:  double vin, double t1
             double n0
outputs:  double vcon
classes:  Filter accum("0.2","1-z^-1")
static_variables:  
init:  
if (r_fixed < 1e-30)
  {
   printf("error in 'var_res_cpp':  r_fixed must be > 1e-30\n");
   printf("   -> in this case, r_fixed = %5.3e\n", r_fixed);
   exit(1);
  } 
vcon = 0.0;


end:  
code:  
double delta_res, vcon_desired;

delta_res = -vin*res_per_v;
vcon_desired = -delta_res/(r_fixed + delta_res)*(n0-t1) + t1;
vcon = accum.inp(vcon_desired-vcon);
