コード例 #1
0
 public Measurement(MeasurementTuple newMT, AssaySelector.MeasurementOption at, NCCReporter.LMLoggers.LognLM logger)
 {
     mt          = newMT;
     this.logger = logger;
     mid         = new MeasId(at);
     InitMisc();
 }
コード例 #2
0
ファイル: IsoAndStrat.cs プロジェクト: eric645/INCC6
        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);
        }
コード例 #3
0
        /// <summary>
        /// Imprint a new measurement with as much information as possible from a results_rec.
        /// Might need to bring the Item Id into the test soon.
        /// </summary>
        /// <param name="rec">The results_rec with the measurement details</param>
        /// <param name="meaId">Unique id for the measurement, from the results_rec fields</param>
        /// <param name="logger">logger handle</param>
        /// <returns>A new measurement</returns>
        public Measurement(INCCResults.results_rec rec, MeasId meaId, NCCReporter.LMLoggers.LognLM logger)
        {
            HVCalibrationParameters hv = NCC.IntegrationHelpers.GetCurrentHVCalibrationParams(rec.det);
            MeasurementTuple        mt = new MeasurementTuple(new DetectorList(rec.det), rec.tests, rec.norm, rec.bkg, rec.iso, rec.acq, hv);

            this.mt     = mt;
            this.logger = logger;
            mid         = meaId;
            InitMisc();
        }
コード例 #4
0
ファイル: IDDIsotopics.cs プロジェクト: hnordquist/INCC6
 public IDDIsotopics(string selected = "default")
 {
     InitializeComponent();
     applog = NC.App.Logger(NCCReporter.LMLoggers.AppSection.App);
     acq = Integ.GetCurrentAcquireParams();
     if (string.IsNullOrEmpty(selected) || string.Compare(selected, "default",true) == 0)
     {
         // get current acquire composite isotopics id and use that
         selected = acq.isotopics_id;
     }
     RefreshIsoCodeCombo();
     RefreshIdComboWithDefaultOrSet(selected);
 }
コード例 #5
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            NCCReporter.LMLoggers.LognLM applog = NC.App.Logger(NCCReporter.LMLoggers.AppSection.App);
            string dest = UIIntegration.GetUsersFolder("Select Destination", string.Empty);

            if (string.IsNullOrEmpty(dest))
            {
                return;
            }
            if (DetectorCurrentRadioButton.Checked)
            {
                List <Detector> l = new List <Detector>();
                l.Add(Integ.GetCurrentAcquireDetector());
                INCCInitialDataDetectorFile iddf = INCCKnew.FromDetectors(l);
                iddf.Save(dest);
            }
            else if (DetectorAllRadioButton.Checked)
            {
                List <Detector>             l    = NC.App.DB.Detectors;
                INCCInitialDataDetectorFile iddf = INCCKnew.FromDetectors(l);
                iddf.Save(dest);
            }
            else if (CalibrationCurrentRadioButton.Checked)
            {
                List <Detector> l = new List <Detector>();
                l.Add(Integ.GetCurrentAcquireDetector());
                List <INCCInitialDataCalibrationFile> lidcf = INCCKnew.CalibFromDetectors(l);
                if (lidcf.Count > 0)
                {
                    if (!lidcf[0].Save(dest))
                    {
                        applog.TraceEvent(NCCReporter.LogLevels.Warning, 33154, "No calibration parameters for " + lidcf[0].Name);
                    }
                }
            }
            else if (CalibrationAllRadioButton.Checked)
            {
                List <Detector> l = NC.App.DB.Detectors;
                List <INCCInitialDataCalibrationFile> lidcf = INCCKnew.CalibFromDetectors(l);
                foreach (INCCInitialDataCalibrationFile idcf in lidcf)
                {
                    if (!idcf.Save(dest))
                    {
                        applog.TraceEvent(NCCReporter.LogLevels.Warning, 33154, "No calibration parameters for " + idcf.Name);
                    }
                }
            }
            Close();
        }
