diff --git a/TBF/Rig/ControlBoard/Enums.cs b/TBF/Rig/ControlBoard/Enums.cs new file mode 100644 index 000000000..75ec23478 --- /dev/null +++ b/TBF/Rig/ControlBoard/Enums.cs @@ -0,0 +1,19 @@ +/// +/// Copyright (c) 2022 Sensus Slovensko a.s. +/// +using System; +using Common; + +namespace TBF.Rig.ControlBoard +{ + public enum Activity + { + [Description("Idle")] Idle, + [Description("Setting flow")] SettingFlow, + [Description("Flying start/stop test")] FlyingStartStopTest, + [Description("Flying start/stop test with div.")] FlyingStartStopTestWithDiverter, + [Description("Standing start/stop test")] StandingStartStopTest, + [Description("Test completed")] TestCompleted, + Count + } +} diff --git a/TBF/Rig/ControlBoard/IControlBoard.cs b/TBF/Rig/ControlBoard/IControlBoard.cs index 91a5837bb..e427fcd7e 100644 --- a/TBF/Rig/ControlBoard/IControlBoard.cs +++ b/TBF/Rig/ControlBoard/IControlBoard.cs @@ -1,4 +1,7 @@ -using System; +/// +/// Copyright (c) 2021-2022 Sensus Slovensko a.s. +/// +using System; using Config.Entities; using Dirichlet.Numerics; using TBF.Boxes; @@ -16,6 +19,9 @@ namespace TBF.Rig.ControlBoard /// void ClearProcessValues(); + Activity Activity { get; } /// Control board activity + void SetActivity(Activity a); + /// /// Values valid always /// diff --git a/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs b/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs index 4d828c071..7b47dd683 100644 --- a/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs +++ b/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs @@ -42,6 +42,10 @@ namespace TBF.Rig.ControlBoard.Papouch OutputPath devices; + public Activity Activity { get { return activity; } } /// Control board activity + Activity activity; + public void SetActivity(Activity a) { activity = a; } + enum SelectedOp { @@ -338,7 +342,11 @@ namespace TBF.Rig.ControlBoard.Papouch /// /// Called from ProcessData.ClearProcessValues() at the beginning of each test /// - public void ClearProcessValues() { } + public void ClearProcessValues() + { + /// Called from ProcessData.ClearProcessValues() at the beginning of each test + SetActivity(Activity.Idle); + } /// /// Set valves to new positions. diff --git a/TBF/Rig/ControlBoard/Uni/FlyingStartStopTestOp.cs b/TBF/Rig/ControlBoard/Uni/FlyingStartStopTestOp.cs index 4a159482a..1018f9300 100644 --- a/TBF/Rig/ControlBoard/Uni/FlyingStartStopTestOp.cs +++ b/TBF/Rig/ControlBoard/Uni/FlyingStartStopTestOp.cs @@ -96,6 +96,7 @@ namespace TBF.Rig.ControlBoard.Uni regV.Idx1, flowMeter.Idx1, (diverter != null) ? diverter.DiverterNr : 0, qFrom, qTo); /// Start the test (and the flow measurement) + uniCB.SetActivity((diverter != null) ? Activity.FlyingStartStopTestWithDiverter : Activity.FlyingStartStopTest); uniCB.StartTest(false, flowMeter.Idx1, (diverter != null) ? diverter.DiverterNr : 0, (diverter != null) ? diverter.StartThreshold : 0, true, withDiverter, false, isProlonged, pulsesCount, massPulsesCount); @@ -212,6 +213,7 @@ namespace TBF.Rig.ControlBoard.Uni public void Stop() { log.Info("Op.Stop()"); + uniCB.SetActivity((opState == OpState.TestCompleted) ? Activity.TestCompleted : Activity.Idle); uniCB.StopAll(false); } } diff --git a/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs b/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs index 747f0a1d0..b5dae668f 100644 --- a/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs +++ b/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs @@ -74,6 +74,7 @@ namespace TBF.Rig.ControlBoard.Uni log.InfoFormat("Start() Et#={0} pulses={1} withDiverter={2}", flowMeter.Idx1, pulsesCount, withDiverter); /// Start the test (and the flow measurement) + uniCB.SetActivity(Activity.StandingStartStopTest); uniCB.StartTest(false, flowMeter.Idx1, (withDiverter ? diverter.DiverterNr : 0), 0, false, withDiverter, true, false, pulsesCount); @@ -122,6 +123,7 @@ namespace TBF.Rig.ControlBoard.Uni public void Stop() { log.Info("Stop()"); + uniCB.SetActivity((opState == OpState.TestCompleted) ? Activity.TestCompleted : Activity.Idle); uniCB.StopAll(false); } } diff --git a/TBF/Rig/ControlBoard/Uni/UniCB.cs b/TBF/Rig/ControlBoard/Uni/UniCB.cs index d49bca711..80f99677f 100644 --- a/TBF/Rig/ControlBoard/Uni/UniCB.cs +++ b/TBF/Rig/ControlBoard/Uni/UniCB.cs @@ -82,7 +82,11 @@ namespace TBF.Rig.ControlBoard.Uni ScopeAnalyzerData scopeAnalyzerData; SwitchCountersData switchCounterData; - public UInt64 State { get { return Data.State; } } /// Control board state + public UInt64 State { get { return Data.State; } } /// Control board state + + public Activity Activity { get { return activity; } } /// Control board activity + Activity activity; + public void SetActivity(Activity a) { activity = a; } /// Quido RS TBF.Rig.Modbus.QuidoRS.QuidoRS quidoRS; @@ -90,7 +94,7 @@ namespace TBF.Rig.ControlBoard.Uni /// Current flow meter ID public int FlowmeterId { get { return Convert.ToInt32(Data.State & (ulong)StatusP.FlowmtrNrMask); } } - public UInt64 DigitalInputs { get { return Data.Vstupy; } } /// Digital inputs + public UInt64 DigitalInputs { get { return Data.Vstupy; } } /// Digital inputs public Int16 AnalogInput(int channel) { @@ -601,7 +605,11 @@ namespace TBF.Rig.ControlBoard.Uni /// /// Interface functions /// - public void ClearProcessValues() { } /// Called from ProcessData.ClearProcessValues() at the beginning of each test + public void ClearProcessValues() + { + /// Called from ProcessData.ClearProcessValues() at the beginning of each test + SetActivity(Activity.Idle); + } public double TestTimeWM(int wmNr1) { diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index c24878275..3896ed6a4 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -204,6 +204,7 @@ ComponentCfgCtrl.cs +