Simulation comparison with offline fraction analytic

Hi CADET Devs,

I noticed the fractionation function is limited to n_comp + 1. This might be useful for the optimization of species separations and yield, but excludes further some applications. For model calibration offline analytical methods are sometimes used to analyze fractions of the whole chromatogram for their content. So you end up with averaged datapoints for each taken fraction over the whole chromatogram, many more than defined components.
It would be great to first being able to simulate those fractions and then calibrating model parameters with the comparison function based on that. I tried tweaking the fractionation function, but the n_comp+1 limitation is abundandly used in the code.

Is there another function intended for this application?

Many thanks!

Hi,

can you please give an example for what you need? Generally, you can add as many fractions as you like in CADET-Process; it’s just that each fraction is then pooled in a target fraction for each component (plus waste). For more information, see here.

Hi,

ok I understand, I can add as many events I want, but the target fraction pools are limited. Can only those be evaluated for the performance parameters?

Example:
Let’s say I have the start and end times of my fractions and I create fractions events from that. Then I want to evaluate eg. the concentration for those fractions with the simulation data. And subsequently compare it to my offline analytical results.

FracData = pd.DataFrame({
    'FracNames': ['Waste', 'A1', 'A2', 'A3', 'Waste],
    'FracStart': [0, 60, 100, 140, 180], # time-based fractionation events
    })

data = FracDataFrame
for i, row in data.iterrows():
    fractionator.add_fractionation_event(row[0], i, row[1]) # i is limited depending on n_comp

Ok, then maybe the Fractionator isn’t the right tool for you. What you could to instead, is to create Fractions from the solution object. It’s still a bit clunky but it would work something like this:

start = 1
end = 2

from CADETProcess.fractionation import Fraction
mass = solution.fraction_mass(start, end)
volume = solution.fraction_volume(start, end)

fraction = Fraction(mass, volume)

print(
    fraction.mass,
    fraction.volume,
    fraction.concentration,
    fraction.purity,
)

In a future release, this could look something like

fraction = solution.create_fraction(start, end)

In case you’re only interested in the concentration of some components, see also this post.

CADET-Match already provides some functionality to compare simulation data with experimental fractionation data.

  • FractionationSSE directly calculates the sum squared error (SSE).
  • FractionationSlide additionally performs a small optimization step which “slides” the fractionation data against the simulation data, determining the offset at which the SSE is minimal for these fractions. This can help in parameter estimation.

At least that’s how I undersood it. Maybe @w.heymann can comment on this.

This functionality is currently not yet available in CADET-Process but @s.leweke was also interested so this is definitely moving up in our priority list. To track progress, check this issue.

We have a first draft for the FractionationSSE Metric here: #86

Note that you’ll need to use a special FractionationReference.
Here’s some example code (with generic numbers):


from CADETProcess.fractionation import Fraction
from CADETProcess.reference import FractionationReference
from CADETProcess.comparison import FractionationSSE
fraction_1 = Fraction(
    start=15,
    end=30,
    mass=[0.5, 0.1],
    volume=1e-6,
)
fraction_2 = Fraction(
    start=30,
    end=45,
    mass=[0.1, 0.5],
    volume=1e-6,
)

component_system = ComponentSystem(['A', 'B'])
reference = FractionationReference(
    'fractions', [fraction_1, fraction_2],
    component_system=component_system
)

The rest should work just as with other metrics.

1 Like

Hi Jo,

thank you for the implementation of this feature!
I integrated it into my script and ran a quick optimization.
So far it looks good :ok_hand::grinning:

I will use/ test it more thoroughly in the upcoming days and will let you know if I encounter any bugs.

I guess you did not touch the plotting function for this comparison, yet. There it would be nice to have a sort of bar plot to visualize the widths of the fractions as well.

2 Likes