(1) Multiple start valves, test methods modified, (2) Component for JuznaAfrika50 (25.04.2018), ver. 2.18.887

This commit is contained in:
Milan Hanajik 2018-04-24 13:24:36 +02:00
parent 1f9df9bb67
commit c0f4c5acef
10 changed files with 290 additions and 123 deletions

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -76,44 +76,44 @@ namespace TBF.BenchControl.Elde
/// <param name="valvesOpen">A list of opening master valves</param>
/// <param name="valvesClose">A list of closing master valves</param>
/// <returns></returns>
IList<SwitchPoint> CollectSwitchPoints(IList<IValve> valvesOpen, IList<IValve> valvesClose)
IList<SwitchPoint> AddSwitchPoints(IList<SwitchPoint> swPoints, IList<IValve> valvesOpen, IList<IValve> valvesClose, int time)
{
IList<SwitchPoint> result = new List<SwitchPoint>();
result.Add(new SwitchPoint(0, valvesOpen, valvesClose));
int ix0 = swPoints.Count;
swPoints.Add(new SwitchPoint(time, valvesOpen, valvesClose));
foreach (var valve in StateMachine.CoupledValves)
{
if ((!valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo)) ||
(valve.InvertCouple && valvesClose.Contains(valve.CoupledTo)))
{
/// The coupled valve 'valve' is opening
int time = valve.LagOpening;
if (time == 0)
{
result[0].VOpen.Add(valve);
}
else
{
result.Add(new SwitchPoint(time, ValveBase.MakeList(valve), null));
}
}
else if ((!valve.InvertCouple && valvesClose.Contains(valve.CoupledTo)) ||
(valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo)))
{
/// The coupled valve 'valve' is closing
int time = valve.LagClosing;
if (time == 0)
{
result[0].VClose.Add(valve);
}
else
{
result.Add(new SwitchPoint(time, null, ValveBase.MakeList(valve)));
}
}
}
return result;
}
foreach (var valve in StateMachine.CoupledValves)
{
if ((!valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo)) ||
(valve.InvertCouple && valvesClose.Contains(valve.CoupledTo)))
{
/// The coupled valve 'valve' is opening
int lag = time + valve.LagOpening;
if (lag == time)
{
swPoints[ix0].VOpen.Add(valve);
}
else
{
swPoints.Add(new SwitchPoint(lag, ValveBase.MakeList(valve), null));
}
}
else if ((!valve.InvertCouple && valvesClose.Contains(valve.CoupledTo)) ||
(valve.InvertCouple && valvesOpen.Contains(valve.CoupledTo)))
{
/// The coupled valve 'valve' is closing
int lag = time + valve.LagClosing;
if (lag == time)
{
swPoints[ix0].VClose.Add(valve);
}
else
{
swPoints.Add(new SwitchPoint(lag, null, ValveBase.MakeList(valve)));
}
}
}
return swPoints;
}
IList<SwitchPoint> SortAndMergeSwitchPoints(IList<SwitchPoint> unsorted)
@ -188,7 +188,8 @@ namespace TBF.BenchControl.Elde
if (valvesOpen == null) valvesOpen = new List<IValve>();
if (valvesClose == null) valvesClose = new List<IValve>();
switchPointsRaw = CollectSwitchPoints(valvesOpen, valvesClose);
switchPointsRaw = new List<SwitchPoint>();
AddSwitchPoints(switchPointsRaw, valvesOpen, valvesClose, 0);
switchPoints = SortAndMergeSwitchPoints(switchPointsRaw);
int timeShift = -switchPoints[0].TimeSec;
MakeMasks(switchPoints, timeShift);
@ -207,6 +208,62 @@ namespace TBF.BenchControl.Elde
{
}
/// <summary>
/// OPEN or CLOSE start/stop valve and associated valves and/or pumps.
/// Events: ValvesSet
/// </summary>
/// <param name="controlBoard">Control board device</param>
/// <param name="close">true: close start valve, false: open start valve</param>
/// <param name="outPath">OutputPath specifying the start valve and associated valves/pumps</param>
/// <remarks>Only Elde.Valve valves are used, other valves on the lists are ignored</remarks>
public SetValvesOp(ControlBoardDev controlBoard, bool close, OutputPath outPath)
{
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
this.controlBoard = controlBoard;
IList<IValve> none = new List<IValve>(); /// An empty list of valves
switchPointsRaw = new List<SwitchPoint>();
if (close)
{
if (outPath.InvertSV1) AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0);
else AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0);
if (outPath.StartValve2 != null)
{
if (outPath.InvertSV2) AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, outPath.LagSV2);
else AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), outPath.LagSV2);
}
if (outPath.StartValve3 != null)
{
if (outPath.InvertSV3) AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, outPath.LagSV3);
else AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), outPath.LagSV3);
}
}
else
{
if (outPath.InvertSV1) AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0);
else AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0);
if (outPath.StartValve2 != null)
{
if (outPath.InvertSV2) AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), -outPath.LagSV2);
else AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, -outPath.LagSV2);
}
if (outPath.StartValve3 != null)
{
if (outPath.InvertSV3) AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), -outPath.LagSV3);
else AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, -outPath.LagSV3);
}
}
switchPoints = SortAndMergeSwitchPoints(switchPointsRaw);
int timeShift = -switchPoints[0].TimeSec;
MakeMasks(switchPoints, timeShift);
}
/// <summary>Start this operation</summary>
public void Start()
{

View File

@ -12,13 +12,20 @@ namespace TBF.BenchControl
public string Name;
public float Qfrom;
public float Qto;
public IRegulValve RegulValve;
public IFlowMeter FlowMeter;
public IRegulValve RegulValve;
public float PidCoef;
public IValve StartValve;
public IDiverter Diverter;
public ITempMeter TempDiv;
public IScale Scale;
public IValve StartValve1;
public bool InvertSV1;
public IValve StartValve2;
public bool InvertSV2;
public int LagSV2;
public IValve StartValve3;
public bool InvertSV3;
public int LagSV3;
public IList<IValve> ValvesOpen;
public IList<IValve> ValvesClose;
@ -37,14 +44,25 @@ namespace TBF.BenchControl
{
Qfrom = entity.Qfrom;
Qto = entity.Qto;
RegulValve = (IRegulValve)TbfComponents.FindComponent(entity.RegulValve, components);
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(entity.FlowMeter, components);
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(entity.FlowMeter, components);
RegulValve = (IRegulValve)TbfComponents.FindComponent(entity.RegulValve, components);
PidCoef = entity.PidCoef;
StartValve = (IValve)TbfComponents.FindComponent(entity.StartValve, components);
Diverter = (IDiverter)TbfComponents.FindComponent(entity.Diverter, components);
TempDiv = (ITempMeter)TbfComponents.FindComponent(entity.TempDiv, components);
Scale = (IScale)TbfComponents.FindComponent(entity.Scale, components);
string[] svs = entity.StartValve != null ? entity.StartValve.Split(new char[] { '~' }) : new string[0];
int iTmp;
///
StartValve1 = (IValve)TbfComponents.FindComponent(((svs.Length > 0) ? svs[0] : string.Empty), components);
InvertSV1 = (svs.Length > 1) ? svs[1].Equals("i") : false;
StartValve2 = (IValve)TbfComponents.FindComponent(((svs.Length > 2) ? svs[2] : string.Empty), components);
InvertSV2 = (svs.Length > 3) ? svs[3].Equals("i") : false;
LagSV2 = (svs.Length > 4 && int.TryParse(svs[4], out iTmp)) ? iTmp : 0;
StartValve3 = (IValve)TbfComponents.FindComponent(((svs.Length > 5) ? svs[5] : string.Empty), components);
InvertSV3 = (svs.Length > 6) ? svs[6].Equals("i") : false;
LagSV3 = (svs.Length > 7 && int.TryParse(svs[7], out iTmp)) ? iTmp : 0;
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
ValvesOpen = new List<IValve>();
foreach (var vName in vOpen) ValvesOpen.Add((IValve)TbfComponents.FindComponent(vName, components));

View File

@ -244,15 +244,26 @@ namespace TBF.BenchControl.TestMethods.FixedStart
(inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
}
///
IList<GenericDevices.IValve> valvesOpen = new List<GenericDevices.IValve>();
valvesOpen.Add(inPath.Pump);
valvesOpen.Add(outPath.StartValve);
///
State.Create(string.Format("{0}({1}) : Turning pump on", test.Method, test.Name))
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(valvesOpen, null))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
@ -373,8 +384,8 @@ namespace TBF.BenchControl.TestMethods.FixedStart
//-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
@ -573,7 +584,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.StartValve, null))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do
@ -685,7 +696,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do

