Excluding components from the Fractionator

Hi,

I’m currently checking out the capabilities of the Fractionator object within CADET-Process.

Is it possible to exclude components from the analysis? I’m working with a model where the first component is H+, but it does not really make much sense to include that component in the fraction analysis. My flow sheet includes an Outlet with the ComponentSystem that includes H+. Could a solution be to add another Outlet that excludes the H+ component, i.e. with a new ComponentSystem? Or is there a simpler solution to this problem?

Best regards
Kristian

Hey,
assuming you’re on dev branch, you can simply exclude components using the optimize_fractionation method.

from CADETProcess.fractionation import FractionationOptimizer
fractionation_optimizer = FractionationOptimizer()
fractionator = fractionation_optimizer.optimize_fractionation(
    simulation_results,
    components=['A', 'B', 'C'],
    purity_required=[0.95, 0.95, 0.95]
)
print(fractionator.performance)
_ = fractionator.plot_fraction_signal()

Here, you just specify the components you are interested in.

If you don’t directly use the optimizer, you can also use the slice_solution method directly to modify the final solution.

from CADETProcess.solution import slice_solution

solution_new = slice_solution(solution_original, components=['A', 'B'],...)

Hi Johannes,

Oh I see, this solution works for me. Thanks for a lot for the support.

I do however still get some kind of weird result in the fractionator.performance object. I’m getting a suspicious runtime warning:

“RuntimeWarning: divide by zero encountered in true_divide return self.mass / self.process.V_eluent”

It could indicate that self.process.V_eluent is in fact equal to 0. Do you have an idea why this is so? Following your documentation I added a “flow_sheet.add_eluent_inlet(‘elution’)” where ‘elution’ is an Inlet. I was guessing that the V_eluent should be available from this Inlet? The recovery also seem to be off at a very high value!

Would you mind sharing the scripts?

Hi Johannes,

I just tried to modify the solution as you describe here using the following code:

results = process_simulator.simulate(procss)
results_new = slice_solution(results.solution.column.outlet, components=['A', 'B', 'C'])
fractionator = Fractionator(results_new)
fractionator.add_fractionation_event('start_A', 0, opt_frac_times[0]*60, 'outlet')
fractionator.add_fractionation_event('end_A', -1, opt_frac_times[1]*60)
fractionator.performance.recovery

However, it seems that the Fractionator only accepts results of type “SimulationResults”. I’m guessing that slice solution will modify the type of the results object?

Hi Kristian,

the problem here is that Solution != SimulationResults.

  • The Solution is a wrapper around the np.array that represents the solution of a unit (e.g. at the unit inlet or outlet).
  • The SimulationResults contains all solution objects plus some meta data.

Good thing is that you can simply add the components flag to the __init__ of the Fractionator.

results = process_simulator.simulate(process)
fractionator = Fractionator(components=['A', 'B', 'C'])

Does this solve your problem?

By the way, for readability, please format code blocks with backticks (```)

e.g.

```
print(‘hello’)
```

will be rendered as:

print('hello')

Ok right, that works. Thanks for the excellent support as well as the tip with backticks :slight_smile:

1 Like