⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 capsupd.c

📁 spice中支持多层次元件模型仿真的可单独运行的插件源码
💻 C
字号:
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1985 Thomas L. Quarles**********//* *//* update the  charge sensitivities and their derivatives */#include "spice.h"#include <stdio.h>#include "util.h"#include "cktdefs.h"#include "capdefs.h"#include "trandefs.h"#include "sperror.h"#include "suffix.h"intCAPsUpdate(inModel,ckt)    GENmodel *inModel;    register CKTcircuit *ckt;{    register CAPmodel *model = (CAPmodel*)inModel;    register CAPinstance *here;    int      iparmno;     double   s1;     double   s2;     double   sxp;     double   vcap;    double   dummy1;     double   dummy2;     SENstruct *info;    info = ckt->CKTsenInfo;    if((info->SENmode == TRANSEN) && (ckt->CKTmode & MODEINITTRAN))        return(OK);#ifdef SENSDEBUG    printf("CAPsenUpdate\n");    printf("CKTtime = %.5e\n",ckt->CKTtime);#endif /* SENSDEBUG */    /*  loop through all the capacitor models */    for( ; model != NULL; model = model->CAPnextModel ) {        /* loop through all the instances of the model */        for (here = model->CAPinstances; here != NULL ;                here=here->CAPnextInstance) {	    if (here->CAPowner != ARCHme) continue;            vcap = *(ckt->CKTrhsOld+here->CAPposNode) -                 *(ckt->CKTrhsOld+here->CAPnegNode) ;               for(iparmno=1;iparmno<=info->SENparms;iparmno++){                s1 = *(info->SEN_Sap[here->CAPposNode] + iparmno);                s2 = *(info->SEN_Sap[here->CAPnegNode] + iparmno);                sxp = here->CAPcapac * (s1 - s2);                if(iparmno == here->CAPsenParmNo) sxp += vcap;                *(ckt->CKTstate0 + here->CAPsensxp + 2*(iparmno - 1)) = sxp;                 if(ckt->CKTtime == 0){                    *(ckt->CKTstate0 + here->CAPsensxp + 2*(iparmno - 1) + 1)=0;                }                else{                    NIintegrate(ckt,&dummy1,&dummy2,here->CAPcapac,                            (here->CAPsensxp + 2 * (iparmno -1 )));                }#ifdef SENSDEBUG                printf("after loading\n");                printf("iparmno = %d\n",iparmno);                printf("s1 = %.7e,s2 = %.7e\n",s1,s2);                printf("sxp = %.7e,sdotxp = %.7e\n",                        sxp,*(ckt->CKTstate0 + here->CAPsensxp +                         2*(iparmno - 1) + 1));                printf("\n");#endif /* SENSDEBUG */            }        }    }    return(OK);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -