Upgrade - improved StandingStartMassCollection method by SLM requirements, added fixed delays, added residual flow delays
This commit is contained in:
parent
38973e0030
commit
6ac3ea87ef
@ -1,20 +1,22 @@
|
||||
///
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using log4net;
|
||||
using NHibernate.Action;
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Rig.RegisterReaders.PulsesFromUniCB;
|
||||
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication.common;
|
||||
using TBF.UiBridge;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.Rig.RegisterReaders.PulsesFromUniCB;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
{
|
||||
@ -113,6 +115,8 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
int delay;
|
||||
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
@ -150,7 +154,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
int totalPulses = Convert.ToInt32(test.Volume / outPath.FlowMeter.LtrPerPulse);
|
||||
|
||||
log.InfoFormat(
|
||||
"{0}({1}) : Test starting (Repetition {2}, LastRepetition={3}, PumpPower={4})",
|
||||
"{0}({1}) : Test starting... (Repetition {2}, LastRepetition={3}, PumpPower={4})",
|
||||
test.Method,
|
||||
test.Name,
|
||||
repetitionNr,
|
||||
@ -338,8 +342,8 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.SetFlowOp(test.QfromM3ph(), test.QtoM3ph(), RefFlow, FlowSettingTimeoutSec))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(cBrd.SetFlowOp(test.QfromM3ph(), test.QtoM3ph(), RefFlow, FlowSettingTimeoutSec))//...develop: step 1
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@ -473,8 +477,8 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Close the start/stop valve before measuring the start mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.CloseStartValveOp())
|
||||
.EnterState();
|
||||
.AddOperation(cBrd.CloseStartValveOp())//...develop: step 2
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
@ -482,10 +486,38 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
///...MF
|
||||
///-----------------
|
||||
delay = 5;
|
||||
//if (test.TimePump2StartV > 0)
|
||||
//{
|
||||
State.Create(string.Format("{0}({1}) : Delay 5s", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(delay)) //...develop: step 3
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
/// Show remaining time
|
||||
if ((delay = Math.Max(delay, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", "Delay", delay / 60, "min", delay % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", "Delay", delay));
|
||||
|
||||
if (delay > 0)
|
||||
delay--;
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
//}
|
||||
///-----------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Start the standing start/stop test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)
|
||||
.AddOperation(testInProgress) //...develop: step 4 --> diverter switch to the mass
|
||||
.EnterState();
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
@ -494,6 +526,36 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
///...MF
|
||||
///-----------------
|
||||
delay = test.TimeFlow2Mass;
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Delay for meters stabilization <T flow stab. - start = {2}s> ", test.Method, test.Name, delay))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)
|
||||
.AddOperation(new Operations.TimerOp(delay)) //...develop: step 5
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
/// Show remaining time
|
||||
if ((delay = Math.Max(delay, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", "Delay", delay / 60, "min", delay % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", "Delay", delay));
|
||||
|
||||
if(delay>0)
|
||||
delay--;
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
|
||||
int time = StateMachine.Time;
|
||||
double currentFlow = RefFlow.Val;
|
||||
|
||||
@ -511,6 +573,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
///
|
||||
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
|
||||
IOperation readStartMassOp = scale.ReadStableMassOp(ref StartMass, test.TimeFlow2Mass, test.MassMethod, test.MassRepeats, test.MassSpread);
|
||||
IOperation readStopMassOp = scale.ReadStableMassOp(ref StartMass, test.TimeStop2Mass, test.MassMethod, test.MassRepeats, test.MassSpread);
|
||||
|
||||
if (dataEntryCmpnt != null)
|
||||
{
|
||||
@ -525,8 +588,8 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
State state2 = State.Create(string.Format("{0}({1}) : Grab images", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(readStartMassOp)
|
||||
.AddOperation(testInProgress)
|
||||
//.AddOperation(readStartMassOp)//...MF presuvam do nasledujucej serie
|
||||
.AddOperation(testInProgress)//...nevhodne prepina diverter
|
||||
.AddOperation(processDataLoggingOp);
|
||||
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
@ -576,22 +639,33 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
string.Format("{0}({1}) : Grabbing images - valve close", test.Method, test.Name));
|
||||
}
|
||||
///////
|
||||
|
||||
|
||||
delay = test.TimeStop2Mass;
|
||||
|
||||
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
|
||||
long readStartTime = StateMachine.Time;
|
||||
State.Create(string.Format("{0}({1}) : Enter start states of water meters", test.Method, test.Name))
|
||||
State.Create(string.Format("{0}({1}) : Enter start states of water meters and Measuring the start mass after residual flow <T stop-mass msrmt time = {2}s>", test.Method, test.Name, test.TimeStop2Mass))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)
|
||||
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
|
||||
.AddOperation(testInProgress)//...nevhodne prepina diverter
|
||||
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))//...develop: half of step 6
|
||||
.AddOperation(readStopMassOp) //...develop: half of step 6
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
/// Show remaining time
|
||||
if ((delay = Math.Max(delay, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", "Delay", delay / 60, "min", delay % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", "Delay", delay));
|
||||
|
||||
if (delay > 0)
|
||||
delay--;
|
||||
}
|
||||
while (!e.Contains(Event.ModelessFormClosed));
|
||||
while (!e.Contains(Event.ModelessFormClosed) || !e.Contains(Event.ScaleDone));
|
||||
long readEndTime = StateMachine.Time;
|
||||
|
||||
log.Debug("Read poseidon - took:" + (readEndTime - readStartTime));
|
||||
@ -672,12 +746,11 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
}
|
||||
}
|
||||
|
||||
//dripping on the scale - using of time constant for delay for measuring
|
||||
State.Create(string.Format("{0}({1}) : Measure the start mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.TimeFlow2Mass, test.MassMethod, test.MassRepeats, test.MassSpread))
|
||||
.AddOperation(testInProgress)//...nevhodne prepina diverter
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, 0, test.MassMethod, test.MassRepeats, test.MassSpread))//...develop: step 8
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@ -699,7 +772,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Measure the start mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)
|
||||
.AddOperation(testInProgress)//...nevhodne prepina diverter
|
||||
//.AddOperation(readStartMassOp)
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.TimeFlow2Mass, test.MassMethod, test.MassRepeats, test.MassSpread))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
@ -733,7 +806,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
/// Measurement loop preparation
|
||||
TestStartTime = DateTime.Now;
|
||||
StartTime = (double)StateMachine.Time;
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
int estimtdEndTime = StateMachine.Time + Convert.ToInt32(test.TestTime);
|
||||
int remainingTime;
|
||||
StartNewStatistics(outPath.FlowMeter, BatchRslts.Batch.BatchNr, test, repetitionNr, Math.Max((int)(test.TestTime / 10), 5));
|
||||
|
||||
@ -742,10 +815,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Start the test, open the start/stop valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.OpenStartValveOp(timeStampStart, startSwitchTime))
|
||||
.AddOperation(cBrd.OpenStartValveOp(timeStampStart, startSwitchTime)) //...develop: step 9
|
||||
.AddOperation(testInProgress)
|
||||
.AddOperation(controlFlowOp)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(processDataLoggingOp)//...develop: step 10, step 11
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@ -759,6 +832,9 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
|
||||
if (delay > 0)
|
||||
delay--;
|
||||
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
@ -803,7 +879,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)
|
||||
.AddOperation(cBrd.CloseStartValveOp(timeStampEnd, stopSwitchTime))
|
||||
.AddOperation(cBrd.CloseStartValveOp(timeStampEnd, stopSwitchTime))//...develop: step 12
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
@ -814,6 +890,38 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
|
||||
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
|
||||
|
||||
///...MF
|
||||
///-----------------
|
||||
delay = test.TimeStop2Mass;
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Delay before end mass measuring <T stop-mass msrmt time = {2}s>", test.Method, test.Name, delay))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)
|
||||
.AddOperation(new Operations.TimerOp(delay)) //...develop: step 13
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
/// Show remaining time
|
||||
if ((delay = Math.Max(delay, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", "Delay", delay / 60, "min", delay % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", "Delay", delay));
|
||||
|
||||
if (delay > 0)
|
||||
delay--;
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
|
||||
|
||||
if (heatMetersPath == null)
|
||||
LogProcessDataHeader(processDataLogger, "End mass");
|
||||
else
|
||||
@ -822,11 +930,14 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
|
||||
/*
|
||||
delay = test.TimeStop2Mass;
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Measuring the end mass after residual flow <T stop-mass msrmt time = {2}s>", test.Method, test.Name, delay))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)
|
||||
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.TimeStop2Mass, test.MassMethod, test.MassRepeats, test.MassSpread))
|
||||
//.AddOperation(testInProgress)...nevhodne prepina diverter
|
||||
.AddOperation(scale.ReadStableMassOp(ref EndMass, delay, test.MassMethod, test.MassRepeats, test.MassSpread))//...develop: step 13
|
||||
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@ -840,26 +951,20 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
retVal = Event.RecoverableError;
|
||||
goto stopTest;
|
||||
}
|
||||
|
||||
/// Show remaining time
|
||||
if ((delay = Math.Max(delay, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", "Delay", delay / 60, "min", delay % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", "Delay", delay));
|
||||
|
||||
if (delay > 0)
|
||||
delay--;
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone) && !e.Contains(Event.Next));
|
||||
while (!e.Contains(Event.ScaleDone) && !e.Contains(Event.Next));*/
|
||||
///
|
||||
tMass2 = StateMachine.Time;
|
||||
|
||||
if (test.DoDrainingAfter)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.SetValvesOp(scale.DrainValve, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
}
|
||||
|
||||
|
||||
double massStart = MeasurementCorrection.CorrectedValue(StartMass.Val, scale.Corrections);
|
||||
double massEnd = MeasurementCorrection.CorrectedValue(EndMass.Val, scale.Corrections);
|
||||
double densityOut = Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
|
||||
@ -1037,6 +1142,20 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
}
|
||||
}
|
||||
|
||||
if (test.DoDrainingAfter)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.SetValvesOp(scale.DrainValve, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user