numdask.c

来自「ngspice又一个电子CAD仿真软件代码.功能更全」· C语言 代码 · 共 122 行

C
122
字号
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1987 Thomas L. Quarles$Id: numdask.c,v 1.2 2005/05/23 07:00:22 sjborley Exp $**********/#include "ngspice.h"#include "const.h"#include "ifsim.h"#include "cktdefs.h"#include "devdefs.h"#include "numddefs.h"#include "complex.h"#include "sperror.h"#include "suffix.h"/* Check out this one */extern int NUMDinitSmSig(NUMDinstance *);/* ARGSUSED */intNUMDask(ckt, inInst, which, value, select)  CKTcircuit *ckt;  GENinstance *inInst;  int which;  IFvalue *value;  IFvalue *select;{  NUMDinstance *inst = (NUMDinstance *) inInst;  switch (which) {  case NUMD_AREA:    value->rValue = inst->NUMDarea;    return (OK);  case NUMD_TEMP:    value->rValue = inst->NUMDtemp - CONSTCtoK;    return (OK);  case NUMD_VD:    value->rValue = *(ckt->CKTstate0 + inst->NUMDvoltage);    return (OK);  case NUMD_ID:    value->rValue = *(ckt->CKTstate0 + inst->NUMDid);    return (OK);  case NUMD_G11:    value->rValue = *(ckt->CKTstate0 + inst->NUMDconduct);    return (OK);  case NUMD_G12:    value->rValue = -*(ckt->CKTstate0 + inst->NUMDconduct);    return (OK);  case NUMD_G21:    value->rValue = -*(ckt->CKTstate0 + inst->NUMDconduct);    return (OK);  case NUMD_G22:    value->rValue = *(ckt->CKTstate0 + inst->NUMDconduct);    return (OK);  case NUMD_C11:    if (!inst->NUMDsmSigAvail	&& ckt->CKTcurrentAnalysis != DOING_TRAN) {      NUMDinitSmSig(inst);    }    value->rValue = inst->NUMDc11;    return (OK);  case NUMD_C12:    if (!inst->NUMDsmSigAvail	&& ckt->CKTcurrentAnalysis != DOING_TRAN) {      NUMDinitSmSig(inst);    }    value->rValue = -inst->NUMDc11;    return (OK);  case NUMD_C21:    if (!inst->NUMDsmSigAvail	&& ckt->CKTcurrentAnalysis != DOING_TRAN) {      NUMDinitSmSig(inst);    }    value->rValue = -inst->NUMDc11;    return (OK);  case NUMD_C22:    if (!inst->NUMDsmSigAvail	&& ckt->CKTcurrentAnalysis != DOING_TRAN) {      NUMDinitSmSig(inst);    }    value->rValue = inst->NUMDc11;    return (OK);  case NUMD_Y11:    if (!inst->NUMDsmSigAvail	&& ckt->CKTcurrentAnalysis != DOING_TRAN) {      NUMDinitSmSig(inst);    }    value->cValue.real = inst->NUMDy11r;    value->cValue.imag = inst->NUMDy11i;    return (OK);  case NUMD_Y12:    if (!inst->NUMDsmSigAvail	&& ckt->CKTcurrentAnalysis != DOING_TRAN) {      NUMDinitSmSig(inst);    }    value->cValue.real = -inst->NUMDy11r;    value->cValue.imag = -inst->NUMDy11i;    return (OK);  case NUMD_Y21:    if (!inst->NUMDsmSigAvail	&& ckt->CKTcurrentAnalysis != DOING_TRAN) {      NUMDinitSmSig(inst);    }    value->cValue.real = -inst->NUMDy11r;    value->cValue.imag = -inst->NUMDy11i;    return (OK);  case NUMD_Y22:    if (!inst->NUMDsmSigAvail	&& ckt->CKTcurrentAnalysis != DOING_TRAN) {      NUMDinitSmSig(inst);    }    value->cValue.real = inst->NUMDy11r;    value->cValue.imag = inst->NUMDy11i;    return (OK);  default:    return (E_BADPARM);  }  /* NOTREACHED */}

⌨️ 快捷键说明

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