Пример #1
0
best_mods=None
best_fom=0
print('writing output to {} and in directory {}'.format(logfile,outdir))
fp=open(logfile,'at')
while True:
  #pick a random value
  mods=AttrDict()
  mods.cycles=9
  for x in vals:
    name=x[0]
    mods[name]=randrange(x[1],x[2],x[3])
  #compute the vent time
  mods.real_vent_time=mods.real_cycle_time*mods.vent_time_fract
  print(mods)
  #Simulate
  ret,param=psa.simulate_and_plot(mods,
                                  do_plots=True,
                                  pause=False,
                                  outdir=outdir,
                                  params_file='params',
                                  roi=roi)
  fom=ret.container_y[-1][1]
  txt=''
  if fom>best_fom:
    best_fom=fom
    txt='IMPROVED'
  fp.write('{} yAN={} mods={}\n'.format(txt,fom,mods))
  fp.flush()
    
    
Пример #2
0
if options.stdout:
    outdir = None

print('options=', options)
print('git revision:{}'.format(util.get_git_commit()))


class AttrDict(dict):
    def __init__(self, *args, **kwargs):
        super(AttrDict, self).__init__(*args, **kwargs)
        self.__dict__ = self


mods = AttrDict()
mods.real_cycle_time = 18
mods.real_vent_time = 14
mods.cycles = 13
mods.product_orifice = .15
mods.vent_orifice = 1.0
roi = None
outdir = 'vent_orifice'
for vo in [1.0, 2.2]:
    mods.vent_orifice = vo
    pars = {**options.__dict__, **mods}
    ret = psa.simulate_and_plot(pars,
                                do_plots=True,
                                pause=options.show,
                                outdir=outdir,
                                params_file='params_jee',
                                roi=roi)