diff --git a/CapMachine.Model/HistoryExp.cs b/CapMachine.Model/HistoryExp.cs
index 253b8ba..d45b44d 100644
--- a/CapMachine.Model/HistoryExp.cs
+++ b/CapMachine.Model/HistoryExp.cs
@@ -57,6 +57,12 @@ namespace CapMachine.Model
[Column(Name = "CapNo", IsNullable = true, StringLength = 150)]
public string? CapNo { get; set; }
+ ///
+ /// 压缩机排量
+ ///
+ [Column(Name = "CapDisplacement", IsNullable = true, StringLength = 100)]
+ public string? CapDisplacement { get; set; }
+
///
/// 制冷剂
///
diff --git a/CapMachine.Wpf/Dtos/ExpInfoDto.cs b/CapMachine.Wpf/Dtos/ExpInfoDto.cs
index d97c762..302665c 100644
--- a/CapMachine.Wpf/Dtos/ExpInfoDto.cs
+++ b/CapMachine.Wpf/Dtos/ExpInfoDto.cs
@@ -92,6 +92,16 @@ namespace CapMachine.Wpf.Dtos
set { _CapNo = value; RaisePropertyChanged(); }
}
+ private string? _CapDisplacement;
+ ///
+ /// 压缩机排量
+ ///
+ public string? CapDisplacement
+ {
+ get { return _CapDisplacement; }
+ set { _CapDisplacement = value; RaisePropertyChanged(); }
+ }
+
private string? _RfNo;
///
/// 制冷剂
diff --git a/CapMachine.Wpf/Models/CsvRecordModel.cs b/CapMachine.Wpf/Models/CsvRecordModel.cs
index 38f3230..af4d50a 100644
--- a/CapMachine.Wpf/Models/CsvRecordModel.cs
+++ b/CapMachine.Wpf/Models/CsvRecordModel.cs
@@ -385,6 +385,42 @@ namespace CapMachine.Wpf.Models
[Name("过热度[K]")]
public double Superheat { get; set; }
+ ///
+ /// 制热量Qh[W]
+ ///
+ [Name("制热量Qh[W]")]
+ public double HeatingCapacity { get; set; }
+
+ ///
+ /// 压缩机性能系数(制热)
+ ///
+ [Name("压缩机性能系数(制热)")]
+ public double COPHeat { get; set; }
+
+ ///
+ /// 等熵效率ns[%]
+ ///
+ [Name("等熵效率ns[%]")]
+ public double IsentrpEff { get; set; }
+
+ ///
+ /// 制冷量Qc[W]
+ ///
+ [Name("制冷量Qc[W]")]
+ public double CoolCapacity { get; set; }
+
+ ///
+ /// 压缩机性能系数(制冷)
+ ///
+ [Name("压缩机性能系数(制冷)")]
+ public double COPCool { get; set; }
+
+ ///
+ /// 容积效率nv[%]
+ ///
+ [Name("容积效率nv[%]")]
+ public double VoltricEff { get; set; }
+
///
/// 创建时间
///
diff --git a/CapMachine.Wpf/Models/CsvRecordModelMap.cs b/CapMachine.Wpf/Models/CsvRecordModelMap.cs
index 796136a..047f9e2 100644
--- a/CapMachine.Wpf/Models/CsvRecordModelMap.cs
+++ b/CapMachine.Wpf/Models/CsvRecordModelMap.cs
@@ -77,6 +77,13 @@ namespace CapMachine.Wpf.Models
Map(m => m.Dryness).Name("干度[%]");
Map(m => m.Subcooling).Name("过冷度[K]");
Map(m => m.Superheat).Name("过热度[K]");
+
+ Map(m => m.HeatingCapacity).Name("制热量Qh[W]").TypeConverterOption.Format("0");
+ Map(m => m.COPHeat).Name("压缩机性能系数(制热)").TypeConverterOption.Format("0.0");
+ Map(m => m.IsentrpEff).Name("等熵效率ns[%]").TypeConverterOption.Format("0.0");
+ Map(m => m.CoolCapacity).Name("制冷量Qc[W]").TypeConverterOption.Format("0");
+ Map(m => m.COPCool).Name("压缩机性能系数(制冷)").TypeConverterOption.Format("0.0");
+ Map(m => m.VoltricEff).Name("容积效率nv[%]").TypeConverterOption.Format("0.0");
Map(m => m.CreateTime).Name("时间");
diff --git a/CapMachine.Wpf/Services/PPCService.cs b/CapMachine.Wpf/Services/PPCService.cs
index f004db8..87fcf4f 100644
--- a/CapMachine.Wpf/Services/PPCService.cs
+++ b/CapMachine.Wpf/Services/PPCService.cs
@@ -10,8 +10,10 @@ using Prism.Events;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using SixLabors.ImageSharp.ColorSpaces;
+using System.Globalization;
using System.Collections.Generic;
using System.Text;
+using System.Text.RegularExpressions;
namespace CapMachine.Wpf.Services
{
@@ -23,7 +25,7 @@ namespace CapMachine.Wpf.Services
///
/// 计算扫描 Task
///
- private static Task CalcTask { get; set; }
+ private static Task CalcTask { get; set; } = Task.CompletedTask;
public ConfigService ConfigService { get; }
private IEventAggregator _EventAggregator { get; set; }
@@ -93,7 +95,8 @@ namespace CapMachine.Wpf.Services
//TxvFrTempTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前温度[℃]")!;
//TxvFrPressTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前压力[BarA]")!;
- if (TagManager.TryGetShortTagByName("SUBCOOL出口温度[℃]", out ShortValueTag? TxvFrTempShortTag))
+ if (TagManager.TryGetShortTagByName("膨胀阀前温度[℃]", out ShortValueTag? TxvFrTempShortTag) ||
+ TagManager.TryGetShortTagByName("SUBCOOL出口温度[℃]", out TxvFrTempShortTag))
{
TxvFrTempTag = TxvFrTempShortTag!;
}
@@ -150,6 +153,31 @@ namespace CapMachine.Wpf.Services
DrynessTag = drynessPct!;
}
+ if (TagManager.TryGetShortTagByName("制热量Qh[W]", out ShortValueTag? heatingCapacityTag))
+ {
+ HeatingCapacityTag = heatingCapacityTag!;
+ }
+ if (TagManager.TryGetShortTagByName("压缩机性能系数(制热)", out ShortValueTag? copHeatTag))
+ {
+ COPHeatTag = copHeatTag!;
+ }
+ if (TagManager.TryGetShortTagByName("等熵效率ns[%]", out ShortValueTag? isentrpEffTag))
+ {
+ IsentrpEffTag = isentrpEffTag!;
+ }
+ if (TagManager.TryGetShortTagByName("制冷量Qc[W]", out ShortValueTag? coolCapacityTag))
+ {
+ CoolCapacityTag = coolCapacityTag!;
+ }
+ if (TagManager.TryGetShortTagByName("压缩机性能系数(制冷)", out ShortValueTag? copCoolTag))
+ {
+ COPCoolTag = copCoolTag!;
+ }
+ if (TagManager.TryGetShortTagByName("容积效率nv[%]", out ShortValueTag? voltricEffTag))
+ {
+ VoltricEffTag = voltricEffTag!;
+ }
+
SuperHeatCoolConfig.FluidsPath = ConfigHelper.GetValue("FluidsPath");
SuperHeatCoolConfig.Cryogen = ConfigHelper.GetValue("Cryogen");
@@ -166,14 +194,14 @@ namespace CapMachine.Wpf.Services
///
public void SaveSuperHeatCoolConfig()
{
- ConfigHelper.SetValue("FluidsPath", SuperHeatCoolConfig.FluidsPath);
- ConfigHelper.SetValue("Cryogen", SuperHeatCoolConfig.Cryogen);
+ ConfigHelper.SetValue("FluidsPath", SuperHeatCoolConfig.FluidsPath ?? string.Empty);
+ ConfigHelper.SetValue("Cryogen", SuperHeatCoolConfig.Cryogen ?? string.Empty);
}
///
/// 吸气压力
///
- public ShortValueTag InhPressTag { get; set; }
+ public ShortValueTag InhPressTag { get; set; } = null!;
///
/// 转速标签
@@ -198,32 +226,44 @@ namespace CapMachine.Wpf.Services
///
/// 吸气温度
///
- public ShortValueTag InhTempTag { get; set; }
+ public ShortValueTag InhTempTag { get; set; } = null!;
///
/// 液体阀前温度
///
- public ShortValueTag TxvFrTempTag { get; set; }
+ public ShortValueTag TxvFrTempTag { get; set; } = null!;
///
/// 液体阀前压力
///
- public ShortValueTag TxvFrPressTag { get; set; }
+ public ShortValueTag TxvFrPressTag { get; set; } = null!;
///
/// 过热度
///
- public ShortValueTag Superheat { get; set; }
+ public ShortValueTag Superheat { get; set; } = null!;
///
/// 过冷度
///
- public ShortValueTag Subcool { get; set; }
+ public ShortValueTag Subcool { get; set; } = null!;
///
/// 干度(无量纲 [-])
///
- public ShortValueTag DrynessTag { get; set; }
+ public ShortValueTag DrynessTag { get; set; } = null!;
+
+ public ShortValueTag? HeatingCapacityTag { get; set; }
+
+ public ShortValueTag? COPHeatTag { get; set; }
+
+ public ShortValueTag? IsentrpEffTag { get; set; }
+
+ public ShortValueTag? CoolCapacityTag { get; set; }
+
+ public ShortValueTag? COPCoolTag { get; set; }
+
+ public ShortValueTag? VoltricEffTag { get; set; }
private double _DrynessTag2Value;
///
@@ -238,28 +278,28 @@ namespace CapMachine.Wpf.Services
///
/// 气路阀前压力(BarA)
///
- public ShortValueTag GasPreValvePressTag { get; set; }
+ public ShortValueTag GasPreValvePressTag { get; set; } = null!;
///
/// 气路阀前温度(℃)
///
- public ShortValueTag GasPreValveTempTag { get; set; }
+ public ShortValueTag GasPreValveTempTag { get; set; } = null!;
///
/// 冷媒流量kg/h
///
- public ShortValueTag VRVTag { get; set; }
+ public ShortValueTag VRVTag { get; set; } = null!;
///
/// 液体流量(kg/h)
/// 液冷媒流量kg/h=液体流量kg/h
///
- public ShortValueTag LiqRefFlowTag { get; set; }
+ public ShortValueTag LiqRefFlowTag { get; set; } = null!;
///
/// 润滑油流量(kg/h)
///
- public ShortValueTag LubeFlowTag { get; set; }
+ public ShortValueTag LubeFlowTag { get; set; } = null!;
///
/// 风量数据-乘以系数的后的最终结果
@@ -448,25 +488,25 @@ namespace CapMachine.Wpf.Services
// 处理 err2
}
- //if (TryUpdateThermodynamicSixResults(out var thermoErr))
- //{
- // if (!string.IsNullOrWhiteSpace(thermoErr))
- // {
- // Logger?.Error($"六个物性结果计算警告: {thermoErr}");
- // }
- //}
- //else
- //{
- // if (!string.IsNullOrWhiteSpace(thermoErr))
- // {
- // Logger?.Error($"六个物性结果计算失败: {thermoErr}");
- // }
- //}
+ if (TryUpdateThermodynamicSixResults(out var thermoErr))
+ {
+ if (!string.IsNullOrWhiteSpace(thermoErr))
+ {
+ Logger?.Error($"六个物性结果计算警告: {thermoErr}");
+ }
+ }
+ else
+ {
+ if (!string.IsNullOrWhiteSpace(thermoErr))
+ {
+ Logger?.Error($"六个物性结果计算失败: {thermoErr}");
+ }
+ }
}
catch (Exception ex)
{
- Logger.Error(String.Format("ErrSource : {0} ErrMsg : {1}", ex.StackTrace.ToString(), ex.Message.ToString()));
+ Logger.Error(String.Format("ErrSource : {0} ErrMsg : {1}", ex.StackTrace ?? string.Empty, ex.Message));
}
}
});
@@ -1159,6 +1199,17 @@ namespace CapMachine.Wpf.Services
{
error = string.Empty;
+ if (InhPressTag == null || InhTempTag == null)
+ {
+ error = "缺少吸气压力/吸气温度标签";
+ return false;
+ }
+ if (TxvFrPressTag == null || TxvFrTempTag == null)
+ {
+ error = "缺少膨胀阀前压力/膨胀阀前温度标签";
+ return false;
+ }
+
if (!TryGetCompressorPower_kW(out var w_kW, out var wErr))
{
error = wErr;
@@ -1217,6 +1268,27 @@ namespace CapMachine.Wpf.Services
COPCooling = copC;
IsentropicEfficiencyPct = etaS_pct;
+ if (HeatingCapacityTag != null)
+ {
+ HeatingCapacityTag.PVModel.EngValue = HeatingCapacityQh_kW * 1000.0;
+ }
+ if (COPHeatTag != null)
+ {
+ COPHeatTag.PVModel.EngValue = COPHeating;
+ }
+ if (IsentrpEffTag != null)
+ {
+ IsentrpEffTag.PVModel.EngValue = IsentropicEfficiencyPct;
+ }
+ if (CoolCapacityTag != null)
+ {
+ CoolCapacityTag.PVModel.EngValue = CoolingCapacityQc_kW * 1000.0;
+ }
+ if (COPCoolTag != null)
+ {
+ COPCoolTag.PVModel.EngValue = COPCooling;
+ }
+
if (!TryComputeVolumetricEfficiencyPct(mRef_kg_s, v1_m3kg, out var etaV_pct, out var etaVErr))
{
VolumetricEfficiencyPct = double.NaN;
@@ -1225,6 +1297,11 @@ namespace CapMachine.Wpf.Services
}
VolumetricEfficiencyPct = etaV_pct;
+
+ if (VoltricEffTag != null)
+ {
+ VoltricEffTag.PVModel.EngValue = VolumetricEfficiencyPct;
+ }
return true;
}
@@ -1269,6 +1346,17 @@ namespace CapMachine.Wpf.Services
mRef_kg_s = double.NaN;
error = string.Empty;
+ if (VRVTag == null)
+ {
+ error = "缺少总流量(冷媒流量)标签";
+ return false;
+ }
+ if (LubeFlowTag == null)
+ {
+ error = "缺少油流量标签";
+ return false;
+ }
+
double mTotal_kg_h = VRVTag.PVModel.EngValue;
double mOil_kg_h = LubeFlowTag.PVModel.EngValue;
@@ -1634,26 +1722,49 @@ namespace CapMachine.Wpf.Services
displacement_cc = double.NaN;
error = string.Empty;
+ const double defaultDisplacementCc = 35d;
+ if (ConfigService?.CurExpInfo != null &&
+ TryParseCompressorDisplacementTextToCc(ConfigService.CurExpInfo.CapDisplacement, out var expCc) &&
+ expCc > 0)
+ {
+ displacement_cc = expCc;
+ return true;
+ }
+
const string key = "CompressorDisplacementCc";
- if (!ConfigHelper.IsExist(key))
+ if (ConfigHelper.IsExist(key) && TryParseCompressorDisplacementTextToCc(ConfigHelper.GetValue(key), out var cfgCc) && cfgCc > 0)
+ {
+ displacement_cc = cfgCc;
+ return true;
+ }
+
+ displacement_cc = defaultDisplacementCc;
+ return true;
+ }
+
+ private static bool TryParseCompressorDisplacementTextToCc(string? text, out double displacementCc)
+ {
+ displacementCc = double.NaN;
+ if (string.IsNullOrWhiteSpace(text))
{
- error = $"未配置压缩机排量,请在 App.config/appSettings 增加 {key}(单位 cc)";
return false;
}
- string v = ConfigHelper.GetValue(key);
- if (!double.TryParse(v, out displacement_cc))
+ var normalized = text.Trim().ToLowerInvariant();
+ normalized = normalized.Replace(',', '.');
+
+ var match = Regex.Match(normalized, @"[-+]?\d+(\.\d+)?");
+ if (!match.Success)
{
- error = $"压缩机排量配置无法解析: {v}";
return false;
}
- if (displacement_cc <= 0)
+ if (!double.TryParse(match.Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var v))
{
- error = $"压缩机排量<=0: {displacement_cc}";
return false;
}
+ displacementCc = v;
return true;
}
diff --git a/CapMachine.Wpf/TagConfig/SysTags.json b/CapMachine.Wpf/TagConfig/SysTags.json
index 7efcea6..2568314 100644
--- a/CapMachine.Wpf/TagConfig/SysTags.json
+++ b/CapMachine.Wpf/TagConfig/SysTags.json
@@ -506,28 +506,28 @@
"BlockIndex": 44
}
},
- // {
- // "Id": 240,
- // "Name": "膨胀阀前温度[℃]",
- // "NameNoUnit": "膨胀阀前温度",
- // "EnName": "TxvFrTemp",
- // "Group": "采集",
- // "MinValue": 0,
- // "MaxValue": 10000,
- // "IsMeter": false,
- // "DecimalPoint": 1,
- // "Precision": 10,
- // "Unit": "℃",
- // "DataType": "Short",
- // "RWInfo": "PLCRead",
- // "PVModel": {
- // "Address": "VW15046",
- // "EngValue": 0,
- // "EngValueStr": "",
- // "Block": "PV",
- // "BlockIndex": 46
- // }
- // },
+ {
+ "Id": 240,
+ "Name": "膨胀阀前温度[℃]",
+ "NameNoUnit": "膨胀阀前温度",
+ "EnName": "TxvFrTemp",
+ "Group": "采集",
+ "MinValue": 0,
+ "MaxValue": 10000,
+ "IsMeter": false,
+ "DecimalPoint": 1,
+ "Precision": 10,
+ "Unit": "℃",
+ "DataType": "Short",
+ "RWInfo": "PLCRead",
+ "PVModel": {
+ "Address": "VW15046",
+ "EngValue": 0,
+ "EngValueStr": "",
+ "Block": "PV",
+ "BlockIndex": 46
+ }
+ },
{
"Id": 250,
"Name": "EVAP出口压力[BarA]",
@@ -1265,6 +1265,137 @@
"Block": "PV",
"BlockIndex": 112
}
+ },
+ {
+ "Id": 560,
+ "Name": "制热量Qh[W]",
+ "NameNoUnit": "制热量Qh",
+ "EnName": "HeatingCapacity",
+ "Group": "计算",
+ "MinValue": 0,
+ "MaxValue": 1000000,
+ "IsMeter": false,
+ "DecimalPoint": 0,
+ "Precision": 1,
+ "Unit": "W",
+ "DataType": "Short",
+ "RWInfo": "PCCalcu",
+ "PVModel": {
+ "Address": "",
+ "EngValue": 0,
+ "EngValueStr": "",
+ "Block": "PV",
+ "BlockIndex": 0
+ }
+ },
+ {
+ "Id": 570,
+ "Name": "压缩机性能系数(制热)",
+ "NameNoUnit": "压缩机性能系数(制热)",
+ "EnName": "COPHeat",
+ "Group": "计算",
+ "MinValue": 0,
+ "MaxValue": 1000,
+ "IsMeter": false,
+ "DecimalPoint": 3,
+ "Precision": 1,
+ "Unit": "",
+ "DataType": "Short",
+ "RWInfo": "PCCalcu",
+ "PVModel": {
+ "Address": "",
+ "EngValue": 0,
+ "EngValueStr": "",
+ "Block": "PV",
+ "BlockIndex": 0
+ }
+ },
+ {
+ "Id": 580,
+ "Name": "等熵效率ns[%]",
+ "NameNoUnit": "等熵效率ns",
+ "EnName": "IsentrpEff",
+ "Group": "计算",
+ "MinValue": 0,
+ "MaxValue": 100,
+ "IsMeter": false,
+ "DecimalPoint": 2,
+ "Precision": 1,
+ "Unit": "%",
+ "DataType": "Short",
+ "RWInfo": "PCCalcu",
+ "PVModel": {
+ "Address": "",
+ "EngValue": 0,
+ "EngValueStr": "",
+ "Block": "PV",
+ "BlockIndex": 0
+ }
+ },
+ {
+ "Id": 590,
+ "Name": "制冷量Qc[W]",
+ "NameNoUnit": "制冷量Qc",
+ "EnName": "CoolCapacity",
+ "Group": "计算",
+ "MinValue": 0,
+ "MaxValue": 1000000,
+ "IsMeter": false,
+ "DecimalPoint": 0,
+ "Precision": 1,
+ "Unit": "W",
+ "DataType": "Short",
+ "RWInfo": "PCCalcu",
+ "PVModel": {
+ "Address": "",
+ "EngValue": 0,
+ "EngValueStr": "",
+ "Block": "PV",
+ "BlockIndex": 0
+ }
+ },
+ {
+ "Id": 600,
+ "Name": "压缩机性能系数(制冷)",
+ "NameNoUnit": "压缩机性能系数(制冷)",
+ "EnName": "COPCool",
+ "Group": "计算",
+ "MinValue": 0,
+ "MaxValue": 1000,
+ "IsMeter": false,
+ "DecimalPoint": 3,
+ "Precision": 1,
+ "Unit": "",
+ "DataType": "Short",
+ "RWInfo": "PCCalcu",
+ "PVModel": {
+ "Address": "",
+ "EngValue": 0,
+ "EngValueStr": "",
+ "Block": "PV",
+ "BlockIndex": 0
+ }
+ },
+ {
+ "Id": 610,
+ "Name": "容积效率nv[%]",
+ "NameNoUnit": "容积效率nv",
+ "EnName": "VoltricEff",
+ "Group": "计算",
+ "MinValue": 0,
+ "MaxValue": 100,
+ "IsMeter": false,
+ "DecimalPoint": 2,
+ "Precision": 1,
+ "Unit": "%",
+ "DataType": "Short",
+ "RWInfo": "PCCalcu",
+ "PVModel": {
+ "Address": "",
+ "EngValue": 0,
+ "EngValueStr": "",
+ "Block": "PV",
+ "BlockIndex": 0
+ }
}
-]
-
\ No newline at end of file
+]
\ No newline at end of file
diff --git a/CapMachine.Wpf/Views/DialogExpInfoView.xaml b/CapMachine.Wpf/Views/DialogExpInfoView.xaml
index ae87d4c..b364101 100644
--- a/CapMachine.Wpf/Views/DialogExpInfoView.xaml
+++ b/CapMachine.Wpf/Views/DialogExpInfoView.xaml
@@ -125,6 +125,10 @@
Binding="{Binding CapNo}"
Header="压缩机编号"
IsReadOnly="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}" />
+