Bug fix in TBF.Utils.GetRegulVallvesPositions( ), TBF crashed when fn. was called from OutputPath from UI.
This commit is contained in:
parent
4464a2025b
commit
0553caac89
@ -53,7 +53,14 @@ namespace TBF.BenchControl
|
||||
Diverter = (IDiverter)TbfComponents.FindComponent(entity.Diverter, components);
|
||||
TempDiv = (ITempMeter)TbfComponents.FindComponent(entity.TempDiv, components);
|
||||
Scale = (IScaleOrTank)TbfComponents.FindComponent(entity.Scale, components);
|
||||
RegulValvesPct = string.IsNullOrEmpty(entity.RegulValvesPct) ? new float[0] : Utils.GetRegulValvesPositions(entity.RegulValvesPct);
|
||||
|
||||
int regvCount = 0;
|
||||
foreach (var cmpnt in components)
|
||||
{
|
||||
if ((cmpnt is IRegulValve) && !(cmpnt is BenchControl.Elde.RegulValveTandem.RegulValveTandem)) regvCount++;
|
||||
}
|
||||
RegulValvesPct = string.IsNullOrEmpty(entity.RegulValvesPct) ? new float[0] : Utils.GetRegulValvesPositions(entity.RegulValvesPct, regvCount);
|
||||
|
||||
string[] svs = entity.StartValve != null ? entity.StartValve.Split(new char[] { '~' }) : new string[0];
|
||||
int iTmp;
|
||||
///
|
||||
|
||||
@ -645,7 +645,7 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
|
||||
/// Get regulation valve positioning operations
|
||||
IList<IOperation> rvPosOps = GetRegValvePositioningOps(RegulValves, Utils.GetRegulValvesPositions(step.RegulValvesPct));
|
||||
IList<IOperation> rvPosOps = GetRegValvePositioningOps(RegulValves, Utils.GetRegulValvesPositions(step.RegulValvesPct, RegulValves.Count));
|
||||
|
||||
/// Max. one SetRegulValvePositionOp can be started or stopped in one sub-step.
|
||||
/// Therefore SetRegulValvePositionOp operations are added and removed to subsequent states one by one.
|
||||
|
||||
@ -193,9 +193,8 @@ namespace TBF
|
||||
/// </summary>
|
||||
/// <param name="entity">String from TransitionStep entity defining all RegulValve positions</param>
|
||||
/// <returns>float[] of regulation valve positions from 0 to 100.0f</returns>
|
||||
public static float[] GetRegulValvesPositions(string regulValvesPct)
|
||||
public static float[] GetRegulValvesPositions(string regulValvesPct, int regvCount)
|
||||
{
|
||||
int regvCount = BenchControl.Sequences.SequenceBase.RegulValves.Count;
|
||||
float[] result = new float[regvCount];
|
||||
|
||||
string[] rvPosStr = string.IsNullOrEmpty(regulValvesPct) ? new string[0] : regulValvesPct.Split(new char[] { ';' });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user