예제 #1
0
        /// <summary>
        /// Counts thermal and fast reactors in database, and adds to BO
        /// </summary>
        public StatisticsBO SpectrumCount(List <ReactorBO> reactorBOList, StatisticsBO statisticsBO)
        {
            int thermalCount = default(int);
            int fastCount    = default(int);
            int totalCount   = reactorBOList.Count();

            if (totalCount > 0)
            {
                _logger.LogMessage("Info", "Spectrum Count request", MethodBase.GetCurrentMethod().ToString(),
                                   totalCount + " ReactorBOs found in list. Counting thermal and fast reactors in database.");
                foreach (ReactorBO reactorBO in reactorBOList)
                {
                    if (reactorBO.IsThermal)
                    {
                        thermalCount++;
                    }
                    else
                    {
                        fastCount++;
                    }
                }
                statisticsBO.ThermalCount = thermalCount;
                statisticsBO.FastCount    = fastCount;
                statisticsBO.ReactorCount = totalCount;
            }
            else
            {
                _logger.LogMessage("Warning", "Empty list in Spectrum Count", MethodBase.GetCurrentMethod().ToString(),
                                   "No ReactorBOs found in list. Did not count thermal and fast reactors.");
            }
            return(statisticsBO);
        }
        public double CalculateEnergyDecrement(int atomicMass)
        {
            double energyDecrement;

            try
            {
                _logger.LogMessage("Info", "Calculate Energy Decrement request", MethodBase.GetCurrentMethod().ToString(),
                                   "Attempting to calculate Energy Decrement " +
                                   "for atomic mass of " + atomicMass);

                energyDecrement = 1D + (Math.Pow((atomicMass - 1D), 2D) / (2D * atomicMass)) * Math.Log((atomicMass - 1D) / (atomicMass + 1D));
                _logger.LogMessage("Energy Decrement calculation completed.");
            }
            catch (Exception ex)
            {
                _logger.LogMessage(ex, "Fatal");
                throw ex;
            }
            finally { }
            return(energyDecrement);
        }