TankSelector.SelectTankOp added, TransitionStep: StepCondition EndCondition --> string EndCondition, etc.
This commit is contained in:
parent
efdd138379
commit
f30d785fb3
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2015, 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -12,7 +12,7 @@ namespace Config.Entities
|
||||
public virtual int ItemNr { get; set; } /// Order of the preparation step
|
||||
public virtual int Duration { get; set; } /// Duration in seconds
|
||||
public virtual string Message { get; set; } /// Message
|
||||
public virtual StepCondition EndCondition { get; set; } /// Condition when transition step is finished (next to the duration)
|
||||
public virtual string EndCondition { get; set; } /// Condition when transition step is finished (next to the duration)
|
||||
public virtual string ValvesOpen { get; set; } /// List of valves to be opened
|
||||
public virtual string ValvesClose { get; set; } /// List of valves to be closed
|
||||
public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';'
|
||||
@ -24,8 +24,8 @@ namespace Config.Entities
|
||||
|
||||
public TransitionStep()
|
||||
{
|
||||
Duration = 5; /// sec.
|
||||
EndCondition = (int)StepCondition.None;
|
||||
Duration = 5; /// sec.
|
||||
EndCondition = "None";
|
||||
}
|
||||
|
||||
public TransitionStep(int itemNr, TransitionSequence sequence)
|
||||
@ -54,7 +54,7 @@ namespace Config.Entities
|
||||
result += indent + "ItemNr = " + ItemNr.ToString() + ", ";
|
||||
result += indent + "Duration = " + Duration.ToString() + ", ";
|
||||
result += indent + "Message = " + Message + ", ";
|
||||
result += indent + "EndCondition = " + EndCondition.ToString() + ", ";
|
||||
result += indent + "EndCondition = " + EndCondition + ", ";
|
||||
result += indent + "ValvesOpen = " + ValvesOpen + ", ";
|
||||
result += indent + "ValvesClose = " + ValvesClose + ", ";
|
||||
result += indent + "RegulValvesPct = " + RegulValvesPct + ", ";
|
||||
|
||||
@ -663,7 +663,7 @@ namespace DeviceTest
|
||||
}
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
//operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
|
||||
//operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
|
||||
@ -691,7 +691,7 @@ namespace DeviceTest
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
//operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
|
||||
//operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
|
||||
@ -719,7 +719,7 @@ namespace DeviceTest
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
//operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
|
||||
//operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
|
||||
|
||||
@ -171,6 +171,10 @@ namespace TBF.BenchControl
|
||||
TimerBusy,
|
||||
SetOutputsDone,
|
||||
|
||||
/// Sequence conditions
|
||||
ConditionNotMet,
|
||||
ConditionMet,
|
||||
|
||||
/// Outer loop control
|
||||
OuterLoopStart,
|
||||
OuterLoopNext,
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TankSelector
|
||||
{
|
||||
public class SelectTankOp : IOperation
|
||||
{
|
||||
public enum OpSpecifier
|
||||
{
|
||||
None,
|
||||
SelectTank,
|
||||
UnselectTank, /// tankNo is ignored, the selected tank is unselected
|
||||
}
|
||||
|
||||
TankSelector tankSelector;
|
||||
OpSpecifier currentOp;
|
||||
int tankNo;
|
||||
|
||||
public SelectTankOp(TankSelector tankSelector, OpSpecifier op, int tankNo)
|
||||
{
|
||||
this.tankSelector = tankSelector;
|
||||
this.currentOp = op;
|
||||
if (currentOp == OpSpecifier.SelectTank) this.tankNo = tankNo;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
switch (currentOp)
|
||||
{
|
||||
case OpSpecifier.SelectTank:
|
||||
tankSelector.SetOutputs((tankNo == 1) ? 1u : ((tankNo == 2) ? 2u : ((tankNo == 3) ? 4u : 0)));
|
||||
break;
|
||||
case OpSpecifier.UnselectTank:
|
||||
tankSelector.SetOutputs((tankNo == 1) ? 8u : ((tankNo == 2) ? 16u : ((tankNo == 3) ? 32u : 0)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
public Event Run()
|
||||
{
|
||||
tankSelector.SetOutputs(0);
|
||||
return Event.ConditionMet;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,11 +5,13 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TankSelector
|
||||
{
|
||||
public class TankSelector : ComponentBase, IOperation
|
||||
public class TankSelector : ComponentBase, ISequenceCondition, IDevice
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TankSelector));
|
||||
public override string ToString() { return string.Format("TankSelector({0})", Cfg.ToString(1)); }
|
||||
@ -20,13 +22,8 @@ namespace TBF.BenchControl.Modbus.TankSelector
|
||||
readonly Elde.ControlBoardDev controlBoard;
|
||||
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
None,
|
||||
SelectTank,
|
||||
}
|
||||
|
||||
CurrentOp currentOp;
|
||||
IList<string> sequenceConditionNames;
|
||||
IList<IOperation> sequenceConditions;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -52,6 +49,7 @@ namespace TBF.BenchControl.Modbus.TankSelector
|
||||
|
||||
public TankSelector()
|
||||
{
|
||||
CreateConditions(false);
|
||||
}
|
||||
|
||||
public TankSelector(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
@ -65,9 +63,39 @@ namespace TBF.BenchControl.Modbus.TankSelector
|
||||
controlBoard = (Elde.ControlBoardDev)TbfComponents.FindComponent(tankSelectorCfg.ControlBoard, components);
|
||||
if (controlBoard == null) throw new Exception(string.Format("Cannot find control board '{0}' for the component {1}", tankSelectorCfg.ControlBoard, Name));
|
||||
|
||||
CreateConditions(true);
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public void Initialize() { SetOutputs(0); }
|
||||
public void RunDeviceBefore() { }
|
||||
public void RunDeviceAfter() { }
|
||||
public void StopDevice() { SetOutputs(0); }
|
||||
|
||||
void CreateConditions(bool createAll)
|
||||
{
|
||||
sequenceConditionNames = new List<string>();
|
||||
sequenceConditionNames.Add(Strings.Select_COLD_tank);
|
||||
sequenceConditionNames.Add(Strings.Select_WARM_tank);
|
||||
sequenceConditionNames.Add(Strings.Select_HOT_tank);
|
||||
sequenceConditionNames.Add(Strings.Unselect_COLD_tank);
|
||||
sequenceConditionNames.Add(Strings.Unselect_WARM_tank);
|
||||
sequenceConditionNames.Add(Strings.Unselect_HOT_tank);
|
||||
|
||||
if (createAll)
|
||||
{
|
||||
sequenceConditions = new List<IOperation>();
|
||||
sequenceConditions.Add(new SelectTankOp(this, SelectTankOp.OpSpecifier.SelectTank, 1));
|
||||
sequenceConditions.Add(new SelectTankOp(this, SelectTankOp.OpSpecifier.SelectTank, 2));
|
||||
sequenceConditions.Add(new SelectTankOp(this, SelectTankOp.OpSpecifier.SelectTank, 3));
|
||||
sequenceConditions.Add(new SelectTankOp(this, SelectTankOp.OpSpecifier.UnselectTank, 1));
|
||||
sequenceConditions.Add(new SelectTankOp(this, SelectTankOp.OpSpecifier.UnselectTank, 2));
|
||||
sequenceConditions.Add(new SelectTankOp(this, SelectTankOp.OpSpecifier.UnselectTank, 3));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set outputs of QuidoRS board
|
||||
/// </summary>
|
||||
@ -78,69 +106,32 @@ namespace TBF.BenchControl.Modbus.TankSelector
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Events: SetOpututsDone, Error
|
||||
/// </summary>
|
||||
/// <param name="outValue">Reference to a variable for the pressure in Bar</param>
|
||||
/// <returns>SetOutputsOp instance reference casted to IOperaton</returns>
|
||||
//public IOperation SetOutputsOp(ushort outValue)
|
||||
//{
|
||||
// return new SetOutputsOp(this, outValue);
|
||||
//}
|
||||
public int ConditionsCount { get { return sequenceConditions != null ? sequenceConditions.Count : 0; } }
|
||||
|
||||
/// <summary>
|
||||
/// Events: pressureDone, Error
|
||||
/// </summary>
|
||||
/// <param name="outValue">Reference to a variable for the pressure in Bar</param>
|
||||
/// <param name="setOutputsDone">Event returned when SetOutput is done</param>
|
||||
/// <returns>SetOutputsOp instance reference casted to IOperaton</returns>
|
||||
//public IOperation ReadPressureOp(ushort outValue, Event setOutputsDone)
|
||||
//{
|
||||
// return new SetOutputsOp(this, outValue, setOutputsDone);
|
||||
//}
|
||||
|
||||
int tankNo;
|
||||
///
|
||||
public IOperation SelectTankOp(int tankNo)
|
||||
/// Returned strings are added to the combo-box
|
||||
public string ConditionName(int i)
|
||||
{
|
||||
if (currentOp != CurrentOp.None)
|
||||
if (sequenceConditionNames != null && i < sequenceConditionNames.Count && i >= 0)
|
||||
{
|
||||
throw new Exception("Cannot start operation 'SelectTankOp'");
|
||||
return sequenceConditionNames[i];
|
||||
}
|
||||
this.tankNo = tankNo;
|
||||
currentOp = CurrentOp.SelectTank;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
switch (currentOp)
|
||||
else
|
||||
{
|
||||
case CurrentOp.SelectTank:
|
||||
SetOutputs((tankNo==1) ? 1u : ((tankNo==2) ? 2u : ((tankNo==3) ? 3u : 0)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
public Event Run()
|
||||
{
|
||||
switch (currentOp)
|
||||
{
|
||||
case CurrentOp.SelectTank:
|
||||
return Event.Done;
|
||||
default:
|
||||
return Event.Done;
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
public IOperation ConditionOp(int i)
|
||||
{
|
||||
currentOp = CurrentOp.None;
|
||||
if (sequenceConditions != null && i < sequenceConditions.Count && i >= 0)
|
||||
{
|
||||
return sequenceConditions[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,6 +368,24 @@ namespace TBF.BenchControl.Sequences
|
||||
log.Info(activity + " " +step.Message);
|
||||
//------------------------------------------------
|
||||
|
||||
///
|
||||
/// Fetch the condition operation, null value is allowed if there is no condition
|
||||
///
|
||||
IOperation conditionOperation = null;
|
||||
if (step.EndCondition != "None")
|
||||
{
|
||||
string[] fields = step.EndCondition.Split(new char[]{'~'});
|
||||
if (fields.Length == 2)
|
||||
{
|
||||
ISequenceCondition seqCondition = TbfComponents.FindComponent(fields[0]) as ISequenceCondition;
|
||||
int condID;
|
||||
if (int.TryParse(fields[1], out condID))
|
||||
{
|
||||
conditionOperation = seqCondition.ConditionOp(condID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// FM controlled pumps are canged imediately without using any state operations
|
||||
log.DebugFormat("step.PumpWithFMPcts = {0}", step.PumpWithFMPcts);
|
||||
float[] allFMPumpPcts = Utils.GetPumpWithFMPcts(step);
|
||||
@ -421,6 +439,7 @@ namespace TBF.BenchControl.Sequences
|
||||
State stepStrt = State
|
||||
.Create(string.Format("SequenceBase.Transition() : Step {0} start, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(conditionOperation)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)));
|
||||
@ -443,6 +462,7 @@ namespace TBF.BenchControl.Sequences
|
||||
State stepDelay = State
|
||||
.Create(string.Format("SequenceBase.Transition() : Step {0} delay {1}s, opening={2}, closing={3}", step.ItemNr + 1, delay, step.ValvesOpen, step.ValvesClose))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(conditionOperation)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)))
|
||||
@ -460,6 +480,8 @@ namespace TBF.BenchControl.Sequences
|
||||
if (e.Contains(Event.Error) || e.Contains(Event.RegulValveTimeOut)) { errorFlag = true; break; }
|
||||
if (TestAndLogUiCmdStop(e)) { stopFlag = true; break; }
|
||||
|
||||
if (e.Contains(Event.ConditionMet)) endContitionFulfilled = true; ;
|
||||
/*
|
||||
switch (step.EndCondition)
|
||||
{
|
||||
case StepCondition.Scale1Empty:
|
||||
@ -477,6 +499,7 @@ namespace TBF.BenchControl.Sequences
|
||||
((StateMachine.Balance3 == null) || StateMachine.Balance3.IsEmpty());
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy) || (!endContitionFulfilled && e.Contains(Event.TimerBusy) && !e.Contains(Event.Next)));
|
||||
}
|
||||
@ -486,6 +509,7 @@ namespace TBF.BenchControl.Sequences
|
||||
log.DebugFormat("SequenceBase.Transition() : Step {0} stop, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose);
|
||||
State stepStop = State.Create(string.Format("SequenceBase.Transition() : Step {0} stop, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(conditionOperation)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)));
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.12.460.1")]
|
||||
[assembly: AssemblyFileVersion("2.12.460.1")]
|
||||
[assembly: AssemblyVersion("2.12.462.1")]
|
||||
[assembly: AssemblyFileVersion("2.12.462.1")]
|
||||
|
||||
54
TestBenchFramework/Resources/Strings.Designer.cs
generated
54
TestBenchFramework/Resources/Strings.Designer.cs
generated
@ -3354,6 +3354,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select COLD tank.
|
||||
/// </summary>
|
||||
internal static string Select_COLD_tank {
|
||||
get {
|
||||
return ResourceManager.GetString("Select_COLD_tank", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select Component.
|
||||
/// </summary>
|
||||
@ -3363,6 +3372,24 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select HOT tank.
|
||||
/// </summary>
|
||||
internal static string Select_HOT_tank {
|
||||
get {
|
||||
return ResourceManager.GetString("Select_HOT_tank", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select WORM tank.
|
||||
/// </summary>
|
||||
internal static string Select_WARM_tank {
|
||||
get {
|
||||
return ResourceManager.GetString("Select_WARM_tank", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Selected results.
|
||||
/// </summary>
|
||||
@ -4311,6 +4338,33 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unselect COLD tank.
|
||||
/// </summary>
|
||||
internal static string Unselect_COLD_tank {
|
||||
get {
|
||||
return ResourceManager.GetString("Unselect_COLD_tank", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unselect HOT tank.
|
||||
/// </summary>
|
||||
internal static string Unselect_HOT_tank {
|
||||
get {
|
||||
return ResourceManager.GetString("Unselect_HOT_tank", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unselect WARM tank.
|
||||
/// </summary>
|
||||
internal static string Unselect_WARM_tank {
|
||||
get {
|
||||
return ResourceManager.GetString("Unselect_WARM_tank", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Up.
|
||||
/// </summary>
|
||||
|
||||
@ -1633,4 +1633,22 @@
|
||||
<data name="Do_you_want_to_retry_RoI_detection" xml:space="preserve">
|
||||
<value>Do you want to retry RoI detection?</value>
|
||||
</data>
|
||||
<data name="Select_COLD_tank" xml:space="preserve">
|
||||
<value>Select COLD tank</value>
|
||||
</data>
|
||||
<data name="Select_HOT_tank" xml:space="preserve">
|
||||
<value>Select HOT tank</value>
|
||||
</data>
|
||||
<data name="Select_WARM_tank" xml:space="preserve">
|
||||
<value>Select WORM tank</value>
|
||||
</data>
|
||||
<data name="Unselect_COLD_tank" xml:space="preserve">
|
||||
<value>Unselect COLD tank</value>
|
||||
</data>
|
||||
<data name="Unselect_HOT_tank" xml:space="preserve">
|
||||
<value>Unselect HOT tank</value>
|
||||
</data>
|
||||
<data name="Unselect_WARM_tank" xml:space="preserve">
|
||||
<value>Unselect WARM tank</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -529,6 +529,7 @@
|
||||
<Compile Include="BenchControl\Modbus\QuidoRS\Factory.cs" />
|
||||
<Compile Include="BenchControl\Modbus\QuidoRS\SetOutputsOp.cs" />
|
||||
<Compile Include="BenchControl\Modbus\TankSelector\Factory.cs" />
|
||||
<Compile Include="BenchControl\Modbus\TankSelector\SelectTankOp.cs" />
|
||||
<Compile Include="BenchControl\Modbus\TankSelector\TankSelector.cs" />
|
||||
<Compile Include="BenchControl\Modbus\TankSelector\TankSelectorCfg.cs" />
|
||||
<Compile Include="BenchControl\Modbus\TankSelector\TankSelectorCfgCtrl.cs">
|
||||
@ -2341,7 +2342,9 @@
|
||||
</EmbeddedResource>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\app.manifest" />
|
||||
<None Include="Properties\app.manifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
||||
@ -38,9 +38,17 @@ namespace TBF.UiControls
|
||||
int regvCount; /// Number of regulating valves
|
||||
int vCount; /// Number of valves
|
||||
|
||||
IList<string> conditionNames;
|
||||
IList<string> conditionComponents;
|
||||
IList<int> conditionIDs;
|
||||
|
||||
|
||||
public TransitionStepsCtrl()
|
||||
: base()
|
||||
{
|
||||
conditionNames = new List<string>();
|
||||
conditionComponents = new List<string>();
|
||||
conditionIDs = new List<int>();
|
||||
}
|
||||
|
||||
public void Initialize(TransitionSequence sequence, TransitionsDlg parent, Control parentControl)
|
||||
@ -103,13 +111,29 @@ namespace TBF.UiControls
|
||||
tb.Visible = false;
|
||||
parent.Controls.Add(tb);
|
||||
|
||||
|
||||
/// End condition
|
||||
editors[(int)Column.Condition] = cb = new ComboBox();
|
||||
cb.Visible = false;
|
||||
cb.Items.Add("---");
|
||||
for (int i = 1; i < (int)StepCondition.Count; i++) cb.Items.Add(((StepCondition)i).ToString());
|
||||
///for (int i = 1; i < (int)StepCondition.Count; i++) cb.Items.Add(((StepCondition)i).ToString());
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (cmpnt is ISequenceCondition)
|
||||
{
|
||||
ISequenceCondition c = cmpnt as ISequenceCondition;
|
||||
for (int i = 0; i < c.ConditionsCount; i++)
|
||||
{
|
||||
cb.Items.Add(c.ConditionName(i));
|
||||
conditionNames.Add(c.ConditionName(i));
|
||||
conditionComponents.Add(cmpnt.Name);
|
||||
conditionIDs.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
parent.Controls.Add(cb);
|
||||
|
||||
|
||||
/// FM controlled pumps
|
||||
for (int i = fixedCount; i < fixedCount + fmPumpCount; i++)
|
||||
{
|
||||
@ -280,7 +304,32 @@ namespace TBF.UiControls
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
|
||||
lvi.SubItems.Add(string.IsNullOrEmpty(step.Message) ? string.Empty : step.Message);
|
||||
lvi.SubItems.Add((step.EndCondition == StepCondition.None) ? "---" : step.EndCondition.ToString());
|
||||
|
||||
if (step.EndCondition == "None")
|
||||
{
|
||||
lvi.SubItems.Add("---");
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] fields = step.EndCondition.Split( new char[] { '~' } );
|
||||
if (fields.Length == 2)
|
||||
{
|
||||
ISequenceCondition cmpnt = TbfComponents.FindComponent(fields[0], parent.TbfComponents) as ISequenceCondition;
|
||||
int id;
|
||||
if (cmpnt != null && int.TryParse(fields[1], out id) && id >= 0 && id < cmpnt.ConditionsCount)
|
||||
{
|
||||
lvi.SubItems.Add(cmpnt.ConditionName(id));
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add("---");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add("---");
|
||||
}
|
||||
}
|
||||
|
||||
string[] fmPumpsStr = (step.PumpWithFMPcts != null) ? step.PumpWithFMPcts.Split(new char[] { ';' })
|
||||
: new string[0];
|
||||
@ -347,12 +396,12 @@ namespace TBF.UiControls
|
||||
///
|
||||
/// Condition
|
||||
///
|
||||
step.EndCondition = StepCondition.None; /// When item text is "---" or a wrong value
|
||||
for (int cond = 1; cond < (int)StepCondition.Count; cond++)
|
||||
step.EndCondition = "None"; /// When item text is "---" or a wrong value
|
||||
for (int cix = 0; cix < conditionNames.Count; cix++)
|
||||
{
|
||||
if (lvi.SubItems[(int)Column.Condition].Text.Equals(((StepCondition)cond).ToString()))
|
||||
if (lvi.SubItems[(int)Column.Condition].Text.Equals(conditionNames[cix]))
|
||||
{
|
||||
step.EndCondition = (StepCondition)cond;
|
||||
step.EndCondition = string.Format("{0}~{1}", conditionComponents[cix], conditionIDs[cix]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user