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

Disable auto derivatives.
Enable algorithmic derivatives.
This commit is contained in:
Holger Vogt 2021-05-30 00:00:26 +02:00
parent db5395032f
commit f12592871a
1 changed files with 7 additions and 3 deletions

View File

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