changeset 17:f0665f53b854

Show FET power dissipation, don't bother with mod rail
author Daniel O'Connor <darius@dons.net.au>
date Sun, 19 Nov 2023 17:59:58 +1030
parents 1c4ff82b5704
children ab481ded407a
files pa-STP6N60M2.asc pa-STP6N60M2.plt sim.py
diffstat 3 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pa-STP6N60M2.asc	Sun Nov 19 17:36:45 2023 +1030
+++ b/pa-STP6N60M2.asc	Sun Nov 19 17:59:58 2023 +1030
@@ -225,8 +225,8 @@
 SYMBOL AutoGenerated/ISL55110 416 912 R0
 WINDOW 3 161 133 Top 2
 SYMATTR InstName U12
-TEXT 1440 576 Left 2 !.tran 0 440n 240n\n*.tran 0 1.8u 1.7u\n*.tran 0 5u 1.7u\n*.tran 0 2.5u 1.5u\n*.tran 0 5u
+TEXT 1440 576 Left 2 !*.tran 0 440n 240n\n*.tran 0 1.8u 1.7u\n.tran 0 5u 1.7u\n*.tran 0 2.5u 1.5u\n*.tran 0 5u
 TEXT 880 968 Left 2 !.meas PIN_HV AVG abs(V(HV)*I(V4))\n.meas PIN_MOD AVG abs(V(MOD_RAIL)*I(V2))\n.meas PIN_LV AVG abs(V(VCC)*I(V1))\n.meas POUT AVG abs(V(RFOut)*I(R1))\n.meas Efficiency Param 100*POUT/(PIN_HV + PIN_LV + PIN_MOD)\n.meas IPEAK_U2 max(abs(Ix(U2:D)))\n.meas V_IPEAK_U2 FIND abs(V(SW)) WHEN Ix(U2:D) = IPEAK_U2 * 0.999 cross=1\n.meas VPEAK_U2 max(abs(V(SW)))\n.meas I_VPEAK_U2 FIND abs(Ix(U2:D)) WHEN V(SW) = VPEAK_U2 * 0.999 cross=1
 TEXT 1448 696 Left 2 !.param F0 = 35.24Meg\n.param Tperiod = 1 / {F0}\n.param dutypct = 34\n.param Ton = 1 / {F0} * {dutypct} / 100\n.param C1 = 220p\n.param C2 = 230p\n.param L1 = 130n\n.param L2 = 178n\n.param R1 = 50
 TEXT 1448 904 Left 2 !.fourier {F0} 9 -1 V(rfout)
-TEXT 488 1112 Left 2 !*.step param dutypct 20 60 7\n*.step param C1 10p 300p 10p\n*.step param C2 80p 300p 5p\n.step param L2 80n 300n 15n
+TEXT 488 1112 Left 2 !*.step param dutypct 20 60 7\n*.step param C1 10p 300p 10p\n*.step param C2 80p 300p 5p\n*.step param L2 80n 300n 15n
Binary file pa-STP6N60M2.plt has changed
--- a/sim.py	Sun Nov 19 17:36:45 2023 +1030
+++ b/sim.py	Sun Nov 19 17:59:58 2023 +1030
@@ -29,15 +29,14 @@
     cmd.extend(simflags)
     cmd.append(runname.name)
     then = datetime.datetime.now()
-    print(f'Starting run {runname} at {then}')
+    #print(f'Starting run {runname} at {then}')
     p = subprocess.Popen(cmd, cwd = rundir)
     p.communicate()
     now = datetime.datetime.now()
     taken = now - then
 
     if p.returncode != 0:
-        print('Run failed: ' + ' '.join(map(shlex.quote, cmd)))
-        return 100000
+        raise Exception(' '.join(map(shlex.quote, cmd)) + ' failed with code ' + str(p.returncode))
 
     #rawpath = rundir / runname.with_suffix('.raw')
     #raw = spicelib.RawRead(rawpath)
@@ -110,8 +109,11 @@
     # Run the simulation
     # Need to convert units to suit
     runname = pathlib.Path(circ).stem + '-' + str(run) + '.net'
-    then, taken, power, eff, thd, ipeak = simulate(circ, simexe, simflags, rundir, runname,
-                                                   {'dutypct' : duty, 'C1' : c1 * 1e-12, 'C2' : c2 * 1e-12, 'L1' : l1 * 1e-6, 'L2' : l2 * 1e-9})
+    try:
+        then, taken, power, eff, thd, ipeak = simulate(circ, simexe, simflags, rundir, runname,
+                                                       {'dutypct' : duty, 'C1' : c1 * 1e-12, 'C2' : c2 * 1e-12, 'L1' : l1 * 1e-6, 'L2' : l2 * 1e-9})
+    except:
+        return 100000
     # Calculate the cost
     cost = calccost(power, eff, thd, ipeak)