* SPICE netlist
V_LINE INPUT INPUT2 PULSE(0 12 0 0 0 0.000312 0.000624) Rser=10000
V_EARTH_REF INPUT2 0 SINE(0 230 50) Rser=1000
C6 N002 INPUT 1n
C7 N006 INPUT2 1n
R12 N006 0 470k tol=1
R13 N002 0 470k tol=1
V4 N001 0 5 Rser=1
R14 N003 -IN 470K tol=5
R15 N007 +IN 470K tol=5
R16 N007 Vref 36k tol=5
R17 OUT N003 470K tol=5
R18 Vref N003 36k tol=5
R19 -IN N002 1000k tol=5
R20 +IN N006 1000k tol=5
R1 N001 Vref 10k tol=1
R2 Vref 0 10k tol=1
R3 N001 OUT_CLAMP_DIV 10k tol=1
R4 OUT_CLAMP_DIV 0 100k tol=1
D1 N004 OUT_CLAMP_DIV 1N4148
XU1 N007 N003 N001 0 OUT LT1001 ;pnba In+)In-)V+)V-)OUT
R5 N004 OUT 1k tol=1
D2 N004 N005 1N4148
R6 SENSE 0 100k tol=1
D3 N005 SENSE 1N4148
.tran 10ms

* LTspice schematic (.asc)
Version 4
SHEET 1 2816 800
WIRE 656 -400 240 -400
WIRE 1248 -400 656 -400
WIRE 1408 -400 1248 -400
WIRE 1248 -368 1248 -400
WIRE 128 -320 -16 -320
WIRE 128 -288 128 -320
WIRE 656 -208 656 -400
WIRE -320 -128 -368 -128
WIRE -80 -128 -240 -128
WIRE 32 -128 -80 -128
WIRE 128 -128 128 -208
WIRE 128 -128 112 -128
WIRE 144 -128 128 -128
WIRE 304 -128 224 -128
WIRE 560 -96 528 -96
WIRE 656 -96 656 -128
WIRE 656 -96 624 -96
WIRE 1408 -64 1408 -400
WIRE 240 -48 240 -400
WIRE -768 -32 -1408 -32
WIRE -656 -32 -768 -32
WIRE -368 -32 -368 -128
WIRE -368 -32 -592 -32
WIRE 128 -32 128 -128
WIRE 208 -32 128 -32
WIRE 304 -16 304 -128
WIRE 304 -16 272 -16
WIRE 352 -16 304 -16
WIRE 416 -16 352 -16
WIRE 528 -16 528 -96
WIRE 528 -16 496 -16
WIRE 704 -16 528 -16
WIRE 816 -16 768 -16
WIRE 944 -16 880 -16
WIRE 1088 -16 944 -16
WIRE -320 0 -496 0
WIRE -80 0 -240 0
WIRE 32 0 -80 0
WIRE 128 0 112 0
WIRE 208 0 128 0
WIRE -1408 16 -1408 -32
WIRE 656 16 656 -96
WIRE 944 16 944 -16
WIRE 128 64 128 0
WIRE -1408 160 -1408 96
WIRE -768 160 -1408 160
WIRE -656 160 -768 160
WIRE -496 160 -496 0
WIRE -496 160 -592 160
WIRE -16 192 -16 -320
WIRE 48 192 -16 192
WIRE 128 192 128 144
WIRE 128 192 48 192
WIRE 1248 192 1248 -288
WIRE 1248 192 128 192
WIRE 1248 224 1248 192
WIRE -1408 240 -1408 160
WIRE -496 240 -496 160
WIRE -368 240 -368 -32
WIRE -496 368 -496 320
WIRE -368 368 -368 320
WIRE -368 368 -496 368
WIRE 240 368 240 16
WIRE 240 368 -368 368
WIRE 656 368 656 96
WIRE 656 368 240 368
WIRE 944 368 944 96
WIRE 944 368 656 368
WIRE 1248 368 1248 304
WIRE 1248 368 944 368
WIRE 1408 368 1408 16
WIRE 1408 368 1248 368
WIRE -1408 400 -1408 320
WIRE -496 400 -496 368
FLAG -768 -32 INPUT
FLAG -768 160 INPUT2
FLAG -1408 400 0
FLAG -496 400 0
FLAG 48 192 Vref
FLAG -80 -128 -IN
FLAG -80 0 +IN
FLAG 352 -16 OUT
FLAG 1088 -16 SENSE
FLAG 656 -96 OUT_CLAMP_DIV
SYMBOL voltage -1408 0 R0
SYMATTR SpiceLine Rser=10000
SYMATTR InstName V_LINE
SYMATTR Value PULSE(0 12 0 0 0 0.000312 0.000624)
SYMBOL voltage -1408 224 R0
SYMATTR Value SINE(0 230 50)
SYMATTR SpiceLine Rser=1000
SYMATTR InstName V_EARTH_REF
SYMBOL cap -592 -48 R90
SYMATTR InstName C6
SYMATTR Value 1n
SYMBOL cap -592 144 R90
SYMATTR InstName C7
SYMATTR Value 1n
SYMBOL res -512 224 R0
SYMATTR InstName R12
SYMATTR Value 470k
SYMATTR SpiceLine tol=1
SYMBOL res -384 224 R0
SYMATTR InstName R13
SYMATTR Value 470k
SYMATTR SpiceLine tol=1
SYMBOL voltage 1408 -80 R0
SYMATTR SpiceLine Rser=1
SYMATTR InstName V4
SYMATTR Value 5
SYMBOL res 128 -144 R90
SYMATTR InstName R14
SYMATTR Value 470K
SYMATTR SpiceLine tol=5
SYMBOL res 128 -16 R90
SYMATTR InstName R15
SYMATTR Value 470K
SYMATTR SpiceLine tol=5
SYMBOL res 112 48 R0
SYMATTR InstName R16
SYMATTR Value 36k
SYMATTR SpiceLine tol=5
SYMBOL res 240 -144 R90
SYMATTR InstName R17
SYMATTR Value 470K
SYMATTR SpiceLine tol=5
SYMBOL res 112 -304 R0
SYMATTR InstName R18
SYMATTR Value 36k
SYMATTR SpiceLine tol=5
SYMBOL res -224 -144 R90
SYMATTR InstName R19
SYMATTR Value 1000k
SYMATTR SpiceLine tol=5
SYMBOL res -224 -16 R90
SYMATTR InstName R20
SYMATTR Value 1000k
SYMATTR SpiceLine tol=5
SYMBOL res 1232 -384 R0
SYMATTR InstName R1
SYMATTR Value 10k
SYMATTR SpiceLine tol=1
SYMBOL res 1232 208 R0
SYMATTR InstName R2
SYMATTR Value 10k
SYMATTR SpiceLine tol=1
SYMBOL res 640 -224 R0
SYMATTR InstName R3
SYMATTR Value 10k
SYMATTR SpiceLine tol=1
SYMBOL res 640 0 R0
SYMATTR InstName R4
SYMATTR Value 100k
SYMATTR SpiceLine tol=1
SYMBOL diode 560 -80 R270
SYMATTR InstName D1
SYMATTR Value 1N4148
SYMBOL OpAmps\\OP07 240 -80 R0
SYMATTR InstName U1
SYMBOL res 512 -32 R90
SYMATTR InstName R5
SYMATTR Value 1k
SYMATTR SpiceLine tol=1
SYMBOL diode 704 0 R270
SYMATTR InstName D2
SYMATTR Value 1N4148
SYMBOL res 928 0 R0
SYMATTR InstName R6
SYMATTR Value 100k
SYMATTR SpiceLine tol=1
SYMBOL diode 816 0 R270
SYMATTR InstName D3
SYMATTR Value 1N4148