예제 #1
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;
 }
예제 #2
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;
 }
예제 #3
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);
        }