Files
kou_zhaoxielou_shandong/口罩泄露定制款/Data/ExperData.cs
2026-01-22 19:18:16 +08:00

218 lines
7.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace
{
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 _testDuration = 120f; // 测试时间改为120秒
/// <summary>
/// 测试时长(秒)
/// </summary>
public float TestDuration { get { return _testDuration; } set { _testDuration = value; } }
static string _testStatus = "";
/// <summary>
/// 实验状态
/// </summary>
public string TestStatus { get { return _testStatus; } set { _testStatus = value; } }
static float benDiNongDu = 0.00f;
/// <summary>
/// 本底浓度(mg/m³)
/// </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>
/// 环境CO2浓度
/// </summary>
public float CO2NongDu_Indoor { get { return cO2NongDu; } set { cO2NongDu = value; } }
static float inDoor_TSINongDu = 0.00f;
/// <summary>
/// 环境气溶胶浓度(mg/m³)
/// </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>
/// 口罩内气溶胶浓度(mg/m³)
/// </summary>
public float Mask_TSINongDu { get { return mask_TSINongDu; } set { mask_TSINongDu = value; } }
static float _liuLiang = 0.00f;
/// <summary>
/// 流量(L/min)
/// </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; } }
// 新增采样流量和干燥气流流量根据YY/T 0866-2024标准
static float _samplingFlowRate = 2.0f; // 默认采样流量2L/min
public float SamplingFlowRate { get { return _samplingFlowRate; } set { _samplingFlowRate = value; } }
static float _dryingFlowRate = 1.0f; // 默认干燥气流1L/min
public float DryingFlowRate { get { return _dryingFlowRate; } set { _dryingFlowRate = value; } }
#endregion
#region YY/T 0866-2024
/// <summary>
/// 连续采样法泄漏率计算公式2
/// P = 1.25 * ((C2 - C0) / C1) * ((S + D) / S) * 100
/// </summary>
public float ContinuousSamplingLeakageRate(List<float> indoorData, List<float> outdoorData,
float backgroundConcentration,
float samplingFlow, float dryingFlow)
{
if (indoorData.Count == 0 || outdoorData.Count == 0)
return 0.0f;
// 使用最后100秒的数据标准要求
int dataCount = Math.Min(indoorData.Count, outdoorData.Count);
int startIndex = Math.Max(0, dataCount - 100); // 取最后100个数据点
// 计算最后100秒的平均值
float C1 = 0, C2 = 0;
int validCount = 0;
for (int i = startIndex; i < dataCount; i++)
{
C1 += indoorData[i];
C2 += outdoorData[i];
validCount++;
}
if (validCount == 0)
return 0.0f;
C1 /= validCount;
C2 /= validCount;
// 应用连续采样法公式
if (C1 <= 0)
return 0.0f;
// P = 1.25 * ((C2 - C0) / C1) * ((S + D) / S) * 100
float leakageRate = 1.25f * ((C2 - backgroundConcentration) / C1) *
((samplingFlow + dryingFlow) / samplingFlow) * 100;
return Math.Max(0, leakageRate); // 确保非负
}
/// <summary>
/// 脉冲式采样法泄漏率计算公式1 - 备用
/// </summary>
public float PulsedSamplingLeakageRate(List<float> indoorData, List<float> outdoorData,
float backgroundConcentration,
float samplingFlow, float dryingFlow,
float totalInhaleTime, float totalExhaleTime)
{
if (indoorData.Count == 0 || outdoorData.Count == 0 || totalInhaleTime <= 0)
return 0.0f;
// 使用最后100秒的数据
int dataCount = Math.Min(indoorData.Count, outdoorData.Count);
int startIndex = Math.Max(0, dataCount - 100);
float C1 = 0, C2 = 0;
int validCount = 0;
for (int i = startIndex; i < dataCount; i++)
{
C1 += indoorData[i];
C2 += outdoorData[i];
validCount++;
}
if (validCount == 0 || C1 <= 0)
return 0.0f;
C1 /= validCount;
C2 /= validCount;
// P = ((C2 - C0) / C1) * ((t_w + t_cm) / t_w) * ((S + D) / S) * 100
float leakageRate = ((C2 - backgroundConcentration) / C1) *
((totalInhaleTime + totalExhaleTime) / totalInhaleTime) *
((samplingFlow + dryingFlow) / samplingFlow) * 100;
return Math.Max(0, leakageRate);
}
#endregion
}
}