P_net_list = np.arange(10e6, 160e6, 10e6) UB = [1473.15, 250e5, 4, 350, 250] LB = [1023.15, 240e5, 2.75, 250, 20] assert (len(UB) == len(LB)) num_data = 150 num_data_operating = 6 iters = 1 #Generate simulation samples lib.generate_samples(UB, LB, len(UB), num_data, num_data_operating, samplefn) points = np.genfromtxt(samplefn, skip_header=1, delimiter=',') print(points) os.chdir(simdir) #Inputs P_NET = [] T_IN_REF_BLK = [] P_HIGH = [] PR = [] DTEMP_HTF_PHX = [] DELTA = [] LOAD = [] T_HTF_IN = [] T_AMB_INPUT = []
'load', 'T_HTF_in', 'T_amb_input', ] UB = [1.5e8, 1273.15, 250e5, 3, 853.15] LB = [1e7, 1023.15, 240e5, 25 / 9.14, 798.15] assert (len(UB) == len(LB)) num_data = 750 num_data_operating = 8 total_cases = num_data * num_data_operating iters = 1 design_params_in = lib.generate_samples(UB, LB, len(UB), num_data) assert (len(design_params_in) == num_data) mofile = 'sCO2PBRig' os.system('cp /home/philgun/solartherm-particle/examples/%s.mo .' % (mofile)) for ins in design_params_in: to_write_1 = [] cmd_base = 'st_simulate --maxStep 0.02s --step 1s --stop 1s --start 0s --np=0 --tolerance 1e-06 %s.mo ' % ( mofile) for i in range(len(ins)): cmd_base += '%s=%s ' % (varname[i], round(ins[i], 2)) to_write_1.append(round(ins[i], 2)) #Design param of turbine inlet temperature - T_ref_blk - 100 --> T_ref_blk - 20 thigh = lib.generate_samples([ins[1] - 20], [ins[1] - 100], 1,
vals.append(value) write_real = '' for v in vals: print(v) write_real += '%s,' % (v) write_real += '\n' with open(resfn, 'a') as f: f.write(write_real) f.close() elapsed_time = time.time() - now print("TOTAL SIMULATION TIME: %s" % (elapsed_time)) ''' lib.generate_samples(UB,LB,len(UB),num_data,num_data_operating,samplefn) points = np.genfromtxt(samplefn,skip_header=1,delimiter=',') os.chdir(simdir) #Saveresult headers = [ 'P_net', 'T_in_ref_blk', 'p_high', 'PR', 'Pinch_PHX',
'load', 'T_HTF_in', 'T_amb_input', ] UB = [1.5e8, 1273.15, 250e5, 3, 853.15] LB = [1e7, 1023.15, 240e5, 25 / 9.14, 798.15] assert (len(UB) == len(LB)) num_data = 750 num_data_operating = 8 total_cases = num_data * num_data_operating iters = 1 design_params_in = lib.generate_samples(UB, LB, len(UB), num_data) assert (len(design_params_in) == num_data) mofile = 'sCO2PBRig' os.system('cp /home/philgun/solartherm-particle/examples/%s.mo .' % (mofile)) for ins in design_params_in: to_write_1 = [] cmd_base = 'st_simulate --maxStep 0.02s --step 1s --stop 1s --start 0s --np=0 --tolerance 1e-06 %s.mo ' % ( mofile) for i in range(len(ins)): cmd_base += '%s=%s ' % (varname[i], round(ins[i], 2)) to_write_1.append(round(ins[i], 2)) #Design param of turbine inlet temperature - T_ref_blk - 100 --> T_ref_blk - 20 thigh = np.linspace(ins[1] - 100, ins[1] - 20, 10)