This commit is contained in:
@@ -78,7 +78,7 @@ namespace 口罩泄露定制款
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 步骤初始化
|
||||
// 步骤初始化 - 根据新标准调整
|
||||
private void InitStepList()
|
||||
{
|
||||
stepList.Clear();
|
||||
@@ -86,11 +86,11 @@ namespace 口罩泄露定制款
|
||||
stepList.Add("请将采样管插头插入测量接口");
|
||||
if (isNeedRun)
|
||||
stepList.Add("请按下跑步机启动按钮");
|
||||
stepList.Add("头部静止、不说话,2 min");
|
||||
stepList.Add("左右转动头部看检测仓左右墙壁(大约15次),2 min");
|
||||
stepList.Add("抬头和低头看检测仓顶和地面(大约15次),2 min");
|
||||
stepList.Add("大声阅读屏幕显示文字,2 min");
|
||||
stepList.Add("头部静止、不说话,2 min");
|
||||
stepList.Add("头部静止、不说话,2 min");
|
||||
stepList.Add("左右转动头部看检测仓左右墙壁(大约15次),2 min");
|
||||
stepList.Add("抬头和低头看检测仓顶和地面(大约15次),2 min");
|
||||
stepList.Add("大声阅读屏幕显示文字,2 min");
|
||||
stepList.Add("头部静止、不说话,2 min");
|
||||
stepList.Add("测试完成,拔下采样管插头,走出测量仓");
|
||||
comboBox1.Items.Clear();
|
||||
foreach (var step in stepList)
|
||||
@@ -541,18 +541,31 @@ namespace 口罩泄露定制款
|
||||
|
||||
if (dt_Show.Columns.Count != 0)
|
||||
{
|
||||
if (list_Tsi_Indoor_Data.Count != 0 && list_Tsi_Outdoor_Data.Count != 0)
|
||||
{
|
||||
_TsiIndoorAgv = list_Tsi_Indoor_Data.Average();
|
||||
_TsiOutdoorAgv = list_Tsi_Outdoor_Data.Average();
|
||||
// 使用最后100秒数据计算(标准要求)
|
||||
int dataCount = Math.Min(list_Tsi_Indoor_Data.Count, list_Tsi_Outdoor_Data.Count);
|
||||
int startIndex = Math.Max(0, dataCount - 100);
|
||||
|
||||
// 关键修改:使用与 timer_UpdataChart_Tick 中相同的计算方法
|
||||
// 而不是简单的 lsit_XieLoulv.Average()
|
||||
_Xieloulv = experData.CumulativeLeakageRate(
|
||||
list_Tsi_Indoor_Data,
|
||||
list_Tsi_Outdoor_Data,
|
||||
List<float> last100Indoor = new List<float>();
|
||||
List<float> last100Outdoor = new List<float>();
|
||||
|
||||
for (int i = startIndex; i < dataCount; i++)
|
||||
{
|
||||
last100Indoor.Add(list_Tsi_Indoor_Data[i]);
|
||||
last100Outdoor.Add(list_Tsi_Outdoor_Data[i]);
|
||||
}
|
||||
|
||||
if (last100Indoor.Count > 0 && last100Outdoor.Count > 0)
|
||||
{
|
||||
_TsiIndoorAgv = last100Indoor.Average();
|
||||
_TsiOutdoorAgv = last100Outdoor.Average();
|
||||
|
||||
// 使用连续采样法计算公式
|
||||
_Xieloulv = experData.ContinuousSamplingLeakageRate(
|
||||
last100Indoor,
|
||||
last100Outdoor,
|
||||
experData.BenDiNongDu,
|
||||
experData.YangPinXiShu);
|
||||
experData.SamplingFlowRate,
|
||||
experData.DryingFlowRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -581,12 +594,12 @@ namespace 口罩泄露定制款
|
||||
experData.ExperNum,
|
||||
experData.ExperType,
|
||||
comboBox1.Text,
|
||||
experData.HuanJingWenDu,
|
||||
experData.HuanJingShiDu,
|
||||
experData.BenDiNongDu,
|
||||
_TsiIndoorAgv,
|
||||
_TsiOutdoorAgv,
|
||||
_Xieloulv); // 这里使用统一计算后的泄露率
|
||||
experData.HuanJingWenDu.ToString("F1"),
|
||||
experData.HuanJingShiDu.ToString("F1"),
|
||||
experData.BenDiNongDu.ToString("F3"),
|
||||
_TsiIndoorAgv.ToString("F3"),
|
||||
_TsiOutdoorAgv.ToString("F3"),
|
||||
_Xieloulv.ToString("F2"));
|
||||
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
@@ -599,11 +612,12 @@ namespace 口罩泄露定制款
|
||||
private void InsertDataToDatabase()
|
||||
{
|
||||
float _Xieloulv = 0.0f;
|
||||
_Xieloulv = experData.CumulativeLeakageRate(
|
||||
_Xieloulv = experData.ContinuousSamplingLeakageRate(
|
||||
list_Tsi_Indoor_Data,
|
||||
list_Tsi_Outdoor_Data,
|
||||
experData.BenDiNongDu,
|
||||
experData.YangPinXiShu);
|
||||
experData.SamplingFlowRate,
|
||||
experData.DryingFlowRate);
|
||||
|
||||
|
||||
// 读取用户数据
|
||||
@@ -979,6 +993,7 @@ namespace 口罩泄露定制款
|
||||
List<float> list_O2_Data = new List<float>();//氧气浓度
|
||||
List<float> list_HuanJingWenDu_Data = new List<float>();//环境内温度
|
||||
List<float> list_HuanJingShiDu_Data = new List<float>();//环境湿度
|
||||
// 修改timer_UpdataChart_Tick - 实时泄漏率计算
|
||||
private void timer_UpdataChart_Tick(object sender, EventArgs e)
|
||||
{
|
||||
int currindex = 0;
|
||||
@@ -990,18 +1005,43 @@ namespace 口罩泄露定制款
|
||||
{
|
||||
currindex = 2;
|
||||
}
|
||||
|
||||
if (data_M130_M135[1] && currentStepIndex >= currindex)
|
||||
{
|
||||
list_Time.Add(DateTime.Now.ToString("HH:mm:ss"));
|
||||
list_Tsi_Indoor_Data.Add(experData.InDoor_TSINongDu);
|
||||
list_Tsi_Outdoor_Data.Add(experData.Mask_TSINongDu);
|
||||
experData.XieLouLv = experData.CumulativeLeakageRate(list_Tsi_Indoor_Data, list_Tsi_Outdoor_Data, experData.BenDiNongDu, experData.YangPinXiShu);
|
||||
|
||||
// 使用最后100秒数据计算实时泄漏率
|
||||
int dataCount = Math.Min(list_Tsi_Indoor_Data.Count, list_Tsi_Outdoor_Data.Count);
|
||||
int startIndex = Math.Max(0, dataCount - 100);
|
||||
|
||||
List<float> last100Indoor = new List<float>();
|
||||
List<float> last100Outdoor = new List<float>();
|
||||
|
||||
for (int i = startIndex; i < dataCount; i++)
|
||||
{
|
||||
last100Indoor.Add(list_Tsi_Indoor_Data[i]);
|
||||
last100Outdoor.Add(list_Tsi_Outdoor_Data[i]);
|
||||
}
|
||||
|
||||
if (last100Indoor.Count > 0 && last100Outdoor.Count > 0)
|
||||
{
|
||||
experData.XieLouLv = experData.ContinuousSamplingLeakageRate(
|
||||
last100Indoor,
|
||||
last100Outdoor,
|
||||
experData.BenDiNongDu,
|
||||
experData.SamplingFlowRate,
|
||||
experData.DryingFlowRate);
|
||||
}
|
||||
|
||||
lsit_XieLoulv.Add(experData.XieLouLv);
|
||||
list_CO2_Indoor_Data.Add(experData.CO2NongDu_Indoor);
|
||||
list_CO2_Outdoor_Data.Add(experData.Mask_CO2NongDu);
|
||||
list_O2_Data.Add(experData.O2NongDu);
|
||||
list_HuanJingWenDu_Data.Add(experData.HuanJingWenDu);
|
||||
list_HuanJingShiDu_Data.Add(experData.HuanJingShiDu);
|
||||
|
||||
chart_TSI.Series[0].Points.DataBindXY(list_Time, list_Tsi_Indoor_Data);
|
||||
chart_TSI.Series[1].Points.DataBindXY(list_Time, list_Tsi_Outdoor_Data);
|
||||
chart_TSI.Series[2].Points.DataBindXY(list_Time, lsit_XieLoulv);
|
||||
@@ -1010,9 +1050,7 @@ namespace 口罩泄露定制款
|
||||
chart2.Series[2].Points.DataBindXY(list_Time, list_O2_Data);
|
||||
chart2.Series[3].Points.DataBindXY(list_Time, list_HuanJingWenDu_Data);
|
||||
chart2.Series[4].Points.DataBindXY(list_Time, list_HuanJingShiDu_Data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//结束时写入Excel
|
||||
public static int comindex;
|
||||
@@ -1091,6 +1129,7 @@ namespace 口罩泄露定制款
|
||||
|
||||
#endregion
|
||||
#region 按钮事件
|
||||
// 修改btn_Start_Click - 加载配置参数
|
||||
private void btn_Start_Click(object sender, EventArgs e)
|
||||
{
|
||||
string configPath = Path.Combine(Application.StartupPath, "UserData.json");
|
||||
@@ -1099,23 +1138,15 @@ namespace 口罩泄露定制款
|
||||
var json = File.ReadAllText(configPath);
|
||||
dynamic config = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
|
||||
experData.BenDiNongDu = config.BenDiNongdu;
|
||||
experData.YangPinXiShu = config.ParticleSize;
|
||||
experData.SamplingFlowRate = config.SamplingFlowRate ?? 2.0f;
|
||||
experData.DryingFlowRate = config.DryingFlowRate ?? 1.0f;
|
||||
experData.ExperName = config.Category;
|
||||
}
|
||||
|
||||
isPaused = false;
|
||||
Pause1.Text = "暂停测试";
|
||||
Pause1.Style = UIStyle.Red;
|
||||
|
||||
|
||||
|
||||
//if (experData.BenDiNongDu == 0.0f)//add by xyy
|
||||
////if (false)
|
||||
//{
|
||||
// MessageBox.Show("未校准本底浓度!");
|
||||
// return;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// 清空数据
|
||||
list_Time.Clear();
|
||||
list_Tsi_Indoor_Data.Clear();
|
||||
@@ -1130,7 +1161,6 @@ namespace 口罩泄露定制款
|
||||
|
||||
fc?.BtnClickFunction(Function.ButtonType.复归型, 130);
|
||||
|
||||
|
||||
LoadIsNeedRunConfig();
|
||||
InitStepList();
|
||||
|
||||
@@ -1139,10 +1169,8 @@ namespace 口罩泄露定制款
|
||||
StartProcess();
|
||||
|
||||
_logger.Log(loginData.UserName, "点击了【测试开始】按钮", loginData.UserPower.ToString());
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
private void btn_Stop_Click(object sender, EventArgs e)
|
||||
{
|
||||
isPaused = false;
|
||||
@@ -2169,7 +2197,7 @@ namespace 口罩泄露定制款
|
||||
list_Tsi_Outdoor_Data.Clear();
|
||||
//experData.XieLouLv = experData.CumulativeLeakageRate(list_Tsi_Indoor_Data, list_Tsi_Outdoor_Data, experData.BenDiNongDu, 1.0f);
|
||||
lsit_XieLoulv.Clear();
|
||||
list_CO2_Indoor_Data.Clear();
|
||||
list_CO2_Indoor_Data.Clear();
|
||||
list_CO2_Outdoor_Data.Clear();
|
||||
list_O2_Data.Clear();
|
||||
list_HuanJingWenDu_Data.Clear();
|
||||
|
||||
Reference in New Issue
Block a user