ltraacct.c, bug fix
reported by Gary Hennigan on tracker http://sourceforge.net/tracker/index.php?func=detail&aid=3591132&group_id=38962&atid=423915 access to uninitialized memory, trying to acquire the "time" of a projected auxiliary timestep in the past. now using the following auxiliary timestep t[-1] voltage(t[-1]) === voltage(t[0]) and t[-1] === t[0] - (t[1] - t[0]) the details are not understood, but thats certainly better than accessing uninitialized memory.
This commit is contained in:
parent
9d52468471
commit
e4cc63417b
|
|
@ -159,6 +159,8 @@ LTRAaccept(CKTcircuit *ckt, GENmodel *inModel)
|
|||
return (error);
|
||||
}
|
||||
#else
|
||||
double dt_01, dt_12;
|
||||
|
||||
/*
|
||||
* remove the hack here - store the total inputs for the last 2 or 3
|
||||
* timesteps
|
||||
|
|
@ -182,18 +184,19 @@ LTRAaccept(CKTcircuit *ckt, GENmodel *inModel)
|
|||
v6 = ckt->CKTtimeIndex < 2 ? v5 : (*(here->LTRAv2 + ckt->CKTtimeIndex - 2) +
|
||||
*(here->LTRAi2 + ckt->CKTtimeIndex - 2) *
|
||||
model->LTRAimped) * model->LTRAattenuation;
|
||||
d1 = (v1 - v2) / (*(ckt->CKTtimePoints +
|
||||
ckt->CKTtimeIndex) - *(ckt->CKTtimePoints +
|
||||
ckt->CKTtimeIndex - 1));
|
||||
d2 = (v2 - v3) / (*(ckt->CKTtimePoints +
|
||||
ckt->CKTtimeIndex - 1) - *(ckt->CKTtimePoints +
|
||||
ckt->CKTtimeIndex - 2));
|
||||
d3 = (v4 - v5) / (*(ckt->CKTtimePoints +
|
||||
ckt->CKTtimeIndex) - *(ckt->CKTtimePoints +
|
||||
ckt->CKTtimeIndex - 1));
|
||||
d4 = (v5 - v6) / (*(ckt->CKTtimePoints +
|
||||
ckt->CKTtimeIndex - 1) - *(ckt->CKTtimePoints +
|
||||
ckt->CKTtimeIndex - 2));
|
||||
|
||||
dt_01 = (*(ckt->CKTtimePoints + ckt->CKTtimeIndex) -
|
||||
*(ckt->CKTtimePoints + ckt->CKTtimeIndex - 1));
|
||||
|
||||
dt_12 = (ckt->CKTtimeIndex < 2)
|
||||
? dt_01
|
||||
: (*(ckt->CKTtimePoints + ckt->CKTtimeIndex - 1) -
|
||||
*(ckt->CKTtimePoints + ckt->CKTtimeIndex - 2));
|
||||
|
||||
d1 = (v1 - v2) / dt_01;
|
||||
d2 = (v2 - v3) / dt_12;
|
||||
d3 = (v4 - v5) / dt_01;
|
||||
d4 = (v5 - v6) / dt_12;
|
||||
|
||||
/*
|
||||
* here we have a big problem with the scheme boxed by the *s below.
|
||||
|
|
|
|||
Loading…
Reference in New Issue