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

end:  
code:  
double delta_cap, vcon_desired;

delta_cap = vin*cap_per_v;
vcon_desired = -delta_cap/(c_fixed + delta_cap)*(n0-t1) + t1;
vcon = accum.inp(vcon_desired-vcon);
