公式更改版本2603142118
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="connecting1" value="Data Source=192.168.40.2;user instance=false;Initial Catalog=FrontLineMachine;User ID=sa;Password=ABCabc123"/>
|
||||
<add key="connecting" value="Data Source=CT-PC;user instance=false;Encrypt=false;Initial Catalog=CapMachine;User ID=sa;Password=12345678"/>
|
||||
<add key="connecting" value="Data Source=DESKTOP-T7B3OHC\SQLEXPRESS;user instance=false;Encrypt=false;Initial Catalog=CapMachine;User ID=sa;Password=12345678"/>
|
||||
<add key="connecting2" value="Data Source=DESKTOP-94B7RIE\SQLEXPRESS;user instance=false;Encrypt=false;Initial Catalog=CapMachine;User ID=sa;Password=12345678"/>
|
||||
<add key="connecting5" value="Data Source=@Address@; Attachs=ems.db; Pooling=true;Min Pool Size=1"/>
|
||||
<add key="PLCScan" value="600"/>
|
||||
<add key="PLCIP" value="127.0.0.1"/>
|
||||
<add key="FluidsPath" value="C:\Program Files (x86)\REFPROP\fluids"/>
|
||||
<add key="FluidsPath" value="D:\fluids"/>
|
||||
<add key="Cryogen" value="R134a"/>
|
||||
<add key="LocalDBPath" value="D:\MSDB\LocalDb\CapMachineDb"/>
|
||||
</appSettings>
|
||||
|
||||
@@ -698,25 +698,21 @@
|
||||
<ProjectReference Include="..\CapMachine.Shared\CapMachine.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Arction.DirectX">
|
||||
<HintPath>C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.DirectX.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Arction.Licensing">
|
||||
<HintPath>C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.Licensing.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Arction.RenderingDefinitions">
|
||||
<HintPath>C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.RenderingDefinitions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Arction.Wpf.Charting.LightningChart">
|
||||
<HintPath>C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.Wpf.Charting.LightningChart.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Folder Include="LocalDll\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="LocalDll\" />
|
||||
<Reference Include="Arction.DirectX">
|
||||
<HintPath>..\..\..\TestApp\LightingChart\Arction.DirectX.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Arction.Licensing">
|
||||
<HintPath>..\..\..\TestApp\LightingChart\Arction.Licensing.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Arction.RenderingDefinitions">
|
||||
<HintPath>..\..\..\TestApp\LightingChart\Arction.RenderingDefinitions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Arction.Wpf.Charting.LightningChart">
|
||||
<HintPath>..\..\..\TestApp\LightingChart\Arction.Wpf.Charting.LightningChart.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Assets\Images\favicon.ico">
|
||||
|
||||
@@ -1157,28 +1157,106 @@ namespace CapMachine.Wpf.Services
|
||||
mRef_kg_s = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
double mTotal_kg_h = VRVTag.EngPvValue;
|
||||
double mOil_kg_h = LubeFlowTag.EngPvValue;
|
||||
if (!TryGetTotalMassFlow_kg_h(out var mTotal_kg_h, out var totalErr))
|
||||
{
|
||||
error = totalErr;
|
||||
return false;
|
||||
}
|
||||
if (!TryGetOilMassFlow_kg_h(out var mOil_kg_h, out var oilErr))
|
||||
{
|
||||
error = oilErr;
|
||||
return false;
|
||||
}
|
||||
if (!TryComputeRefrigerantMassFlow_kg_h(mTotal_kg_h, mOil_kg_h, out var mRef_kg_h, out var refErr))
|
||||
{
|
||||
error = refErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TryConvertMassFlow_kg_h_To_kg_s(mRef_kg_h, out mRef_kg_s, out error);
|
||||
}
|
||||
|
||||
private bool TryGetTotalMassFlow_kg_h(out double mTotal_kg_h, out string error)
|
||||
{
|
||||
mTotal_kg_h = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (VRVTag == null)
|
||||
{
|
||||
error = "缺少总流量(冷媒流量)标签";
|
||||
return false;
|
||||
}
|
||||
|
||||
mTotal_kg_h = VRVTag.EngPvValue;
|
||||
if (double.IsNaN(mTotal_kg_h) || double.IsInfinity(mTotal_kg_h))
|
||||
{
|
||||
error = "总流量(冷媒流量)为 NaN/Inf";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryGetOilMassFlow_kg_h(out double mOil_kg_h, out string error)
|
||||
{
|
||||
mOil_kg_h = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (LubeFlowTag == null)
|
||||
{
|
||||
error = "缺少油流量标签";
|
||||
return false;
|
||||
}
|
||||
|
||||
mOil_kg_h = LubeFlowTag.EngPvValue;
|
||||
if (double.IsNaN(mOil_kg_h) || double.IsInfinity(mOil_kg_h))
|
||||
{
|
||||
error = "油流量为 NaN/Inf";
|
||||
return false;
|
||||
}
|
||||
|
||||
double mRef_kg_h = mTotal_kg_h - mOil_kg_h;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryComputeRefrigerantMassFlow_kg_h(double mTotal_kg_h, double mOil_kg_h, out double mRef_kg_h, out string error)
|
||||
{
|
||||
mRef_kg_h = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (double.IsNaN(mTotal_kg_h) || double.IsInfinity(mTotal_kg_h))
|
||||
{
|
||||
error = "总流量(冷媒流量)为 NaN/Inf";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (double.IsNaN(mOil_kg_h) || double.IsInfinity(mOil_kg_h))
|
||||
{
|
||||
error = "油流量为 NaN/Inf";
|
||||
return false;
|
||||
}
|
||||
|
||||
mRef_kg_h = mTotal_kg_h - mOil_kg_h;
|
||||
if (mRef_kg_h <= 0)
|
||||
{
|
||||
error = $"冷媒质量流量<=0,总流量={mTotal_kg_h}kg/h,油流量={mOil_kg_h}kg/h";
|
||||
return false;
|
||||
}
|
||||
|
||||
mRef_kg_s = mRef_kg_h / 3600.0;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryConvertMassFlow_kg_h_To_kg_s(double massFlow_kg_h, out double massFlow_kg_s, out string error)
|
||||
{
|
||||
massFlow_kg_s = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (double.IsNaN(massFlow_kg_h) || double.IsInfinity(massFlow_kg_h) || massFlow_kg_h <= 0)
|
||||
{
|
||||
error = $"无效质量流量={massFlow_kg_h}kg/h";
|
||||
return false;
|
||||
}
|
||||
|
||||
massFlow_kg_s = massFlow_kg_h / 3600.0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1400,25 +1478,146 @@ namespace CapMachine.Wpf.Services
|
||||
copCooling = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (mRef_kg_s <= 0 || double.IsNaN(mRef_kg_s) || double.IsInfinity(mRef_kg_s))
|
||||
if (!TryComputeHeatingCapacityQh_kW(mRef_kg_s, h2_kJkg, h3_kJkg, out qh_kW, out var qhErr))
|
||||
{
|
||||
error = qhErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TryComputeCoolingCapacityQc_kW(mRef_kg_s, h1_kJkg, h3_kJkg, out qc_kW, out var qcErr))
|
||||
{
|
||||
error = qcErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TryComputeHeatingCOP(qh_kW, w_kW, out copHeating, out var copHErr))
|
||||
{
|
||||
error = copHErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TryComputeCoolingCOP(qc_kW, w_kW, out copCooling, out var copCErr))
|
||||
{
|
||||
error = copCErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryComputeEnthalpyDifference_kJkg(double minuend_kJkg, double subtrahend_kJkg, string quantityName, out double deltaH_kJkg, out string error)
|
||||
{
|
||||
deltaH_kJkg = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (double.IsNaN(minuend_kJkg) || double.IsInfinity(minuend_kJkg) || double.IsNaN(subtrahend_kJkg) || double.IsInfinity(subtrahend_kJkg))
|
||||
{
|
||||
error = $"{quantityName}输入存在 NaN/Inf";
|
||||
return false;
|
||||
}
|
||||
|
||||
deltaH_kJkg = minuend_kJkg - subtrahend_kJkg;
|
||||
if (double.IsNaN(deltaH_kJkg) || double.IsInfinity(deltaH_kJkg))
|
||||
{
|
||||
error = $"{quantityName}结果异常";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryComputeCapacity_kW(double mRef_kg_s, double deltaH_kJkg, string quantityName, out double capacity_kW, out string error)
|
||||
{
|
||||
capacity_kW = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (double.IsNaN(mRef_kg_s) || double.IsInfinity(mRef_kg_s) || mRef_kg_s <= 0)
|
||||
{
|
||||
error = "无效冷媒质量流量";
|
||||
return false;
|
||||
}
|
||||
if (w_kW <= 0 || double.IsNaN(w_kW) || double.IsInfinity(w_kW))
|
||||
|
||||
if (double.IsNaN(deltaH_kJkg) || double.IsInfinity(deltaH_kJkg))
|
||||
{
|
||||
error = $"{quantityName}焓差异常";
|
||||
return false;
|
||||
}
|
||||
|
||||
capacity_kW = mRef_kg_s * deltaH_kJkg;
|
||||
if (double.IsNaN(capacity_kW) || double.IsInfinity(capacity_kW))
|
||||
{
|
||||
error = $"{quantityName}结果异常";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryComputeHeatingCapacityQh_kW(double mRef_kg_s, double h2_kJkg, double h3_kJkg, out double qh_kW, out string error)
|
||||
{
|
||||
qh_kW = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (!TryComputeEnthalpyDifference_kJkg(h2_kJkg, h3_kJkg, "制热焓差(h2-h3)", out var deltaH_kJkg, out var deltaErr))
|
||||
{
|
||||
error = deltaErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TryComputeCapacity_kW(mRef_kg_s, deltaH_kJkg, "制热量Qh", out qh_kW, out error);
|
||||
}
|
||||
|
||||
private bool TryComputeCoolingCapacityQc_kW(double mRef_kg_s, double h1_kJkg, double h3_kJkg, out double qc_kW, out string error)
|
||||
{
|
||||
qc_kW = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (!TryComputeEnthalpyDifference_kJkg(h1_kJkg, h3_kJkg, "制冷焓差(h1-h3)", out var deltaH_kJkg, out var deltaErr))
|
||||
{
|
||||
error = deltaErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TryComputeCapacity_kW(mRef_kg_s, deltaH_kJkg, "制冷量Qc", out qc_kW, out error);
|
||||
}
|
||||
|
||||
private bool TryComputeCOP(double capacity_kW, double w_kW, string quantityName, out double cop, out string error)
|
||||
{
|
||||
cop = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (double.IsNaN(capacity_kW) || double.IsInfinity(capacity_kW))
|
||||
{
|
||||
error = $"{quantityName}输入异常";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (double.IsNaN(w_kW) || double.IsInfinity(w_kW) || w_kW <= 0)
|
||||
{
|
||||
error = "无效压缩机功率";
|
||||
return false;
|
||||
}
|
||||
|
||||
qh_kW = mRef_kg_s * (h2_kJkg - h3_kJkg);
|
||||
qc_kW = mRef_kg_s * (h1_kJkg - h3_kJkg);
|
||||
cop = capacity_kW / w_kW;
|
||||
if (double.IsNaN(cop) || double.IsInfinity(cop))
|
||||
{
|
||||
error = $"{quantityName}结果异常";
|
||||
return false;
|
||||
}
|
||||
|
||||
copHeating = qh_kW / w_kW;
|
||||
copCooling = qc_kW / w_kW;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryComputeHeatingCOP(double qh_kW, double w_kW, out double copHeating, out string error)
|
||||
{
|
||||
return TryComputeCOP(qh_kW, w_kW, "COP(制热)", out copHeating, out error);
|
||||
}
|
||||
|
||||
private bool TryComputeCoolingCOP(double qc_kW, double w_kW, out double copCooling, out string error)
|
||||
{
|
||||
return TryComputeCOP(qc_kW, w_kW, "COP(制冷)", out copCooling, out error);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按流程图计算等熵效率:
|
||||
/// <c>ηs[%] = (h2s - h1) / (h2 - h1) * 100</c>。
|
||||
@@ -1434,23 +1633,19 @@ namespace CapMachine.Wpf.Services
|
||||
etaS_pct = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
double denom = h2_kJkg - h1_kJkg;
|
||||
const double eps = 1e-9;
|
||||
if (Math.Abs(denom) < eps)
|
||||
if (!TryComputeEnthalpyDifference_kJkg(h2_kJkg, h1_kJkg, "实际压缩焓升(h2-h1)", out var actualRise_kJkg, out var actualErr))
|
||||
{
|
||||
error = "等熵效率分母(h2-h1)过小";
|
||||
error = actualErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
double eta = (h2s_kJkg - h1_kJkg) / denom;
|
||||
if (double.IsNaN(eta) || double.IsInfinity(eta))
|
||||
if (!TryComputeEnthalpyDifference_kJkg(h2s_kJkg, h1_kJkg, "等熵压缩焓升(h2s-h1)", out var isentropicRise_kJkg, out var isoErr))
|
||||
{
|
||||
error = "等熵效率结果异常";
|
||||
error = isoErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
etaS_pct = eta * 100.0;
|
||||
return true;
|
||||
return TryComputeEfficiencyPct(isentropicRise_kJkg, actualRise_kJkg, "等熵效率", out etaS_pct, out error);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1467,22 +1662,88 @@ namespace CapMachine.Wpf.Services
|
||||
etaV_pct = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (!TryGetCompressorSpeed_rpm(out var speed_rpm, out var speedErr))
|
||||
{
|
||||
error = speedErr;
|
||||
return false;
|
||||
}
|
||||
if (!TryGetCompressorDisplacement_cc(out var disp_cc, out var dispErr))
|
||||
{
|
||||
error = dispErr;
|
||||
return false;
|
||||
}
|
||||
if (!TryComputeSuctionVolumeFlow_m3_h(mRef_kg_s, v1_m3kg, out var suctionVolFlow_m3_h, out var suctionErr))
|
||||
{
|
||||
error = suctionErr;
|
||||
return false;
|
||||
}
|
||||
if (!TryComputeTheoreticalVolumeFlow_m3_h(speed_rpm, disp_cc, out var theoVolFlow_m3_h, out var theoErr))
|
||||
{
|
||||
error = theoErr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TryComputeEfficiencyPct(suctionVolFlow_m3_h, theoVolFlow_m3_h, "容积效率", out etaV_pct, out error);
|
||||
}
|
||||
|
||||
private bool TryComputeEfficiencyPct(double numerator, double denominator, string quantityName, out double efficiencyPct, out string error)
|
||||
{
|
||||
efficiencyPct = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (double.IsNaN(numerator) || double.IsInfinity(numerator))
|
||||
{
|
||||
error = $"{quantityName}分子异常";
|
||||
return false;
|
||||
}
|
||||
|
||||
const double eps = 1e-9;
|
||||
if (double.IsNaN(denominator) || double.IsInfinity(denominator) || Math.Abs(denominator) < eps)
|
||||
{
|
||||
error = $"{quantityName}分母过小或异常";
|
||||
return false;
|
||||
}
|
||||
|
||||
double efficiency = numerator / denominator;
|
||||
if (double.IsNaN(efficiency) || double.IsInfinity(efficiency))
|
||||
{
|
||||
error = $"{quantityName}结果异常";
|
||||
return false;
|
||||
}
|
||||
|
||||
efficiencyPct = efficiency * 100.0;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryGetCompressorSpeed_rpm(out double speed_rpm, out string error)
|
||||
{
|
||||
speed_rpm = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (SpeedTag == null)
|
||||
{
|
||||
error = "缺少转速标签";
|
||||
return false;
|
||||
}
|
||||
|
||||
double speed_rpm = SpeedTag.EngPvValue;
|
||||
speed_rpm = SpeedTag.EngPvValue;
|
||||
if (double.IsNaN(speed_rpm) || double.IsInfinity(speed_rpm) || speed_rpm <= 0)
|
||||
{
|
||||
error = $"无效转速: {speed_rpm} rpm";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TryGetCompressorDisplacement_cc(out var disp_cc, out var dispErr))
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryComputeSuctionVolumeFlow_m3_h(double mRef_kg_s, double v1_m3kg, out double suctionVolFlow_m3_h, out string error)
|
||||
{
|
||||
suctionVolFlow_m3_h = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (double.IsNaN(mRef_kg_s) || double.IsInfinity(mRef_kg_s) || mRef_kg_s <= 0)
|
||||
{
|
||||
error = dispErr;
|
||||
error = "无效冷媒质量流量";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1492,22 +1753,40 @@ namespace CapMachine.Wpf.Services
|
||||
return false;
|
||||
}
|
||||
|
||||
if (double.IsNaN(mRef_kg_s) || double.IsInfinity(mRef_kg_s) || mRef_kg_s <= 0)
|
||||
suctionVolFlow_m3_h = (mRef_kg_s * 3600.0) * v1_m3kg;
|
||||
if (double.IsNaN(suctionVolFlow_m3_h) || double.IsInfinity(suctionVolFlow_m3_h))
|
||||
{
|
||||
error = "无效冷媒质量流量";
|
||||
error = "实际吸气体积流量结果异常";
|
||||
return false;
|
||||
}
|
||||
|
||||
double suctionVolFlow_m3_h = (mRef_kg_s * 3600.0) * v1_m3kg;
|
||||
return true;
|
||||
}
|
||||
|
||||
double theoVolFlow_m3_h = (speed_rpm / 60.0) * disp_cc * 0.0036;
|
||||
if (theoVolFlow_m3_h <= 0)
|
||||
private bool TryComputeTheoreticalVolumeFlow_m3_h(double speed_rpm, double disp_cc, out double theoVolFlow_m3_h, out string error)
|
||||
{
|
||||
theoVolFlow_m3_h = double.NaN;
|
||||
error = string.Empty;
|
||||
|
||||
if (double.IsNaN(speed_rpm) || double.IsInfinity(speed_rpm) || speed_rpm <= 0)
|
||||
{
|
||||
error = $"无效转速: {speed_rpm} rpm";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (double.IsNaN(disp_cc) || double.IsInfinity(disp_cc) || disp_cc <= 0)
|
||||
{
|
||||
error = $"无效压缩机排量: {disp_cc} cc";
|
||||
return false;
|
||||
}
|
||||
|
||||
theoVolFlow_m3_h = (speed_rpm / 60.0) * disp_cc * 0.0036;
|
||||
if (double.IsNaN(theoVolFlow_m3_h) || double.IsInfinity(theoVolFlow_m3_h) || theoVolFlow_m3_h <= 0)
|
||||
{
|
||||
error = "理论吸气体积流量<=0";
|
||||
return false;
|
||||
}
|
||||
|
||||
etaV_pct = (suctionVolFlow_m3_h / theoVolFlow_m3_h) * 100.0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user