View File

@ -181,8 +181,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
//------------------------------------------------
State.Create("FixedStartAdvanced : Closing the start/stop valve before the fixed start test")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do
{
@ -309,8 +309,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Opening the start/stop valve at the beginning of the fixed start test")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.StartValve, null))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do
{
@ -372,8 +372,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Closing the start/stop valve at the end of the fixed start test")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do
{

View File

@ -251,15 +251,26 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
(inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
}
///
IList<GenericDevices.IValve> valvesOpen = new List<GenericDevices.IValve>();
valvesOpen.Add(inPath.Pump);
valvesOpen.Add(outPath.StartValve);
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
///
State.Create(string.Format("{0}({1}) : Turning pump on", test.Method, test.Name))
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(valvesOpen, null))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(heatMetersPromptOp)
.EnterState();
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
@ -380,8 +391,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
//-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
@ -610,7 +621,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.StartValve, null))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do
@ -722,7 +733,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do

View File

@ -233,13 +233,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
(inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
}
///
IList<GenericDevices.IValve> valvesOpen = new List<GenericDevices.IValve>();
valvesOpen.Add(inPath.Pump);
valvesOpen.Add(outPath.StartValve);
///
State.Create(string.Format("{0}({1}) : Turning pump on", test.Method, test.Name))
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(valvesOpen, null))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
@ -251,6 +247,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
//--------------------------------
@ -362,7 +373,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
@ -600,7 +611,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.StartValve, null))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do
@ -712,7 +723,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState();
do

