Browse Source

Set derivative d out/d contrl to 0 if outside of switching range.

Disable auto derivatives.
Enable algorithmic derivatives.
pre-master-46
Holger Vogt 5 years ago
parent
commit
f12592871a
  1. 10
      src/xspice/icm/xtradev/pswitch/cfunc.mod

10
src/xspice/icm/xtradev/pswitch/cfunc.mod

@ -231,6 +231,10 @@ void cm_pswitch(ARGS) /* structure holding parms,
}
pi_pcntl = INPUT(out) / r * (loc->c2 * inmean * inmean - loc->c1);
if(r == r_on)
pi_pcntl = 0;
if(r == r_off)
pi_pcntl = 0;
pi_pvout = 1.0 / r;
}
@ -246,9 +250,9 @@ void cm_pswitch(ARGS) /* structure holding parms,
if(ANALYSIS != MIF_AC) { /* Output DC & Transient Values */
OUTPUT(out) = INPUT(out) / r;
// PARTIAL(out,out) = pi_pvout;
// PARTIAL(out,cntl_in) = pi_pcntl;
cm_analog_auto_partial();
PARTIAL(out,out) = pi_pvout;
PARTIAL(out,cntl_in) = pi_pcntl;
// cm_analog_auto_partial();
/* Note that the minus signs are required because current is positive
flowing INTO rather than OUT OF a component node. */

Loading…
Cancel
Save