Mercurial > ~darius > hgwebdir.cgi > pa
diff sim.py @ 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 | ac2ff6be22f7 |
children | 28475b505f1f |
line wrap: on
line diff
--- 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)