View File

@ -168,8 +168,8 @@ namespace TBF.BenchControl.TestMethods.LeakTest
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(null, outPath.StartValve))
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))

View File

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

View File

@ -25,14 +25,21 @@ namespace TBF.UiControls
Name,
Qfrom,
Qto,
RegulValve,
RefFlowmtr,
RefFlowmtr,
RegulValve,
PidCoef,
StartValve,
Div,
Tdiv,
Scale,
FixedColumnsCount,
StartValve1,
InvertSV1,
StartValve2,
InvertSV2,
LagSV2,
StartValve3,
InvertSV3,
LagSV3,
FixedColumnsCount,
}
readonly int fixedColumnsCount = (int)Column.FixedColumnsCount;
@ -67,13 +74,20 @@ namespace TBF.UiControls
Columns.Add(Strings.Name, (ls.OutputColumnCount > 0) ? ls.OutputColumnWidths[0] : 60 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Q_from_m3h, (ls.OutputColumnCount > 1) ? ls.OutputColumnWidths[1] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Q_to_m3h, (ls.OutputColumnCount > 2) ? ls.OutputColumnWidths[2] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Reg_valve, (ls.OutputColumnCount > 3) ? ls.OutputColumnWidths[3] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Flowmeter, (ls.OutputColumnCount > 4) ? ls.OutputColumnWidths[4] : 85 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Flowmeter, (ls.OutputColumnCount > 3) ? ls.OutputColumnWidths[3] : 85 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Reg_valve, (ls.OutputColumnCount > 4) ? ls.OutputColumnWidths[4] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.PID, (ls.OutputColumnCount > 5) ? ls.OutputColumnWidths[5] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.StartValve, (ls.OutputColumnCount > 6) ? ls.OutputColumnWidths[6] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Diverter, (ls.OutputColumnCount > 7) ? ls.OutputColumnWidths[7] : 60 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.T_div, (ls.OutputColumnCount > 8) ? ls.OutputColumnWidths[8] : 70 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Balance, (ls.OutputColumnCount > 9) ? ls.OutputColumnWidths[9] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Diverter, (ls.OutputColumnCount > 6) ? ls.OutputColumnWidths[6] : 60 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.T_div, (ls.OutputColumnCount > 7) ? ls.OutputColumnWidths[7] : 70 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Balance, (ls.OutputColumnCount > 8) ? ls.OutputColumnWidths[8] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(string.Format("{0} 1", Strings.StartValve), (ls.OutputColumnCount > 9) ? ls.OutputColumnWidths[9] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(string.Format("Inv. SV1"), (ls.OutputColumnCount > 10) ? ls.OutputColumnWidths[10] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(string.Format("{0} 2", Strings.StartValve), (ls.OutputColumnCount > 11) ? ls.OutputColumnWidths[11] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(string.Format("Inv.SV2"), (ls.OutputColumnCount > 12) ? ls.OutputColumnWidths[12] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(string.Format("Lag SV2"), (ls.OutputColumnCount > 13) ? ls.OutputColumnWidths[13] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(string.Format("{0} 3", Strings.StartValve), (ls.OutputColumnCount > 14) ? ls.OutputColumnWidths[14] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(string.Format("Inv.SV3"), (ls.OutputColumnCount > 15) ? ls.OutputColumnWidths[15] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(string.Format("Lag SV3"), (ls.OutputColumnCount > 16) ? ls.OutputColumnWidths[16] : 80 * parent.Dpi / PathsDlg.Dpi100pct);
int clmn = (int)Column.FixedColumnsCount;
foreach (var vlv in parent.Valves)
{
@ -85,44 +99,68 @@ namespace TBF.UiControls
}
/// Prepare fixed columns combo boxes
ComboBox regulValveComboBox = new ComboBox();
ComboBox flowMeterComboBox = new ComboBox();
ComboBox startValveComboBox = new ComboBox();
ComboBox flowMeterComboBox = new ComboBox();
ComboBox regulValveComboBox = new ComboBox();
ComboBox diverterComboBox = new ComboBox();
ComboBox tempMeterDivComboBox = new ComboBox();
ComboBox scaleComboBox = new ComboBox();
regulValveComboBox.Items.Add("---");
ComboBox startValve1ComboBox = new ComboBox();
ComboBox invertSV1ComboBox = new ComboBox();
ComboBox startValve2ComboBox = new ComboBox();
ComboBox invertSV2ComboBox = new ComboBox();
TextBox lagSV2TextBox = new TextBox();
ComboBox startValve3ComboBox = new ComboBox();
ComboBox invertSV3ComboBox = new ComboBox();
TextBox lagSV3TextBox = new TextBox();
flowMeterComboBox.Items.Add("---");
startValveComboBox.Items.Add("---");
regulValveComboBox.Items.Add("---");
diverterComboBox.Items.Add("---");
tempMeterDivComboBox.Items.Add("---");
scaleComboBox.Items.Add("---");
startValve1ComboBox.Items.Add("---");
invertSV1ComboBox.Items.Add(Strings.no);
invertSV1ComboBox.Items.Add(Strings.yes);
startValve2ComboBox.Items.Add("---");
invertSV2ComboBox.Items.Add(Strings.no);
invertSV2ComboBox.Items.Add(Strings.yes);
startValve3ComboBox.Items.Add("---");
invertSV3ComboBox.Items.Add(Strings.no);
invertSV3ComboBox.Items.Add(Strings.yes);
foreach (var cmpnt in parent.TbfComponents)
{
if (cmpnt is IRegulValve) regulValveComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IFlowMeter) flowMeterComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IFlowMeter) flowMeterComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IRegulValve) regulValveComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IDiverter) diverterComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IScale) scaleComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is ITempMeter) tempMeterDivComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is ITempMeter) tempMeterDivComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IScale) scaleComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IValve && (cmpnt as IValve).CoupledTo == null)
{
startValveComboBox.Items.Add(cmpnt.Cfg.Name);
startValve1ComboBox.Items.Add(cmpnt.Cfg.Name);
startValve2ComboBox.Items.Add(cmpnt.Cfg.Name);
startValve3ComboBox.Items.Add(cmpnt.Cfg.Name);
}
}
editors = new Control[fixedColumnsCount + 64];
///
editors[(int)Column.Name] = new TextBox(); /// Name
editors[(int)Column.Qfrom] = new TextBox(); /// Q_from
editors[(int)Column.Qto] = new TextBox(); /// Q_to
editors[(int)Column.RegulValve] = regulValveComboBox;
editors[(int)Column.RefFlowmtr] = flowMeterComboBox;
editors[(int)Column.PidCoef] = new TextBox(); /// PID
editors[(int)Column.StartValve] = startValveComboBox;
editors[(int)Column.Div] = diverterComboBox;
editors[(int)Column.Tdiv] = tempMeterDivComboBox;
editors[(int)Column.Scale] = scaleComboBox;
/// Prepare valve combo-boxes (max. 64 valves)
editors[(int)Column.Name] = new TextBox(); /// Name
editors[(int)Column.Qfrom] = new TextBox(); /// Q_from
editors[(int)Column.Qto] = new TextBox(); /// Q_to
editors[(int)Column.RefFlowmtr] = flowMeterComboBox;
editors[(int)Column.RegulValve] = regulValveComboBox;
editors[(int)Column.PidCoef] = new TextBox(); /// PID
editors[(int)Column.Div] = diverterComboBox;
editors[(int)Column.Tdiv] = tempMeterDivComboBox;
editors[(int)Column.Scale] = scaleComboBox;
editors[(int)Column.StartValve1] = startValve1ComboBox;
editors[(int)Column.InvertSV1] = invertSV1ComboBox;
editors[(int)Column.StartValve2] = startValve2ComboBox;
editors[(int)Column.InvertSV2] = invertSV2ComboBox;
editors[(int)Column.LagSV2] = lagSV2TextBox;
editors[(int)Column.StartValve3] = startValve3ComboBox;
editors[(int)Column.InvertSV3] = invertSV3ComboBox;
editors[(int)Column.LagSV3] = lagSV3TextBox;
/// Prepare valve combo-boxes (max. 64 valves)
for (int i = 0; i < 64; i++)
{
ComboBox cb = new ComboBox();
@ -197,14 +235,23 @@ namespace TBF.UiControls
lvi.SubItems.Add(path.Qfrom.ToString());
lvi.SubItems.Add(path.Qto.ToString());
lvi.SubItems.Add((path.RegulValve != null) ? path.RegulValve.Cfg.Name : "---");
lvi.SubItems.Add((path.FlowMeter != null) ? path.FlowMeter.Cfg.Name : "---");
lvi.SubItems.Add((path.FlowMeter != null) ? path.FlowMeter.Cfg.Name : "---");
lvi.SubItems.Add((path.RegulValve != null) ? path.RegulValve.Cfg.Name : "---");
lvi.SubItems.Add(path.PidCoef.ToString("F1"));
lvi.SubItems.Add((path.StartValve != null) ? path.StartValve.Cfg.Name : "---");
lvi.SubItems.Add((path.Diverter != null) ? path.Diverter.Cfg.Name : "---");
lvi.SubItems.Add((path.TempDiv != null) ? path.TempDiv.Cfg.Name : "---");
lvi.SubItems.Add((path.Scale != null) ? path.Scale.Cfg.Name : "---");
lvi.SubItems.Add((path.StartValve1 != null) ? path.StartValve1.Cfg.Name : "---");
lvi.SubItems.Add(path.InvertSV1 ? Strings.yes : Strings.no);
lvi.SubItems.Add((path.StartValve2 != null) ? path.StartValve2.Cfg.Name : "---");
lvi.SubItems.Add(path.InvertSV2 ? Strings.yes : Strings.no);
lvi.SubItems.Add(path.LagSV2.ToString());
lvi.SubItems.Add((path.StartValve3 != null) ? path.StartValve3.Cfg.Name : "---");
lvi.SubItems.Add(path.InvertSV3 ? Strings.yes : Strings.no);
lvi.SubItems.Add(path.LagSV3.ToString());
foreach (var valve in parent.Valves)
{
if (valve.Category == ValveCategory.All || valve.Category == ValveCategory.Output)
@ -246,17 +293,29 @@ namespace TBF.UiControls
allOk &= Utils.TryParseUFloat(lvi.SubItems[(int)Column.Qto].Text, out Qto);
entity.Qto = Qto;
entity.RegulValve = lvi.SubItems[(int)Column.RegulValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.RegulValve].Text;
entity.FlowMeter = lvi.SubItems[(int)Column.RefFlowmtr].Text.Equals("---") ? null : lvi.SubItems[(int)Column.RefFlowmtr].Text;
entity.FlowMeter = lvi.SubItems[(int)Column.RefFlowmtr].Text.Equals("---") ? null : lvi.SubItems[(int)Column.RefFlowmtr].Text;
entity.RegulValve = lvi.SubItems[(int)Column.RegulValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.RegulValve].Text;
float pid;
allOk &= Utils.TryParseSFloat(lvi.SubItems[(int)Column.PidCoef].Text, out pid);
entity.PidCoef = pid;
entity.StartValve = lvi.SubItems[(int)Column.StartValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.StartValve].Text;
entity.Diverter = lvi.SubItems[(int)Column.Div].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Div].Text;
entity.TempDiv = lvi.SubItems[(int)Column.Tdiv].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Tdiv].Text;
entity.Scale = lvi.SubItems[(int)Column.Scale].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Scale].Text;
entity.Diverter = lvi.SubItems[(int)Column.Div].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Div].Text;
entity.TempDiv = lvi.SubItems[(int)Column.Tdiv].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Tdiv].Text;
entity.Scale = lvi.SubItems[(int)Column.Scale].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Scale].Text;
string sv1 = lvi.SubItems[(int)Column.StartValve1].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)Column.StartValve1].Text;
bool invertSV1 = lvi.SubItems[(int)Column.InvertSV1].Text.Equals(Strings.yes);
string sv2 = lvi.SubItems[(int)Column.StartValve2].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)Column.StartValve2].Text;
bool invertSV2 = lvi.SubItems[(int)Column.InvertSV2].Text.Equals(Strings.yes);
int lagSV2 = 0;
int.TryParse(lvi.SubItems[(int)Column.LagSV2].Text, out lagSV2);
string sv3 = lvi.SubItems[(int)Column.StartValve3].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)Column.StartValve3].Text;
bool invertSV3 = lvi.SubItems[(int)Column.InvertSV3].Text.Equals(Strings.yes);
int lagSV3 = 0;
int.TryParse(lvi.SubItems[(int)Column.LagSV3].Text, out lagSV3);
///
entity.StartValve = string.Format("{0}~{1}~{2}~{3}~{4}~{5}~{6}~{7}", sv1, (invertSV1 ? "i" : "n"), sv2, (invertSV2 ? "i" : "n"), lagSV2, sv3, (invertSV3 ? "i" : "n"), lagSV3);
string valvesOpen = string.Empty;
string valvesClose = string.Empty;