spice2ocs Syntax

Case
----

The parser is case sensitive for parameters, while it is insensitive for element names.
Therefore
vm1 1 2 3
is the same as:
VM1 1 2 3

While 
M2 3 4 mynmos Vth=0.7
is NOT the same as:
M2 3 4 mynmos vth=0.7

Representing numbers:
--------------------
Both octave syntax and spice syntax are allowed to be used for representing numbers.
For instance, "1U" and "1e-6" are both valid expressions for 10^(-6).

SPICE syntax for numbers:
MIL -> 25.4e-6
A   -> 1e-18
F   -> 1e-15
P   -> 1e-12
N   -> 1e-9
U   -> 1e-6
M   -> 1e-3
K   -> 1e3
MEG -> 1e6
G   -> 1e9
T   -> 1e12

Elements Cards
--------------
- Capacitors:
Cname n+ n- cvalue

- Diodes:
Cname anode knode modelname <parameters>

- MOS:
Mname gnode dnode snode bnode modelname <parameters>

N.B.: one instance of a MOS element MUST be preceeded (everywhere in the file) by the declaration of the related model.
For instance:

.MODEL mynmos NMOS( k=1e-4 Vth=0.1 rd=1e6)
M2 Vgate 0 Vdrain 0 mynmos

- Resistors:
Rname n+ n- rvalue

- Voltage sources:
Vname n+ n- <dcvalue> <transvalue>

Transvalue specifies a transient voltage source
SIN(VO  VA  FREQ TD  THETA)
where:
VO    (offset)
VA    (amplitude)
FREQ  (frequency)
TD    (delay)
THETA (damping factor)

0 to TD: V0 
TD to TSTOP:  VO  + VA*exp(-(time-TD)*THETA)*sine(twopi*FREQ*(time+TD))

Currently the damping factor has no effect.

Pulse
PULSE(V1 V2 TD TR  TF  PW  PER)

parameters meaning
V1         (initial value)
V2         (pulsed value)
TD         (delay time)
TR         (rise  time)
TF         (fall time)
PW         (pulse width)
PER        (period)

Currently rise and fall time are not implemented yet.

- .MODEL cards
Defines a model for semiconductor devices

.MODEL MNAME TYPE(PNAME1=PVAL1 PNAME2=PVAL2 ... )

TYPE can be:
NMOS N-channel MOSFET model
PMOS P-channel MOSFET model
D    diode model

The parameter "LEVEL" is currently assigned to the field "section" in the call
of the element functions by the solver.
Currently supported values for the parameter LEVEL for NMOS and PMOS are:
- simple
- lincap
(see OCS documentation of function Mdiode).

Currently supported values for the parameter LEVEL for D are:
- simple
(see OCS documentation of functions Mdiode and Mpmosfet).

Variable names
--------------
While in IFF, the variable names are specified into an .nms file, using spice2ocs the variable names are automatically generated by te parser.

Particularly, each node is identified by a name (string), related to a(-n external) variable into the state matrix vector. The ground node (index 1 into the variable vector) is by default assigned to the name "0", and it must always appear into the netlist. The parser assigns to each node name an index into the state variable vector. The assigned index depends on the order of appearance of the node name into the netlist.

Internal variables represent currents and charges into the system.
The name of the internal variables is automatically generated by the parser. For instance, given the element

V1 Va Vb 1

It will be related to the variable I(V1) into the vector outstruct.namesn.
outstruct.namesn{iv1}="I(V1)"

If more internal variables belong to a same element, a variable name is generated just for the first variable. For instance: if the element V1 had 3 internal variables starting from the index iv1, it would result:

outstruct.namesn{iv1}="I(V1)"
outstruct.namesn{iv1+1}=""
outstruct.namesn{iv1+2}=""

One is allowed to plot internal and/or external variable of a circuit solved (out) by IFF, by listing them into the pltvars field, when calling the function 

utl_plot_by_name (t, out, outstruct, pltvars);
