예제 #1
0
        public static ForcedExpiration GetData(List <double> flowins, List <double> flowexp, double vC, double _sampleTime, ILogger logger)
        {
            _logger = logger;
            ForcedExpiration._sampleTime = _sampleTime;
            var    volumeListInIns = Integral.Calculate_VolumeInList(flowins, PulmonaryAnalysis.C1_fromATPtoSTPD(), _sampleTime);
            var    volumeListInExp = Integral.Calculate_VolumeInList(flowexp, PulmonaryAnalysis.C2_fromBTPStoSTPD(), _sampleTime);
            double FVC             = DefinitionFVC(volumeListInExp);
            var    FEV             = DefinitionFEV(volumeListInExp);
            var    FEF             = DefinitionFEF(volumeListInExp, flowexp, FVC);
            double MEF02_12        = DefinitionMEF02_12(flowexp);
            var    FIV             = DefinitionFIV(volumeListInIns);
            var    FIF             = DefinitionFIF(volumeListInIns, flowins, FVC);
            double PEF             = DefinitionPEF(flowexp);
            double PIF             = DefinitionPIF(flowins);

            return(new ForcedExpiration(vC, FVC, FEV, PEF, FEF, MEF02_12, PIF, FIF, FIV));
        }
예제 #2
0
        static double DefinitionMEF02_12(List <double> flowExp)
        {
            double MEF02_12;

            try
            {
                double resultForStep = 0;
                int    indexOfvolume02 = 0, indexOfvolume12 = 0;
                MEF02_12 = 0;
                for (int i = 1; i < flowExp.Count; i++)
                {
                    resultForStep += (flowExp[i] + flowExp[i - 1]) * 0.5 * _sampleTime * PulmonaryAnalysis.C2_fromBTPStoSTPD();
                    if (resultForStep >= 0.2)
                    {
                        indexOfvolume02 = i;
                    }
                    else if (resultForStep >= 1.2)
                    {
                        indexOfvolume12 = i;
                        MEF02_12        = flowExp.GetRange(indexOfvolume02, indexOfvolume12 - indexOfvolume02).Average();
                    }
                }
            }
            catch (Exception ex)
            {
                MEF02_12 = -1;
                _logger.LogError(string.Format("Error: {0}, Stack: {1}", ex.Message, ex.StackTrace));
            }
            return(MEF02_12);
        }