|
|
@ -150,7 +150,14 @@ void cm_aswitch(ARGS) /* structure holding parms, |
|
|
if ( PARAM(log) == MIF_TRUE ) { /* Logarithmic Variation in 'R' */ |
|
|
if ( PARAM(log) == MIF_TRUE ) { /* Logarithmic Variation in 'R' */ |
|
|
intermediate = log(r_off / r_on) / (cntl_on - cntl_off); |
|
|
intermediate = log(r_off / r_on) / (cntl_on - cntl_off); |
|
|
r = r_on * exp(intermediate * (cntl_on - INPUT(cntl_in))); |
|
|
r = r_on * exp(intermediate * (cntl_on - INPUT(cntl_in))); |
|
|
|
|
|
|
|
|
|
|
|
if (PARAM(limit) == MIF_TRUE) { |
|
|
|
|
|
if(r<r_on) r=r_on;/* minimum resistance limiter */ |
|
|
|
|
|
if(r>r_off) r=r_off;/* maximum resistance limiter */ |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
if(r<=1.0e-9) r=1.0e-9;/* minimum resistance limiter */ |
|
|
if(r<=1.0e-9) r=1.0e-9;/* minimum resistance limiter */ |
|
|
|
|
|
} |
|
|
pi_pvout = 1.0 / r; |
|
|
pi_pvout = 1.0 / r; |
|
|
pi_pcntl = intermediate * INPUT(out) / r; |
|
|
pi_pcntl = intermediate * INPUT(out) / r; |
|
|
} |
|
|
} |
|
|
@ -158,14 +165,18 @@ void cm_aswitch(ARGS) /* structure holding parms, |
|
|
intermediate = (r_on - r_off) / (cntl_on - cntl_off); |
|
|
intermediate = (r_on - r_off) / (cntl_on - cntl_off); |
|
|
r = INPUT(cntl_in) * intermediate + ((r_off*cntl_on - |
|
|
r = INPUT(cntl_in) * intermediate + ((r_off*cntl_on - |
|
|
r_on*cntl_off) / (cntl_on - cntl_off)); |
|
|
r_on*cntl_off) / (cntl_on - cntl_off)); |
|
|
|
|
|
|
|
|
|
|
|
if (PARAM(limit) == MIF_TRUE) { |
|
|
|
|
|
if(r<r_on) r=r_on;/* minimum resistance limiter */ |
|
|
|
|
|
if(r>r_off) r=r_off;/* maximum resistance limiter */ |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
if(r<=1.0e-9) r=1.0e-9;/* minimum resistance limiter */ |
|
|
if(r<=1.0e-9) r=1.0e-9;/* minimum resistance limiter */ |
|
|
|
|
|
} |
|
|
pi_pvout = 1.0 / r; |
|
|
pi_pvout = 1.0 / r; |
|
|
pi_pcntl = -intermediate * INPUT(out) / (r*r); |
|
|
pi_pcntl = -intermediate * INPUT(out) / (r*r); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*pi_pvout = 1.0 / r;*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ANALYSIS != MIF_AC) { /* Output DC & Transient Values */ |
|
|
if(ANALYSIS != MIF_AC) { /* Output DC & Transient Values */ |
|
|
OUTPUT(out) = INPUT(out) / r; /* Note that the minus */ |
|
|
OUTPUT(out) = INPUT(out) / r; /* Note that the minus */ |
|
|
PARTIAL(out,out) = pi_pvout; /* Signs are required */ |
|
|
PARTIAL(out,out) = pi_pvout; /* Signs are required */ |
|
|
|