1 ## Copyright (C) 2006,2007,2008 Carlo de Falco, Culpo Massimiliano
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: Carlo de Falco <cdf _AT_ users.sourceforge.net>
20 ## author culpo@math.uni-wuppertal.de
24 ## @deftypefn{Function File} @
25 ## {[@var{a},@var{b},@var{c}]=}Mcurrentsources(@var{string},@var{parameters},@
26 ## @var{parameternames},@var{extvar},@var{intvar},@var{t})
28 ## SBN file implementing models for current sources.
30 ## @var{string} is used to select among models. Parameters are listed
31 ## as inner items. Possible models are:
34 ## @item @var{string} = "DC" (Static indipendent current source)
36 ## @item I -> Current source value
38 ## @item @var{string} = "VCCS" (Voltage controlled current source)
40 ## @item K -> Control parameter
42 ## @item @var{string} = "sinwave" (Sinusoidal indipendent current
45 ## @item shift -> mean value of sinusoidal input
46 ## @item Ampl -> amplitude of sinusoidal wave
47 ## @item f -> frequency of sinusoidal wave
48 ## @item delay -> delay of sinusoidal wave
50 ## @item @var{string} = "VCPS" (Voltage controlled power source)
52 ## @item K -> Control parameter
56 ## See the @cite{IFF file format specifications} for details about
57 ## the output structures.
59 ## @seealso{prs_iff,asm_initialize_system,asm_build_system}
62 function [a,b,c] = Mcurrentsources (string,parameters,parameternames,extvar,intvar,t)
67 for ii=1:length(parameternames)
68 eval([parameternames{ii} "=" num2str(parameters(ii)) ";"])
77 ## Voltage controlled current source
79 for ii=1:length(parameternames)
80 eval([parameternames{ii} "=" num2str(parameters(ii)) ";"])
91 for ii=1:length(parameternames)
92 eval([parameternames{ii} "=" num2str(parameters(ii)) ";"])
95 I = shift+Ampl * sin(2*pi*(t+delay)*f );
102 ## Voltage controlled power source
104 for ii=1:length(parameternames)
105 eval([parameternames{ii} "=" num2str(parameters(ii)) ";"])
108 dv = extvar(3) - extvar(4);
113 b = [0 0 dIdv -dIdv;\
120 error (["unknown section:" string])