diff --git a/examples/Monte_Carlo/MC_2_control.sp b/examples/Monte_Carlo/MC_2_control.sp index 9b9f36063..40bb95850 100644 --- a/examples/Monte_Carlo/MC_2_control.sp +++ b/examples/Monte_Carlo/MC_2_control.sp @@ -6,7 +6,7 @@ * .control save buf $ we just need output vector buf, save memory by more than 10x - let mc_runs = 100 $ number of runs for monte carlo + let mc_runs = 10 $ number of runs for monte carlo let run = 1 $ number of the actual run * Where to find the circuit netlist file MC_2_circ.sp @@ -22,7 +22,11 @@ reset set run ="$&run" $ create a variable from the vector set rndseed = $run $ set the rnd seed value to the loop index - source MC_2_circ.sp $ load the circuit, including model data + if run = 1 + source MC_2_circ.sp $ load the circuit once from file, including model data + else + mc_source $ re-load the circuit from internal storage + end tran 15p 200n 0 write mc_ring{$run}.out buf $ write each sim output to its own rawfile linearize buf $ lienarize buf to allow fft diff --git a/examples/Monte_Carlo/MC_ring.sp b/examples/Monte_Carlo/MC_ring.sp index f63ae0467..d65277a66 100644 --- a/examples/Monte_Carlo/MC_ring.sp +++ b/examples/Monte_Carlo/MC_ring.sp @@ -95,11 +95,22 @@ cout buf ss 0.2pF * close to 8192, which would yield varying number of line length and thus scale for fft. * * We have to figure out what to do if a single simulation will not converge. -* Is there a variable which may be set if there is no convergence? -* Then we might skip this run and continue with a new run. It does not exist for now. -* So we have to rely on the robustness of the following steps not leading -* to a seg fault if the tran data are missing. +* There is the variable 'sim_status' which is set to 1 if the simulation +* fails with ’xx simulation(s) aborted’, e.g. because of non-convergence. +* Then we might skip this run and continue with a new run. * + echo Simulation status $sim_status + let simstat = $sim_status + if simstat = 1 + if run = mc_runs + echo go to end + else + echo go to next run + end + destroy $curplot + goto next + end + set run ="$&run" $ create a variable from the vector set mc_runs ="$&mc_runs" $ create a variable from the vector echo simulation run no. $run of $mc_runs @@ -136,6 +147,8 @@ cout buf ss 0.2pF let maxffts[{$run}]={$dt}.fft_max let halfffts[{$run}]={$dt}.fft_40 let run = run + 1 + label next + reset end ***** plotting ********************************************************** setplot $plot_out