Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

Memristor subcircuit

Hello. I want to simulate memristor in Multisim. SPICE model is below:

 

.SUBCKT memristor Plus Minus PARAMS:
+pi=3.1415926 Kb=1.38e-23 q=1.6e-19
+eps0=8.85e-12 area=6.4e-9 d=4e-8 sclp=5 scln=7 AAp=2.4e6 AAn=1e6 Ub=0.9 epsr=8
+Ron=300 T0=300 ktemp=1 cI=1e-4 ronp=6.1k ronn=8.5k epsi=epsr*eps0
+pthset=3e-12 pthreset=-0.8e-8
+voff=0 von=1e-7

**IF(V(Plus, Minus)>0,V(Plus, Minus)*abs(I(Gcond)),0))
Eposinstpower p1 0 value={IF(V(Plus,Minus)>0,I(Gcond)*V(Plus,Minus),0)}
Eneginstpower p2 0 value={IF(V(Plus,Minus)<0,I(Gcond)*V(Plus,Minus),0)}
Epospower pp 0 value={idt(V(p1),0)}
Enegpower np 0 value={idt(V(p2),0)}
Esetth st 0 value={(floor( V(np)/pthreset ) + 1 )*pthset}
Eresetth rt 0 value={floor( V(pp)/pthset )*pthreset}
Estate s 0 value={ IF(V(s)==voff, IF(V(pp)>V(st), von, voff ), IF( V(np)<V(rt), voff, von ) )}

Eon on 0 value={V(Plus, Minus)}
Ronp on 0 r=ronp
Ronn on 0 r=ronn

Goffp 0 offp value={ area*AAp*ktemp*(T0**2)*exp(-q*Ub/(Kb * T0))*exp( sqrt(abs(V(Plus, Minus)))*(sclp + q / (Kb * T0) * ( sqrt(q / (d * 4 * pi * epsi)))) ) }
Goffn 0 offn value={-area*AAn*ktemp*(T0**2)*exp(-q*Ub/(Kb * T0))*exp( sqrt(abs(V(Plus, Minus)))*(scln + q / (Kb * T0) * ( sqrt(q / (d * 4 * pi * epsi)))) ) }
Raux1 offp 0 r=1k
Raux2 offn 0 r=1k

Gcond Plus Minus value={ max( -cI, min(cI, IF(V(s)==voff, IF( V(Plus, Minus)>0, I(Goffp), I(Goffn) ), IF( V(Plus, Minus)>0, I(Ronp), I(Ronn) ) ) ) ) }

************************
** event counters
************************
* E_p_events p_events 0 value={floor( V(tpp)/p_th_3_4 )}
* E_n_events n_events 0 value={floor( V(tnp)/p_th_2_1 )}
Ecycle cycle 0 value={floor( V(pp)/pthreset )}
EsEvent sEvent 0 value={floor( V(pp)/pthreset ) + floor( V(np)/pthset ) }

.ENDS memristor

 

 

Where is a mistake? There is a 6 errors:

SPICE Netlist Error in schematic RefDes 'u1', element 'eposinstpower': Element 'gcond' referenced in expression does not exist in local scope or is not of a type compatible with the I() function
SPICE Netlist Error in schematic RefDes 'u1', element 'eneginstpower': Element 'gcond' referenced in expression does not exist in local scope or is not of a type compatible with the I() function
SPICE Netlist Error in schematic RefDes 'u1', element 'gcond': Element 'r3' referenced in expression does not exist in local scope or is not of a type compatible with the I() function
SPICE Netlist Error in schematic RefDes 'u1', element 'gcond': Element 'r4' referenced in expression does not exist in local scope or is not of a type compatible with the I() function
SPICE Netlist Error in schematic RefDes 'u1', element 'gcond': Element 'r1' referenced in expression does not exist in local scope or is not of a type compatible with the I() function
SPICE Netlist Error in schematic RefDes 'u1', element 'gcond': Element 'r2' referenced in expression does not exist in local scope or is not of a type compatible with the I() function
gcond:xu1: unknown controlling source r3:xu1
gcond:xu1: unknown controlling source r3:xu1
gcond:xu1: unknown controlling source r3:xu1
gcond:xu1: unknown controlling source r3:xu1
gcond:xu1: unknown controlling source r3:xu1
gcond:xu1: unknown controlling source r3:xu1
======= SPICE Netlist check completed, 6 error(s), 0 warning(s) =======

0 Kudos
Message 1 of 1
(1,998 Views)