def uf_df(uo: dict): d = uo['data'] n_tanks = d['n tanks []'] rt = d['residence time [min]'] volume_reduction = d['volume reduction []'] t_switch = d['switch time [min]'] efficiency = d['efficiency []'] concentration = fc_uo.Concentration( t, flow_reduction=volume_reduction, uo_id=f"{uo['id']}_concentration") buffer_exchange = fc_uo.BufferExchange( t, exchange_ratio=efficiency, uo_id=f"{uo['id']}_buffer_exchange") flow_through = fc_uo.FlowThroughWithSwitching( t, pdf=pdf.TanksInSeries(t, n_tanks), uo_id=f"{uo['id']}_rtd") flow_through.rt_target = rt flow_through.t_cycle = t_switch uo['uo_class'] = special_uo.ComboUO uo['parameters'] = { "uo_id": uo['id'], "sub_uo_list": [concentration, buffer_exchange, flow_through], "gui_title": uo['title'], } uo['attributes'] = {}
def test_init(self): # assert proper exchange_ratio ( 1 >= exchange_ratio > 0) with self.assertRaises(AssertionError): fc_uo.BufferExchange(self.t, 0, self.uo_id) with self.assertRaises(AssertionError): fc_uo.BufferExchange(self.t, 1.01, self.uo_id) fc_uo.BufferExchange(self.t, 1.0, self.uo_id) # assert bindings np.testing.assert_array_equal(self.t, self.uo._t) self.assertEqual(self.exchange_ratio, self.uo.exchange_ratio) self.assertEqual(self.uo_id, self.uo.uo_id) self.assertEqual(self.gui_title, self.uo.gui_title) # assert default values self.assertTrue(self.uo.c_exchange_buffer.size == 0) self.assertEqual([], self.uo.non_retained_species) self.assertEqual(0, self.uo.relative_losses)
def setUp(self) -> None: self.t = np.linspace(0, 100, 230) self.exchange_ratio = 0.95 self.uo_id = "buffer_exchange" self.gui_title = "Buffer Exchange Step" self.uo = fc_uo.BufferExchange( self.t, self.exchange_ratio, self.uo_id, self.gui_title ) self.uo.log = TestLogger()
from bio_rtd.uo import fc_uo, special_uo # Time step (`dt`) simulation time (`t`). t = np.linspace(0, 100, 1000) dt = t[1] # ## CREATING INSTANCE ## # Concentration. conc = fc_uo.Concentration(t, flow_reduction=10, uo_id="concentration_sub_step") conc.relative_losses = 0.10 # 10 % losses # BufferExchange buffer_exchange = fc_uo.BufferExchange(t, exchange_ratio=0.95, uo_id="buffer_exchange_sub_step") # FlowThrough flow_through = fc_uo.FlowThrough( t, # Peak shape description (result of a pulse injection experiment) pdf=pdf.GaussianFixedRelativeWidth(t, relative_sigma=0.2), uo_id="rtd_sub_step") # Peak position ( = first momentum of a peak at pulse injection experiment) flow_through.rt_target = 5 # min # UFDF uf_df = special_uo.ComboUO(t, sub_uo_list=[conc, buffer_exchange, flow_through], uo_id="uf_df", gui_title="UfDf step")
# AEX polishing step, FlowThroughWithSwitching. ft_aex = fc_uo.FlowThroughWithSwitching( t, pdf=pdf.GaussianFixedDispersion(t, dispersion_index=2**2 / 8), uo_id="aex_ft", gui_title="Polishing, AEX, flow-through") ft_aex.v_void = 10 # mL ft_aex.v_cycle = 50 * 10 # mL; switch column unit after 20 L # UFDF # Concentration. conc = fc_uo.Concentration(t, flow_reduction=40, uo_id="uf_df_conc") # BufferExchange buffer_exchange = fc_uo.BufferExchange(t, exchange_ratio=0.995, uo_id="uf_df_buffer_exchange") # FlowThrough flow_through = fc_uo.FlowThrough(t, pdf=pdf.TanksInSeries(t, n_tanks=3), uo_id="uf_df_rtd") flow_through.v_void = 0.5 * 3 # mL uf_df = special_uo.ComboUO(t, sub_uo_list=[conc, buffer_exchange, flow_through], uo_id="uf_df", gui_title="UFDF") # DSP train dsp_train = [ft_cell_removal, pcc_pro_a, st_cstr, ft_vi, ft_aex, uf_df] """Inlet."""