v {xschem version=3.4.5 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-2023 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 {}
B 2 860 -550 1360 -160 {flags=graph 
y1 = 0
y2 = 6
divy = 4
subdivy=1
x1=-0.0573452
x2=22.5919
divx=8
  unitx=1
color=15
node=i(vload)
dataset=-1}
B 2 860 -790 1360 -550 {flags=graph 
y1 = 7.29412e-05
y2 = 99.9997
divy = 4
subdivy=1
x1=-0.0573452
x2=22.5919
divx=8
  unitx=1
color=8
node="\\"Power;
plus
i(vload)
*\\""
dataset=-1}
T {position the mouse close to one of the curves
and press 't' to display only that curve.
This allows you to annotate the active
waveform in the schematic.} 480 -370 0 0 0.3 0.3 {}
T {tcleval(SUN=[expr \{[xschem getprop rect 2 0 dataset] == -1 ? \{N/A\} : ([xschem getprop rect 2 0 dataset] + 1)*20\}]%)} 710 -460 0 0 0.4 0.4 {name=xxxx}
N 430 -480 430 -420 {
lab=minus}
N 430 -570 430 -540 {
lab=mn}
N 290 -460 310 -460 {
lab=fade}
N 430 -700 430 -630 {
lab=pn}
N 430 -800 430 -760 {
lab=plus}
C {iopin.sym} 430 -800 2 1 {name=p1 lab=plus}
C {iopin.sym} 430 -420 2 1 {name=p2 lab=minus}
C {title.sym} 160 -40 0 0 {name=l1 author="Stefan Schippers" net_name=true}
C {ammeter.sym} 430 -510 2 1 {name=Vm}
C {lab_pin.sym} 430 -650 2 0 {name=l2 sig_type=std_logic lab=pn}
C {lab_pin.sym} 430 -550 2 0 {name=l3 sig_type=std_logic lab=mn}
C {isource_arith.sym} 430 -600 2 0 {name=G1
CUR="v(f) * power * 2.16 / n - power * 2.16 / n * (3.5e-7 * exp( v(pn,mn) / n / 0.041))"
}
C {ipin.sym} 290 -460 2 1 {name=p2 lab=fade}
C {ammeter.sym} 340 -460 3 0 {name=Vf}
C {lab_pin.sym} 370 -460 2 0 {name=l3 sig_type=std_logic lab=f}
C {ammeter.sym} 430 -730 2 1 {name=Vp}
C {code_shown.sym} 20 -340 0 0 {name=CONTROL 
only_toplevel=true
value=".param power=100
.param n=36
vload plus minus 0
vsun fade 0 0
vref minus 0 0
.control
save plus minus i(vload) i(vm) n(pn) v(mn)
dc vload 0 48 0.2 vsun 0.2 1.0 0.2
write pv_ngspice.raw 
quit
.endc
"}
C {launcher.sym} 930 -140 0 0 {name=h3 
descr="Netlist, Simulate, Reload waves" 
tclcommand="
if \{![info exists sim]\} \{set_sim_defaults\}
set sim(spice,0,fg) 1
if \{[xschem raw_query loaded]\} \{ ;# Unload
  xschem raw_clear
\}
xschem netlist
xschem simulate
xschem raw_read $netlist_dir/[file tail [file rootname [xschem get current_name]]].raw
"
}
C {launcher.sym} 930 -100 0 0 {name=h1 
descr="Load embedded waves" 
tclcommand="xschem raw_read_from_attr"
spice_data="
[encoded data, 117003 characters]
XBR9qQutwRQAAAAAAEhAAAAAAAAAAAAAAAAAAAAAABQAAAAAAEhAFAAAAAAASEAAAAAAAAAAAICJiQpUobDBgImJClShsMGAiYkKVKGwwQ=="}
C {ngspice_get_expr.sym} 480 -600 0 0 {name=r24 
node="[format %.4g [expr ([ngspice::get_voltage pn] - [ngspice::get_voltage mn]) * [ngspice::get_current Vm]]] W"
descr = Power
}
C {launcher.sym} 1300 -90 0 0 {name=h2 
descr="Reload waves" 
tclcommand="
xschem raw_read $netlist_dir/[file tail [file rootname [xschem get current_name]]].raw
"
}
