numdask.c

来自「spice中支持多层次元件模型仿真的可单独运行的插件源码」· C语言 代码 · 共 120 行

C
120
字号
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1987 Thomas L. Quarles**********/#include "spice.h"#include <stdio.h>#include "const.h"#include "util.h"#include "ifsim.h"#include "cktdefs.h"#include "devdefs.h"#include "numddefs.h"#include "complex.h"#include "sperror.h"#include "suffix.h"/* ARGSUSED */intNUMDask(ckt, inInst, which, value, select)  CKTcircuit *ckt;  GENinstance *inInst;  int which;  IFvalue *value;  IFvalue *select;{  NUMDinstance *inst = (NUMDinstance *) inInst;  SPcomplex yd;  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 + -
显示快捷键?