From 6f600772d9fba28d3e6e1907c52d6049ed556164 Mon Sep 17 00:00:00 2001 From: rlar Date: Mon, 17 Dec 2012 20:53:40 +0100 Subject: [PATCH] top vsrc --- src/spicelib/devices/vsrc/vsrcacct.c | 15 +-------------- src/spicelib/devices/vsrc/vsrcdel.c | 1 + src/spicelib/devices/vsrc/vsrcload.c | 13 ++++++++----- src/spicelib/devices/vsrc/vsrcset.c | 1 + 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/spicelib/devices/vsrc/vsrcacct.c b/src/spicelib/devices/vsrc/vsrcacct.c index 3d112f47d..c2e52cb6f 100644 --- a/src/spicelib/devices/vsrc/vsrcacct.c +++ b/src/spicelib/devices/vsrc/vsrcacct.c @@ -178,20 +178,6 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) } } - /* check td + first >= 0 */ - - /* - * Postition: - * nxt = [0, order[ - * rpt = [0.. [ - * with - * time == arr[nxt] + rpt*period + td - * - * (fixme, no thats inclusive see above) - * - * evtl ==order als Ende Kriterium, !!! must - */ - /* (libc) Remainder Functions, `same sign ...' and magnitude ... */ #if 0 @@ -201,6 +187,7 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) rest = time; #endif +/*hier gehts weiter*/ if (!ckt->CKTbreak || here->nxt >= here->VSRCfunctionOrder) break; diff --git a/src/spicelib/devices/vsrc/vsrcdel.c b/src/spicelib/devices/vsrc/vsrcdel.c index 5c5691f47..0b52f8927 100644 --- a/src/spicelib/devices/vsrc/vsrcdel.c +++ b/src/spicelib/devices/vsrc/vsrcdel.c @@ -27,6 +27,7 @@ VSRCdelete(GENmodel *inModel, IFuid name, GENinstance **inst) FREE(here); return(OK); } + /* oder here delete ? */ prev = &(here->VSRCnextInstance); } } diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index cec8142fe..86b57aa02 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -90,7 +90,7 @@ pwl_state_get(struct pwl_state *this, double time) } -static void +static struct pwl_state * pwl_state_init(struct pwl_state *this, VSRCinstance *here) { @@ -101,6 +101,9 @@ pwl_state_init(struct pwl_state *this, VSRCinstance *here) : here->VSRCr == 0 && here->VSRCrperiod == 0 && here->VSRCrBreakpt == 0 ); #endif + if (!this) + this = TMALLOC(struct pwl_state, 1); + this->len = here->VSRCfunctionOrder; this->arr = here->VSRCcoeffs; this->position = 0; @@ -109,6 +112,8 @@ pwl_state_init(struct pwl_state *this, VSRCinstance *here) this->td = here->VSRCrdelay; this->tp = here->VSRCrperiod; this->rBreakpt = here->VSRCrBreakpt; + + return this; } @@ -387,10 +392,8 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) case PWL: { - if (!here->VSRC_state) { - here->VSRC_state = TMALLOC(struct pwl_state, 1); - pwl_state_init((struct pwl_state *) here->VSRC_state, here); - } + if (!here->VSRC_state) + here->VSRC_state = pwl_state_init(NULL, here); value = pwl_state_get((struct pwl_state *) here -> VSRC_state, time); } diff --git a/src/spicelib/devices/vsrc/vsrcset.c b/src/spicelib/devices/vsrc/vsrcset.c index 0428bbc86..a77836f63 100644 --- a/src/spicelib/devices/vsrc/vsrcset.c +++ b/src/spicelib/devices/vsrc/vsrcset.c @@ -70,6 +70,7 @@ VSRCunsetup(GENmodel *inModel, CKTcircuit *ckt) for (here = model->VSRCinstances; here != NULL; here=here->VSRCnextInstance) { + /* here free * ? */ if (here->VSRCbranch) { CKTdltNNum(ckt, here->VSRCbranch); here->VSRCbranch = 0;