- bug fixed when component (class) in the DB does not exist in the code

- preparing FixedStartMassCollection sequence
This commit is contained in:
Milan Hanajik 2014-09-16 12:04:08 +02:00
parent c187dc9abf
commit a79be1e07a
11 changed files with 41 additions and 30 deletions

View File

@ -18,6 +18,8 @@ namespace TBF.BenchControl.Sequences
{
private static readonly ILog log = LogManager.GetLogger(typeof(SequenceBase));
protected static readonly ILog processDataLogger = LogManager.GetLogger("ProcessData");
protected static readonly ILog allResults = LogManager.GetLogger("AllResults");
protected static readonly ILog summaryResults = LogManager.GetLogger("SummaryResults");
///------------------------------------------------------------
/// Global static variables set only once.

View File

@ -57,9 +57,15 @@ namespace TBF.BenchControl
return null;
}
/// <summary>
/// Get a component configuration given a component DB entity
/// </summary>
/// <param name="entity">DB entity</param>
/// <returns>An appropriate component configuration or null if factory was not found</returns>
public static IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component entity)
{
return CmpntFactoryFromClassName(entity.ClassName).CmpntCfgFromCmpntEntity(entity);
IComponentFactory cmpntFactory = CmpntFactoryFromClassName(entity.ClassName);
return (cmpntFactory != null) ? cmpntFactory.CmpntCfgFromCmpntEntity(entity) : null;
}
/// <summary>
@ -81,9 +87,11 @@ namespace TBF.BenchControl
IList<IComponent> components = new List<BenchControl.Generic.IComponent>();
foreach (var entity in cmptnEntities)
{
IComponent cmpnt = BenchControl.TbfComponents
.CmpntFactoryFromClassName(entity.ClassName)
.ComponentFromCmpntCfg(BenchControl.TbfComponents.CmpntCfgFromCmpntEntity(entity), components);
IComponentFactory cmpntFactory = BenchControl.TbfComponents.CmpntFactoryFromClassName(entity.ClassName);
if (cmpntFactory == null) continue;
IComponent cmpnt = cmpntFactory
.ComponentFromCmpntCfg(BenchControl.TbfComponents.CmpntCfgFromCmpntEntity(entity), components);
/// Inherit DebugMode from the parent (if any)
if ((cmpnt.Cfg.DebugLevel == Entities.DebugMode.Inherit) &&

View File

@ -10,8 +10,6 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
public class RoiDetectionSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(RoiDetectionSeq));
private static readonly ILog allResults = LogManager.GetLogger("AllResults");
private static readonly ILog summaryResults = LogManager.GetLogger("SummaryResults");
public IList<Event> Execute(Entities.Test test)

View File

@ -12,9 +12,6 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
public class CombinedMetersSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(CombinedMetersSeq));
private static readonly ILog allResults = LogManager.GetLogger("AllResults");
private static readonly ILog summaryResults = LogManager.GetLogger("SummaryResults");
private static readonly ILog processDataLog = LogManager.GetLogger("ProcessData");
/// <summary>
/// Flying start mass collection method sequence for combined meter

View File

@ -11,9 +11,6 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
public class CombinedWithDetectionSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(CombinedWithDetectionSeq));
private static readonly ILog allResults = LogManager.GetLogger("AllResults");
private static readonly ILog summaryResults = LogManager.GetLogger("SummaryResults");
private static readonly ILog processDataLog = LogManager.GetLogger("ProcessData");
const int DetectionBufferSize = 9;
const int DetectionKernelSize = 5;

View File

