* Z:\home\khalils\Downloads\files\data\raw_asc\2758dbc2bf90_20231004_Current_sink.asc
* Generated by LTspice 26.0.1 for Windows.
* .tran 0 1000m 0 10u startup uic
* R5 emulates digital\npotentiometer in parallel
* Library below included based on ModelFile attribute of instance XU1 (C:\users\khalils\AppData\Local\LTspice\lib\sym\OpAmps\LT6220.asy)
R3 N001 N002 R = 10k*(1-V(SP))
V5 SP 0 {SP}
R2 VCC N001 390k
R1 IN- 0 5m
V1 VSINK 0 2.5
R6 g N003 10k
XM1 VSINK N003 IN- irfb7545pbf ;pnba D)G)S
V4 fb g ac 1
R4 N002 0 R = 10k*V(SP)
C1 P001 IN- 330n
R7 N003 P001 56
XU1 N002 IN- VCC 0 fb LT6220 ;pnba IN+)IN-)VCC)VEE)OUT
V2 NC_01 0 PULSE(1m .999 0 1u 1u 100m 200m)
R5 N001 0 10k
V3 VCC 0 5
.include irfb7545pbf.txt
.include MCP6001.txt
.ac dec 100 10 1G
.step param SP 1m 999m 1m
.meas PM FIND V(fb)/V(g) WHEN mag(V(fb)/V(g)) = 1
.meas GM FIND V(fb)/V(g) WHEN ph(V(fb)/V(g)) = 0
.lib LTC4.lib
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 2040 680
WIRE 880 80 608 80
WIRE 0 96 0 64
WIRE 880 144 880 80
WIRE 608 160 416 160
WIRE 80 176 48 176
WIRE 128 176 80 176
WIRE 304 176 288 176
WIRE 352 176 304 176
WIRE 432 192 416 192
WIRE 880 240 880 224
WIRE 880 240 608 240
WIRE 608 256 608 240
WIRE 0 320 0 192
WIRE 80 320 0 320
WIRE 352 320 80 320
WIRE 432 320 432 192
WIRE 432 320 352 320
DATAFLAG 192 320 "round($/1u)*1u"
DATAFLAG 432 160 "round($/1u)*1u"
SYMBOL voltage 0 -176 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value 5
SYMBOL res 64 160 R0
SYMATTR InstName R7
SYMATTR Value 56
SYMBOL res 224 160 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL voltage 304 176 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName V4
SYMATTR Value ac 1
SYMBOL cap 64 256 R0
SYMATTR InstName C1
SYMATTR Value 330n
SYMBOL OpAmps\\LT6220 384 176 R180
SYMATTR InstName U1
SYMBOL res 592 144 R0
SYMATTR InstName R4
SYMATTR Value R = 10k*V(SP)
SYMBOL res 592 -16 R0
SYMATTR InstName R2
SYMATTR Value 390k
SYMBOL voltage 304 -176 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value PULSE(1m .999 0 1u 1u 100m 200m)
SYMBOL res 864 128 R0
SYMATTR InstName R5
SYMATTR Value 10k
SYMBOL voltage 192 -176 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V5
SYMATTR Value {SP}
SYMBOL res 592 64 R0
SYMATTR InstName R3
SYMATTR Value R = 10k*(1-V(SP))
SYMBOL res 16 304 M0
SYMATTR InstName R1
SYMATTR Value 5m
SYMBOL nmos 48 96 M0
SYMATTR InstName M1
SYMATTR Value irfb7545pbf
SYMATTR Prefix X
SYMBOL voltage 96 -176 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 2.5
FLAG 0 400 0
FLAG 0 64 VSINK
FLAG 384 208 VCC
FLAG 384 144 0
FLAG 96 -80 0
FLAG 304 -80 0
FLAG 96 -160 VSINK
FLAG 192 -160 SP
FLAG 0 -80 0
FLAG 0 -160 VCC
FLAG 352 320 IN-
FLAG 608 256 0
FLAG 608 0 VCC
FLAG 192 -80 0
FLAG 304 176 fb
FLAG 208 176 g
TEXT 632 328 Left 2 ;.tran 0 1000m 0 10u startup uic
TEXT 304 336 Left 2 !.include irfb7545pbf.txt
TEXT 304 360 Left 2 !.include MCP6001.txt
TEXT 704 16 Left 2 ;R5 emulates digital\npotentiometer in parallel
TEXT 632 360 Left 2 !.ac dec 100 10 1G
TEXT 304 392 Left 2 !.step param SP 1m 999m 1m
TEXT 304 424 Left 2 !.meas PM FIND V(fb)/V(g) WHEN mag(V(fb)/V(g)) = 1\n.meas GM FIND V(fb)/V(g) WHEN ph(V(fb)/V(g)) = 0