コード例 #6
0
ファイル: FileCtrlINCC5.cs プロジェクト: tempbottle/INCC6
 static void ResetMeasurement()
 {
     if (NC.App.Opstate.Measurement != null)
     {
         NC.App.Opstate.Measurement = null;
         NCCReporter.LMLoggers.LognLM log = NC.App.Loggers.Logger(NCCReporter.LMLoggers.AppSection.Control);
         long mem = GC.GetTotalMemory(false);
         log.TraceEvent(NCCReporter.LogLevels.Verbose, 4255, "Total GC Memory is {0:N0}Kb", mem / 1024L);
         log.TraceEvent(NCCReporter.LogLevels.Verbose, 4248, "GC now");
         GC.Collect();
         GC.WaitForPendingFinalizers();
         log.TraceEvent(NCCReporter.LogLevels.Verbose, 4284, "GC complete");
         mem = GC.GetTotalMemory(true);
         log.TraceEvent(NCCReporter.LogLevels.Verbose, 4255, "Total GC Memory now {0:N0}Kb", mem / 1024L);
     }
 }
コード例 #7
0
ファイル: Excel.cs プロジェクト: tempbottle/INCC6
 public static bool ExcelPresent(NCCReporter.LMLoggers.LognLM optlog = null)
 {
     try
     {
         //Excel.Application nitz;
         //nitz = new Excel.Application();
         return(true);
     }
     catch (Exception e)
     {
         if (optlog != null)
         {
             optlog.TraceException(e);
         }
     }
     return(false);
 }
コード例 #8
0
        void LoadtheMCACombobox()
        {
            Device.MCADeviceInfo[] deviceInfos = null;
            int indexOfMyDesire = -1;

            try
            {
                deviceInfos = Device.MCADevice.QueryDevices();
                MCAComboBox.Items.Clear();
                if (deviceInfos.Length > 0)
                {
                    MCAComboBox.Visible = true;
                    // Populate the combobox in the selector panel
                    foreach (Device.MCADeviceInfo d in deviceInfos)
                    {
                        string id = d.Serial.ToString("D5");
                        string s  = string.Format("{0}{1}  FW# {2}  HW# {3} on {4}", MCAPrefix, id, d.FirmwareVersion, d.HardwareVersion, d.Address);
                        int    i  = MCAComboBox.Items.Add(s);
                        object o  = MCAComboBox.Items[i];
                        if (string.Equals(id, det.Id.ElectronicsId, StringComparison.OrdinalIgnoreCase))
                        {
                            indexOfMyDesire = i;
                        }
                    }
                    if (indexOfMyDesire >= 0)
                    {
                        MCAComboBox.SelectedIndex = indexOfMyDesire;
                    }
                }
                else
                {
                    MCAComboBox.Visible = false;
                }
            } catch (Exception e)
            {
                NCCReporter.LMLoggers.LognLM log = NC.App.Loggers.Logger(NCCReporter.LMLoggers.AppSection.Control);
                log.TraceException(e);
            }
        }
コード例 #9
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            bool notify = true;

            NCCReporter.LMLoggers.LognLM ctrllog = N.App.Loggers.Logger(NCCReporter.LMLoggers.AppSection.Control);
            foreach (ListViewItem lvi in MeasurementView.Items)
            {
                if (lvi.Selected)
                {
                    int lvIndex = 0;
                    if (!int.TryParse(lvi.SubItems[5].Text, out lvIndex))                     // 5 has the original mlist index of this sorted row element
                    {
                        continue;
                    }
                    MeasId mid = mlist[lvIndex].MeasurementId;
                    ctrllog.TraceEvent(NCCReporter.LogLevels.Info, 22222,
                                       "Deleting " + mid.MeasOption.PrintName() + " " + mid.MeasDateTime.ToString("yy.MM.dd HH:mm:ss") + ", #" + mid.UniqueId + " for " + det.Id.DetectorId);
                    N.App.DB.DeleteMeasurement(mlist[lvIndex].MeasurementId);
                    notify = false;
                }
            }
            LoadList(notify);
        }
コード例 #10
0
 public SimpleHVReport(NCCReporter.LMLoggers.LognLM ctrllog)
 {
     this.ctrllog = ctrllog;
 }
コード例 #11
0
ファイル: Excel.cs プロジェクト: tempbottle/INCC6
 public ExcelPush(NCCReporter.LMLoggers.LognLM ctrllog)
 {
     this.ctrllog = ctrllog;
 }
