#tolerance #nosave #noprint #vector set rewind set noecho #simulation pltype = 0 set printmode = save #mprint SET COLWIDTH=22 SET SPICEDIGITS=5 nameplot ref newplot evahi ref.default ref.default evahi.pltype = 0 printstatus -t "######## sensitivity for each parameter ########" nextparam null while param <> null alterparam tolerance(param)/3 #simulation paramvec = param printstatus -p paramvec paramtol = tolerance(param) paramval = getparam(param) pltype = 1 #mprint nv = nextvector(null) while nv <> null if length(nv) = 1 if nv <> pltype nv = nv - ref.nv end end nv = nextvector(nv) end unalterparam nextparam end setplot ref nv = nextvector(null) printstatus -t "######## measurements ########" while nv <> null if length(nv) = 1 pl = nextplot(null) while pl <> null if pltype = 1 * the inner loop, we are looping through each sensitivity plot looking at the same vector * we will alter the parameter id'd by paramvec to maximaize/minimize the vector setparam paramvec if nv >= 0 alterparam paramtol else alterparam -paramtol end end pl = nextplot(pl) end #simulation #mprint pltype = 2 * if we want sensitivity at the extreme, we weed to go through each param * and change it to be a bit different than it is at the extreme, run a simulation , * and mark it as pltype 3 along with its paramvec, then we can take the diff * from the pltype = 2 to get the sensitivity at the extreme if the sign at the extreme * is different than at the nominal, we can report an error or go on to do worst case * for worstcase, we need to reduce the param change by 1/2 and do this over again... * either continue in this loop or make a wc loop afterward... save the paramvalue * and tolerance evahi.nv = nv if nv <> pltype printstatus -n nv end end nv = nextvector(nv) end set printmode = print unset noecho setplot EVAHI ECHO ECHO -U "**********EVA PARAMETER LIST**********" ECHO PRINTTEXT -UN PARAMETER PRINTTEXT -U NOMINAL TOLERANCE ECHO ECHO nextparam null while param <> null paramvec = param PRINTNAME PARAMVEC PRINTVAL PARAMVEC PRINTTOL PARAMVEC ECHO nextparam end ECHO newplot evasort ref.default ref.default setplot REF nv = nextvector(null) while nv <> null if length(nv) = 1 if ref.nv <> 0 evasort.nv = ((evahi.nv-ref.nv)*100)/ref.nv else evasort.nv = 0; end end nv = nextvector(nv) end ECHO ECHO -U "**********EVA-HI RESULTS**********" ECHO PRINTTEXT -UN VECTOR PRINTTEXT -U NOMINAL EVA-HI CHANGE% ECHO ECHO setplot evasort sort -VD nv = nextvector(null) while nv <> null if length(nv) = 1 if nv <> pltype PRINTNAME NV PRINTVAL REF.NV PRINTVAL EVAHI.NV PRINTVAL EVASORT.NV ECHO end end nv = nextvector(nv) end ECHO ECHO * now the eva resultas are in pltype = 2 plots set printmode = print unset noecho setplot evahi echo ########## EVA HI analysis Results ############# #mprint