更新
This commit is contained in:
@@ -14,6 +14,7 @@ public sealed class ExperimentDataService : IExperimentDataService
|
||||
private double? _initialMass;
|
||||
private double _accumulatedTotalHeatRelease;
|
||||
private double _accumulatedTotalSmoke;
|
||||
private int? _lastAccumulationSeconds;
|
||||
private bool _isTestRunning;
|
||||
|
||||
public ExperimentDataService(IRealtimeDataService realtimeDataService)
|
||||
@@ -90,14 +91,39 @@ public sealed class ExperimentDataService : IExperimentDataService
|
||||
};
|
||||
}
|
||||
|
||||
if (double.IsFinite(snapshot.HeatReleaseRate))
|
||||
if (snapshot.TestSeconds < 0)
|
||||
{
|
||||
_accumulatedTotalHeatRelease += snapshot.HeatReleaseRate;
|
||||
return snapshot with
|
||||
{
|
||||
TotalHeatRelease = _accumulatedTotalHeatRelease,
|
||||
TotalSmoke = _accumulatedTotalSmoke
|
||||
};
|
||||
}
|
||||
|
||||
if (double.IsFinite(snapshot.SmokeProduction))
|
||||
if (!_lastAccumulationSeconds.HasValue)
|
||||
{
|
||||
_accumulatedTotalSmoke += snapshot.SmokeProduction;
|
||||
_lastAccumulationSeconds = snapshot.TestSeconds;
|
||||
return snapshot with
|
||||
{
|
||||
TotalHeatRelease = _accumulatedTotalHeatRelease,
|
||||
TotalSmoke = _accumulatedTotalSmoke
|
||||
};
|
||||
}
|
||||
|
||||
var deltaSeconds = snapshot.TestSeconds - _lastAccumulationSeconds.Value;
|
||||
if (deltaSeconds > 0)
|
||||
{
|
||||
if (double.IsFinite(snapshot.HeatReleaseRate))
|
||||
{
|
||||
_accumulatedTotalHeatRelease += snapshot.HeatReleaseRate * deltaSeconds;
|
||||
}
|
||||
|
||||
if (double.IsFinite(snapshot.SmokeProduction))
|
||||
{
|
||||
_accumulatedTotalSmoke += snapshot.SmokeProduction * deltaSeconds;
|
||||
}
|
||||
|
||||
_lastAccumulationSeconds = snapshot.TestSeconds;
|
||||
}
|
||||
|
||||
return snapshot with
|
||||
@@ -137,5 +163,6 @@ public sealed class ExperimentDataService : IExperimentDataService
|
||||
_initialMass = null;
|
||||
_accumulatedTotalHeatRelease = 0;
|
||||
_accumulatedTotalSmoke = 0;
|
||||
_lastAccumulationSeconds = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public sealed class ModbusRealtimeDataService : IRealtimeDataService
|
||||
private const ushort HeatReleaseRateRegister = 354;
|
||||
private const ushort Qa180Register = 366;
|
||||
private const ushort Qa300Register = 370;
|
||||
private const ushort SmokeProductionRegister = 390;
|
||||
private const ushort SmokeProductionRegister = 392;
|
||||
private const ushort IgnitionSecondsRegister = 1014;
|
||||
private const ushort TestSecondsRegister = 1015;
|
||||
private const ushort FlameDetectedCoil = 3;
|
||||
|
||||
@@ -206,7 +206,7 @@ public sealed class TestPageViewModel : PageViewModel
|
||||
HeatMetrics[1].SetValue(snapshot.Qa180);
|
||||
HeatMetrics[2].SetValue(snapshot.Qa300);
|
||||
HeatMetrics[3].SetValue(snapshot.TotalHeatRelease);
|
||||
HeatMetrics[4].SetValue(snapshot.SmokeProduction);
|
||||
HeatMetrics[4].SetValue(snapshot.TotalSmoke);
|
||||
HeatMetrics[5].SetValue(snapshot.CurrentMass);
|
||||
HeatMetrics[6].SetValue(snapshot.MassLoss);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user