コード例 #12
0
ファイル: Excel.cs プロジェクト: tempbottle/INCC6
        //protected Excel.Application target;

        // dev note: pre-define template somewhere, and use it, having the very nice graph already prepared for line by line updating here
        public ExcelPush(string existingWB, NCCReporter.LMLoggers.LognLM ctrllog)
        {
            this.ctrllog = ctrllog;
        }
コード例 #13
0
ファイル: IsoAndStrat.cs プロジェクト: tempbottle/INCC6
        /// <summary>
        ///  update isotopic composition data in db to calling date's values
        /// </summary>
        /// <param name="PuMass">mass of item</param>
        /// <param name="ref_date">date to update to </param>
        /// <param name="curiso">current iso</param>
        /// <param name="newiso">updated iso</param>
        /// <param name="logger">should be thru the global state</param>
        /// <param name="INCCParity">if true, ignore current day fraction in calculations</param>
        /// <returns>updated isotopics</returns>
        public static CompositeIsotopics update_comp_isotopics(double PuMass,           /* mass of item */
                                                               DateTimeOffset ref_date, /* date to update to */
                                                               CompositeIsotopics curiso, NCCReporter.LMLoggers.LognLM logger, bool INCCParity)
        {
            double ref_days;
            double pu_days;
            double am_days;

            Tuple[] iso_mass              = MakeArray();
            Tuple[] decay_fract_pu_to_am  = MakeArray();
            Tuple[] decay_fract_am_to_now = MakeArray();

            Tuple[] decay_fract_pu_to_now = MakeArray();
            Tuple[] cur_mass = MakeArray();

            double temp         = 0.0;
            double temp_sum     = 0.0;
            double cur_mass_sum = 0.0;
            //double x, y; part of err computation. hn
            double pu_mass = PuMass;

            if (pu_mass <= 0.0)
            {
                pu_mass = 1.0;
            }

            double isosum = 0.0;

            for (Isotope iso = Isotope.pu238; iso <= Isotope.pu242; iso++)
            {
                isosum += curiso[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(null);
            }
            CompositeIsotopics newcompiso = new CompositeIsotopics();

            //dev note: roundabout way to do this from INCC code


            // The INCC6 parity flag is used to toggle this behavior:
            // INCC literally truncates the fractional date here, so it is always at time of the full day
            //      gen_date_time_str_to_seconds (&seconds, results.meas_date, "00:00:00", GEN_DTF_IAEA);
            //      ref_days = (double) seconds / SECONDS_PER_DAY;
            //

            if (INCCParity)
            {
                pu_days  = (curiso.pu_date.Date.Subtract(ZeroIAEATime)).TotalDays;
                am_days  = (curiso.am_date.Date.Subtract(ZeroIAEATime)).TotalDays;
                ref_days = (long)(ref_date.Date.Subtract(ZeroIAEATime)).TotalDays;
            }
            else
            {
                pu_days  = (curiso.pu_date.Subtract(ZeroIAEATime)).TotalDays;
                am_days  = (curiso.am_date.Subtract(ZeroIAEATime)).TotalDays;
                ref_days = (long)(ref_date.Subtract(ZeroIAEATime)).TotalDays;
            }

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

            for (Isotope iso = Isotope.pu238; iso <= Isotope.pu242; iso++)
            {
                cur_mass[(int)iso].v = iso_mass[(int)iso].v * decay_fract_pu_to_now[(int)iso].v;
            }
            cur_mass[(int)Isotope.am241].v = decay_fract_am_to_now[(int)Isotope.am241].v * curiso[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)
                   * (LN2 / Halflives[(int)Isotope.pu241]) / ((LN2 / Halflives[(int)Isotope.pu241]) - (LN2 / Halflives[(int)Isotope.am241]));
            cur_mass[(int)Isotope.am241].v = (cur_mass[(int)Isotope.am241].v * temp_sum) + temp;

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

            if (cur_mass_sum <= 0.0)
            {
                logger.TraceEvent(NCCReporter.LogLevels.Warning, 36784, "Unable to update isotopics, mass sum must be greater than zero");
                return(null);
            }
            else
            {
                logger.TraceEvent(NCCReporter.LogLevels.Verbose, 36722, "'update_isotopics' mass sum " + cur_mass_sum);
            }


            newcompiso.pu_date = new DateTime(ref_date.Ticks);
            newcompiso.am_date = new DateTime(ref_date.Ticks);
            for (Isotope iso = Isotope.pu238; iso <= Isotope.am241; iso++)
            {
                newcompiso[iso].v = 100.0 * cur_mass[(int)iso].v / cur_mass_sum;
            }
            //todo: composite isotopics have no err values? hn

            /*for (Isotope iso = Isotope.pu238; iso <= Isotope.pu242; iso++)
             * {
             *  if (curiso[iso].v != 0)
             *      newcompiso[iso].sigma = curiso[iso].sigma * newcompiso[iso].v / curiso[iso].v;
             *  else
             *      newcompiso[iso].sigma = curiso[iso].sigma;
             *
             * }*/
            //todo: composite isotopics have no err values? hn

            /*if (curiso[Isotope.am241].v != 0.0)
             * {
             *  x = (decay_fract_am_to_now[(int)Isotope.am241].v / 100.0) * temp_sum *
             *     curiso[Isotope.am241].sigma;
             *  temp = decay_fract_pu_to_am[(int)Isotope.pu241].v *
             *      (decay_fract_am_to_now[(int)Isotope.am241].v - decay_fract_am_to_now[(int)Isotope.pu241].v)
             * (LN2 / PU241HL) / ((LN2 / PU241HL) - (LN2 / AM241HL));
             *  y = temp * (pu_mass / 100.0) * curiso[Isotope.pu241].sigma;
             *  newcompiso[Isotope.am241].sigma = Math.Sqrt(x * x + y * y) / cur_mass_sum * 100.0;
             * }
             * else
             *  newcompiso[Isotope.am241].sigma = curiso[Isotope.am241].sigma;*/

            return(newcompiso);
        }
コード例 #14
0
ファイル: IsoAndStrat.cs プロジェクト: eric645/INCC6
        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);
        }
