From 513d9bd50d5c7b88a7fb07be9abfdbe110f42fbd Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Mon, 25 Sep 2023 14:02:59 +0200
Subject: [PATCH] Update LOFAR2 station spec for HBA and dithering settings

---
 .../tmss/tmssapp/adapters/l2stationspecs.py   |  2 +-
 .../lofar2station-1.json                      | 50 +++++++++++++++++--
 2 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/l2stationspecs.py b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/l2stationspecs.py
index 27e62c9c5fb..dde5019b395 100644
--- a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/l2stationspecs.py
+++ b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/l2stationspecs.py
@@ -82,7 +82,7 @@ def convert_to_l2stationspecs_dict(subtask: models.Subtask) -> dict:
             l2stationspecs['stop_time'] = subtask.scheduled_stop_time.isoformat()
             l2stationspecs['antenna_field'] = antenna_field
             l2stationspecs['antenna_set'] = antenna_set_mapping[antenna_set][station_type]
-            l2stationspecs['tile_beam'] = subtask.specifications_doc["stations"]["analog_pointing"]
+            l2stationspecs['HBA']['tile_beam'] = subtask.specifications_doc["stations"]["analog_pointing"]
             l2stationspecs['filter'] = subtask.specifications_doc["stations"]["filter"]
             l2stationspecs['SAPs'] = [{'pointing' : dp['pointing'], 'subbands' : dp['subbands'] } for dp in subtask.specifications_doc["stations"]["digital_pointings"]]
 
diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/schemas/common_schema_template/lofar2station-1.json b/SAS/TMSS/backend/src/tmss/tmssapp/schemas/common_schema_template/lofar2station-1.json
index 5b47664ccc8..236cb2c5fe1 100644
--- a/SAS/TMSS/backend/src/tmss/tmssapp/schemas/common_schema_template/lofar2station-1.json
+++ b/SAS/TMSS/backend/src/tmss/tmssapp/schemas/common_schema_template/lofar2station-1.json
@@ -90,9 +90,53 @@
         "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/datetime/10#/definitions/timestamp",
         "default": "2100-01-01T00:00:00Z"
       },
-      "tile_beam": {
-        "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/pointing/9#/definitions/pointing",
-        "default": {}
+      "HBA": {
+        "type": "object",
+        "additionalProperties": false,
+        "default": {},
+        "properties": {
+          "tile_beam": {
+            "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/pointing/9#/definitions/pointing",
+            "default": {}
+          },
+          "DAB_filter": {
+            "type": "boolean",
+            "default": false,
+            "description": "Enable hardware filter on DAB frequencies"
+          },
+          "element_selection": {
+            "type": "string",
+            "default": "ALL",
+            "description": "Which element(s) to enable in each tile",
+            "enum": [
+              "ALL",
+              "GENERIC_201512"
+            ]
+          }
+        }
+      },
+      "dithering": {
+        "type": "object",
+        "additionalProperties": false,
+        "default": {},
+        "properties": {
+          "enabled": {
+            "type": "boolean",
+            "default": false
+          },
+          "power": {
+            "type": "number",
+            "description": "Power of dithering signal, in dBm",
+            "minimum": -25.0,
+            "maximum": -4.0,
+            "default": -4.0
+          },
+          "frequency": {
+            "type": "number",
+            "description": "Frequency of dithering signal, in Hz",
+            "default": 102000000
+          }
+        }
       }
     },
     "required": [
-- 
GitLab