CSV 的报错的更改
This commit is contained in:
@@ -122,13 +122,13 @@ namespace CapMachine.Wpf.Services
|
||||
new Columns(){ Name="OS1温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="OS2温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="COND2温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="EVAP出口温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
//new Columns(){ Name="EVAP出口温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="冷媒流量[kg/h]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="润滑油流量[kg/h]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="排气温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="膨胀阀前压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="膨胀阀前温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="EVAP出口压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
//new Columns(){ Name="EVAP出口压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="腔内压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="压缩机表面温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="PTC流量[L/min]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
@@ -149,27 +149,27 @@ namespace CapMachine.Wpf.Services
|
||||
new Columns(){ Name="通讯PTC膜温[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="通讯PTC模块温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="液冷媒流量[kg/h]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="干度流量[kg/h]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
//new Columns(){ Name="干度流量[kg/h]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="H5吸气混合器温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="COND循环水温[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="SUBCOOL出口温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="吸气混合器出口温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="H1出口温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="S.C循环水温[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="EVAP循环水温[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
//new Columns(){ Name="EVAP循环水温[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="吸气混合器出口压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
|
||||
new Columns(){ Name="气路阀前压力[BarA]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="气路阀前温度[℃]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="干度[%]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="干度[-]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="过冷度[K]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="过热度[K]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
|
||||
new Columns(){ Name="制热量Qh[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="压缩机性能系数(制热)",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="压缩机性能系数(制热COP)",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="等熵效率ns[%]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="制冷量Qc[W]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="压缩机性能系数(制冷)",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="压缩机性能系数(制冷COP)",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
new Columns(){ Name="容积效率nv[%]",MapType=typeof(float).ToString(),IsIdentity=false,IsPrimary=false},
|
||||
|
||||
new Columns(){ Name="创建时间",MapType="System.DateTime",IsIdentity=false,IsPrimary=false},
|
||||
@@ -704,12 +704,9 @@ namespace CapMachine.Wpf.Services
|
||||
private static readonly HashSet<string> ExcludedCsvHeaderNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"EVAP出口温度[℃]",
|
||||
"EVAP出口温度[°C]",
|
||||
"EVAP出口压力[BarA]",
|
||||
"干度流量[kg/h]",
|
||||
"干度流量[kq/h]",
|
||||
"EVAP循环水温[℃]",
|
||||
"EVAP循坏水温[℃]",
|
||||
};
|
||||
|
||||
private static readonly object CsvSchemaRewriteLock = new object();
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace CapMachine.Wpf.Services
|
||||
public MachineRtDataService MachineRtDataService { get; }
|
||||
private readonly EnthalpyDrynessCalculator _enthalpyDrynessCalculator;
|
||||
private readonly ThermodynamicSixResultsCalculator _thermodynamicSixResultsCalculator;
|
||||
private readonly SuperheatSubcoolCalculator _superheatSubcoolCalculator;
|
||||
|
||||
/// <summary>
|
||||
/// 标签中心
|
||||
@@ -41,6 +42,7 @@ namespace CapMachine.Wpf.Services
|
||||
MachineRtDataService = machineRtDataService;
|
||||
_enthalpyDrynessCalculator = new EnthalpyDrynessCalculator(_refpropLock);
|
||||
_thermodynamicSixResultsCalculator = new ThermodynamicSixResultsCalculator(_refpropLock);
|
||||
_superheatSubcoolCalculator = new SuperheatSubcoolCalculator(_refpropLock);
|
||||
TagManager = MachineRtDataService.TagManger;
|
||||
|
||||
if (TagManager.TryGetShortTagByName("转速[rpm]", out ShortValueTag? speedShortTag))
|
||||
@@ -130,7 +132,7 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
|
||||
// 干度标签(如不存在则仅跳过写入,不抛异常)。优先使用“干度[%]”,其次“干度[-]”。
|
||||
if (TagManager.TryGetShortTagByName("干度[%]", out ShortValueTag? drynessPct))
|
||||
if (TagManager.TryGetShortTagByName("干度[-]", out ShortValueTag? drynessPct))
|
||||
{
|
||||
DrynessTag = drynessPct!;
|
||||
}
|
||||
@@ -139,7 +141,7 @@ namespace CapMachine.Wpf.Services
|
||||
{
|
||||
HeatingCapacityTag = heatingCapacityTag!;
|
||||
}
|
||||
if (TagManager.TryGetShortTagByName("压缩机性能系数(制热)", out ShortValueTag? copHeatTag))
|
||||
if (TagManager.TryGetShortTagByName("压缩机性能系数(制热COP)", out ShortValueTag? copHeatTag))
|
||||
{
|
||||
COPHeatTag = copHeatTag!;
|
||||
}
|
||||
@@ -151,7 +153,7 @@ namespace CapMachine.Wpf.Services
|
||||
{
|
||||
CoolCapacityTag = coolCapacityTag!;
|
||||
}
|
||||
if (TagManager.TryGetShortTagByName("压缩机性能系数(制冷)", out ShortValueTag? copCoolTag))
|
||||
if (TagManager.TryGetShortTagByName("压缩机性能系数(制冷COP)", out ShortValueTag? copCoolTag))
|
||||
{
|
||||
COPCoolTag = copCoolTag!;
|
||||
}
|
||||
@@ -302,15 +304,8 @@ namespace CapMachine.Wpf.Services
|
||||
try
|
||||
{
|
||||
|
||||
long iErr, kph = 1;
|
||||
|
||||
double te = 0.0, te1 = 0.0, p = 0.0, p1 = 0.0, d = 0.0, Dl = 0.0, Dv = 0.0, q = 0.0, h = 0.0, ee = 0.0, hh = 0.0, ss = 0.0, cp = 0.0, cv = 0.0, w = 0.0;
|
||||
double[] x = new double[20], xliq = new double[20], xvap = new double[20];
|
||||
double[] xlkg = new double[20], xvkg = new double[20];
|
||||
|
||||
double tk = 0.0, wm = 0.0, prevDeltaH = 0.0;//prevDeltaH 未使用
|
||||
|
||||
//textBox5.Text = "";
|
||||
double[] x = new double[20];
|
||||
double wm = 0.0;
|
||||
|
||||
// 幂等初始化:仅首次或工质/路径变化时执行 SETPATH/SETUP,提高每秒循环效率
|
||||
if (!EnsureRefpropInitialized(out var initErr))
|
||||
@@ -324,33 +319,7 @@ namespace CapMachine.Wpf.Services
|
||||
x[0] = 1.0;
|
||||
IRefProp64.WMOLdll(x, ref wm);
|
||||
|
||||
//p = Convert.ToDouble(textBox2.Text) * 1000.0;//textBox2 Comp.吸气压力(kpa)
|
||||
p = (InhPressTag.PVModel.EngValue) * 100.0;// 保持你原有流程:将 BarA 当作 MPa? 历史代码为 *1000.0,不改变你的算法
|
||||
kph = 1;
|
||||
|
||||
p1 = (TxvFrPressTag.PVModel.EngValue) * 100.0;// 保持你原有流程
|
||||
//p1 = Convert.ToDouble(textBox3.Text) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
||||
// 统一放入同一把锁中,避免并发导致的 Fortran 读文件/状态竞态
|
||||
string herr = new string(' ', 255); long herrLen = 255; iErr = 0;
|
||||
lock (_refpropLock)
|
||||
{
|
||||
IRefProp64.SATPdll(ref p, x, ref kph, ref te, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
||||
}
|
||||
|
||||
if (iErr == 0)
|
||||
Superheat.PVModel.EngValue = Math.Abs(InhTempTag.PVModel.EngValue - (te - 273.15));
|
||||
else
|
||||
Superheat.PVModel.EngValue = 0;
|
||||
|
||||
herr = new string(' ', 255); herrLen = 255; iErr = 0;
|
||||
lock (_refpropLock)
|
||||
{
|
||||
IRefProp64.SATPdll(ref p1, x, ref kph, ref te1, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
||||
}
|
||||
if (iErr == 0)
|
||||
Subcool.PVModel.EngValue = Math.Abs(TxvFrTempTag.PVModel.EngValue - (te1 - 273.15));
|
||||
else
|
||||
Subcool.PVModel.EngValue = 0;
|
||||
UpdateSuperheatAndSubcool_BySatp();
|
||||
|
||||
|
||||
//这里写死干度的输入数据
|
||||
@@ -363,7 +332,7 @@ namespace CapMachine.Wpf.Services
|
||||
double vrvFlowKgPerH = VRVTag.PVModel.EngValue;
|
||||
double liqRefFlowKgPerH = LiqRefFlowTag.PVModel.EngValue;
|
||||
double lubeFlowKgPerH = 0.0;
|
||||
|
||||
|
||||
|
||||
//干度技术
|
||||
|
||||
@@ -383,7 +352,8 @@ namespace CapMachine.Wpf.Services
|
||||
{
|
||||
if (DrynessTag != null)
|
||||
{
|
||||
DrynessTag.PVModel.EngValue = drynessResult.Dryness1_01 * 100.0;
|
||||
//DrynessTag.PVModel.EngValue = drynessResult.Dryness1_01 * 100.0;
|
||||
DrynessTag.PVModel.EngValue = Math.Round(drynessResult.Dryness1_01, 4);
|
||||
}
|
||||
//DrynessTag2Value = drynessResult.Dryness1_01 * 100.0;
|
||||
|
||||
@@ -422,7 +392,7 @@ namespace CapMachine.Wpf.Services
|
||||
if (drynessResult.IsDryness2Success)
|
||||
{
|
||||
//DrynessTag.PVModel.EngValue = drynessResult.Dryness2_01 * 100.0;
|
||||
DrynessTag2Value = drynessResult.Dryness2_01 * 100.0;
|
||||
DrynessTag2Value = Math.Round(drynessResult.Dryness2_01,4) ;
|
||||
//if (drynessResult.Dryness2_01 <= 0)
|
||||
//{
|
||||
// LogDrynessSnapshotIfNeeded(
|
||||
@@ -486,6 +456,20 @@ namespace CapMachine.Wpf.Services
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateSuperheatAndSubcool_BySatp()
|
||||
{
|
||||
_superheatSubcoolCalculator.Calculate(
|
||||
inhPressBarA: InhPressTag.PVModel.EngValue,
|
||||
inhTempC: InhTempTag.PVModel.EngValue,
|
||||
txvFrPressBarA: TxvFrPressTag.PVModel.EngValue,
|
||||
txvFrTempC: TxvFrTempTag.PVModel.EngValue,
|
||||
out var superheatK,
|
||||
out var subcoolK);
|
||||
|
||||
Superheat.PVModel.EngValue = superheatK;
|
||||
Subcool.PVModel.EngValue = subcoolK;
|
||||
}
|
||||
|
||||
// 若类中尚未定义,请添加全局互斥锁,串行化所有 REFPROP 调用
|
||||
private static readonly object _refpropLock = new object();
|
||||
|
||||
@@ -664,7 +648,7 @@ namespace CapMachine.Wpf.Services
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
double suctionPress_BarA = InhPressTag.PVModel.EngValue;
|
||||
double suctionTemp_C = InhTempTag.PVModel.EngValue;
|
||||
|
||||
Reference in New Issue
Block a user