diff --git a/TestBenchFramework/BenchControl/GenericDevices/ICamera.cs b/TestBenchFramework/BenchControl/GenericDevices/ICamera.cs index 8054f2622..34fd9b77f 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/ICamera.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/ICamera.cs @@ -12,6 +12,10 @@ namespace TBF.BenchControl.GenericDevices /// int CameraNr { get; } + string RoiParams { get; set; } + + void ClearRoiParams(); + /// /// Grab one image. /// diff --git a/TestBenchFramework/BenchControl/GenericDevices/IRoi.cs b/TestBenchFramework/BenchControl/GenericDevices/IRoi.cs index 4a739a094..fff766c7c 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/IRoi.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/IRoi.cs @@ -11,6 +11,8 @@ namespace TBF.BenchControl.GenericDevices bool Detected { get; set; } + string RoiParams { get; } + /// /// Watermeter wheel/arrow detection process. /// diff --git a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs index 97b91b0e6..024268317 100644 --- a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs +++ b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs @@ -20,8 +20,8 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 { return string.Format("{0}, Name={1}, HWAddress={2}, IPAddress={3}, Serial={4}, Image={5}", this.GetType().Namespace.Substring(17), - cameraCfg.Name, - cameraCfg.HardwareAddress, + CameraCfg.Name, + CameraCfg.HardwareAddress, ipAddress == null ? "not detected" : ipAddress.ToString(), string.IsNullOrEmpty(serial) ? "not detected" : serial, string.IsNullOrEmpty(sdCardVer) ? "not detected" : sdCardVer); @@ -36,24 +36,33 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 const string ClpPrompt = "$ "; - readonly CameraCfg cameraCfg; + public readonly CameraCfg CameraCfg; public readonly GenericDevices.INetworkAdapter NetAdapter; public IPAddress IPAddress { get { return ipAddress; } } IPAddress ipAddress; - public string Hardware { get { return hardware; } } string hardware; + public string Hardware { get { return hardware; } } - public string Revision { get { return revision; } } string revision; + public string Revision { get { return revision; } } - public string Serial { get { return serial; } } string serial; + public string Serial { get { return serial; } } - public string SDCardVer { get { return sdCardVer; } } string sdCardVer; + public string SDCardVer { get { return sdCardVer; } } + + + string roiParams; + public string RoiParams + { + get { return roiParams; } + set { roiParams = value; } + } + public void ClearRoiParams() { roiParams = string.Empty; } public Telnet.TelnetClient Telnet; @@ -77,7 +86,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 public Camera(Generic.IComponentCfg cfg, IList components) : base(cfg) { - cameraCfg = cfg as CameraCfg; + CameraCfg = cfg as CameraCfg; NetAdapter = TbfComponents.FindComponent(cfg.ParentName, components) as GenericDevices.INetworkAdapter; if (NetAdapter == null) throw new ArgumentNullException("no network adapter"); @@ -85,6 +94,8 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 terminalDlg = null; measurementUdpPortNr = GetNextUdpPortNr(); + + ClearRoiParams(); running = false; @@ -95,20 +106,20 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 public void Initialize() { - if (cameraCfg.DebugLevel == DebugMode.Simulate) return; + if (CameraCfg.DebugLevel == DebugMode.Simulate) return; /// Detect a camera - bool cameraDetected = DetectCamera(cameraCfg.HardwareAddress, true, + bool cameraDetected = DetectCamera(CameraCfg.HardwareAddress, true, out ipAddress, out hardware, out revision, out serial, out sdCardVer); if (!cameraDetected) throw new Exception(string.Format("Camera {0} with address {1} not detected", - Name, cameraCfg.HardwareAddress)); + Name, CameraCfg.HardwareAddress)); /// Open telnet clint and start the log-in process - Telnet = new Telnet.TelnetClient(this, cameraCfg.Name, ClpUserName, ClpPassword, ClpPrompt); + Telnet = new Telnet.TelnetClient(this, CameraCfg.Name, ClpUserName, ClpPassword, ClpPrompt); - if (cameraCfg.DisplayTerminal) + if (CameraCfg.DisplayTerminal) { - terminalDlg = new TerminalDlg(cameraCfg.Name, Telnet); + terminalDlg = new TerminalDlg(CameraCfg.Name, Telnet); terminalDlg.Show(); } @@ -147,7 +158,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 { if (Telnet != null) { - return new MeasurementOp(this, NetAdapter.IPAddress.ToString(), measurementUdpPortNr, string.Empty); /// TODO + return new MeasurementOp(this, NetAdapter.IPAddress.ToString(), measurementUdpPortNr, roiParams); } else { @@ -223,9 +234,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 } string msg = string.Format("Camera {0} detected in {1} ms: HWAddress={2} IPAddress={3} {4}", - cameraCfg.Name, + CameraCfg.Name, duration_ms, - cameraCfg.HardwareAddress, + CameraCfg.HardwareAddress, ipAddress == null ? "not detected" : ipAddress.ToString(), response); log.Info(msg); diff --git a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/MeasurementOp.cs b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/MeasurementOp.cs index fd3cd78a0..c51ffa8de 100644 --- a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/MeasurementOp.cs +++ b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/MeasurementOp.cs @@ -5,11 +5,12 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 public class MeasurementOp : IOperation { readonly CLP1611.Camera camera; + readonly CLP1611.CameraCfg cameraCfg; readonly Telnet.TelnetClient telnet; readonly string ipAddress; readonly int portNr; - readonly string args; + readonly string roiArgs; string command; bool measurementCommandSent; @@ -19,13 +20,14 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 /// Events: Event.None or Event.Error /// /// CLP1611.Camera reference - public MeasurementOp(Camera camera, string ipAddress, int portNr, string args) + public MeasurementOp(Camera camera, string ipAddress, int portNr, string roiArgs) { this.camera = camera; + this.cameraCfg = camera.CameraCfg; this.telnet = camera.Telnet; this.ipAddress = ipAddress; this.portNr = portNr; - this.args = args; + this.roiArgs = roiArgs; measurementCommandSent = false; } @@ -45,8 +47,11 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 // // Prepare and send (=enqueue) command // - command = string.Format("clp/Measurement -o {4}:{5} {6}", ipAddress, portNr, args); - //command = string.Format("clp/Measurement -r {0} {1} {2} {3} -o {4}:{5} {6}", roiX, roiY, roiWid, roiHgh, ipAddress, portNr, args); + command = string.Format("clp/Measurement -udp {0} {1}{2}{3} 1 1 0 0 0", + ipAddress, + portNr, + cameraCfg.UseTestImages ? (" -l " + cameraCfg.TestImagesCount.ToString()) : string.Empty, + roiArgs); telnet.Enqueue(new Telnet.Command(Telnet.CmdAction.SEND_STRING, command)); measurementCommandSent = true; } diff --git a/TestBenchFramework/BenchControl/Network/Camera/Roi/Roi.cs b/TestBenchFramework/BenchControl/Network/Camera/Roi/Roi.cs index 2cfcb0097..a71c38cda 100644 --- a/TestBenchFramework/BenchControl/Network/Camera/Roi/Roi.cs +++ b/TestBenchFramework/BenchControl/Network/Camera/Roi/Roi.cs @@ -20,7 +20,7 @@ namespace TBF.BenchControl.Network.Camera.Roi /// /// Cfg /// - readonly RoiCfg roiCfg; + public readonly RoiCfg RoiCfg; public readonly CLP1611.Camera NetCamera; public readonly Roi PreviousRoi; @@ -32,7 +32,7 @@ namespace TBF.BenchControl.Network.Camera.Roi /// public GenericDevices.ICamera Camera { get { return NetCamera as GenericDevices.ICamera; } } - public double PulsesPerLtr { get { return (double)roiCfg.ProcParams.PulsesPerLtr; } } + public double PulsesPerLtr { get { return (double)RoiCfg.ProcParams.PulsesPerLtr; } } public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); ; } } public int WMPulses { get { return wmPulses; } } @@ -56,6 +56,12 @@ namespace TBF.BenchControl.Network.Camera.Roi public Boxes.IntBox RoiY; public Boxes.IntBox RoiWid; public Boxes.IntBox RoiHgh; + /// + public string RoiParams + { + get { return string.Format(" -roi 1 {0} {1} {2} bkgnd.bmp", RoiX.Val, RoiY.Val, RoiCfg.RoiParams); } + } + public Roi() @@ -66,10 +72,10 @@ namespace TBF.BenchControl.Network.Camera.Roi public Roi(Generic.IComponentCfg cfg, IList components) : base(cfg) { - roiCfg = cfg as RoiCfg; + RoiCfg = cfg as RoiCfg; NetCamera = TbfComponents.FindComponent(cfg.ParentName, components) as CLP1611.Camera; - PreviousRoi = TbfComponents.FindComponent(roiCfg.PreviousRoi, components) as Roi; + PreviousRoi = TbfComponents.FindComponent(RoiCfg.PreviousRoi, components) as Roi; detected = false; RoiX = new Boxes.IntBox(); @@ -103,9 +109,9 @@ namespace TBF.BenchControl.Network.Camera.Roi { if (args.Command == CfgChangeCmd.CfgChange) { - roiCfg.RoiParams = tmpcfg.RoiParams; - roiCfg.UseTestImages = tmpcfg.UseTestImages; - roiCfg.TestImagesCount = tmpcfg.TestImagesCount; + RoiCfg.RoiParams = tmpcfg.RoiParams; + RoiCfg.UseTestImages = tmpcfg.UseTestImages; + RoiCfg.TestImagesCount = tmpcfg.TestImagesCount; } } }; @@ -127,7 +133,7 @@ namespace TBF.BenchControl.Network.Camera.Roi if (NetCamera != null && NetCamera.Telnet != null) { Telnet = NetCamera.Telnet; - return new RoiDetectionOp(this, roiCfg.RoiParams, RoiX, RoiY, RoiWid, RoiHgh); + return new RoiDetectionOp(this, RoiX, RoiY, RoiWid, RoiHgh); } else { diff --git a/TestBenchFramework/BenchControl/Network/Camera/Roi/RoiDetectionOp.cs b/TestBenchFramework/BenchControl/Network/Camera/Roi/RoiDetectionOp.cs index f085c343b..a8384a65f 100644 --- a/TestBenchFramework/BenchControl/Network/Camera/Roi/RoiDetectionOp.cs +++ b/TestBenchFramework/BenchControl/Network/Camera/Roi/RoiDetectionOp.cs @@ -5,9 +5,9 @@ namespace TBF.BenchControl.Network.Camera.Roi public class RoiDetectionOp : IOperation { readonly Roi roi; + readonly RoiCfg roiCfg; readonly CLP1611.Camera camera; readonly Telnet.TelnetClient telnet; - readonly string args; string command; bool roiDetectionCommandSent; @@ -28,13 +28,13 @@ namespace TBF.BenchControl.Network.Camera.Roi /// Events: Event.None or Event.Error /// /// CLP1611.Camera reference - public RoiDetectionOp(Roi roi, string args, Boxes.IntBox roiX, Boxes.IntBox roiY, - Boxes.IntBox roiWid, Boxes.IntBox roiHgh) + public RoiDetectionOp(Roi roi, Boxes.IntBox roiX, Boxes.IntBox roiY, + Boxes.IntBox roiWid, Boxes.IntBox roiHgh) { this.roi = roi; + this.roiCfg = roi.RoiCfg; this.camera = roi.NetCamera; this.telnet = roi.Telnet; - this.args = args; this.roiX = roiX; this.roiY = roiY; this.roiWid = roiWid; @@ -90,7 +90,10 @@ namespace TBF.BenchControl.Network.Camera.Roi previous.RoiWid.Val, previous.RoiHgh.Val); previous = previous.PreviousRoi; } - command = string.Format("clp/RoiDetection{0} {1}", masks, args); + command = string.Format("clp/RoiDetection{0}{1} {2}", + masks, + roiCfg.UseTestImages ? (" -l " + roiCfg.TestImagesCount.ToString()) : string.Empty, + roiCfg.RoiParams); // // Send (or enqueue) command diff --git a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs index 8d330b62c..f8c6afc2f 100644 --- a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs @@ -171,13 +171,43 @@ namespace TBF.BenchControl.TestMethods.Adjustment int time = StateMachine.Time; double currentFlow = RefFlow.Val; - /// Extract cameras from the current sensors path, add operations to the detection state - IList measureOperations = new List(); - for (int i = 0; i < sensPath.RegisterReaders.Length; i++) - { - GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi; - if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp()); - } + + /// + /// Prepare cameras, ROI-s and measurementOperations + /// + + /// Find ROI-s + IList rois = new List(); + foreach (var rr in sensPath.RegisterReaders) + { + if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi); + } + + /// Find cameras + IList cameras = new List(); + foreach (var roi in rois) + { + if (!cameras.Contains(roi.Camera)) + { + roi.Camera.ClearRoiParams(); + cameras.Add(roi.Camera); + } + } + + /// Register ROI-parameters to cameras + foreach (var roi in rois) + { + roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams; + } + + /// Prepare measurementOperations + IList measureOperations = new List(); + foreach (var camera in cameras) + { + measureOperations.Add(camera.MeasurementOp()); + } + + //------------------------------------------------ Bridge.OnActivity(this, Strings.Test_in_progress); diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index 2080f1865..fe63b0929 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -176,13 +176,43 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection int flowDetectTime = 0; float estFlowSetTime = 100.0f; - /// Extract cameras from the current sensors path, add operations to the detection state - IList measureOperations = new List(); - for (int i = 0; i < sensPath.RegisterReaders.Length; i++) - { - GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi; - if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp()); - } + + /// + /// Prepare cameras, ROI-s and measurementOperations + /// + + /// Find ROI-s + IList rois = new List(); + foreach (var rr in sensPath.RegisterReaders) + { + if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi); + } + + /// Find cameras + IList cameras = new List(); + foreach (var roi in rois) + { + if (!cameras.Contains(roi.Camera)) + { + roi.Camera.ClearRoiParams(); + cameras.Add(roi.Camera); + } + } + + /// Register ROI-parameters to cameras + foreach (var roi in rois) + { + roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams; + } + + /// Prepare measurementOperations + IList measureOperations = new List(); + foreach (var camera in cameras) + { + measureOperations.Add(camera.MeasurementOp()); + } + + //------------------------------------------------ Bridge.OnActivity(this, Strings.Switching_flow_detection); diff --git a/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs index 9185c60d5..00f472322 100644 --- a/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs @@ -149,13 +149,43 @@ namespace TBF.BenchControl.TestMethods.Endurance /// Flying start measurement through line 1 or line 2 ///----------------------------------------------------- - /// Extract cameras from the current sensors path, add operations to the detection state - IList measureOperations = new List(); - for (int i = 0; i < sensPath.RegisterReaders.Length; i++) - { - GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi; - if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp()); - } + + /// + /// Prepare cameras, ROI-s and measurementOperations + /// + + /// Find ROI-s + IList rois = new List(); + foreach (var rr in sensPath.RegisterReaders) + { + if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi); + } + + /// Find cameras + IList cameras = new List(); + foreach (var roi in rois) + { + if (!cameras.Contains(roi.Camera)) + { + roi.Camera.ClearRoiParams(); + cameras.Add(roi.Camera); + } + } + + /// Register ROI-parameters to cameras + foreach (var roi in rois) + { + roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams; + } + + /// Prepare measurementOperations + IList measureOperations = new List(); + foreach (var camera in cameras) + { + measureOperations.Add(camera.MeasurementOp()); + } + + //------------------------------------------------ Bridge.OnActivity(this, Strings.Test_in_progress); diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs index 0339ef8f2..dd89edf96 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs @@ -208,13 +208,41 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced double currentFlow = RefFlow.Val; - /// Extract cameras from the current sensors path, add operations to the detection state - IList measureOperations = new List(); - for (int i = 0; i < sensPath.RegisterReaders.Length; i++) - { - GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi; - if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp()); - } + /// + /// Prepare cameras, ROI-s and measurementOperations + /// + + /// Find ROI-s + IList rois = new List(); + foreach (var rr in sensPath.RegisterReaders) + { + if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi); + } + + /// Find cameras + IList cameras = new List(); + foreach (var roi in rois) + { + if (!cameras.Contains(roi.Camera)) + { + roi.Camera.ClearRoiParams(); + cameras.Add(roi.Camera); + } + } + + /// Register ROI-parameters to cameras + foreach (var roi in rois) + { + roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams; + } + + /// Prepare measurementOperations + IList measureOperations = new List(); + foreach (var camera in cameras) + { + measureOperations.Add(camera.MeasurementOp()); + } + /// diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index ab0c1facc..47497f5fe 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -283,13 +283,41 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection double currentFlow = RefFlow.Val; - /// Extract cameras from the current sensors path, add operations to the detection state - IList measureOperations = new List(); - for (int i = 0; i < sensPath.RegisterReaders.Length; i++) - { - GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi; - if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp()); - } + /// + /// Prepare cameras, ROI-s and measurementOperations + /// + + /// Find ROI-s + IList rois = new List(); + foreach (var rr in sensPath.RegisterReaders) + { + if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi); + } + + /// Find cameras + IList cameras = new List(); + foreach (var roi in rois) + { + if (!cameras.Contains(roi.Camera)) + { + roi.Camera.ClearRoiParams(); + cameras.Add(roi.Camera); + } + } + + /// Register ROI-parameters to cameras + foreach (var roi in rois) + { + roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams; + } + + /// Prepare measurementOperations + IList measureOperations = new List(); + foreach (var camera in cameras) + { + measureOperations.Add(camera.MeasurementOp()); + } + /// diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index 50c14458c..e9971995c 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -243,13 +243,43 @@ namespace TBF.BenchControl.TestMethods.FlyingStart temperature_set: - /// Extract cameras from the current sensors path, add operations to the detection state - IList measureOperations = new List(); - for (int i = 0; i < sensPath.RegisterReaders.Length; i++) - { - GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi; - if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp()); - } + + /// + /// Prepare cameras, ROI-s and measurementOperations + /// + + /// Find ROI-s + IList rois = new List(); + foreach (var rr in sensPath.RegisterReaders) + { + if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi); + } + + /// Find cameras + IList cameras = new List(); + foreach (var roi in rois) + { + if (!cameras.Contains(roi.Camera)) + { + roi.Camera.ClearRoiParams(); + cameras.Add(roi.Camera); + } + } + + /// Register ROI-parameters to cameras + foreach (var roi in rois) + { + roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams; + } + + /// Prepare measurementOperations + IList measureOperations = new List(); + foreach (var camera in cameras) + { + measureOperations.Add(camera.MeasurementOp()); + } + + //------------------------------------------------ Bridge.OnActivity(this, Strings.Test_in_progress); diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index bdc26d414..1392d88a4 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -344,14 +344,43 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection temperature_set: - /// Extract cameras from the current sensors path, add operations to the detection state - IList measureOperations = new List(); - for (int i = 0; i < sensPath.RegisterReaders.Length; i++) + + /// + /// Prepare cameras, ROI-s and measurementOperations + /// + + /// Find ROI-s + IList rois = new List(); + foreach (var rr in sensPath.RegisterReaders) + { + if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi); + } + + /// Find cameras + IList cameras = new List(); + foreach (var roi in rois) { - GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi; - if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp()); + if (!cameras.Contains(roi.Camera)) + { + roi.Camera.ClearRoiParams(); + cameras.Add(roi.Camera); + } } + /// Register ROI-parameters to cameras + foreach (var roi in rois) + { + roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams; + } + + /// Prepare measurementOperations + IList measureOperations = new List(); + foreach (var camera in cameras) + { + measureOperations.Add(camera.MeasurementOp()); + } + + if (emptyTheTank) { @@ -476,6 +505,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection while (!e.Contains(Event.MeasurementStarted)); + foreach (var rr in sensPath.RegisterReaders) + { + } + foreach (var rr in sensPath.RegisterReaders) { if (rr is WaterMeters.iPerl.WaterMeter) (rr as WaterMeters.iPerl.WaterMeter).TestName = test.Name; diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index dd18966d8..ee8eeae09 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.12.437.1")] -[assembly: AssemblyFileVersion("2.12.437.1")] +[assembly: AssemblyVersion("2.12.438.1")] +[assembly: AssemblyFileVersion("2.12.438.1")]