Assignment of drain valves to scales and tanks fixed. ver. 2.26.1607

This commit is contained in:
Milan Hanajik 2021-04-12 12:00:05 +02:00
parent 2673584113
commit 18880dc04d
6 changed files with 23 additions and 29 deletions

View File

@ -288,7 +288,7 @@ namespace TBF.BenchControl.Elde
/// Specific pre-initialization for control board only
/// </summary>
/// <param name="ctrlBrdComponent"></param>
public void InitializeComponent(
public void InitializeEldeComponent(
#if DN100
ControlCom2VB.ControlCom2panel ctrlBrdComponent,
#elif FUZHOU_150 || MUNICH

View File

@ -28,14 +28,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public string SerialNumber { get { return serialNumber; } }
string serialNumber;
public BalanceNewDev()
{
}
public BalanceNewDev() { }
public BalanceNewDev(Generic.IComponentCfg cfg)
: base(cfg)
{
log.Warn(this.ToString());
}
/// <summary>

View File

@ -32,7 +32,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public BalanceOld(Generic.IComponentCfg cfg)
: base(cfg)
{
log.Warn(this.ToString());
}

View File

@ -277,26 +277,23 @@ namespace TBF.BenchControl
{
IScaleOrTank tank = cmpnt as IScaleOrTank;
tanks.Add(tank);
if ((tank.ScaleNr == 0) && (Tank1 == null)) Tank1 = tank;
else if ((tank.ScaleNr == 1) && (Tank2 == null)) Tank2 = tank;
else if ((tank.ScaleNr == 2) && (Tank3 == null)) Tank3 = tank;
if (Tank1 == null) Tank1 = tank;
else if (Tank2 == null) Tank2 = tank;
else if (Tank3 == null) Tank3 = tank;
}
Elde.Valve.Valve eldeValve = (cmpnt as Elde.Valve.Valve);
if ((eldeValve != null) && eldeValve.Inverted) valvesToInvert |= eldeValve.Mask;
cmpnt.StartChangeHandler(); /// Start handling parameter change events
}
/// Create an array with tank capacities
double[] tankCapacities = new double[tanks.Count];
for (int i = 0; i < tankCapacities.Length; i++) tankCapacities[i] = tanks[i].Capacity;
/// Pre-initialize the control board (= buffer the arguments ctrlBrdComponent, tankCapacities)
if (ControlBoard != null)
if (ControlBoard != null)
{
ControlBoard.InitializeComponent(ctrlBrdComponent, valvesToInvert, tankCapacities);
/// Create an array with tank capacities from 'tanks' list
double[] tankCapacities = new double[tanks.Count];
for (int i = 0; i < tankCapacities.Length; i++) tankCapacities[i] = tanks[i].Capacity;
ControlBoard.InitializeEldeComponent(ctrlBrdComponent, valvesToInvert, tankCapacities);
}
else
{
@ -307,7 +304,7 @@ namespace TBF.BenchControl
public static string CurrentlyInitializedComponentName;
///
public static string InitializeDevices()
public static string InitializeComponents()
{
CurrentlyInitializedComponentName = "-";
@ -331,7 +328,8 @@ namespace TBF.BenchControl
CurrentlyInitializedComponentName = cmpnt.Name;
cmpnt.Initialize();
}
cmpnt.StartChangeHandler(); /// Start handling parameter change events
}
CurrentlyInitializedComponentName = "---";
@ -354,22 +352,22 @@ namespace TBF.BenchControl
{
IScaleOrTank tank = cmpnt as IScaleOrTank;
if ((tank.ScaleNr == 0) && (DrainValve1 == null))
if (tank == Tank1 && DrainValve1 == null)
{
DrainValve1 = tank.DrainValve;
log.WarnFormat("InitializeBoardEtc() ... Scale1={0} Draining valve1={1}",
log.WarnFormat("InitializeComponents() ... Scale1={0} DrainValve1={1}",
tank.Name, (DrainValve1 != null) ? DrainValve1.Name : "---");
}
else if ((tank.ScaleNr == 1) && (DrainValve2 == null))
else if (tank == Tank2 && DrainValve2 == null)
{
DrainValve2 = tank.DrainValve;
log.WarnFormat("InitializeBoardEtc() ... Scale2={0} Draining valve2={1}",
log.WarnFormat("InitializeComponents() ... Scale2={0} DrainValve2={1}",
tank.Name, (DrainValve2 != null) ? DrainValve2.Name : "---");
}
else if ((tank.ScaleNr == 2) && (DrainValve3 == null))
else if (tank == Tank3 && DrainValve3 == null)
{
DrainValve3 = tank.DrainValve;
log.WarnFormat("InitializeBoardEtc() ... Scale3={0} Draining valve3={1}",
log.WarnFormat("InitializeComponents() ... Scale3={0} DrainValve3={1}",
tank.Name, (DrainValve3 != null) ? DrainValve3.Name : "---");
}
}

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.26.1599.0")]
[assembly: AssemblyFileVersion("2.26.1599.0")]
[assembly: AssemblyVersion("2.26.1607.0")]
[assembly: AssemblyFileVersion("2.26.1607.0")]

View File

@ -219,7 +219,7 @@ namespace TBF.UI
try
{
string message = BenchControl.StateMachine.InitializeDevices();
string message = BenchControl.StateMachine.InitializeComponents();
form.CloseForm(null, new EventArgs());
formThread.Join();