- Tank emptying remaining time indication
- Bug fixed: When copying a procwdure ItemId was not correctly set, remained 0 - Always create a message log when device initialization is completed successfully
This commit is contained in:
parent
42c255e40e
commit
ea6c9818cf
@ -96,9 +96,9 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
|
||||
if (idcCameraCfg.DebugLevel != Entities.DebugMode.DetectedOff)
|
||||
{
|
||||
log.WarnFormat("Detected: {0} on COM{1} ver. {2}", Name, idcCameraCfg.ComPortNr, Idc100.Version);
|
||||
}
|
||||
}
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
|
||||
@ -212,6 +212,8 @@ namespace TBF.BenchControl.Elde
|
||||
EtCalib,
|
||||
DiverterEdge,
|
||||
BalanceRange);
|
||||
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
|
||||
@ -75,7 +75,9 @@ namespace TBF.BenchControl.Greco
|
||||
serialPort.Open();
|
||||
measurementBuilder = new StringBuilder(40);
|
||||
msrmntState = MsrmntState.Busy;
|
||||
}
|
||||
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
|
||||
@ -22,7 +22,7 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceDev));
|
||||
public override string ToString() { return string.Format("{0}, Mettler-Toledo Balance", balanceCfg.Name); }
|
||||
public override string ToString() { return string.Format("{0} - Mettler-Toledo Balance", balanceCfg.Name); }
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of balances via static fields and methods
|
||||
@ -100,7 +100,9 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
serialPort = new SerialPort(comPortName, balanceCfg.BaudRate, balanceCfg.Parity, balanceCfg.DataBits, balanceCfg.StopBits);
|
||||
serialPort.Handshake = balanceCfg.Handshake;
|
||||
serialPort.Open();
|
||||
}
|
||||
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
}
|
||||
|
||||
public bool IsEmpty(float mass)
|
||||
{
|
||||
|
||||
@ -21,7 +21,7 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceNewDev));
|
||||
public override string ToString() { return string.Format("Mettler-Toledo Balance with SN"); }
|
||||
public override string ToString() { return string.Format("{0} - Mettler-Toledo Balance with SN", balanceCfg.Name); }
|
||||
|
||||
public static void ResetStaticProperties() { }
|
||||
|
||||
|
||||
@ -28,18 +28,36 @@ namespace TBF.BenchControl.Operations
|
||||
/// Set by constructors
|
||||
int timerTime;
|
||||
Event eventExpired;
|
||||
TBF.Boxes.IntBox remainingTimeSec;
|
||||
|
||||
/// <summary>
|
||||
/// Constructors, optional argument is a timer name (you can create more then one timer)
|
||||
/// </summary>
|
||||
public TimerOp(int timerTime, Event eventExpired)
|
||||
{
|
||||
this.timerTime = timerTime;
|
||||
this.eventExpired = eventExpired;
|
||||
}
|
||||
public TimerOp(int timerTime)
|
||||
: this(timerTime, Event.TimerExpired)
|
||||
public TimerOp(int timerTimeSec, Event eventExpired, TBF.Boxes.IntBox remainingTimeSec)
|
||||
{
|
||||
this.timerTime = timerTimeSec;
|
||||
this.eventExpired = eventExpired;
|
||||
this.remainingTimeSec = remainingTimeSec;
|
||||
}
|
||||
public TimerOp(int timerTimeSec, Event eventExpired)
|
||||
: this(timerTimeSec, eventExpired, null)
|
||||
{
|
||||
}
|
||||
public TimerOp(int timerTime, TBF.Boxes.IntBox remainingTimeSec)
|
||||
: this(timerTime, Event.TimerExpired, remainingTimeSec)
|
||||
{
|
||||
}
|
||||
public TimerOp(int timerTime)
|
||||
: this(timerTime, Event.TimerExpired, null)
|
||||
{
|
||||
}
|
||||
|
||||
void UpdateRemainingTime()
|
||||
{
|
||||
if (remainingTimeSec != null)
|
||||
{
|
||||
remainingTimeSec.Val = System.Math.Max(expireTime - StateMachine.Time, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <param name="obj">Time period (TimeSpan)</param>
|
||||
@ -48,10 +66,14 @@ namespace TBF.BenchControl.Operations
|
||||
timeExpired = false;
|
||||
timerStarted = true;
|
||||
expireTime = StateMachine.Time + timerTime;
|
||||
|
||||
UpdateRemainingTime();
|
||||
}
|
||||
|
||||
public Event Run()
|
||||
{
|
||||
UpdateRemainingTime();
|
||||
|
||||
if (timerStarted && !timeExpired && StateMachine.Time >= expireTime)
|
||||
{
|
||||
timeExpired = true;
|
||||
|
||||
@ -54,8 +54,8 @@ namespace TBF.BenchControl.Sequences
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
|
||||
//--------------------------------------------------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Emptying_tank);
|
||||
State startNew = State.Create("MainSeq : Emptying tanks, Starting cameras")
|
||||
IntBox remainingTime = new IntBox();
|
||||
State startNew = State.Create("MainSeq : Emptying tanks, Starting cameras")
|
||||
.AddOperation(checkUiOp);
|
||||
foreach (var cmpnt in StateMachine.Components)
|
||||
{
|
||||
@ -87,14 +87,17 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
if (balanceEmptyTime > 0)
|
||||
{
|
||||
startNew.AddOperation(new TimerOp(balanceEmptyTime))
|
||||
startNew.AddOperation(new TimerOp(balanceEmptyTime, remainingTime))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(allEmptyingValves, null));
|
||||
}
|
||||
|
||||
startNew.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnActivity(this, string.Format("{0}, {1} {2} {3}", Strings.Emptying_tank,
|
||||
Strings.remaining_time, remainingTime.Val.ToString(), Strings.sec));
|
||||
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
if (e.Contains(Event.UiCmdStop) &&
|
||||
!e.Contains(Event.ValvesBusy) &&
|
||||
@ -102,13 +105,15 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
goto stop_emptying;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (e.Contains(Event.TimerBusy) ||
|
||||
e.Contains(Event.CameraBusy) ||
|
||||
e.Contains(Event.ValvesBusy));
|
||||
|
||||
if (e.Contains(Event.CameraOpFailed)) goto error; /// TODO: resolve in some other way
|
||||
|
||||
Bridge.OnActivity(this, Strings.Emptying_tank);
|
||||
|
||||
stop_emptying:
|
||||
//--------------------------------------------------------------------------------------------
|
||||
State stopEmptying = State.Create("MainSeq : Stop emptying of water tanks")
|
||||
|
||||
18
TestBenchFramework/Resources/Strings.Designer.cs
generated
18
TestBenchFramework/Resources/Strings.Designer.cs
generated
@ -1473,6 +1473,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to remaining time.
|
||||
/// </summary>
|
||||
internal static string remaining_time {
|
||||
get {
|
||||
return ResourceManager.GetString("remaining_time", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to < &Remove.
|
||||
/// </summary>
|
||||
@ -1554,6 +1563,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to s.
|
||||
/// </summary>
|
||||
internal static string sec {
|
||||
get {
|
||||
return ResourceManager.GetString("sec", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Selected results:.
|
||||
/// </summary>
|
||||
|
||||
@ -765,4 +765,10 @@
|
||||
<data name="Starting_system" xml:space="preserve">
|
||||
<value>Prüfstand starten</value>
|
||||
</data>
|
||||
<data name="remaining_time" xml:space="preserve">
|
||||
<value>remaining time</value>
|
||||
</data>
|
||||
<data name="sec" xml:space="preserve">
|
||||
<value>s</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -853,4 +853,10 @@
|
||||
<data name="Starting_system" xml:space="preserve">
|
||||
<value>Starting the system</value>
|
||||
</data>
|
||||
<data name="remaining_time" xml:space="preserve">
|
||||
<value>remaining time</value>
|
||||
</data>
|
||||
<data name="sec" xml:space="preserve">
|
||||
<value>s</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -116,7 +116,7 @@ namespace TBF.UiControls
|
||||
|
||||
public void AddOne()
|
||||
{
|
||||
/// Find an unused test name
|
||||
/// Find an unused procedure name
|
||||
string newName;
|
||||
for (int nameId = 1; true; nameId++)
|
||||
{
|
||||
@ -126,7 +126,7 @@ namespace TBF.UiControls
|
||||
if (notUsed) break;
|
||||
}
|
||||
|
||||
base.AddOne(new Entities.Procedure(newName, MyItems.Count));
|
||||
base.AddOne(new Entities.Procedure(newName, MyItems.Count + 1));
|
||||
}
|
||||
|
||||
public new void RemoveSelected()
|
||||
@ -187,7 +187,8 @@ namespace TBF.UiControls
|
||||
/// Make a copy of the selected procedure
|
||||
Entities.Procedure newProcedure = selectedProcedure.Clone();
|
||||
newProcedure.Name = selectedProcedure.Name + Strings.New_name_copy;
|
||||
newProcedure.CreationUser = Entities.User.CurrentUser.Name;
|
||||
newProcedure.ItemNr = MyItems.Count;
|
||||
newProcedure.CreationUser = Entities.User.CurrentUser.Name;
|
||||
newProcedure.CreationTime = DateTime.Now;
|
||||
|
||||
if ((new ProcedureDlg(newProcedure)).ShowDialog() == DialogResult.OK)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user