Make FROM/TO work in TRIG/TARG and WHEN variants of .meas/meas command.

Discussion at
https://sourceforge.net/p/ngspice/discussion/133842/thread/973e152274/
This commit is contained in:
Giles Atkinson 2022-08-13 21:01:42 +01:00 committed by Holger Vogt
parent a1dd1f5563
commit 04445e42ea
1 changed files with 20 additions and 0 deletions

View File

@ -469,6 +469,19 @@ com_measure_when(
else if ((ac_check || sp_check) && (scaleValue < 0))
continue;
if (dc_check) {
/* dc: start from pos or neg scale value */
if ((scaleValue < meas->m_from) || (scaleValue > meas->m_to))
continue;
} else {
/* all others: start from neg scale value */
if (scaleValue < meas->m_from)
continue;
if ((meas->m_to != 0.0e0) && (scaleValue > meas->m_to))
break;
}
/* if 'dc': reset first if scale jumps back to origin */
if ((first > 1) && (dc_check && (meas->m_td == scaleValue)))
first = 1;
@ -1667,6 +1680,13 @@ get_measure2(
goto err_ret1;
}
// If there was a FROM propagate trig<->targ
if (measTrig->m_from !=0.0 && measTarg->m_from == 0.0)
measTarg->m_from = measTrig->m_from;
else if (measTarg->m_from !=0.0 && measTrig->m_from == 0.0)
measTrig->m_from = measTarg->m_from;
// measure trig
if (measTrig->m_at == 1e99)
com_measure_when(measTrig);