Exemplo n.º 1
0
        public uint CombinedCalculation(out Isotopics newIsotopics, bool INCCParity, NCCReporter.LMLoggers.LognLM logger)
        {
            MassSum = 0;
            uint res = 0;

            newIsotopics = null;
            foreach (CompositeIsotopic ci in isotopicComponents)
            {
                if (ci.pu_mass == 0.0f)
                {
                    continue;
                }
                res = ci.CalculateDecayAndMass(ref_date, INCCParity, logger);
                if (res != 0)
                {
                    break;
                }
            }
            if (res != 0)
            {
                return(res);
            }
            MassSum = CalculateMassSums();
            if (MassSum <= 0)
            {
                logger.TraceEvent(NCCReporter.LogLevels.Error, 36784, "Sum of masses = 0.");
                res = 36784;
            }
            else
            {
                newIsotopics = CreateIsotopicsFromSums(ref_date, INCCParity, MassSum);
            }
            return(res);
        }
Exemplo n.º 2
0
 public void Copy(Isotopics src, float mass)
 {
     pu_date  = new DateTime(src.pu_date.Ticks);
     am_date  = new DateTime(src.am_date.Ticks);
     isotopes = Isotopics.CopyArray(src.isotopes);
     pu_mass  = mass;
 }
Exemplo n.º 3
0
 public void Copy(CompositeIsotopic src)
 {
     pu_date  = new DateTime(src.pu_date.Ticks);
     am_date  = new DateTime(src.am_date.Ticks);
     isotopes = Isotopics.CopyArray(src.isotopes);
     pu_mass  = src.pu_mass;
 }
Exemplo n.º 4
0
 public void InitVals()
 {
     pu_date  = new DateTime(2010, 1, 1);
     am_date  = new DateTime(2010, 1, 1);
     isotopes = Isotopics.MakeArray();
     isotopes[(int)Isotope.pu240].v = 100.0;
     pu_mass = 1;
 }
Exemplo n.º 5
0
 public void CopyTo(CompositeIsotopic dest)
 {
     dest.pu_date  = new DateTime(pu_date.Ticks);
     dest.am_date  = new DateTime(am_date.Ticks);
     dest.isotopes = Isotopics.CopyArray(isotopes);
     dest.modified = true;
     dest.pu_mass  = pu_mass;
 }
Exemplo n.º 6
0
 public void Copy(Isotopics src, float mass)
 {
     pu_date     = new DateTime(src.pu_date.Ticks);
     am_date     = new DateTime(src.am_date.Ticks);
     isotopes    = Isotopics.CopyArray(src.isotopes);
     id          = string.Copy(src.id);
     source_code = src.source_code;
     pu_mass     = mass;
 }
Exemplo n.º 7
0
 public static AnalysisDefs.Isotopics GetAcquireIsotopics(AcquireParameters acq)
 {
     AnalysisDefs.Isotopics iso = CentralizedState.App.DB.Isotopics.GetList().
                                  Find(i => string.Compare(i.id, acq.isotopics_id, true) == 0);
     if (iso == null)
     {
         iso = CentralizedState.App.DB.Isotopics.GetDefault();
     }
     return(iso);
 }
Exemplo n.º 8
0
 public void Copy(CompositeIsotopics src)
 {
     pu_date            = new DateTime(src.pu_date.Ticks);
     am_date            = new DateTime(src.am_date.Ticks);
     ref_date           = new DateTime(src.ref_date.Ticks);
     isotopes           = Isotopics.CopyArray(src.isotopes);
     id                 = string.Copy(src.id);
     source_code        = src.source_code;
     pu_mass            = src.pu_mass;
     isotopicComponents = new List <CompositeIsotopic>(src.isotopicComponents);
 }
Exemplo n.º 9
0
 public void CopyTo(CompositeIsotopics dest)
 {
     dest.pu_date            = new DateTime(pu_date.Ticks);
     dest.am_date            = new DateTime(am_date.Ticks);
     dest.ref_date           = new DateTime(ref_date.Ticks);
     dest.isotopes           = Isotopics.CopyArray(isotopes);
     dest.id                 = string.Copy(id);
     dest.source_code        = source_code;
     dest.modified           = true;
     dest.pu_mass            = pu_mass;
     dest.isotopicComponents = new List <CompositeIsotopic>(isotopicComponents);
 }
