creating Custom calculation

I'm looking for some guidance. I'm brand new to OpenLab CDS 2.5 and have been trying to learn how to create a custom calculation to tie to an established process method. I need my reports to reflect, in percentage, the total concentration of compounds in our product samples.

 

The calculations are:

Total CBD = (0.877*CBDA) + CBD

Total THC = [(0.877*THCA) + (D9THC + D8THC)]

Total cannabinoids = (sum amount of all the canna compounds combined.

 

Any help would be greatly appreciated! 

Parents
  • Hello,

     

    Here are some example CCs to get you started with your method. These all have the scope of injection so you get one value per injection for each CC. You might need to change the compound names depending on how they are named in your method. Also the last one Total Cannabinoids sums all identified peaks in the injection. If this is not what you need the CC could be altered but you could also just use a named group in DA. The named group would be easier to use to select specific peaks out of your identification table. 

     

    Total CBD

    (0.877 * CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "CBDA").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Max) + CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "CBD").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Max

    Total THC

    (0.877 * CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "THCA").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Sum) + (CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "D9THC").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Sum + CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "D8THC").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Sum)

    Total Cannabinoids

    CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Sum

     

     

     

Reply
  • Hello,

     

    Here are some example CCs to get you started with your method. These all have the scope of injection so you get one value per injection for each CC. You might need to change the compound names depending on how they are named in your method. Also the last one Total Cannabinoids sums all identified peaks in the injection. If this is not what you need the CC could be altered but you could also just use a named group in DA. The named group would be easier to use to select specific peaks out of your identification table. 

     

    Total CBD

    (0.877 * CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "CBDA").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Max) + CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "CBD").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Max

    Total THC

    (0.877 * CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "THCA").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Sum) + (CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "D9THC").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Sum + CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Name.ToUpper() = "D8THC").Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Sum)

    Total Cannabinoids

    CurrentInjection.AllIdentifiedPeaks.Where(function (x) x.Compound_Concentration > 0 ).Select(function(x) x.Compound_Concentration).Sum

     

     

     

Children
  • I am looking to do something very similar and I have tried using these calculations, but they are not quite working for me.

    I am running 6 replicate injections for my sample. I run them as one sequence. In my sequence report, I want to create the following table (using my custom calculation fields):

     

    Compound Summary

    Compound

    Compound Concentration Ave. (%)

    CBDA

    CBD

    THCA

    D9THC

    Total Potential CBD

    =0.877*CBDA(%) + CBD

    Total Potential THC

    =0.877*THCA(%) + D9THC

    Ratio Total Potential CBD/THC

    Total CBD / total THC

    I want to use the Average compound Concentrations from the six injections in my sequence, so I am assuming I would need to modify the scope for "Sequence" and not "Injections"?

    Any assistance will be greatly appreciated.

Was this helpful?