TestMethods.Evacuation added.
This commit is contained in:
parent
2c00ed6dc4
commit
ff28d507cf
@ -129,6 +129,7 @@ namespace TBF.Rig
|
||||
Factories.Add(new TestMethods.DiverterTest.Factory());
|
||||
Factories.Add(new TestMethods.Dummy.Factory());
|
||||
Factories.Add(new TestMethods.Endurance.Factory());
|
||||
Factories.Add(new TestMethods.Evacuation.Factory());
|
||||
Factories.Add(new TestMethods.FixedStart.Single.Factory());
|
||||
Factories.Add(new TestMethods.FixedStart.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FixedStart.HeatMeters.Factory());
|
||||
|
||||
45
TBF/Rig/TestMethods/Evacuation/Component.cs
Normal file
45
TBF/Rig/TestMethods/Evacuation/Component.cs
Normal file
@ -0,0 +1,45 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Rig.TestMethods.Evacuation
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}({1})", GetType().Namespace.Substring(8), Cfg.ToString(1));
|
||||
}
|
||||
|
||||
public bool CanTest(MetersKind meters) { return true; }
|
||||
public bool DoTransitions() { return false; }
|
||||
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
return true;
|
||||
}
|
||||
|
||||
public Component() { }
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new EvacuationSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
95
TBF/Rig/TestMethods/Evacuation/EvacuationSeq.cs
Normal file
95
TBF/Rig/TestMethods/Evacuation/EvacuationSeq.cs
Normal file
@ -0,0 +1,95 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Common;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Rig.TestMethods.Evacuation
|
||||
{
|
||||
public class EvacuationSeq : Sequences.SequenceBase
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EvacuationSeq));
|
||||
|
||||
/// <summary>
|
||||
/// Fixed start mass collection method sequence
|
||||
/// </summary>
|
||||
/// <param name="test">Test entity</param>
|
||||
/// <returns>
|
||||
/// Event.Done . . . . . . . OK
|
||||
/// Event.MakeSecondPass . . OK, 2nd pass (=evaluation) required
|
||||
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
||||
/// Event.OpArgumentError . Target flow is out of range
|
||||
/// Event.Error . . . . . . Unspecified error
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
DebugMode debugLevel)
|
||||
{
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.JustStarted));
|
||||
|
||||
TransitionSequence purgeEnd = StateMachine.TransitionSequences
|
||||
.FirstOrDefault<TransitionSequence>(x => x.Name == StateMachine.Procedure.TransitionEnd);
|
||||
|
||||
TestStartTime = DateTime.Now;
|
||||
Event retVal = (purgeEnd != null) ? Transition(purgeEnd, TransitionContext.PurgeEnd) : Event.OK;
|
||||
bool passed = (retVal == Event.Done);
|
||||
TestEndTime = DateTime.Now;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
|
||||
if (tstRslt != null)
|
||||
{
|
||||
Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters);
|
||||
UpdateTempPressDensAmb(tstRslt);
|
||||
|
||||
/// Main results
|
||||
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
|
||||
tstRslt.StartTime = TestStartTime;
|
||||
tstRslt.EndTime = TestEndTime;
|
||||
tstRslt.TestTime = Math.Max(1.0, EndTime - StartTime); /// [s] measurement time, at least 1 to prevent division by zero
|
||||
tstRslt.TestDone = passed;
|
||||
tstRslt.ErrorFlags = 0;
|
||||
tstRslt.InfoFlags = 0;
|
||||
|
||||
///
|
||||
/// Single meters
|
||||
///
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
|
||||
GenericDevices.IRegReader regReader = sensPath.RegisterReaders[i];
|
||||
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.TestDone = passed;
|
||||
meterRslt.Passed = passed;
|
||||
}
|
||||
}
|
||||
|
||||
/// Update results
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.TransitionAfter));
|
||||
|
||||
return new List<Event> { retVal };
|
||||
}
|
||||
}
|
||||
}
|
||||
26
TBF/Rig/TestMethods/Evacuation/Factory.cs
Normal file
26
TBF/Rig/TestMethods/Evacuation/Factory.cs
Normal file
@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.Configs.NameOnly;
|
||||
|
||||
namespace TBF.Rig.TestMethods.Evacuation
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(GetType().Namespace.Substring(20), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1186,6 +1186,9 @@
|
||||
<Compile Include="Rig\TestMethods\Endurance\CycleStepsCtrl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rig\TestMethods\Evacuation\Component.cs" />
|
||||
<Compile Include="Rig\TestMethods\Evacuation\EvacuationSeq.cs" />
|
||||
<Compile Include="Rig\TestMethods\Evacuation\Factory.cs" />
|
||||
<Compile Include="Rig\TestMethods\FixedStartAdvanced\FixedStartAdvancedSeq.cs" />
|
||||
<Compile Include="Rig\TestMethods\FixedStartAdvanced\Single\Component.cs" />
|
||||
<Compile Include="Rig\TestMethods\FixedStartAdvanced\Single\Factory.cs" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user