Exemplo n.º 10
0
 public void InitVals()
 {
     pu_date  = new DateTime(2010, 1, 1);
     am_date  = new DateTime(2010, 1, 1);
     ref_date = new DateTime(2010, 1, 1);
     isotopes = Isotopics.MakeArray();
     isotopes[(int)Isotope.pu240].v = 100.0;
     isotopicComponents             = new List <CompositeIsotopic>();
     id          = "Default";
     source_code = Isotopics.SourceCode.OD;
     pu_mass     = 1;
 }
Exemplo n.º 11
0
        public Isotopics CreateIsotopicsFromSums(DateTime ref_date, bool INCCParity, double mass_sum)
        {
            Isotopics isor = new Isotopics();

            isor.pu_date     = new DateTime(ref_date.Ticks);
            isor.am_date     = new DateTime(ref_date.Ticks);
            isor.source_code = source_code;
            isor.id          = string.Copy(id);
            for (Isotope iso = Isotope.pu238; iso <= Isotope.am241; iso++)
            {
                isor.SetVal(iso, 100.0 * currentMassSum[(int)iso].v / mass_sum);
            }
            return(isor);
        }
Exemplo n.º 12
0
 public CompositeIsotopic(CompositeIsotopic iso)
 {
     if (iso == null)
     {
         InitVals();
     }
     else
     {
         pu_date  = new DateTime(iso.pu_date.Ticks);
         am_date  = new DateTime(iso.am_date.Ticks);
         isotopes = Isotopics.CopyArray(iso.isotopes);
         pu_mass  = iso.pu_mass;
     }
 }
Exemplo n.º 13
0
 public CompositeIsotopics(CompositeIsotopics iso)
 {
     if (iso == null)
     {
         InitVals();
     }
     else
     {
         pu_date            = new DateTime(iso.pu_date.Ticks);
         am_date            = new DateTime(iso.am_date.Ticks);
         ref_date           = new DateTime(iso.ref_date.Ticks);
         isotopes           = Isotopics.CopyArray(iso.isotopes);
         id                 = string.Copy(iso.id);
         source_code        = iso.source_code;
         pu_mass            = iso.pu_mass;
         isotopicComponents = new List <CompositeIsotopic>(iso.isotopicComponents);
     }
 }
Exemplo n.º 14
0
        public uint CalculateDecayAndMass(DateTime ref_date, bool INCCParity, NCCReporter.LMLoggers.LognLM logger)
        {
            double ref_days;
            double pu_days;
            double am_days;

            Tuple[] iso_mass              = Isotopics.MakeArray();
            Tuple[] decay_fract_pu_to_am  = Isotopics.MakeArray();
            Tuple[] decay_fract_am_to_now = Isotopics.MakeArray();
            Tuple[] decay_fract_pu_to_now = Isotopics.MakeArray();

            double temp     = 0.0;
            double temp_sum = 0.0;
            double pumass   = pu_mass;

            double isosum = 0.0;

            for (Isotope iso = Isotope.pu238; iso <= Isotope.pu242; iso++)
            {
                isosum += isotopes[(int)iso].v;
            }

            if (isosum <= 0.0)
            {
                logger.TraceEvent(NCCReporter.LogLevels.Warning, 36783, "Unable to update isotopics, sum of Pu isotopes must be greater than zero");
                return(36783);
            }
            Tuple[] newiso = Isotopics.MakeArray();
            if (INCCParity)
            {
                pu_days  = (pu_date.Date.Subtract(Isotopics.ZeroIAEATime)).TotalDays;
                am_days  = (am_date.Date.Subtract(Isotopics.ZeroIAEATime)).TotalDays;
                ref_days = (long)(ref_date.Date.Subtract(Isotopics.ZeroIAEATime)).TotalDays;
            }
            else
            {
                pu_days  = (pu_date.Subtract(Isotopics.ZeroIAEATime)).TotalDays;
                am_days  = (am_date.Subtract(Isotopics.ZeroIAEATime)).TotalDays;
                ref_days = (long)(ref_date.Subtract(Isotopics.ZeroIAEATime)).TotalDays;
            }

            for (Isotope iso = Isotope.pu238; iso <= Isotope.pu242; iso++)
            {
                iso_mass[(int)iso].v              = (isotopes[(int)iso].v * pumass / 100.0);
                decay_fract_pu_to_am[(int)iso].v  = Math.Exp((-Isotopics.LN2 / Isotopics.Halflives[(int)iso]) * (am_days - pu_days));
                decay_fract_pu_to_now[(int)iso].v = Math.Exp((-Isotopics.LN2 / Isotopics.Halflives[(int)iso]) * (ref_days - pu_days));
            }
            decay_fract_am_to_now[(int)Isotope.pu241].v = Math.Exp((-Isotopics.LN2 / Isotopics.Halflives[(int)Isotope.pu241]) * (ref_days - am_days));
            decay_fract_am_to_now[(int)Isotope.am241].v = Math.Exp((-Isotopics.LN2 / Isotopics.Halflives[(int)Isotope.am241]) * (ref_days - am_days));

            for (Isotope iso = Isotope.pu238; iso <= Isotope.pu242; iso++)
            {
                CurrentMass[(int)iso].v = iso_mass[(int)iso].v * decay_fract_pu_to_now[(int)iso].v;
            }
            CurrentMass[(int)Isotope.am241].v = decay_fract_am_to_now[(int)Isotope.am241].v * isotopes[(int)Isotope.am241].v / 100.0;

            for (Isotope iso = Isotope.pu238; iso <= Isotope.pu242; iso++)
            {
                temp_sum += (decay_fract_pu_to_am[(int)iso].v * iso_mass[(int)iso].v);
            }

            temp = decay_fract_pu_to_am[(int)Isotope.pu241].v * iso_mass[(int)Isotope.pu241].v *
                   (decay_fract_am_to_now[(int)Isotope.am241].v - decay_fract_am_to_now[(int)Isotope.pu241].v)
                   * (Isotopics.LN2 / Isotopics.Halflives[(int)Isotope.pu241]) / ((Isotopics.LN2 / Isotopics.Halflives[(int)Isotope.pu241]) - (Isotopics.LN2 / Isotopics.Halflives[(int)Isotope.am241]));
            CurrentMass[(int)Isotope.am241].v = (CurrentMass[(int)Isotope.am241].v * temp_sum) + temp;
            return(0);
        }
