Pspice code error for design memristor please solve it

Status
Not open for further replies.

nkhadar

Newbie level 2
Joined
May 24, 2017
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
37
*Netlist corresponding to schematic of Fig. 1a


Code dot - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.subckt memristorplus plus minus PARAMS:
*Parameters' values
+rmin=100 rmax=390 rinit=390 alpha=1E15 beta=10 gamma=0.1 Vtr=1.5 Vtl=-1.5 yo=0.0001
+m=82 fo=310 Lo=5
Gr 0 r value={dr_dt(V(plus)-V(minus))*(st_f(V(plus)-V(minus))*st_f(V(r)-rmin)+
+st_f(-(V(plus)-V(minus)))*st_f(rmax-v(r)))}
Cr r 0 1 IC={rinit}
Raux r 0 1E12
*Current equation Imem = V / R(L)
Gpm plus minus value={(V(plus)-V(minus))/((fo*exp(2*L(V(r))))/L(V(r)))}
*Func. for non-linear threshold-based behavior
.func dr_dt(y)={-alpha*((y-VtL)/(gamma+abs(y-VtL)))*st_f(-y+VtL)-beta*y*st_f(y-VtL)*
+st_f(-y+VtR)-alpha*((y-Vtr)/(gamma+abs(y-VtR)))*st_f(y-VtR)}
*Smoothing function
.func st_f(y)={1/(exp(-y/yo)+1)}
*L(V) function
.func L(y)={Lo-Lo*m/y}
.ends memristorplus





*Netlist corresponding to schematic of Fig. 1a


Code dot - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.subckt memristorminus plus minus PARAMS:
*Parameters' values
+rmin=100 rmax=390 rinit=100 alpha=1E15 beta=10 gamma=0.1 Vtr=-1.5 Vtl=1.5 yo=0.0001
+m=82 fo=310 Lo=5
Gr 0 r value={dr_dt(V(plus)-V(minus))*(st_f(V(plus)-V(minus))*st_f(V(r)-rmin)+
+st_f(-(V(plus)-V(minus)))*st_f(rmax-v(r)))}
Cr r 0 1 IC={rinit}
Raux r 0 1E12
*Current equation Imem = V / R(L)
Gpm plus minus value={(V(plus)-V(minus))/((fo*exp(2*L(V(r))))/L(V(r)))}
*Func. for non-linear threshold-based behavior
.func dr_dt(y)={-alpha*((y-VtL)/(gamma+abs(y-VtL)))*st_f(-y+VtL)-beta*y*st_f(y-VtL)*
+st_f(-y+VtR)-alpha*((y-Vtr)/(gamma+abs(y-VtR)))*st_f(y-VtR)}
*Smoothing function
.func st_f(y)={1/(exp(-y/yo)+1)}
*L(V) function
.func L(y)={Lo-Lo*m/y}
.ends memristorminus





* Main Circuit


Code dot - [expand]
1
2
3
4
5
6
7
8
9
VS 1 0 DC 3 PWL( 0s 0 0.25s 3 0.5s 0 0.75s -3 1s 0 1.25s 3 1.5s 0 1.75s -3 2s 0 2.25s 3 2.5s 0 2.75s -3 3s 0)  
X1 1 2 memristorplus
X2 2 0 memristorminus
*ANALYSIS
.TRAN   10m  1
 
 
.PROBE
.END

 
Last edited by a moderator:

Node 2 is floating - connect a high value resistance between node 2 and ground to overcome this error.
The second problem is with expression used in device Gpm, this is getting evaluated to zero (denominator), you may need to suitably modify it to prevent this.
Gpm plus minus value={(V(plus)-V(minus))/((fo*exp(2*L(V(r))))/L(V(r)))}
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…