v {xschem version=3.4.6 file_version=1.2
*
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
* simulation.
* Copyright (C) 1998-2024 Stefan Frederik Schippers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
}
G {}
K {}
V {}
S {}
E {}
L 18 845 -530 880 -530 {}
L 18 845 -530 845 -450 {}
L 18 845 -450 880 -450 {}
L 18 880 -450 900 -400 {}
L 18 900 -400 910 -400 {}
L 18 910 -580 910 -400 {}
L 18 900 -580 910 -580 {}
L 18 880 -530 900 -580 {}
L 18 880 -530 880 -450 {}
L 18 900 -580 900 -400 {}
B 2 1200 -500 1880 -310 {flags=graph
y1 = -0.00095
y2 = 12
divy = 6
x1=0.0246194
x2=0.0249318
divx=10
node="i(v.x1.vu)
i(v.x0.vu)
i(v.x1.vd)
i(v.x0.vd)"
color="11 13 12 7"
unitx=m
linewidth_mult=2.3

autoload=1
sim_type=tran}
B 2 1200 -830 1880 -520 {flags=graph
y1 = -50
y2 = 61
divy = 12
x1=0.0246194
x2=0.0249318
divx=10
node="OUTP
OUTM
VPP
VNN
x1.VBOOST
x0.VBOOST"
color="4 15 10 12 7 4"
unitx=m
hilight_wave=-1
linewidth_mult=2.3

autoload=1
sim_type=tran}
B 2 1200 -1020 1880 -830 {flags=graph
y1 = 0
y2 = 1100
divy = 6
x1=0.0246194
x2=0.0249318
divx=10


unitx=m
color="19 7"
node="supply power;i(vcurrvnn) vnn * i(vcurrvpp) vpp * +
running average supply power;i(vcurrvnn) vnn * i(vcurrvpp) vpp * + 200u ravg()"
linewidth_mult=2.3

autoload=1
sim_type=tran}
B 2 1200 -310 1880 -120 {flags=graph
y1 = 0
y2 = 960
divy = 6
x1=0.0246194
x2=0.0249318
divx=10


unitx=m
color="4 7"
node="\\"Load power;outm outp - i(v.x1.v8) *\\"
\\"Running Average Load power;outm outp - i(v.x1.v8) * 200u ravg()\\""
linewidth_mult=2.3

autoload=1
sim_type=tran}
B 2 1740 -1110 1877 -1050 {flags=image
alpha=0.6
[encoded data, 50943 characters]
ps_invert=true
jpeg_quality=30}
B 2 1570 -1107.5 1708 -1045 {flags=image
alpha=0.6
image=/home/schippes/x/xyce.png
[encoded data, 61011 characters]
ps_invert=true
jpeg_quality=30}
T {actual value
50u} 400 -820 0 0 0.4 0.4 {}
T {actual value
50u} 400 -360 0 0 0.4 0.4 {}
T {actual value
50u} 50 -750 0 0 0.4 0.4 {}
T {actual value
50u} 80 -290 0 0 0.4 0.4 {}
T {actual value
200} 860 -1280 0 0 0.4 0.4 {}
T {Select one or more graphs (and no other objects)
and use arrow keys to zoom / pan waveforms} 1290 -1180 0 0 0.3 0.3 {}
N 60 -1210 60 -1190 {lab=VPPI}
N 60 -1070 60 -1050 {lab=VNNI}
N 710 -700 860 -700 {lab=OUTM}
N 500 -1150 570 -1150 {lab=VSS}
N 570 -1150 570 -1140 {lab=VSS}
N 570 -1140 610 -1140 {lab=VSS}
N 540 -1190 570 -1190 {lab=IN}
N 610 -1200 700 -1200 {lab=REFP}
N 310 -1060 310 -1050 {lab=VNN}
N 310 -1130 310 -1120 {lab=VSS}
N 60 -1050 160 -1050 {lab=VNNI}
N 60 -1210 160 -1210 {lab=VPPI}
N 310 -1130 320 -1130 {lab=VSS}
N 290 -1210 320 -1210 {lab=VPP}
N 290 -1050 310 -1050 {lab=VNN}
N 290 -1130 310 -1130 {lab=VSS}
N 550 -950 710 -950 {lab=OUTM}
N 400 -890 550 -890 {lab=FBN}
N 550 -770 550 -750 {lab=IN}
N 350 -890 350 -700 {lab=FBN}
N 710 -950 710 -700 {lab=OUTM}
N 710 -240 860 -240 {lab=OUTP}
N 260 -220 350 -220 {lab=INX}
N 550 -490 710 -490 {lab=OUTP}
N 400 -430 550 -430 {lab=FB}
N 350 -430 350 -240 {lab=FB}
N 710 -490 710 -240 {lab=OUTP}
N 240 -400 240 -380 {lab=VPP}
N 260 -220 260 -190 {lab=INX}
N 260 -130 260 -110 {lab=VSS}
N 500 -1070 570 -1070 {lab=VSS}
N 540 -1110 570 -1110 {lab=IN}
N 610 -1120 700 -1120 {lab=REFM}
N 200 -220 240 -220 {lab=INX}
N 550 -310 550 -290 {lab=VSS}
N 650 -700 710 -700 {lab=OUTM}
N 650 -240 710 -240 {lab=OUTP}
N 240 -220 260 -220 {lab=INX}
N 260 -680 350 -680 {lab=VSSX}
N 240 -860 240 -840 {lab=VPP}
N 260 -680 260 -650 {lab=VSSX}
N 260 -590 260 -570 {lab=VSS}
N 240 -680 260 -680 {lab=VSSX}
N 180 -680 240 -680 {lab=VSSX}
N 870 -1200 890 -1200 {lab=IN_INT}
N 870 -1200 870 -1130 {lab=IN_INT}
N 400 -1000 400 -980 {lab=VPP}
N 400 -540 400 -520 {lab=VPP}
N 860 -700 860 -520 {lab=OUTM}
N 860 -460 860 -240 {lab=OUTP}
N 350 -890 400 -890 {lab=FBN}
N 350 -430 400 -430 {lab=FB}
N 570 -1060 610 -1060 {lab=VSS}
N 570 -1070 570 -1060 {lab=VSS}
N 320 -1210 360 -1210 {lab=VPP}
N 310 -1050 360 -1050 {lab=VNN}
N 320 -1130 360 -1130 {lab=VSS}
N 320 -1140 320 -1130 { lab=VSS}
N 320 -1210 320 -1200 { lab=VPP}
N 400 -920 400 -890 { lab=FBN}
N 400 -460 400 -430 { lab=FB}
N 240 -780 240 -680 { lab=VSSX}
N 240 -320 240 -220 { lab=INX}
N 220 -1210 230 -1210 {lab=#net1}
N 220 -1050 230 -1050 {lab=#net2}
N 60 -1130 230 -1130 {lab=#net3}
N 950 -1200 1020 -1200 {
lab=IN}
C {vsource.sym} 60 -1160 0 0 {name=V1 value="dc 'VPP'
+ pwl 0 0 1m 'VPP'"
}
C {vsource.sym} 60 -1100 0 0 {name=V0 value="dc 'VPP'
+ pwl 0 0 1m 'VPP'"
}
C {lab_pin.sym} 360 -1210 0 1 {name=p5 lab=VPP}
C {lab_pin.sym} 360 -1050 0 1 {name=p6 lab=VNN}
C {lab_pin.sym} 360 -1130 0 1 {name=p3 lab=VSS}
C {lab_pin.sym} 860 -240 0 1 {name=p14 lab=OUTP
text_size_1=0.7
text_size_0=0.7}
C {res.sym} 860 -490 0 1 {name=R1 m=1 value=8}
C {lab_pin.sym} 500 -1150 0 0 {name=p26 lab=VSS}
C {lab_pin.sym} 540 -1190 0 0 {name=p31 lab=IN}
C {vcvs.sym} 610 -1170 0 0 {name=E3 value=\{gain*0.99\}}
C {lab_pin.sym} 700 -1200 0 1 {name=p32 lab=REFP}
C {capa.sym} 310 -1090 0 0 {name=C3 m=1 value="100u"}
C {res.sym} 190 -1210 1 1 {name=R11 m=1 value=0.1}
C {res.sym} 190 -1050 1 1 {name=R9 m=1 value=0.1}
C {res.sym} 550 -920 0 1 {name=R19 m=1 value=50k
}
C {res.sym} 550 -860 0 1 {name=R0 m=1 value="'50k/gain'"}
C {lab_pin.sym} 550 -750 0 0 {name=p108 lab=IN}
C {mos_power_ampli.sym} 500 -660 0 0 {name=x1
}
C {lab_pin.sym} 350 -640 0 0 {name=p2 lab=VPP}
C {lab_pin.sym} 350 -620 0 0 {name=p4 lab=VNN}
C {lab_pin.sym} 860 -700 0 1 {name=p9 lab=OUTM
text_size_1=0.7
text_size_0=0.7
}
C {mos_power_ampli.sym} 500 -200 0 0 {name=x0
}
C {lab_pin.sym} 350 -180 0 0 {name=p12 lab=VPP}
C {lab_pin.sym} 350 -160 0 0 {name=p13 lab=VNN}
C {res.sym} 240 -350 0 1 {name=R6 m=1 value=50k}
C {lab_pin.sym} 240 -400 0 0 {name=p7 lab=VPP}
C {res.sym} 260 -160 0 1 {name=R7 m=1 value=50k}
C {lab_pin.sym} 260 -110 0 0 {name=p15 lab=VSS}
C {lab_pin.sym} 500 -1070 0 0 {name=p20 lab=VSS}
C {lab_pin.sym} 540 -1110 0 0 {name=p21 lab=IN}
C {vcvs.sym} 610 -1090 0 0 {name=E0 value=\{-gain*0.99\}}
C {lab_pin.sym} 700 -1120 0 1 {name=p23 lab=REFM}
C {lab_pin.sym} 240 -250 0 0 {name=p8 lab=INX}
C {lab_pin.sym} 870 -1010 0 0 {name=p126 lab=VSS}
C {lab_pin.sym} 1020 -1200 0 1 {name=p127 lab=IN}
C {capa.sym} 550 -800 0 0 {name=C5 m=1 value="100n ; ic=0"}
C {lab_pin.sym} 550 -290 0 0 {name=p11 lab=VSS}
C {capa.sym} 550 -340 0 0 {name=C6 m=1 value="100n ; ic=0"}
C {lab_pin.sym} 350 -200 0 0 {name=p28 lab=VSS}
C {lab_pin.sym} 350 -660 0 0 {name=p1 lab=VSS}
C {res.sym} 550 -460 0 1 {name=R2 m=1 value=50k}
C {res.sym} 550 -400 0 1 {name=R3 m=1 value="'50k/(gain-2)'"}
C {vsource.sym} 870 -1100 0 0 {name=V3 
xvalue="dc 0 pulse -.1 .1 1m .1u .1u 10.1u 20u" 
value="dc 0 sin 0 1 \{frequ\} 1m"
}
C {res.sym} 240 -810 0 1 {name=R4 m=1 value=50k}
C {lab_pin.sym} 240 -860 0 0 {name=p18 lab=VPP}
C {res.sym} 260 -620 0 1 {name=R5 m=1 value=50k}
C {lab_pin.sym} 260 -570 0 0 {name=p10 lab=VSS}
C {res.sym} 400 -950 0 1 {name=R8 m=1 value=50k}
C {capa.sym} 170 -220 1 0 {name=C4 m=1 value="100n ; ic=0"}
C {lab_pin.sym} 140 -220 0 0 {name=p0 lab=IN}
C {capa.sym} 150 -680 1 0 {name=C1 m=1 value="100n ; ic=0"}
C {lab_pin.sym} 120 -680 0 0 {name=p17 lab=VSS}
C {lab_pin.sym} 240 -710 0 0 {name=p22 lab=VSSX}
C {res.sym} 920 -1200 1 1 {name=R10 m=1 value=2}
C {lab_pin.sym} 400 -1000 0 0 {name=p24 lab=VPP}
C {res.sym} 400 -490 0 1 {name=R13 m=1 value=50k}
C {lab_pin.sym} 400 -540 0 0 {name=p16 lab=VPP}
C {vsource.sym} 870 -1040 0 0 {name=Vin value=0 xvalue="pwl 0 .1 1m .1 1.01m 0"
}
C {lab_pin.sym} 350 -270 0 0 {name=p19 lab=FB}
C {lab_pin.sym} 350 -730 0 0 {name=p25 lab=FBN}
C {title.sym} 160 -30 0 0 {name=l2 author="Stefan Schippers"}
C {lab_pin.sym} 870 -1150 0 0 {name=p27 lab=IN_INT}
C {ammeter.sym} 260 -1210 3 0 {name=vcurrvpp}
C {ammeter.sym} 260 -1050 3 0 {name=vcurrvnn}
C {ammeter.sym} 260 -1130 3 0 {name=vcurrvss}
C {launcher.sym} 710 -70 0 0 {name=h2
descr="Ctrl-Click
Clear all probes" 
tclcommand="
    xschem push_undo
    xschem set no_undo 1
    xschem set no_draw 1
 
    set lastinst [xschem get instances]
    for \{ set i 0 \} \{ $i < $lastinst \} \{incr i \} \{
      set type [xschem getprop instance $i cell::type]
      if \{ [regexp \{(^|/)probe$\} $type ] \} \{
        xschem setprop $i voltage fast
      \}
      if \{ [regexp \{current_probe$\} $type ] \} \{
        xschem setprop $i current fast
      \}
      if \{ [regexp \{differential_probe$\} $type ] \} \{
        xschem setprop $i voltage fast
      \}
    \}
    xschem set no_undo 0
    xschem set no_draw 0
    xschem redraw
"
}
C {capa.sym} 320 -1170 0 0 {name=C2 m=1 value="100u"}
C {ngspice_get_expr.sym} 840 -460 2 0 {name=r29 
node="[format %.4g [expr \{([ngspice::get_voltage outm] - [ngspice::get_voltage outp]) * [ngspice::get_current \{r1[i]\}]\}]] "
descr = power
text_size_0=0.4
text_size_1=0.4}
C {launcher.sym} 710 -120 0 0 {name=h3
descr="Load file into gaw" 
comment="
  This launcher gets raw filename from current schematic using 'xschem get schname'
  and stripping off path and suffix.  It then loads raw file into gaw.
  This allow to use it in any schematic without changes.
"
tclcommand="
set rawfile [file tail [file rootname [xschem get schname]]].raw
gaw_cmd \\"tabledel $rawfile
load $netlist_dir/$rawfile
table_set $rawfile\\"
unset rawfile"
}
C {spice_probe.sym} 710 -860 0 0 {name=p40 analysis=tran }
C {spice_probe.sym} 710 -400 0 0 {name=p41 analysis=tran }
C {spice_probe.sym} 660 -1200 0 0 {name=p42 analysis=tran }
C {spice_probe.sym} 670 -1120 0 0 {name=p43 analysis=tran }
C {spice_probe.sym} 950 -1200 0 0 {name=p44 analysis=tran }
C {launcher.sym} 1000 -270 0 0 {name=h1
descr="Backannotate"
tclcommand="xschem annotate_op $netlist_dir/poweramp.raw"}
C {spice_probe.sym} 350 -1210 0 0 {name=p45 analysis=tran }
C {spice_probe.sym} 350 -1050 0 0 {name=p46 analysis=tran }
C {launcher.sym} 1325 -1225 0 0 {name=h5 
descr="load ngspice waves" 
tclcommand="
xschem raw read $netlist_dir/poweramp.raw tran; xschem redraw
"
}
C {launcher.sym} 1450 -30 0 0 {name=h6
descr="Graph Manual page"
url="https://xschem.sourceforge.io/stefan/xschem_man/graphs.html"}
C {simulator_commands.sym} 1020 -670 0 0 {name=NGSPICE
simulator=ngspice
only_toplevel=false 
spice_ignore=0
value="
.option ITL4=20000 ITL5=0
vvss vss 0 dc 0 
.param VPP=50
.temp 30
.param frequ=15k
.param gain=45
.option savecurrents

** models are generally not free: you must download
** SPICE models for active devices and put them  into the below 
** referenced file in simulation directory.
.include \\"models_poweramp.txt\\"
.control
save all
op
write poweramp.raw
set appendwrite
tran  2e-7 0.025 uic
* .FOUR 20k v(outm,outp)
* .probe i(*) 
save p(r*) p(v*)
write poweramp.raw
quit 0
.endc
"}
C {simulator_commands.sym} 1020 -870 0 0 {name=COMMANDS1
simulator=xyce
only_toplevel=false 
value="
vvss vss 0 dc 0 
.temp 30
.param VPP=50
.param frequ=5k
.param gain=45

** models are generally not free: you must download
** SPICE models for active devices and put them  into the below 
** referenced file in simulation directory.
.include \\"models_poweramp.txt\\"
.tran  8e-7 0.07 uic
* .op
.print tran format=raw file=poweramp_xyce.raw v(*) i(*) 
+ v(x1:*) v(x0:*) i(x1:*) i(x0:*)
* .print dc format=raw file=poweramp_op.raw v(*) i(*) v(x1:*) v(x0:*) i(x1:*) i(x0:*)

"}
C {launcher.sym} 1675 -1225 0 0 {name=h7 
descr="load Xyce waves" 
tclcommand="
xschem raw_read $netlist_dir/poweramp_xyce.raw tran
"
}
C {simulator_commands.sym} 1020 -480 0 0 {name=NGSPICE_BATCH
simulator=ngspice
spice_ignore=1
only_toplevel=false 
value="
.option ITL4=20000 ITL5=0
vvss vss 0 dc 0 
.temp 30

.param frequ=5k
.param gain=45
.option savecurrents

** models are generally not free: you must download
** SPICE models for active devices and put them  into the below 
** referenced file in simulation directory.
.include \\"models_poweramp.txt\\"
.save all
.op
.tran  8e-7 0.07 uic
"}
C {launcher.sym} 960 -330 0 0 {name=h4
descr="Swap interactive
/batch mode"
tclcommand="proc simswap \{\} \{
  set x [xschem getprop instance NGSPICE spice_ignore]
  xschem setprop instance NGSPICE_BATCH spice_ignore $x
  set x [expr \{ !$x\}]
  xschem setprop instance NGSPICE spice_ignore $x
\}

simswap

"
}
C {lab_pin.sym} 60 -1210 0 0 {name=p29 lab=VPPI}
C {lab_pin.sym} 60 -1050 0 0 {name=p30 lab=VNNI}