@ -12,9 +12,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
public class FixedStartMassCollectionSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(FixedStartMassCollectionSeq));
private static readonly ILog allResults = LogManager.GetLogger("AllResults");
private static readonly ILog summaryResults = LogManager.GetLogger("SummaryResults");
private static readonly ILog processDataLog = LogManager.GetLogger("ProcessData");
/// <summary>
/// Flying start mass collection method sequence
@ -69,7 +66,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
///
/// Measure the weight and skip emptying if there is enough room in the tank
///
State.Create("FlyingStartCollectionMethod : Measuring the mass of water in the tank")
State.Create("FixedStartMassCollection : Measuring the mass of water in the tank")
.AddOperation(checkUiOp)
.AddOperation(outPath.Balance.ReadMassOp(ref mass))
.EnterState();
@ -106,7 +103,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
foreach (var pump in PumpsWithFM) pump.TurnOnDfltPower();
State.Create("FlyingStartCollectionMethod : Starting the pump")
State.Create("FixedStartMassCollection : Starting the pump")
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
@ -123,7 +120,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
while (!e.Contains(Event.ValvesSet));
//--------------------------------
State.Create("FlyingStartCollectionMethod : Setting the flow")
State.Create("FixedStartMassCollection : Setting the flow")
.AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min.
.EnterState();
@ -143,6 +140,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
while (!e.Contains(Event.FlowReached));
flow_set:
////------------------------------------------------
//Bridge.OnActivity(this, Strings.Stopping_the_flow_fixed_start);
////------------------------------------------------
//State.Create("FixedStartMassCollection : Stopping the flow (fixed start test)")
// .AddOperation(checkUiOp)
int time = StateMachine.Time;
float currentFlow = refFlow.Val;
@ -157,7 +161,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------
State.Create("FlyingStartCollectionMethod : Measuring the start mass")
State.Create("FixedStartMassCollection : Measuring the start mass")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
@ -186,7 +190,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------
State.Create("FlyingStartCollectionMethod : Starting the test")
State.Create("FixedStartMassCollection : Starting the test")
.AddOperation(checkUiOp)
.AddOperations(measureOperations)
.AddOperation(cBrd.StartMeasurementOp(outPath.FlowMeter, totalPulses, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, (float)test.TolerRed))
@ -263,7 +267,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------
State.Create("FlyingStartCollectionMethod : Measuring the end mass")
State.Create("FixedStartMassCollection : Measuring the end mass")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
@ -380,7 +384,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// Quit this sequence ///
///----------------------///
State.Create("FlyingStartCollectionMethod : Stopping diverter, gate, etc.")
State.Create("FixedStartMassCollection : Stopping diverter, gate, etc.")
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();

View File

@ -12,9 +12,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
public class FlyingStartSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlyingStartSeq));
private static readonly ILog allResults = LogManager.GetLogger("AllResults");
private static readonly ILog summaryResults = LogManager.GetLogger("SummaryResults");
private static readonly ILog processDataLog = LogManager.GetLogger("ProcessData");
/// <summary>
/// Flying start mass collection method sequence

View File

@ -12,8 +12,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
public class FlyingStartCollectionMethodSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlyingStartCollectionMethodSeq));
private static readonly ILog allResults = LogManager.GetLogger("AllResults");
private static readonly ILog summaryResults = LogManager.GetLogger("SummaryResults");
/// <summary>
/// Flying start mass collection method sequence
@ -142,6 +140,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
while (!e.Contains(Event.FlowReached));
flow_set:
int time = StateMachine.Time;
float currentFlow = refFlow.Val;

View File

@ -12,9 +12,6 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
public class ReferenceFlowmeterCalibrationSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(ReferenceFlowmeterCalibrationSeq));
private static readonly ILog allResults = LogManager.GetLogger("AllResults");
private static readonly ILog summaryResults = LogManager.GetLogger("SummaryResults");
private static readonly ILog processDataLog = LogManager.GetLogger("ProcessData");
/// <summary>
/// Flying start mass collection method sequence

View File

@ -1662,6 +1662,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Stopping the flow (fixed start test).
/// </summary>
internal static string Stopping_the_flow_fixed_start {
get {
return ResourceManager.GetString("Stopping_the_flow_fixed_start", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>

View File

@ -826,4 +826,7 @@
<data name="dflt" xml:space="preserve">
<value>dflt</value>
</data>
<data name="Stopping_the_flow_fixed_start" xml:space="preserve">
<value>Stopping the flow (fixed start test)</value>
</data>
</root>