1 ## Copyright (C) 2006,2007,2008 Massimiliano Culpo, Carlo de Falco
3 ## This file is part of:
4 ## OCS - A Circuit Simulator for Octave
6 ## OCS is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program (see the file LICENSE); if not,
17 ## see <http://www.gnu.org/licenses/>.
19 ## author: culpo@math.uni-wuppertal.de, Carlo de Falco <cdf _AT_ users.sourceforge.net>
23 ## @deftypefn{Function File} @
24 ## {[@var{a},@var{b},@var{c}]=}Mdiode(@var{string},@var{parameters},@
25 ## @var{parameternames},@var{extvar},@var{intvar},@var{t})
27 ## SBN file implementing models for diodes.
29 ## @var{string} is used to select among models. Parameters are listed
30 ## as inner items. Possible models are:
33 ## @item @var{string} = "simple" (Usual exponential diode model)
35 ## @item Is -> reverse current
36 ## @item Vth -> thermal voltage
37 ## @item Rpar -> parasitic resistance
39 ## @item @var{string} = "PDEsymmetric" (Drift-Diffusion PDE model)
41 ## @item len -> diode length
42 ## @item Nnodes -> number of nodes of 1D grid
43 ## @item Dope -> doping (abrupt and symmetric)
44 ## @item toll -> absolute tolerance
45 ## @item maxit -> max iterations number
46 ## @item Area -> device area
50 ## See the @cite{IFF file format specifications} for details about
51 ## the output structures.
53 ## @seealso{prs_iff,asm_initialize_system,asm_build_system}
56 function [a,b,c] = Mdiode (string,parameters,parameternames,extvar,intvar,t)
64 for ii=1:length(parameternames)
65 eval([parameternames{ii} "=" num2str(parameters(ii)) ";"])
71 I = Is*(exp((vp - vm)/Vth) -1 ) + (vp - vm)/Rpar;
72 geq = Is*exp((vp - vm)/Vth)/Vth + 1/Rpar;
75 b = [geq -geq; -geq geq];
92 for ii=1:length(parameternames)
93 eval([parameternames{ii} "=" num2str(parameters(ii)) ";"])
99 [I,g] = Mpdesympnjunct (len,Dope,vp-vm,Area,Nnodes,toll,maxit,ptoll,pmaxit);
108 error(["unknown section:" string])