コード例 #15
0
 public HVControl(DAQControl control)
 {
     this.control = control;
     ctrllog      = NC.App.Loggers.Logger(LMLoggers.AppSection.Control);
 }
コード例 #16
0
 public MethodResultsReport(NCCReporter.LMLoggers.LognLM ctrllog)
     : base(ctrllog)
 {
     INCCResultsReports = new List <List <string> >();
 }
コード例 #17
0
 public TestDataFile(NCCReporter.LMLoggers.LognLM ctrllog)
     : base(ctrllog)
 {
     INCCTestDataFiles = new List <List <string> >();
 }
コード例 #18
0
 public ReportMangler(NCCReporter.LMLoggers.LognLM ctrllog)
 {
     this.ctrllog       = ctrllog;
     INCCResultsReports = new List <List <string> >();
     TestDataFiles      = new List <List <string> >();
 }
コード例 #19
0
ファイル: Excel.cs プロジェクト: tempbottle/INCC6
 public ExcelPush(NCCReporter.LMLoggers.LognLM ctrllog)
 {
     this.ctrllog = ctrllog;
 }
コード例 #20
0
ファイル: Excel.cs プロジェクト: tempbottle/INCC6
       //protected Excel.Application target;

        // dev note: pre-define template somewhere, and use it, having the very nice graph already prepared for line by line updating here
        public ExcelPush(string existingWB, NCCReporter.LMLoggers.LognLM ctrllog)
        {
            this.ctrllog = ctrllog;
        }
コード例 #21
0
 // dev note: pre-define template somewhere, and use it, having the very nice graph already prepared for line by line updating here
 public HVExcel(string existingWB, NCCReporter.LMLoggers.LognLM ctrllog) : base(existingWB, ctrllog)
 {
 }
コード例 #22
0
 public HVExcel(NCCReporter.LMLoggers.LognLM ctrllog)
     : base(ctrllog)
 {
 }
コード例 #23
0
ファイル: HV.cs プロジェクト: tempbottle/INCC6
 public SimpleHVReport(NCCReporter.LMLoggers.LognLM ctrllog)
 {
     this.ctrllog = ctrllog;
 }
コード例 #24
0
 public Measurement(MeasurementTuple newMT, NCCReporter.LMLoggers.LognLM logger)
 {
     mt          = newMT;
     this.logger = logger;
     InitMisc();
 }
コード例 #25
0
ファイル: HV.cs プロジェクト: tempbottle/INCC6
 public HVControl(DAQControl control)
 {
     this.control = control;
     ctrllog = NC.App.Loggers.Logger(LMLoggers.AppSection.Control);
 }