Hi there,
I am currently running an optimisation using the multi-state SMA and had a quick question with regards to indexing Keq values. In my binding model I have 2 states for 2 species as follows:
component_system = ComponentSystem()
component_system.add_component('Salt')
component_system.add_component('A')
component_system.add_component('B')
binding_model = MultistateStericMassAction(component_system, bound_states=[1, 2, 2]
binding_model.adsorption_rate = [0.0, 25, 0.0, 190, 0.0]
binding_model.desorption_rate = [0.0, 50, 0.0, 142, 0.0]
I’m assuming if I want to define a Keq for population 2 bound state 1, i.e. index 3 in ka and kd = 190/142, then my optimization variable becomes index 3 too, as follows:
optimization_problem.add_variable(
name='equilibrium_constant_B',
evaluation_objects=None,
lb=1e-4, ub=1e4,
transform='auto',
indices=[3])
I was just a little unsure whether the default was component indexing in which case it would become [2]?
Thanks
Hey,
I think the kEq doesn’t need an index, because it’s never explicitly set anywhere (because it has evaluation_objects=None
). It’s only used to calculate the dependent variables (kA and/or kD), which need the index.
Thanks Ron,
So does the index refer to the index of ka and kd that will be used in in calculating keq? if so I assume [3] is correct?
Hey,
here’s an example configuration:
optimization_problem.add_variable(
name='adsorption_rate_B',
parameter_path='flow_sheet.column.binding_model.adsorption_rate',
lb=1e-3, ub=1e3,
transform='auto',
indices=[3] # needs an index
)
optimization_problem.add_variable(
name='desorption_rate_B',
parameter_path='flow_sheet.column.binding_model.desorption_rate',
lb=1e-3, ub=1e3,
transform='auto',
indices=[3] # needs an index
)
optimization_problem.add_variable(
name='equilibrium_constant_B',
evaluation_objects=None, # doesn't need an index
lb=1e-4, ub=1e3,
transform='auto'
)
optimization_problem.add_variable_dependency(
dependent_variable="adsorption_rate_B",
independent_variables=["desorption_rate_B", "equilibrium_constant_B"],
transform=lambda k_d, k_eq: k_eq * k_d
)
Does that clear up the question?
2 Likes