using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 头罩视野.Services
{
    public  class ExperData: INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        #region 实验属性
        static string experName = "";
        /// <summary>
        /// 实验人员
        /// </summary>
        public string ExperName { get { return experName; } set { experName = value; } }
       
        static string experDate = "";
        /// <summary>
        /// 实验日期
        /// </summary>
        public string ExperDate { get { return experDate; } set { experDate = value; } }
      
        static string experNum = "";
        /// <summary>
        /// 实验编号
        /// </summary>
        public string ExperNum { get { return experNum; } set { experNum = value; } }
     
        static string experType = " ";
        /// <summary>
        /// 实验种类
        /// </summary>
        public string ExperType { get { return experType; } set { experType = value; } }
        static float experMaskType = 2.0f;
        /// <summary>
        /// 口罩类型
        /// </summary>
        public float ExperMaskType { get { return experMaskType; } set { experMaskType = value; } }
        /// <summary>
        /// 面罩类型
        /// </summary>
        static string maskType;
        public string MaskType { get { return maskType; } set { maskType = value; } }
        static float _yangPinXiShu = 1.0f;
        /// <summary>
        /// 样品系数
        /// </summary>
        public float YangPinXiShu { get { return _yangPinXiShu; } set { _yangPinXiShu = value; } }
        static string _testStatus = "";


        /// <summary>
        /// 实验状态
        /// </summary>
        public string TestStatus { get { return _testStatus; } set { _testStatus = value; } }
        static float benDiNongDu = 0.00f;
        /// <summary>
        /// 本底浓度
        /// </summary>
        public float BenDiNongDu { get { return benDiNongDu; } set { benDiNongDu = value; } }
    
        static float huanJingWenDu = 0.00f;
        /// <summary>
        /// 环境温度
        /// </summary>
        public float HuanJingWenDu { get { return huanJingWenDu; } set { huanJingWenDu = value; } }
            
     
        static float huanJingShiDu = 0.00f;
        /// <summary>
        /// 环境湿度
        /// </summary>
        public float HuanJingShiDu { get { return huanJingShiDu; } set { huanJingShiDu = value; } }
     
        static float o2NongDu = 0.00f;
        /// <summary>
        /// 环境氧浓度
        /// </summary>
        public float O2NongDu { get { return o2NongDu; } set { o2NongDu = value; } }
        
        static float cO2NongDu = 0.00f;
        /// <summary>
        /// 环境C02浓度
        /// </summary>
        public float CO2NongDu_Indoor { get { return cO2NongDu; } set { cO2NongDu = value; } }
        
        static float inDoor_TSINongDu = 0.00f;
        /// <summary>
        /// 环境气溶胶浓度
        /// </summary>
        public float InDoor_TSINongDu { get { return inDoor_TSINongDu; } set { inDoor_TSINongDu = value; } }
        
        static float mask_CO2NongDu = 0.00f;
        /// <summary>
        /// 口罩内CO2浓度
        /// </summary>
        public float Mask_CO2NongDu { get { return mask_CO2NongDu; } set { mask_CO2NongDu = value; } }
       
        static float mask_TSINongDu = 0.00f;
        /// <summary>
        /// 口罩内气溶胶浓度
        /// </summary>
        public float Mask_TSINongDu { get { return mask_TSINongDu; } set { mask_TSINongDu = value; } }

        static float _liuLiang = 0.00f;
        /// <summary>
        /// 流量
        /// </summary>
        public float LiuLiang { get { return _liuLiang; } set { _liuLiang = value; } }
        static float _xieloulv = 0.00f;
        /// <summary>
        /// 泄露率
        /// </summary>
        public float XieLouLv { get { return _xieloulv; } set { _xieloulv = value; } }


        #endregion

        #region 泄露率计算
        //单独动作泄露率
        public float CumulativeLeakageRate(List<float> inDoor_Tsi,List<float> out_Door_Tsi,float benDiNongdu,float xiShu)
        {
            if (inDoor_Tsi.Count != 0 && out_Door_Tsi.Count != 0&& benDiNongdu!=0.0f)
            {         
                //计算室内Tsi浓度平均值
                float inDoor_Tsi_Avg = inDoor_Tsi.Average();
                //计算室外Tsi浓度平均值
                float out_Door_Tsi_Avg = out_Door_Tsi.Average();
                //计算泄露率
                float leakageRate = ((out_Door_Tsi_Avg - inDoor_Tsi_Avg) * xiShu) / benDiNongdu;
                return leakageRate;
            }
            else
            {
                return 0.00f;
            }
   
        }
        //全部动作泄露率
        public float CumulativeLeakageRate_All(List<float> All_Cv_List)

        {
             return All_Cv_List.Average();
        }
        #endregion

    }
}
