EnduranceDataLogging - initial version, ver. 2.12.416

This commit is contained in:
Milan Hanajik
2016-12-12 00:01:25 +01:00
parent da4b5a50a7
commit 7dc42fb900
5 changed files with 98 additions and 5 deletions
@@ -0,0 +1,40 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using TBF.BenchControl.Sequences;
namespace TBF.BenchControl.Operations
{
public class EnduranceDataLoggingOp : IOperation
{
StreamWriter writer;
SequenceBase sequenceBase;
bool heatMeters;
public EnduranceDataLoggingOp(StreamWriter writer, SequenceBase sequenceBase)
{
this.writer = writer;
this.sequenceBase = sequenceBase;
}
public void Start()
{
sequenceBase.LogEnduranceData(writer);
}
public Event Run()
{
sequenceBase.LogEnduranceData(writer);
return Event.None;
}
public void Stop()
{
writer.Flush();
}
}
}
@@ -67,6 +67,7 @@ namespace TBF.BenchControl.Sequences
protected IOperation checkUiOp;
protected IOperation processDataLoggingOp;
protected IOperation enduranceDataLoggingOp;
///
@@ -141,6 +142,34 @@ namespace TBF.BenchControl.Sequences
TempRefLo2);
}
///
/// Endurance data logging
///
public void LogEnduranceHeader(System.IO.StreamWriter writer)
{
LogEnduranceHeader(writer, null);
}
public void LogEnduranceHeader(System.IO.StreamWriter writer, string sectionName)
{
writer.WriteLine();
if (sectionName != null)
writer.Write(sectionName);
writer.WriteLine("Time T_up T_dn Pr_up Pr_dn Flow");
}
public void LogEnduranceData(System.IO.StreamWriter writer)
{
writer.WriteLine(string.Format("{0:dd.MM.yyyy HH:mm.ss} {1} {2} {3} {4} {5}",
DateTime.Now,
TempUp,
TempDown,
PressUp,
PressDown,
RefFlow));
}
protected Event EmptyTheTank(IValve emptyTankValve, IBalance balance)
{
@@ -38,6 +38,24 @@ namespace TBF.BenchControl.TestMethods.Endurance
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
string enduranceLogDir = string.Format("C:\\TBF\\Results\\{0:yyyy}\\{0:MM}\\{0:dd}\\", BatchRslts.Batch.StartTime);
string enduranceLogName = string.Format("{0}{1:HHmm}.txt", enduranceLogDir, BatchRslts.Batch.StartTime);
System.IO.Directory.CreateDirectory(enduranceLogDir);
try
{
bool writeHeader = !System.IO.File.Exists(enduranceLogName);
System.IO.StreamWriter writer = new System.IO.StreamWriter(enduranceLogName, true);
enduranceDataLoggingOp = new TBF.BenchControl.Operations.EnduranceDataLoggingOp(writer, this);
if (writeHeader)
LogEnduranceHeader(writer);
}
catch
{
enduranceDataLoggingOp = null;
}
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
@@ -158,7 +176,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperations(measureOperations)
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
.AddOperation(enduranceDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, (float)test.TolerRed))
.EnterState();
do
@@ -203,7 +222,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
: null)
.AddOperation(queryEnd1)
.AddOperation(processDataLoggingOp)
.EnterState();
.AddOperation(enduranceDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
@@ -442,6 +462,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleParamsUpload, Elde.Command.None, 0))
.EnterState();
do
@@ -471,6 +492,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleStart, Elde.Command.EnduranceCycleStop, 0))
.EnterState();
do
@@ -520,7 +542,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.EnterState();
.AddOperation(enduranceDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.12.415.1")]
[assembly: AssemblyFileVersion("2.12.415.1")]
[assembly: AssemblyVersion("2.12.416.1")]
[assembly: AssemblyFileVersion("2.12.416.1")]
+1
View File
@@ -491,6 +491,7 @@
</Compile>
<Compile Include="BenchControl\Modbus\QuidoRS\Factory.cs" />
<Compile Include="BenchControl\Modbus\QuidoRS\SetOutputsOp.cs" />
<Compile Include="BenchControl\Operations\EnduranceDataLoggingOp.cs" />
<Compile Include="BenchControl\Operations\EnthalpyCalculationOp.cs" />
<Compile Include="BenchControl\Output\FileWriters\Basic\FactoryCompound.cs" />
<Compile Include="BenchControl\Output\FileWriters\Basic\FactoryHeatMeters.cs" />