From dbb4cfc0b5e5bc2aca31ab29be75dda9a7460685 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Thu, 6 May 2021 15:09:16 +0200
Subject: [PATCH] TMSS-747: Fix COBALT beamformer model in the blocksize
 calculation. Added regression test based on use case that broke in
 production.

---
 .../TaskPrescheduler/lib/cobaltblocksize.py       |  2 +-
 .../TaskPrescheduler/test/t_cobaltblocksize.py    | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/SAS/ResourceAssignment/TaskPrescheduler/lib/cobaltblocksize.py b/SAS/ResourceAssignment/TaskPrescheduler/lib/cobaltblocksize.py
index ac14727d9a2..52c3ae18532 100644
--- a/SAS/ResourceAssignment/TaskPrescheduler/lib/cobaltblocksize.py
+++ b/SAS/ResourceAssignment/TaskPrescheduler/lib/cobaltblocksize.py
@@ -96,7 +96,7 @@ class BlockConstraints(object):
         NR_PPF_TAPS = 16
         MAX_THREADS_PER_BLOCK = 1024
         CORRELATOR_BLOCKSIZE = 16
-        BEAMFORMER_NR_DELAYCOMPENSATION_CHANNELS = 64
+        BEAMFORMER_NR_DELAYCOMPENSATION_CHANNELS = 256
         BEAMFORMER_DELAYCOMPENSATION_BLOCKSIZE = 16
 
         # Process correlator settings
diff --git a/SAS/ResourceAssignment/TaskPrescheduler/test/t_cobaltblocksize.py b/SAS/ResourceAssignment/TaskPrescheduler/test/t_cobaltblocksize.py
index 8eaec011e3f..dee024550e8 100644
--- a/SAS/ResourceAssignment/TaskPrescheduler/test/t_cobaltblocksize.py
+++ b/SAS/ResourceAssignment/TaskPrescheduler/test/t_cobaltblocksize.py
@@ -99,5 +99,20 @@ class TestBlockSize(unittest.TestCase):
 
             self.assertAlmostEquals(c._samples2time(bs.integrationSamples), integrationTime, delta = integrationTime * 0.05)
 
+    @unit_test
+    def testCoherentStokesBlocksize(self):
+        """ Test the coherent stokes block size against reference output, based on cases that used to fail in production.
+            If the output of these calculations change, make sure the described configurations do actually work in COBALT! """
+
+        coh = StokesSettings()
+        coh.nrChannelsPerSubband = 16
+        coh.timeIntegrationFactor = 1
+
+        c = BlockConstraints(coherentStokesSettings=[coh])
+        bs = BlockSize(c)
+
+        self.assertEqual(bs.blockSize, 196608)
+
+
 if __name__ == "__main__":
     unittest.main(verbosity=2)
-- 
GitLab