Exemplo n.º 15
0
        public static Measurement BuildMeasurementTemp(AcquireParameters acq, Detector det, AssaySelector.MeasurementOption mo, TestParameters tp, BackgroundParameters bkg, NormParameters np, AnalysisDefs.Isotopics iso, HVCalibrationParameters hvp)
        {
            // gather it all together
            MeasurementTuple mt = new MeasurementTuple(new DetectorList(det),
                                                       tp,
                                                       np,
                                                       bkg,
                                                       iso,
                                                       acq,
                                                       hvp);

            det.Id.source = acq.data_src;  // set the detector overall data source value here

            // create the context holder for the measurement. Everything is rooted here ...
            Measurement meas = new Measurement(mt, mo);

            FillInMeasurementDetails(meas);
            // ready for insertion of methods and processing start
            return(meas);
        }
Exemplo n.º 16
0
        protected Section ConstructReportSection(INCCReportSection section, Detector det, MeasOptionSelector moskey = null)
        {
            INCCStyleSection sec = null;

            try
            {
                switch (section)
                {
                case INCCReportSection.Header:
                    sec = new INCCStyleSection(null, 1);
                    sec.AddHeader(N.App.Name + " " + N.App.Config.VersionString);      // section header
                    break;

                case INCCReportSection.Context:
                    sec = new INCCStyleSection(null, 1);
                    ConstructContextContent(sec, det);
                    break;

                case INCCReportSection.Isotopics:
                    if (AssaySelector.ForMass(meas.MeasOption))
                    {
                        sec = new INCCStyleSection(null, 1);
                        sec.SetFPCurrentFormatPrecision(4);
                        Isotopics curiso = Isotopics.update_isotopics(1.0, meas.MeasDate, meas.Isotopics, meas.logger, N.App.AppContext.INCCParity);
                        if (curiso == null)
                        {
                            curiso = new Isotopics();
                            meas.Isotopics.CopyTo(curiso);
                            ctrllog.TraceEvent(LogLevels.Warning, 82034, "Using incorrect updated defaults for " + meas.Isotopics.id);
                        }
                        sec.AddTwo("Isotopics id:", meas.Isotopics.id);
                        sec.AddTwo("Isotopics source code:", meas.Isotopics.source_code.ToString());
                        sec.AddDualNumericRow("Pu238:", meas.Isotopics[Isotope.pu238], curiso[Isotope.pu238]);
                        sec.AddDualNumericRow("Pu239:", meas.Isotopics[Isotope.pu239], curiso[Isotope.pu239]);
                        sec.AddDualNumericRow("Pu240:", meas.Isotopics[Isotope.pu240], curiso[Isotope.pu240]);
                        sec.AddDualNumericRow("Pu241:", meas.Isotopics[Isotope.pu241], curiso[Isotope.pu241]);
                        sec.AddDualNumericRow("Pu242:", meas.Isotopics[Isotope.pu242], curiso[Isotope.pu242]);
                        sec.AddDualDateOnlyRow("Pu date:", meas.Isotopics.pu_date, curiso.pu_date);
                        sec.AddDualNumericRow("Am241:", meas.Isotopics[Isotope.am241], curiso[Isotope.am241]);
                        sec.AddDualDateOnlyRow("Am date:", meas.Isotopics.am_date, curiso.am_date);
                        // dev note: here is where the alternative K vals are added in the Euratom version
                    }
                    break;

                case INCCReportSection.ShiftRegister:
                    sec = new INCCStyleSection(null, 1);
                    ConstructSRSection(sec, moskey.MultiplicityParams, det);
                    break;

                case INCCReportSection.Adjustments:
                    sec = new INCCStyleSection(null, 1);
                    if (AssaySelector.ForMass(meas.MeasOption) || meas.MeasOption == AssaySelector.MeasurementOption.rates)
                    {
                        ushort push = sec.FPFormatPrecision;
                        sec.SetFPCurrentFormatPrecision(4);
                        sec.AddNumericRow("Normalization constant:", meas.Norm.currNormalizationConstant);
                        sec.SetFPCurrentFormatPrecision(push);
                    }
                    if (AssaySelector.UsesBackground(meas.MeasOption))
                    {
                        sec.AddNumericRow("Passive singles bkgrnd:", meas.Background.DeadtimeCorrectedSinglesRate);
                        sec.AddNumericRow("Passive doubles bkgrnd:", meas.Background.DeadtimeCorrectedDoublesRate);
                        sec.AddNumericRow("Passive triples bkgrnd:", meas.Background.DeadtimeCorrectedTriplesRate);

                        if (det.Id.SRType <= InstrType.AMSR)
                        {
                            sec.AddNumericRow("Passive scaler1 bkgrnd:", meas.Background.Scaler1.v);
                            sec.AddNumericRow("Passive scaler2 bkgrnd:", meas.Background.Scaler2.v);
                        }

                        sec.AddNumericRow("Active singles bkgrnd:", meas.Background.INCCActive.Singles);
                        sec.AddNumericRow("Active doubles bkgrnd:", meas.Background.INCCActive.Doubles);
                        sec.AddNumericRow("Active triples bkgrnd:", meas.Background.INCCActive.Triples);
                        if (det.Id.SRType <= InstrType.AMSR)
                        {
                            sec.AddNumericRow("Passive scaler1 bkgrnd:", meas.Background.INCCActive.Scaler1Rate);
                            sec.AddNumericRow("Passive scaler2 bkgrnd:", meas.Background.INCCActive.Scaler2Rate);
                        }
                    }
                    break;

                case INCCReportSection.CycleSummary:
                    sec = new INCCStyleSection(null, 1);
                    sec.AddIntegerRow(String.Format("Number {0} cycles:", meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected()?"Active":"Passive"), (int)meas.Cycles.GetValidCycleCountForThisKey(moskey.MultiplicityParams));    //det.MultiplicityParams)); // could also use CycleList length but CycleList can be longer when a reanalysis occurs and the analysis processing stops short of the end of the list due to modified termination conditions
                    sec.AddNumericRow("Count time (sec):", (meas.Cycles.Count > 0 ? meas.Cycles[0].TS.TotalSeconds : 0.0));
                    break;

                case INCCReportSection.Messages:
                    List <MeasurementMsg> sl = null;
                    bool found = meas.Messages.TryGetValue(moskey.MultiplicityParams, out sl);
                    if (found)
                    {
                        sec = new INCCStyleSection(null, 1);
                        sec.AddHeader(String.Format("{0} messages", meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected() ? "Active" : "Passive"));      /// todo: is there an active messages section header analog?
                        foreach (MeasurementMsg m in sl)
                        {
                            Row r = new Row();
                            r.Add(0, m.text);      // expand to log style with toString?
                            sec.Add(r);
                        }
                    }
                    break;

                case INCCReportSection.Reference:
                    sec = new INCCStyleSection(null, 1);
                    sec.AddHeader("Counting results, summaries and cycle counts file name");      // section header
                    Row resline = new Row(); resline.Add(0, "  " + meas.ResultsFileName);
                    sec.Add(resline);
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                ctrllog.TraceException(e);
            }
            return(sec);
        }