From b07a54b8e101c2c2714fae82364eddbca607b8fc Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Mon, 1 Jun 2020 16:04:11 +0200 Subject: [PATCH] test of supply ramping --- src/spicelib/analysis/optran.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/spicelib/analysis/optran.c b/src/spicelib/analysis/optran.c index 7edcbe69d..fd63f6e38 100644 --- a/src/spicelib/analysis/optran.c +++ b/src/spicelib/analysis/optran.c @@ -236,6 +236,19 @@ OPtran(CKTcircuit *ckt) // int type = ckt->CKTcurJob->JOBtype; SPfrontEnd->IFerrorf(ERR_INFO, "Transient op started"); + if (opramptime > 0) { + CKTnode* n; + ckt->CKTsrcFact = 0.; + SPfrontEnd->IFerrorf(ERR_INFO, "Ramptime enabled"); + for (n = ckt->CKTnodes; n; n = n->next) + ckt->CKTrhsOld[n->number] = 0; + + for (i = 0; i < ckt->CKTnumStates; i++) + ckt->CKTstate0[i] = 0; + + /* First, try a straight solution with all sources at zero */ + converged = NIiter(ckt, ckt->CKTdcTrcvMaxIter); + } #if 0 /* Set the final time */ /* If we are in transient simulation */ @@ -554,7 +567,6 @@ resume: } ckt->CKTstates[0] = temp; -/* 600 */ for (;;) { #if defined SHARED_MODULE redostep = 1; @@ -564,6 +576,10 @@ resume: /* time abort? */ optime += ckt->CKTdelta; + /* supply ramping, when opramptime > 0 */ + if (opramptime > 0) + ckt->CKTsrcFact = MIN(1., optime / opramptime); + ckt->CKTdeltaOld[0]=ckt->CKTdelta; NIcomCof(ckt); save_mode = ckt->CKTmode;