- 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:
@@ -96,9 +96,9 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
|||||||
|
|
||||||
if (idcCameraCfg.DebugLevel != Entities.DebugMode.DetectedOff)
|
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()
|
public void RunDeviceBefore()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -212,6 +212,8 @@ namespace TBF.BenchControl.Elde
|
|||||||
EtCalib,
|
EtCalib,
|
||||||
DiverterEdge,
|
DiverterEdge,
|
||||||
BalanceRange);
|
BalanceRange);
|
||||||
|
|
||||||
|
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Run this device</summary>
|
/// <summary>Run this device</summary>
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ namespace TBF.BenchControl.Greco
|
|||||||
serialPort.Open();
|
serialPort.Open();
|
||||||
measurementBuilder = new StringBuilder(40);
|
measurementBuilder = new StringBuilder(40);
|
||||||
msrmntState = MsrmntState.Busy;
|
msrmntState = MsrmntState.Busy;
|
||||||
}
|
|
||||||
|
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Run this device</summary>
|
/// <summary>Run this device</summary>
|
||||||
public void RunDeviceBefore()
|
public void RunDeviceBefore()
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.MettlerToledo
|
|||||||
/// Warn: Start measurement when busy is true
|
/// Warn: Start measurement when busy is true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceDev));
|
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>
|
/// <summary>
|
||||||
/// Enumeration of balances via static fields and methods
|
/// 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 = new SerialPort(comPortName, balanceCfg.BaudRate, balanceCfg.Parity, balanceCfg.DataBits, balanceCfg.StopBits);
|
||||||
serialPort.Handshake = balanceCfg.Handshake;
|
serialPort.Handshake = balanceCfg.Handshake;
|
||||||
serialPort.Open();
|
serialPort.Open();
|
||||||
}
|
|
||||||
|
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsEmpty(float mass)
|
public bool IsEmpty(float mass)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.MettlerToledo
|
|||||||
/// Warn: Start measurement when busy is true
|
/// Warn: Start measurement when busy is true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceNewDev));
|
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() { }
|
public static void ResetStaticProperties() { }
|
||||||
|
|
||||||
|
|||||||
@@ -28,18 +28,36 @@ namespace TBF.BenchControl.Operations
|
|||||||
/// Set by constructors
|
/// Set by constructors
|
||||||
int timerTime;
|
int timerTime;
|
||||||
Event eventExpired;
|
Event eventExpired;
|
||||||
|
TBF.Boxes.IntBox remainingTimeSec;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructors, optional argument is a timer name (you can create more then one timer)
|
/// Constructors, optional argument is a timer name (you can create more then one timer)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TimerOp(int timerTime, Event eventExpired)
|
public TimerOp(int timerTimeSec, Event eventExpired, TBF.Boxes.IntBox remainingTimeSec)
|
||||||
{
|
|
||||||
this.timerTime = timerTime;
|
|
||||||
this.eventExpired = eventExpired;
|
|
||||||
}
|
|
||||||
public TimerOp(int timerTime)
|
|
||||||
: this(timerTime, Event.TimerExpired)
|
|
||||||
{
|
{
|
||||||
|
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>
|
/// <param name="obj">Time period (TimeSpan)</param>
|
||||||
@@ -48,10 +66,14 @@ namespace TBF.BenchControl.Operations
|
|||||||
timeExpired = false;
|
timeExpired = false;
|
||||||
timerStarted = true;
|
timerStarted = true;
|
||||||
expireTime = StateMachine.Time + timerTime;
|
expireTime = StateMachine.Time + timerTime;
|
||||||
|
|
||||||
|
UpdateRemainingTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Event Run()
|
public Event Run()
|
||||||
{
|
{
|
||||||
|
UpdateRemainingTime();
|
||||||
|
|
||||||
if (timerStarted && !timeExpired && StateMachine.Time >= expireTime)
|
if (timerStarted && !timeExpired && StateMachine.Time >= expireTime)
|
||||||
{
|
{
|
||||||
timeExpired = true;
|
timeExpired = true;
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ namespace TBF.BenchControl.Sequences
|
|||||||
while (e.Contains(Event.ValvesBusy));
|
while (e.Contains(Event.ValvesBusy));
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------
|
||||||
Bridge.OnActivity(this, Strings.Emptying_tank);
|
IntBox remainingTime = new IntBox();
|
||||||
State startNew = State.Create("MainSeq : Emptying tanks, Starting cameras")
|
State startNew = State.Create("MainSeq : Emptying tanks, Starting cameras")
|
||||||
.AddOperation(checkUiOp);
|
.AddOperation(checkUiOp);
|
||||||
foreach (var cmpnt in StateMachine.Components)
|
foreach (var cmpnt in StateMachine.Components)
|
||||||
{
|
{
|
||||||
@@ -87,14 +87,17 @@ namespace TBF.BenchControl.Sequences
|
|||||||
}
|
}
|
||||||
if (balanceEmptyTime > 0)
|
if (balanceEmptyTime > 0)
|
||||||
{
|
{
|
||||||
startNew.AddOperation(new TimerOp(balanceEmptyTime))
|
startNew.AddOperation(new TimerOp(balanceEmptyTime, remainingTime))
|
||||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(allEmptyingValves, null));
|
.AddOperation(StateMachine.ControlBoard.SetValvesOp(allEmptyingValves, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
startNew.EnterState();
|
startNew.EnterState();
|
||||||
do
|
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.Error)) goto error;
|
||||||
if (e.Contains(Event.UiCmdStop) &&
|
if (e.Contains(Event.UiCmdStop) &&
|
||||||
!e.Contains(Event.ValvesBusy) &&
|
!e.Contains(Event.ValvesBusy) &&
|
||||||
@@ -102,13 +105,15 @@ namespace TBF.BenchControl.Sequences
|
|||||||
{
|
{
|
||||||
goto stop_emptying;
|
goto stop_emptying;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (e.Contains(Event.TimerBusy) ||
|
while (e.Contains(Event.TimerBusy) ||
|
||||||
e.Contains(Event.CameraBusy) ||
|
e.Contains(Event.CameraBusy) ||
|
||||||
e.Contains(Event.ValvesBusy));
|
e.Contains(Event.ValvesBusy));
|
||||||
|
|
||||||
if (e.Contains(Event.CameraOpFailed)) goto error; /// TODO: resolve in some other way
|
if (e.Contains(Event.CameraOpFailed)) goto error; /// TODO: resolve in some other way
|
||||||
|
|
||||||
|
Bridge.OnActivity(this, Strings.Emptying_tank);
|
||||||
|
|
||||||
stop_emptying:
|
stop_emptying:
|
||||||
//--------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------
|
||||||
State stopEmptying = State.Create("MainSeq : Stop emptying of water tanks")
|
State stopEmptying = State.Create("MainSeq : Stop emptying of water tanks")
|
||||||
|
|||||||
+18
@@ -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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to < &Remove.
|
/// Looks up a localized string similar to < &Remove.
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Selected results:.
|
/// Looks up a localized string similar to Selected results:.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -765,4 +765,10 @@
|
|||||||
<data name="Starting_system" xml:space="preserve">
|
<data name="Starting_system" xml:space="preserve">
|
||||||
<value>Prüfstand starten</value>
|
<value>Prüfstand starten</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="remaining_time" xml:space="preserve">
|
||||||
|
<value>remaining time</value>
|
||||||
|
</data>
|
||||||
|
<data name="sec" xml:space="preserve">
|
||||||
|
<value>s</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -853,4 +853,10 @@
|
|||||||
<data name="Starting_system" xml:space="preserve">
|
<data name="Starting_system" xml:space="preserve">
|
||||||
<value>Starting the system</value>
|
<value>Starting the system</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="remaining_time" xml:space="preserve">
|
||||||
|
<value>remaining time</value>
|
||||||
|
</data>
|
||||||
|
<data name="sec" xml:space="preserve">
|
||||||
|
<value>s</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -116,7 +116,7 @@ namespace TBF.UiControls
|
|||||||
|
|
||||||
public void AddOne()
|
public void AddOne()
|
||||||
{
|
{
|
||||||
/// Find an unused test name
|
/// Find an unused procedure name
|
||||||
string newName;
|
string newName;
|
||||||
for (int nameId = 1; true; nameId++)
|
for (int nameId = 1; true; nameId++)
|
||||||
{
|
{
|
||||||
@@ -126,7 +126,7 @@ namespace TBF.UiControls
|
|||||||
if (notUsed) break;
|
if (notUsed) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.AddOne(new Entities.Procedure(newName, MyItems.Count));
|
base.AddOne(new Entities.Procedure(newName, MyItems.Count + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public new void RemoveSelected()
|
public new void RemoveSelected()
|
||||||
@@ -187,7 +187,8 @@ namespace TBF.UiControls
|
|||||||
/// Make a copy of the selected procedure
|
/// Make a copy of the selected procedure
|
||||||
Entities.Procedure newProcedure = selectedProcedure.Clone();
|
Entities.Procedure newProcedure = selectedProcedure.Clone();
|
||||||
newProcedure.Name = selectedProcedure.Name + Strings.New_name_copy;
|
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;
|
newProcedure.CreationTime = DateTime.Now;
|
||||||
|
|
||||||
if ((new ProcedureDlg(newProcedure)).ShowDialog() == DialogResult.OK)
|
if ((new ProcedureDlg(newProcedure)).ShowDialog() == DialogResult.OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user