ssr_binary.add_event_dependency('eluent_on', ['inject_off']) ssr_binary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) ssr_binary.add_event_dependency('eluent_off', ['inject_on']) ssr_binary.add_event('recycle_on', 'flow_sheet.column.output_state', 0) ssr_binary.add_event('recycle_off', 'flow_sheet.column.output_state', 1) ssr_binary.add_event_dependency('feed_on', ['inject_off']) ssr_binary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) ssr_binary.add_event_dependency( 'inject_off', ['inject_on', 'feed_duration', 'recycle_off', 'recycle_on'], [1, 1, 1, -1]) # Set process times ssr_binary.cycle_time = 191.11 ssr_binary.feed_duration.time = 42.956 ssr_binary.recycle_on.time = 354.081 ssr_binary.recycle_off.time = 358.552 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True process_simulator.n_cycles_min = 4 ssr_binary_sim_results = process_simulator.simulate(ssr_binary) ssr_binary_sim_results.save(case_dir) from CADETProcess.fractionation import optimize_fractionation ssr_binary_frac = optimize_fractionation( ssr_binary_sim_results.chromatograms,
def simulate_solid_equilibria(binding_model, buffer, unit_model='cstr', flush=None): process_name = flow_sheet_name = 'initial_conditions' component_system = binding_model.component_system # Unit Operations buffer_source = Source(component_system, name='buffer') buffer_source.c = buffer if flush is None: flush = buffer flush_source = Source(component_system, 'flush') flush_source.c = flush if unit_model == 'cstr': unit = Cstr(component_system, 'cstr') unit.porosity = 0.5 unit.V = 1e-6 Q = 1e-6 cycle_time = 1000 * unit.volume / Q unit.flow_rate = Q elif unit_model == 'column': unit = LumpedRateModelWithoutPores(component_system, name='column') unit.length = 0.1 unit.diameter = 0.01 unit.axial_dispersion = 1e-6 unit.total_porosity = 0.7 Q = 60 / (60 * 1e6) cycle_time = 10 * unit.volume / Q try: q = binding_model.n_comp * binding_model.n_states * [0] q[0] = binding_model.capacity unit.q = q except AttributeError: pass unit.binding_model = binding_model outlet = Sink(component_system, name='outlet') # flow sheet fs = FlowSheet(component_system, name=flow_sheet_name) fs.add_unit(buffer_source) fs.add_unit(flush_source) fs.add_unit(unit) fs.add_unit(outlet, chromatogram_sink=True) fs.add_connection(buffer_source, unit) fs.add_connection(flush_source, unit) fs.add_connection(unit, outlet) # Process proc = Process(fs, name=process_name) proc.cycle_time = cycle_time ## Create Events and Durations proc.add_event('buffer_on', 'flow_sheet.buffer.flow_rate', Q) proc.add_event('buffer_off', 'flow_sheet.buffer.flow_rate', 0, 0.9 * cycle_time) proc.add_event('eluent_off', 'flow_sheet.flush.flow_rate', 0.0, 0.0) proc.add_event('eluent_on', 'flow_sheet.flush.flow_rate', Q, 0.9 * cycle_time) # Simulator process_simulator = Cadet() process_simulator.unit_return_parameters.write_solution_bulk = True process_simulator.unit_return_parameters.write_solution_solid = True proc_results = process_simulator.simulate(proc) if unit_model == 'cstr': init_q = proc_results.solution[unit.name].solid.solution[-1, :] elif unit_model == 'column': init_q = proc_results.solution[unit.name].solid.solution[-1, 0, :] return init_q.tolist()
fs = FlowSheet(component_system) fs.add_unit(feed, feed_source=True) fs.add_unit(eluent, eluent_source=True) fs.add_unit(eluent_salt, eluent_source=True) fs.add_unit(column) fs.add_unit(outlet, chromatogram_sink=True) fs.add_connection(feed, column) fs.add_connection(eluent, column) fs.add_connection(eluent_salt, column) fs.add_connection(column, outlet) # Process lwe = Process(fs, 'lwe') lwe.cycle_time = 15000.0 ## Create Events and Durations Q = 2.88e-8 feed_duration = 7500.0 gradient_start = 9500.0 gradient_slope = Q / (lwe.cycle_time - gradient_start) lwe.add_event('feed_on', 'flow_sheet.feed.flow_rate', Q) lwe.add_event('feed_off', 'flow_sheet.feed.flow_rate', 0.0) lwe.add_duration('feed_duration', time=feed_duration) lwe.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) lwe.add_event('eluent_initialization', 'flow_sheet.eluent.flow_rate', 0) lwe.add_event('eluent_salt_initialization', 'flow_sheet.eluent_salt.flow_rate', 0)
## Create Events and Durations Q = 60 / (60 * 1e6) batch_binary.add_event('feed_on', 'flow_sheet.feed.flow_rate', Q) batch_binary.add_event('feed_off', 'flow_sheet.feed.flow_rate', 0.0) batch_binary.add_duration('feed_duration') batch_binary.add_event('eluent_on', 'flow_sheet.eluent.flow_rate', Q) batch_binary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) batch_binary.add_event_dependency('eluent_on', ['feed_off']) batch_binary.add_event_dependency('eluent_off', ['feed_on']) batch_binary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) ## Set process times batch_binary.cycle_time = 176.45 batch_binary.feed_duration.time = 51.95 x = [374.4299005082142, 118.65641374452873] batch_binary.cycle_time = x[0] batch_binary.feed_duration.time = x[1] if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = False process_simulator.n_cycles = 4 batch_binary_sim_results = process_simulator.simulate(batch_binary)
Q = 60 / (60 * 1e6) # Create Events and Durations batch_long_ternary.add_event('feed_on', 'flow_sheet.feed.flow_rate', Q) batch_long_ternary.add_event('feed_off', 'flow_sheet.feed.flow_rate', 0.0) batch_long_ternary.add_duration('feed_duration', 'feed_on', 'feed_off') batch_long_ternary.add_event('eluent_on', 'flow_sheet.eluent.flow_rate', Q) batch_long_ternary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) batch_long_ternary.add_event_dependency('eluent_on', ['feed_off']) batch_long_ternary.add_event_dependency('eluent_off', ['feed_on']) batch_long_ternary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) batch_long_ternary.cycle_time = 135.134 batch_long_ternary.feed_duration.time = 16.268 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True batch_long_ternary_sim_results = process_simulator.simulate( batch_long_ternary) batch_long_ternary_sim_results.save(case_dir) from CADETProcess.fractionation import optimize_fractionation batch_long_ternary_frac = optimize_fractionation( batch_long_ternary_sim_results.chromatograms, batch_long_ternary.process_meta,
ssr_binary.add_event_dependency('eluent_on', ['inject_off']) ssr_binary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) ssr_binary.add_event_dependency('eluent_off', ['inject_on']) ssr_binary.add_event('recycle_on', 'flow_sheet.column.output_state', 0) ssr_binary.add_event('recycle_off', 'flow_sheet.column.output_state', 1) ssr_binary.add_event_dependency('feed_on', ['inject_off']) ssr_binary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) ssr_binary.add_event_dependency( 'inject_off', ['inject_on', 'feed_duration', 'recycle_off', 'recycle_on'], [1, 1, 1, -1]) # Set process times ssr_binary.cycle_time = 600 ssr_binary.feed_duration.time = 60 ssr_binary.recycle_on.time = 360 ssr_binary.recycle_off.time = 420 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True x_min = 0 ssr_binary_sim_results = process_simulator.simulate(ssr_binary) ssr_binary_sim_results.save(start=x_min, case_dir=case_dir) from CADETProcess.fractionation import optimize_fractionation ssr_binary_frac = optimize_fractionation(
ssr_binary.add_event_dependency('eluent_on', ['inject_off']) ssr_binary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) ssr_binary.add_event_dependency('eluent_off', ['inject_on']) ssr_binary.add_event('recycle_on', 'flow_sheet.column.output_state', 0) ssr_binary.add_event('recycle_off', 'flow_sheet.column.output_state', 1) ssr_binary.add_event_dependency('feed_on', ['inject_off']) ssr_binary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) ssr_binary.add_event_dependency( 'inject_off', ['inject_on', 'feed_duration', 'recycle_off', 'recycle_on'], [1, 1, 1, -1]) # Set process times ssr_binary.cycle_time = 195.472 ssr_binary.feed_duration.time = 36.136 ssr_binary.recycle_on.time = 360.395 ssr_binary.recycle_off.time = 366.771 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True ssr_binary_sim_results = process_simulator.simulate(ssr_binary) ssr_binary_sim_results.save(case_dir) from CADETProcess.fractionation import optimize_fractionation ssr_binary_frac = optimize_fractionation( ssr_binary_sim_results.chromatograms,
Q = 60/(60*1e6) # Create Events and Durations batch_long_ternary.add_event('feed_on', 'flow_sheet.feed.flow_rate', Q) batch_long_ternary.add_event('feed_off', 'flow_sheet.feed.flow_rate', 0.0) batch_long_ternary.add_duration('feed_duration', 'feed_on', 'feed_off') batch_long_ternary.add_event('eluent_on', 'flow_sheet.eluent.flow_rate', Q) batch_long_ternary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) batch_long_ternary.add_event_dependency('eluent_on', ['feed_off']) batch_long_ternary.add_event_dependency('eluent_off', ['feed_on']) batch_long_ternary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1,1]) batch_long_ternary.cycle_time = 113.48 batch_long_ternary.feed_duration.time = 31.668 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True batch_long_ternary_sim_results = process_simulator.simulate(batch_long_ternary) batch_long_ternary_sim_results.save(case_dir) from CADETProcess.fractionation import optimize_fractionation batch_long_ternary_frac = optimize_fractionation( batch_long_ternary_sim_results.chromatograms, batch_long_ternary.process_meta,
ssr_binary.add_event_dependency('eluent_on', ['inject_off']) ssr_binary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) ssr_binary.add_event_dependency('eluent_off', ['inject_on']) ssr_binary.add_event('recycle_on', 'flow_sheet.column.output_state', 0) ssr_binary.add_event('recycle_off', 'flow_sheet.column.output_state', 1) ssr_binary.add_event_dependency('feed_on', ['inject_off']) ssr_binary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) ssr_binary.add_event_dependency( 'inject_off', ['inject_on', 'feed_duration', 'recycle_off', 'recycle_on'], [1, 1, 1, -1]) # Set process times ssr_binary.cycle_time = 182.236 ssr_binary.feed_duration.time = 56.904 ssr_binary.recycle_on.time = 359.39 ssr_binary.recycle_off.time = 361.313 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True ssr_binary_sim_results = process_simulator.simulate(ssr_binary) ssr_binary_sim_results.save(case_dir) from CADETProcess.fractionation import optimize_fractionation ssr_binary_frac = optimize_fractionation( ssr_binary_sim_results.chromatograms,
Q = 60 / (60 * 1e6) # Create Events and Durations batch_ternary.add_event('feed_on', 'flow_sheet.feed.flow_rate', Q) batch_ternary.add_event('feed_off', 'flow_sheet.feed.flow_rate', 0.0) batch_ternary.add_duration('feed_duration', 'feed_on', 'feed_off') batch_ternary.add_event('eluent_on', 'flow_sheet.eluent.flow_rate', Q) batch_ternary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) batch_ternary.add_event_dependency('eluent_on', ['feed_off']) batch_ternary.add_event_dependency('eluent_off', ['feed_on']) batch_ternary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) batch_ternary.cycle_time = 600 batch_ternary.feed_duration.time = 60 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.n_cycles = 1 batch_ternary_sim_results = process_simulator.simulate(batch_ternary) from CADETProcess.fractionation import optimize_fractionation batch_ternary_frac = optimize_fractionation( batch_ternary_sim_results.chromatograms, batch_ternary.process_meta, purity_required=0.95) batch_ternary_frac.save(case_dir, start=2.5)
# Create Events and Durations batch_binary.add_event('feed_on', 'flow_sheet.feed.flow_rate', Q) batch_binary.add_event('feed_off', 'flow_sheet.feed.flow_rate', 0.0) batch_binary.add_duration('feed_duration', 'feed_on', 'feed_off') batch_binary.add_event('eluent_on', 'flow_sheet.eluent.flow_rate', Q) batch_binary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) batch_binary.add_event_dependency('eluent_on', ['feed_off']) batch_binary.add_event_dependency('eluent_off', ['feed_on']) batch_binary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) # Set process times batch_binary.cycle_time = 192.163 batch_binary.feed_duration.time = 46.463 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True batch_binary_sim_results = process_simulator.simulate(batch_binary) batch_binary_sim_results.save(case_dir) from CADETProcess.fractionation import optimize_fractionation batch_binary_frac = optimize_fractionation( batch_binary_sim_results.chromatograms, batch_binary.process_meta, purity_required=0.95)
Q = 60/(60*1e6) # Create Events and Durations batch_long_ternary.add_event('feed_on', 'flow_sheet.feed.flow_rate', Q) batch_long_ternary.add_event('feed_off', 'flow_sheet.feed.flow_rate', 0.0) batch_long_ternary.add_duration('feed_duration', 'feed_on', 'feed_off') batch_long_ternary.add_event('eluent_on', 'flow_sheet.eluent.flow_rate', Q) batch_long_ternary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) batch_long_ternary.add_event_dependency('eluent_on', ['feed_off']) batch_long_ternary.add_event_dependency('eluent_off', ['feed_on']) batch_long_ternary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1,1]) batch_long_ternary.cycle_time = 449.176 batch_long_ternary.feed_duration.time = 66.753 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True batch_long_ternary_sim_results = process_simulator.simulate(batch_long_ternary) batch_long_ternary_sim_results.save(case_dir) from CADETProcess.fractionation import optimize_fractionation batch_long_ternary_frac = optimize_fractionation( batch_long_ternary_sim_results.chromatograms, batch_long_ternary.process_meta,
ssr_binary.add_event_dependency('eluent_on', ['inject_off']) ssr_binary.add_event('eluent_off', 'flow_sheet.eluent.flow_rate', 0.0) ssr_binary.add_event_dependency('eluent_off', ['inject_on']) ssr_binary.add_event('recycle_on', 'flow_sheet.column.output_state', 0) ssr_binary.add_event('recycle_off', 'flow_sheet.column.output_state', 1) ssr_binary.add_event_dependency('feed_on', ['inject_off']) ssr_binary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) ssr_binary.add_event_dependency( 'inject_off', ['inject_on', 'feed_duration', 'recycle_off', 'recycle_on'], [1, 1, 1, -1]) # Set process times ssr_binary.cycle_time = 404.967 ssr_binary.feed_duration.time = 48.131 ssr_binary.recycle_on.time = 355.32 ssr_binary.recycle_off.time = 575.315 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True ssr_binary_sim_results = process_simulator.simulate(ssr_binary) ssr_binary_sim_results.save(case_dir) from CADETProcess.fractionation import optimize_fractionation ssr_binary_frac = optimize_fractionation( ssr_binary_sim_results.chromatograms,
serial_ternary.add_event_dependency('eluent_1_on', ['feed_off'], [1]) serial_ternary.add_event_dependency('eluent_1_off', ['feed_on'], [1]) serial_ternary.add_event_dependency('feed_off', ['feed_on', 'feed_duration'], [1, 1]) serial_ternary.add_event('serial_on', 'flow_sheet.column_1.output_state', 1) serial_ternary.add_event('serial_off', 'flow_sheet.column_1.output_state', 0) serial_ternary.add_event('eluent_2_on', 'flow_sheet.eluent_2.flow_rate', Q) serial_ternary.add_event('eluent_2_off', 'flow_sheet.eluent_2.flow_rate', 0.0) serial_ternary.add_event_dependency('eluent_2_on', ['serial_off'], [1]) serial_ternary.add_event_dependency('eluent_2_off', ['serial_on'], [1]) # Set process times serial_ternary.cycle_time = 210.121 serial_ternary.feed_duration.time = 45.859 serial_ternary.serial_on.time = 119.017 serial_ternary.serial_off.time = 47.634 if __name__ == '__main__': from CADETProcess.simulation import Cadet process_simulator = Cadet() process_simulator.evaluate_stationarity = True serial_ternary_sim_results = process_simulator.simulate(serial_ternary) serial_ternary_sim_results.save(case_dir) from CADETProcess.fractionation import optimize_fractionation serial_ternary_frac = optimize_fractionation( serial_ternary_sim_results.chromatograms,