add ac and dc simulation to memristor model
This commit is contained in:
parent
f53eb5cf78
commit
fde8c46356
|
|
@ -6,8 +6,10 @@ Memristor with threshold as XSPICE code model
|
||||||
* XSPICE code model, parameter selection and plotting by
|
* XSPICE code model, parameter selection and plotting by
|
||||||
* Holger Vogt 2012
|
* Holger Vogt 2012
|
||||||
|
|
||||||
|
* ac and op (dc) simulation just use start resistance rinit!
|
||||||
|
|
||||||
.param stime=10n
|
.param stime=10n
|
||||||
.param vmax = 3
|
.param vmax = 4.5
|
||||||
|
|
||||||
* send parameters to the .control section
|
* send parameters to the .control section
|
||||||
.csparam stime={stime}
|
.csparam stime={stime}
|
||||||
|
|
@ -16,15 +18,16 @@ Memristor with threshold as XSPICE code model
|
||||||
*Xmem 1 0 memristor
|
*Xmem 1 0 memristor
|
||||||
* triangular sweep (you have to adapt the parameters to 'alter' command in the .control section)
|
* triangular sweep (you have to adapt the parameters to 'alter' command in the .control section)
|
||||||
*V1 1 0 DC 0 PWL(0 0 '0.25*stime' 'vmax' '0.5*stime' 0 '0.75*stime' '-vmax' 'stime' 0)
|
*V1 1 0 DC 0 PWL(0 0 '0.25*stime' 'vmax' '0.5*stime' 0 '0.75*stime' '-vmax' 'stime' 0)
|
||||||
* sinusoidal sweep
|
* sinusoidal sweep for transient, dc for op, ac
|
||||||
V1 0 1 DC 0 sin(0 'vmax' '1/stime')
|
V1 0 1 DC 0.1 ac 1 sin(0 'vmax' '1/stime')
|
||||||
|
|
||||||
|
Rl 1 11 1k
|
||||||
|
|
||||||
* memristor model with limits and threshold
|
* memristor model with limits and threshold
|
||||||
* "artificial" parameters alpha, beta, and vt. beta and vt adapted to basic programming frequency
|
* "artificial" parameters alpha, beta, and vt. beta and vt adapted to basic programming frequency
|
||||||
* just to obtain nice results!
|
* just to obtain nice results!
|
||||||
* You have to care for the physics and set real values!
|
* You have to care for the physics and set real values!
|
||||||
amen 1 2 memr
|
amen 11 2 memr
|
||||||
.model memr memristor (rmin=1k rmax=10k rinit=7k alpha=0 beta='20e3/stime' vt=1.6)
|
.model memr memristor (rmin=1k rmax=10k rinit=7k alpha=0 beta='20e3/stime' vt=1.6)
|
||||||
|
|
||||||
vgnd 2 0 dc 0
|
vgnd 2 0 dc 0
|
||||||
|
|
@ -41,6 +44,10 @@ Rmem plus minus r={V(x)}
|
||||||
* transient simulation same programming voltage but rising frequencies
|
* transient simulation same programming voltage but rising frequencies
|
||||||
.control
|
.control
|
||||||
*** first simulation ***
|
*** first simulation ***
|
||||||
|
op
|
||||||
|
print all
|
||||||
|
ac lin 101 1 100k
|
||||||
|
plot v(11)
|
||||||
* approx. 100 simulation points
|
* approx. 100 simulation points
|
||||||
let deltime = stime/100
|
let deltime = stime/100
|
||||||
tran $&deltime $&stime uic
|
tran $&deltime $&stime uic
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ SUMMARY
|
||||||
|
|
||||||
** Experimental, still to be tested in circuits !! **
|
** Experimental, still to be tested in circuits !! **
|
||||||
|
|
||||||
|
dc and ac simulation just return rinit.
|
||||||
|
|
||||||
INTERFACES
|
INTERFACES
|
||||||
|
|
||||||
cm_memristor()
|
cm_memristor()
|
||||||
|
|
@ -56,7 +58,7 @@ double f1(double y);
|
||||||
|
|
||||||
void cm_memristor (ARGS)
|
void cm_memristor (ARGS)
|
||||||
{
|
{
|
||||||
// Complex_t ac_gain;
|
Complex_t ac_gain;
|
||||||
double partial;
|
double partial;
|
||||||
double int_value;
|
double int_value;
|
||||||
double *rval;
|
double *rval;
|
||||||
|
|
@ -91,14 +93,19 @@ void cm_memristor (ARGS)
|
||||||
cm_analog_integrate(int_value, rval, &partial);
|
cm_analog_integrate(int_value, rval, &partial);
|
||||||
/* output the current */
|
/* output the current */
|
||||||
OUTPUT(memris) = INPUT(memris) / *rval;
|
OUTPUT(memris) = INPUT(memris) / *rval;
|
||||||
|
/* This does work, but is questionable */
|
||||||
PARTIAL(memris, memris) = partial;
|
PARTIAL(memris, memris) = partial;
|
||||||
|
/* This may be a (safe?) replacement, but in fact is not
|
||||||
|
so good at high voltage (at strong non-linearity)
|
||||||
|
cm_analog_auto_partial();*/
|
||||||
}
|
}
|
||||||
/* no AC and DC modeling so far !
|
|
||||||
else if(ANALYSIS == AC) {
|
else if(ANALYSIS == AC) {
|
||||||
ac_gain.real = *vc;
|
ac_gain.real = 1/ *rval;
|
||||||
ac_gain.imag = 0.0;
|
ac_gain.imag = 0.0;
|
||||||
AC_GAIN(memris, memris) = ac_gain;
|
AC_GAIN(memris, memris) = ac_gain;
|
||||||
} */
|
}
|
||||||
|
else
|
||||||
|
OUTPUT(memris) = INPUT(memris) / *rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the window function */
|
/* the window function */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue