Compare commits
4 Commits
38d28599ad
...
6ac3ea87ef
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ac3ea87ef | |||
| 38973e0030 | |||
| 37c89a4c9c | |||
| 0075362f92 |
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.9.3069.1")]
|
||||
[assembly: AssemblyFileVersion("3.9.3069.1")]
|
||||
[assembly: AssemblyVersion("3.9.3069.8")]
|
||||
[assembly: AssemblyFileVersion("3.9.3069.8")]
|
||||
|
||||
@ -10,7 +10,8 @@ namespace TBF.Rig
|
||||
{
|
||||
Valid,
|
||||
Overload,
|
||||
Failed,
|
||||
Underload,
|
||||
Failed,
|
||||
Busy,
|
||||
Busy1, ///
|
||||
Busy2, /// Used by Mettler-Toledo Multi to distinguish which scale was queried
|
||||
@ -86,6 +87,7 @@ namespace TBF.Rig
|
||||
|
||||
AmbientDone,
|
||||
ScaleDone,
|
||||
ScaleUnderload,
|
||||
ScaleOverload,
|
||||
ScaleTimeout,
|
||||
PressureDone,
|
||||
|
||||
@ -34,12 +34,14 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
bool measurementCompleted;
|
||||
int timeout;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="scale">Balance device instance</param>
|
||||
/// <param name="result">Reference to the measured mass in kg</param>
|
||||
/// <param name="readingsCount">Required mass readings count (>= 4)</param>
|
||||
bool zeroingAfterUnderload;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="scale">Balance device instance</param>
|
||||
/// <param name="result">Reference to the measured mass in kg</param>
|
||||
/// <param name="readingsCount">Required mass readings count (>= 4)</param>
|
||||
/// <param name="maxSpread">Maximum spread of measurements in kg (otherwise the measurement continues)</param>
|
||||
/// <param name="method">Method: false = slow (precise), true = fast (immediate)</param>
|
||||
public ReadStableMassOp(GenericDevices.IScale scale, ref DoubleBox result, int delayBefore, MassMethod method,
|
||||
@ -89,6 +91,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
startTime = StateMachine.Time;
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
zeroingAfterUnderload = false;
|
||||
|
||||
if (delayBefore == 0 && scale.Activity == Activity.Idle)
|
||||
{
|
||||
@ -136,7 +139,34 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
return Event.None; /// Wait for a mass measurement
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
log.WarnFormat(
|
||||
"ReadStableMassOp.Run() ... scale underload detected, zeroing scale");
|
||||
|
||||
currentReadingsCount = 0;
|
||||
Array.Clear(massReadings, 0, massReadings.Length);
|
||||
Array.Clear(sortedMassReadings, 0, sortedMassReadings.Length);
|
||||
|
||||
zeroingAfterUnderload = true;
|
||||
scale.SendZeroWhenStableCmd();
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (zeroingAfterUnderload && scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
log.InfoFormat(
|
||||
"ReadStableMassOp.Run() ... scale zeroing after underload completed, restarting measurement");
|
||||
|
||||
zeroingAfterUnderload = false;
|
||||
StartMeasurement();
|
||||
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
/// Save the measurement
|
||||
if (currentReadingsCount < totalReadingsCount)
|
||||
|
||||
@ -78,6 +78,13 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
return Event.ScaleOverload;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
tara.Val = scale.Capacity;
|
||||
done = true;
|
||||
return Event.ScaleUnderload;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
tara.Val = scale.Mass;
|
||||
|
||||
@ -68,6 +68,12 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Busy) return Event.Busy;
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
done = true;
|
||||
return Event.ScaleUnderload;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Overload)
|
||||
{
|
||||
done = true;
|
||||
|
||||
@ -68,6 +68,7 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
{
|
||||
WaitingBeforeMeasurment,
|
||||
MassMeasurement,
|
||||
ZeroingAfterUnderload,
|
||||
}
|
||||
|
||||
OpState opState;
|
||||
@ -142,14 +143,45 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
return Event.ScaleDone;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Busy)
|
||||
{
|
||||
/// Measurement is in progress - resend command if timeout occurs
|
||||
if (scale.MsrmntTime >= timeout) StartMeasurement();
|
||||
return Event.None; /// Wait for a mass measurement
|
||||
}
|
||||
if (scale.MsrmntState == MsrmntState.Busy)
|
||||
{
|
||||
/// The command is still being processed - resend it after timeout.
|
||||
if (scale.MsrmntTime >= timeout)
|
||||
{
|
||||
if (opState == OpState.ZeroingAfterUnderload)
|
||||
scale.SendZeroWhenStableCmd();
|
||||
else
|
||||
StartMeasurement();
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
log.Warn("ReadStableMassOp.Run() ... scale underload detected, zeroing scale");
|
||||
|
||||
currentReadingsCount = 0;
|
||||
Array.Clear(massReadings, 0, massReadings.Length);
|
||||
Array.Clear(sortedMassReadings, 0, sortedMassReadings.Length);
|
||||
|
||||
opState = OpState.ZeroingAfterUnderload;
|
||||
scale.SendZeroWhenStableCmd();
|
||||
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (opState == OpState.ZeroingAfterUnderload && scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
log.Info("ReadStableMassOp.Run() ... scale zeroing completed, restarting mass measurement");
|
||||
|
||||
opState = OpState.MassMeasurement;
|
||||
StartMeasurement();
|
||||
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
/// Save the measurement
|
||||
if (currentReadingsCount < totalReadingsCount)
|
||||
@ -167,7 +199,7 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
}
|
||||
}
|
||||
|
||||
if (currentReadingsCount >= totalReadingsCount)
|
||||
if (currentReadingsCount >= totalReadingsCount)
|
||||
{
|
||||
Array.Copy(massReadings, sortedMassReadings, totalReadingsCount);
|
||||
Array.Sort(sortedMassReadings);
|
||||
|
||||
@ -401,7 +401,7 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
{
|
||||
/// Invalid value : Scale is in underload range
|
||||
mass = 0;
|
||||
msrmntState = MsrmntState.Failed;
|
||||
msrmntState = MsrmntState.Underload;
|
||||
}
|
||||
else if ((proto == Protocol.ID1 && field.Length == 1 && field[0] == "SI+") ||
|
||||
(proto == Protocol.SICS && field.Length == 2 && field[0] == "S" && field[1] == "+") ||
|
||||
|
||||
@ -71,6 +71,13 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Busy) return Event.Busy;
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
tara.Val = scale.Capacity;
|
||||
done = true;
|
||||
return Event.ScaleUnderload;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Overload)
|
||||
{
|
||||
tara.Val = scale.Capacity;
|
||||
|
||||
@ -74,6 +74,12 @@ namespace TBF.Rig.Scales.MettlerToledo
|
||||
return Event.ScaleOverload;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Underload)
|
||||
{
|
||||
done = true;
|
||||
return Event.ScaleUnderload;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
done = true;
|
||||
|
||||
@ -710,8 +710,37 @@ namespace TBF.Rig.Sequences
|
||||
regVPosOps,
|
||||
"SequenceBase : Transition : TestStart - Default action");
|
||||
|
||||
if (evnt == Event.Error || evnt == Event.UiCmdStop) return evnt;
|
||||
}
|
||||
///
|
||||
/// Bugfix: PerformSteps() may return Error or UiCmdStop before the common
|
||||
/// transition shutdown code is reached.
|
||||
///
|
||||
if (evnt == Event.Error || evnt == Event.UiCmdStop)
|
||||
{
|
||||
log.WarnFormat(
|
||||
"Transition(context={0}): PerformSteps returned {1}, performing safe shutdown (FM pump off, default valves).",
|
||||
context,
|
||||
evnt);
|
||||
|
||||
if (inPath.Pump is GenericDevices.IPumpFM)
|
||||
(inPath.Pump as GenericDevices.IPumpFM).TurnOff();
|
||||
|
||||
State.Create("SequenceBase : Transition : STOP/ERROR - Setting default valves")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoardMain.SetValvesOp(
|
||||
StateMachine.DefaultValvesOpen,
|
||||
StateMachine.DefaultValvesClose))
|
||||
.EnterState();
|
||||
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
return evnt;
|
||||
}
|
||||
}
|
||||
else if (context == TransitionContext.AfterTestWithOverlap && nextInPath != null && nextBenchPath != null && nextOutPath != null)
|
||||
{
|
||||
log.WarnFormat("Transition(., context={0}), overlapped action (next flow regulation)", context);
|
||||
|
||||
@ -153,8 +153,16 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
|
||||
int totalPulses = Convert.ToInt32(test.Volume / outPath.FlowMeter.LtrPerPulse);
|
||||
|
||||
log.InfoFormat(
|
||||
"{0}({1}) : Test starting... (Repetition {2}, LastRepetition={3}, PumpPower={4})",
|
||||
test.Method,
|
||||
test.Name,
|
||||
repetitionNr,
|
||||
isLastRepetition,
|
||||
test.PumpPower);
|
||||
|
||||
///============================================================================================
|
||||
|
||||
|
||||
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
|
||||
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
@ -453,7 +461,19 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// reading pump power for dynamic using as default test.PumpPower for next test instances in cycle
|
||||
///
|
||||
if (inPath.Pump is IPump)
|
||||
{
|
||||
test.PumpPower = (float)(inPath.Pump as IPump).Power;
|
||||
|
||||
log.InfoFormat(
|
||||
"PumpPower initialized from operator to '{0}'%",
|
||||
test.PumpPower);
|
||||
}
|
||||
|
||||
// if (atleastOneGenesis)
|
||||
// {
|
||||
// log.Info($"Genesis - Starting... Test Name:{test.Name.ToLower()}.");
|
||||
@ -472,7 +492,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
// }
|
||||
// }
|
||||
|
||||
if (drainTheTank)
|
||||
if (drainTheTank)
|
||||
{
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Closing_the_tank);
|
||||
@ -1327,13 +1347,13 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
|
||||
if (stopCycle) retVal = Event.ErrorFlagsStop;
|
||||
|
||||
stopTest:
|
||||
stopTest:
|
||||
/*GenesisHeadBatch.BatchHolder.Value.RemoveAllMeters();*/
|
||||
StopRecordingStatistics(); /// Make sure graph files are closed
|
||||
|
||||
///
|
||||
/// Quit this sequence
|
||||
///
|
||||
///
|
||||
/// Quit this sequence
|
||||
///
|
||||
if (isLastRepetition || retVal == Event.UiCmdStop
|
||||
|| retVal == Event.OpArgumentError
|
||||
|| retVal == Event.RecoverableError
|
||||
@ -1341,7 +1361,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
|| retVal == Event.Error
|
||||
|| retVal == Event.ConfigurationError)
|
||||
{
|
||||
cBrd.StopAll(false);
|
||||
cBrd.StopAll(retVal == Event.UiCmdStop ? true : false);
|
||||
}
|
||||
|
||||
return new List<Event> { retVal };
|
||||
|
||||
@ -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 };
|
||||
@ -149,6 +153,14 @@ 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})",
|
||||
test.Method,
|
||||
test.Name,
|
||||
repetitionNr,
|
||||
isLastRepetition,
|
||||
test.PumpPower);
|
||||
|
||||
///============================================================================================
|
||||
|
||||
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
|
||||
@ -330,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();
|
||||
@ -435,6 +447,19 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
/// Temperature is withing required range at this point
|
||||
///
|
||||
|
||||
|
||||
///
|
||||
/// reading pump power for dynamic using as default test.PumpPower for next test instances in cycle
|
||||
///
|
||||
if (inPath.Pump is IPump)
|
||||
{
|
||||
test.PumpPower = (float)(inPath.Pump as IPump).Power;
|
||||
|
||||
log.InfoFormat(
|
||||
"PumpPower initialized from operator to '{0}'%",
|
||||
test.PumpPower);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
|
||||
//-----------------------------------------------------------------
|
||||
@ -452,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; }
|
||||
@ -461,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++)
|
||||
{
|
||||
@ -473,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;
|
||||
|
||||
@ -490,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)
|
||||
{
|
||||
@ -504,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++)
|
||||
@ -555,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));
|
||||
@ -651,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
|
||||
@ -678,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)
|
||||
@ -712,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));
|
||||
|
||||
@ -721,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();
|
||||
@ -738,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();
|
||||
@ -782,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 {
|
||||
@ -793,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
|
||||
@ -801,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();
|
||||
@ -819,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,
|
||||
@ -1016,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);
|
||||
//------------------------------------------------
|
||||
@ -1360,7 +1500,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
|| retVal == Event.Error
|
||||
|| retVal == Event.ConfigurationError)
|
||||
{
|
||||
cBrd.StopAll(false);
|
||||
cBrd.StopAll(retVal == Event.UiCmdStop ? true : false);
|
||||
}
|
||||
|
||||
return new List<Event> { retVal };
|
||||
|
||||
Loading…
Reference in New Issue
Block a user