diff --git a/CDB/LOFAR_ConfigDb.json b/CDB/LOFAR_ConfigDb.json index 60b0115925b2ccf01bd27b3e0d072a17c78d580f..c7573e87dad80a51cec0ef4874f5f1bc41149f4a 100644 --- a/CDB/LOFAR_ConfigDb.json +++ b/CDB/LOFAR_ConfigDb.json @@ -7,13 +7,6 @@ } } }, - "Femto": { - "CS999": { - "Femto": { - "opc-ua/test-femto/1": {} - } - } - }, "ObservationControl": { "STAT": { "ObservationControl": { @@ -59,511 +52,7 @@ "STAT": { "RECV": { "STAT/RECV/1": { - "attribute_properties": { - "Ant_mask_RW": { - "archive_period": [ - "600000" - ] - }, - "CLK_Enable_PWR_R": { - "archive_period": [ - "600000" - ] - }, - "CLK_I2C_STATUS_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "CLK_PLL_error_R": { - "archive_period": [ - "600000" - ] - }, - "CLK_PLL_locked_R": { - "archive_period": [ - "600000" - ] - }, - "CLK_monitor_rate_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "CLK_translator_busy_R": { - "archive_period": [ - "600000" - ] - }, - "HBA_element_LNA_pwr_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "HBA_element_LNA_pwr_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "HBA_element_beamformer_delays_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "HBA_element_beamformer_delays_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "HBA_element_led_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "HBA_element_led_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "HBA_element_pwr_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "HBA_element_pwr_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "RCU_ADC_lock_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "RCU_I2C_STATUS_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "RCU_ID_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "RCU_LED0_R": { - "archive_period": [ - "600000" - ] - }, - "RCU_LED0_RW": { - "archive_period": [ - "600000" - ] - }, - "RCU_LED1_R": { - "archive_period": [ - "600000" - ] - }, - "RCU_LED1_RW": { - "archive_period": [ - "600000" - ] - }, - "RCU_Pwr_dig_R": { - "archive_period": [ - "600000" - ] - }, - "RCU_attenuator_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "RCU_attenuator_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "RCU_band_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "RCU_band_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "RCU_mask_RW": { - "archive_period": [ - "600000" - ] - }, - "RCU_monitor_rate_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1.0", - "1.0" - ], - "rel_change": [ - "-1.0", - "1.0" - ] - }, - "RCU_temperature_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1.0", - "1.0" - ], - "rel_change": [ - "-1.0", - "1.0" - ] - }, - "RCU_translator_busy_R": { - "archive_period": [ - "600000" - ] - }, - "RCU_version_R": { - "archive_period": [ - "600000" - ] - }, - "State": { - "archive_period": [ - "600000" - ], - "event_period": [ - "0" - ] - }, - "Status": { - "archive_period": [ - "600000" - ], - "event_period": [ - "0" - ] - } - }, "properties": { - "polled_attr": [ - "state", - "1000", - "status", - "1000", - "ant_mask_rw", - "1000", - "rcu_adc_lock_r", - "1000", - "rcu_attenuator_r", - "1000", - "rcu_attenuator_rw", - "1000", - "rcu_band_r", - "1000", - "rcu_band_rw", - "1000", - "rcu_id_r", - "1000", - "rcu_led0_r", - "1000", - "rcu_led0_rw", - "1000", - "rcu_mask_rw", - "1000", - "rcu_monitor_rate_rw", - "1000", - "rcu_pwr_dig_r", - "1000", - "rcu_temperature_r", - "1000", - "rcu_version_r", - "1000", - "hba_element_beamformer_delays_r", - "1000", - "hba_element_beamformer_delays_rw", - "1000", - "hba_element_led_r", - "1000", - "hba_element_led_rw", - "1000", - "hba_element_pwr_r", - "1000", - "hba_element_pwr_rw", - "1000", - "clk_enable_pwr_r", - "1000", - "clk_i2c_status_r", - "1000", - "clk_monitor_rate_rw", - "1000", - "clk_pll_error_r", - "1000", - "clk_pll_locked_r", - "1000", - "clk_translator_busy_r", - "1000", - "hba_element_lna_pwr_r", - "1000", - "hba_element_lna_pwr_rw", - "1000", - "rcu_i2c_status_r", - "1000", - "rcu_led1_r", - "1000", - "rcu_led1_rw", - "1000", - "rcu_translator_busy_r", - "1000" - ] - } - } - } - } - }, - "random_data": { - "STAT": { - "Random_Data": { - "STAT/random_data/1": { - "properties": { - "polled_attr": [ - "rnd1", - "1000", - "rnd2", - "1000", - "rnd3", - "1000", - "rnd4", - "1000", - "rnd5", - "1000", - "rnd6", - "1000", - "rnd7", - "1000", - "rnd8", - "1000", - "rnd9", - "1000", - "rnd10", - "1000", - "rnd11", - "1000", - "rnd12", - "1000", - "rnd13", - "1000", - "rnd14", - "1000", - "rnd15", - "1000", - "rnd16", - "1000", - "rnd17", - "1000", - "rnd18", - "1000", - "rnd19", - "1000", - "rnd20", - "1000", - "rnd21", - "1000", - "state", - "1000", - "status", - "1000" - ] - } - }, - "STAT/random_data/2": { - "properties": { - "polled_attr": [ - "rnd1", - "100", - "rnd2", - "100", - "rnd3", - "100", - "rnd4", - "100", - "rnd5", - "100", - "rnd6", - "100", - "rnd7", - "100", - "rnd8", - "100", - "rnd9", - "100", - "rnd10", - "100", - "rnd11", - "100", - "rnd12", - "100", - "rnd13", - "100", - "rnd14", - "100", - "rnd15", - "100", - "rnd16", - "100", - "rnd17", - "100", - "rnd18", - "100", - "rnd19", - "100", - "rnd20", - "100" - ] } } } @@ -573,170 +62,7 @@ "STAT": { "SDP": { "STAT/SDP/1": { - "attribute_properties": { - "SDP_mask_RW": { - "event_period": [ - "60000" - ] - }, - "State": { - "archive_period": [ - "600000" - ] - }, - "Status": { - "archive_period": [ - "600000" - ] - }, - "fpga_mask_RW": { - "archive_period": [ - "600000" - ] - }, - "fpga_scrap_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "fpga_scrap_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "fpga_status_R": { - "archive_period": [ - "600000" - ] - }, - "fpga_temp_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "fpga_version_R": { - "archive_period": [ - "600000" - ] - }, - "fpga_weights_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "fpga_weights_RW": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "tr_busy_R": { - "archive_period": [ - "600000" - ] - }, - "tr_reload_RW": { - "archive_period": [ - "600000" - ] - }, - "tr_tod_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-1", - "1" - ], - "rel_change": [ - "-1", - "1" - ] - }, - "tr_uptime_R": { - "archive_period": [ - "600000" - ], - "archive_rel_change": [ - "-3600", - "3600" - ], - "rel_change": [ - "-10", - "10" - ] - } - }, "properties": { - "polled_attr": [ - "fpga_temp_r", - "1000", - "state", - "1000", - "status", - "1000", - "fpga_mask_rw", - "1000", - "fpga_scrap_r", - "1000", - "fpga_scrap_rw", - "1000", - "fpga_status_r", - "1000", - "fpga_version_r", - "1000", - "fpga_weights_r", - "1000", - "fpga_weights_rw", - "1000", - "tr_busy_r", - "1000", - "tr_reload_rw", - "1000", - "tr_tod_r", - "1000", - "tr_uptime_r", - "1000" - ] } } } @@ -819,58 +145,6 @@ } } } - }, - "StatsCrosslet": { - "CS997": { - "StatsCrosslet": { - "opc-ua/test-crossletstats/1": { - "attribute_properties": { - "visibilities_imag": { - "archive_rel_change": [ - "-0.1", - "0.1" - ], - "rel_change": [ - "-0.1", - "0.1" - ] - }, - "visibilities_real": { - "archive_rel_change": [ - "-0.1", - "0.1" - ], - "rel_change": [ - "-0.1", - "0.1" - ] - } - }, - "properties": { - "polled_attr": [ - "integration_time", - "0", - "pause_time", - "0", - "rcu_modes", - "0", - "state", - "0", - "status", - "0", - "subband", - "0", - "time_stamp", - "0", - "visibilities_imag", - "0", - "visibilities_real", - "0" - ] - } - } - } - } } } } diff --git a/CDB/MAXIV-ConfigDb.json b/CDB/MAXIV-ConfigDb.json deleted file mode 100644 index 2087ec3feb67a7ed362fd415a9ab4c654d6741f6..0000000000000000000000000000000000000000 --- a/CDB/MAXIV-ConfigDb.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "servers": { - "Femto": { - "TangoRestServer": { - "tango-rest": { - "TangoRestServer": { - "tango-rest/rest/0": { - "properties": { - "TANGO_DB": [ - "tango://databaseds:10000/sys/database/2" - ], - "TOMCAT_AUTH_METHOD": [ - "plain" - ], - "TOMCAT_PORT": [ - "8080" - ] - } - } - } - } - } - } -} diff --git a/CDB/stations/dummy_positions_ConfigDb.json b/CDB/stations/dummy_positions_ConfigDb.json new file mode 100644 index 0000000000000000000000000000000000000000..5f998a8102a8ceaad66b7a7a46ed293aa2223b67 --- /dev/null +++ b/CDB/stations/dummy_positions_ConfigDb.json @@ -0,0 +1,130 @@ +{ + "servers": { + "RECV": { + "STAT": { + "RECV": { + "STAT/RECV/1": { + "properties": { + "HBAT_reference_itrf": [ + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786", + "3826577.066", "461022.948", "5064892.786" + ], + "HBAT_antenna_itrf_offsets": [ + "-1.847", "-1.180", " 1.493", + "-1.581", " 0.003", " 1.186", + "-1.315", " 1.185", " 0.880", + "-1.049", " 2.367", " 0.573", + "-0.882", "-1.575", " 0.804", + "-0.616", "-0.393", " 0.498", + "-0.350", " 0.789", " 0.191", + "-0.083", " 1.971", "-0.116", + " 0.083", "-1.971", " 0.116", + " 0.350", "-0.789", "-0.191", + " 0.616", " 0.393", "-0.498", + " 0.882", " 1.575", "-0.804", + " 1.049", "-2.367", "-0.573", + " 1.315", "-1.185", "-0.880", + " 1.581", "-0.003", "-1.186", + " 1.847", " 1.180", "-1.493" + ] + } + } + } + } + } + } +} diff --git a/CDB/test_ConfigDb.json b/CDB/test_ConfigDb.json deleted file mode 100644 index 7f7e69512d0e9475e5d640ba6033ce7819106101..0000000000000000000000000000000000000000 --- a/CDB/test_ConfigDb.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "servers": { - "RECV": { - "1": { - "RECV": { - "STAT/RECV/1": { - "properties": { - "OPC_Server_Name": [ - "ltspi.astron.nl" - ] - } - } - } - } - }, - "SDP": { - "1": { - "SDP": { - "STAT/SDP/1": { - "properties": { - "OPC_Server_Name": [ - "dop36.astron.nl" - ] - } - } - } - } - }, - "APSCTL": { - "1": { - "APSCTL": { - "STAT/APSCTL/1": { - "properties": { - "OPC_Server_Name": [ - "ltspi.astron.nl" - ], - "OPC_Server_Port": [ - "4844" - ], - "OPC_Time_Out": [ - "5.0" - ] - } - } - } - } - }, - "test_device": { - "1": { - "test_device": { - "STAT/test_device/1": { - "attribute_properties": { - "Ant_mask_RW": { - "archive_period": [ - "600000" - ] - } - }, - "properties": { - "OPC_Server_Name": [ - "host.docker.internal" - ], - "OPC_Server_Port": [ - "4842" - ], - "OPC_Time_Out": [ - "5.0" - ] - } - } - } - } - } - } -} diff --git a/sbin/run_integration_test.sh b/sbin/run_integration_test.sh index acb3adce8bfc07c59a6224fd517e8dccc4f7c143..12c0337d18b5cac35ff0de432292c253fdf1e3f8 100755 --- a/sbin/run_integration_test.sh +++ b/sbin/run_integration_test.sh @@ -29,6 +29,7 @@ sleep 60 # Do not remove `bash`, otherwise statement ignored by gitlab ci shell! bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/LOFAR_ConfigDb.json bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/stations/simulators_ConfigDb.json +bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/stations/dummy_positions_ConfigDb.json cd "$LOFAR20_DIR/docker-compose" || exit 1 make start sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim diff --git a/tangostationcontrol/tangostationcontrol/devices/beam.py b/tangostationcontrol/tangostationcontrol/devices/beam.py index eb0f3aabb89190d0156b67ac9a1de9539eb9841d..1ca5631b4d5d7e65981512fada14a3e398ec6556 100644 --- a/tangostationcontrol/tangostationcontrol/devices/beam.py +++ b/tangostationcontrol/tangostationcontrol/devices/beam.py @@ -66,10 +66,14 @@ class Beam(lofar_device): self.recv_proxy = DeviceProxy("STAT/RECV/1") # Retrieve positions from RECV device - self.HBAT_reference_itrf = self.recv_proxy.get_hbat_reference_itrf().reshape(96,3) - self.HBAT_antenna_itrf = self.recv_proxy.get_hbat_antenna_itrf().reshape(96,16,3) - # Retrieve signal delays from RECV device - self.HBAT_signal_input_delays = self.recv_proxy.get_hbat_signal_input_delays().reshape(96,32) + HBAT_reference_itrf = self.recv_proxy.HBAT_reference_itrf_R + HBAT_antenna_itrf_offsets = self.recv_proxy.HBAT_antenna_itrf_offsets_R + + # a delay calculator for each tile + self.HBAT_delay_calculators = [delay_calculator(reference_itrf) for reference_itrf in HBAT_reference_itrf] + + # absolute positions of each antenna element + self.HBAT_antenna_positions = [reference_itrf + HBAT_antenna_itrf_offsets for reference_itrf in HBAT_reference_itrf] # -------- # internal functions @@ -85,11 +89,11 @@ class Beam(lofar_device): for tile in range(96): # initialise delay calculator - d = delay_calculator(self.HBAT_reference_itrf[tile]) + d = self.HBAT_delay_calculators[tile] d.set_measure_time(timestamp) # calculate the delays based on the set reference position, the set time and now the set direction and antenna positions - delays[tile] = d.convert(pointing_direction[tile], self.HBAT_antenna_itrf[tile]) + delays[tile] = d.convert(pointing_direction[tile], self.HBAT_antenna_positions[tile]) return delays @@ -102,11 +106,11 @@ class Beam(lofar_device): # Convert delays into beam weights delays = delays.flatten() - HBAT_bf_delays = self.recv_proxy.calculate_HBAT_bf_delays(delays) - HBAT_bf_delays = numpy.array(HBAT_bf_delays, dtype=numpy.int64).reshape(96,32) + HBAT_bf_delay_steps = self.recv_proxy.calculate_HBAT_bf_delay_steps(delays) + HBAT_bf_delay_steps = numpy.array(HBAT_bf_delay_steps, dtype=numpy.int64).reshape(96,32) # Write weights to RECV - self.recv_proxy.HBAT_BF_delays_RW = HBAT_bf_delays + self.recv_proxy.HBAT_BF_delay_steps_RW = HBAT_bf_delay_steps # Record where we now point to, now that we've updated the weights. # Only the entries within the mask have been updated diff --git a/tangostationcontrol/tangostationcontrol/devices/lofar_device.py b/tangostationcontrol/tangostationcontrol/devices/lofar_device.py index 6fed370c4e714813b1a7ce6768cc93209cff1c5e..5ca671d4c73b37c1035c69ed75ce82f08def2095 100644 --- a/tangostationcontrol/tangostationcontrol/devices/lofar_device.py +++ b/tangostationcontrol/tangostationcontrol/devices/lofar_device.py @@ -93,15 +93,6 @@ class lofar_device(Device, metaclass=DeviceMeta): # trigger a write_{name} call. See https://www.tango-controls.org/community/forum/c/development/c/accessing-own-deviceproxy-class/?page=1#post-2021 self.proxy = DeviceProxy(self.get_name()) - # register a proxy to ourselves, to interact with - # our attributes and commands as a client would. - # - # this is required to get/set attributes. - # - # we cannot write directly to our attribute, as that would not - # trigger a write_{name} call. See https://www.tango-controls.org/community/forum/c/development/c/accessing-own-deviceproxy-class/?page=1#post-2021 - self.proxy = DeviceProxy(self.get_name()) - @log_exceptions() def delete_device(self): """Hook to delete resources allocated in init_device. diff --git a/tangostationcontrol/tangostationcontrol/devices/recv.py b/tangostationcontrol/tangostationcontrol/devices/recv.py index 587f6dda577112be4b965b470a6a16cc7be4dc1c..22f2f84831eb218c67733026d0271d086e004f33 100644 --- a/tangostationcontrol/tangostationcontrol/devices/recv.py +++ b/tangostationcontrol/tangostationcontrol/devices/recv.py @@ -63,16 +63,14 @@ class RECV(opcua_device): ],dtype=numpy.float64) ) - HBAT_reference_itrf = device_property( + HBAT_reference_itrf = device_property( dtype='DevVarFloatArray', - mandatory=False, - default_value = numpy.tile(numpy.array([3826577.066, 461022.948, 5064892.786]),(96,1)) # CS002LBA, in ITRF2005 timestamp 2012.5 + mandatory=False ) - HBAT_antenna_itrf = device_property( + HBAT_antenna_itrf_offsets = device_property( dtype='DevVarFloatArray', - mandatory=False, - default_value = numpy.tile(numpy.array([3826923.546, 460915.441, 5064643.489]),(96,16,1)) # CS001LBA, in ITRF2005 timestamp 2012.5 + mandatory=False ) HBAT_signal_input_delays = device_property( @@ -109,8 +107,8 @@ class RECV(opcua_device): # The HBAT beamformer delays represent 32 delays for each of the 96 inputs. # The 32 delays deconstruct as delays[polarisation][dipole], and each delay is the number of 'delay steps' to apply (0.5ns for HBAT1). - HBAT_BF_delays_R = attribute_wrapper(comms_annotation=["HBAT_BF_delays_R" ],datatype=numpy.int64 , dims=(32,96)) - HBAT_BF_delays_RW = attribute_wrapper(comms_annotation=["HBAT_BF_delays_RW" ],datatype=numpy.int64 , dims=(32,96), access=AttrWriteType.READ_WRITE) + HBAT_BF_delay_steps_R = attribute_wrapper(comms_annotation=["HBAT_BF_delay_steps_R" ],datatype=numpy.int64 , dims=(32,96)) + HBAT_BF_delay_steps_RW = attribute_wrapper(comms_annotation=["HBAT_BF_delay_steps_RW" ],datatype=numpy.int64 , dims=(32,96), access=AttrWriteType.READ_WRITE) HBAT_LED_on_R = attribute_wrapper(comms_annotation=["HBAT_LED_on_R" ],datatype=numpy.bool_ , dims=(32,96)) HBAT_LED_on_RW = attribute_wrapper(comms_annotation=["HBAT_LED_on_RW" ],datatype=numpy.bool_ , dims=(32,96), access=AttrWriteType.READ_WRITE) HBAT_PWR_LNA_on_R = attribute_wrapper(comms_annotation=["HBAT_PWR_LNA_on_R" ],datatype=numpy.bool_ , dims=(32,96)) @@ -149,6 +147,14 @@ class RECV(opcua_device): RECVTR_monitor_rate_RW = attribute_wrapper(comms_annotation=["RECVTR_monitor_rate_RW" ],datatype=numpy.int64 , access=AttrWriteType.READ_WRITE) RECVTR_translator_busy_R = attribute_wrapper(comms_annotation=["RECVTR_translator_busy_R" ],datatype=numpy.bool_ ) + HBAT_antenna_itrf_offsets_R = attribute(access=AttrWriteType.READ, + dtype=((numpy.float,),), max_dim_x=3, max_dim_y=16, + fget=lambda self: numpy.array(self.HBAT_antenna_itrf_offsets).reshape(16,3)) + + HBAT_reference_itrf_R = attribute(access=AttrWriteType.READ, + dtype=((numpy.float,),), max_dim_x=3, max_dim_y=96, + fget=lambda self: numpy.array(self.HBAT_reference_itrf).reshape(96,3)) + # -------- # overloaded functions # -------- @@ -156,7 +162,7 @@ class RECV(opcua_device): # -------- # internal functions # -------- - def _calculate_HBAT_bf_delays(self, delays: numpy.ndarray): + def _calculate_HBAT_bf_delay_steps(self, delays: numpy.ndarray): """ Helper function that converts a signal path delay (in seconds) to an analog beam weight, which is a value per tile per dipole per polarisation. @@ -168,59 +174,30 @@ class RECV(opcua_device): calibrated_delays = numpy.add(polarised_delays, self.HBAT_signal_input_delays) # Find the right delay step by looking for the closest match in property RECV-> HBAT_bf_delay_step_delays - HBAT_bf_delays = numpy.zeros((96,32), dtype=numpy.int64) + HBAT_bf_delay_steps = numpy.zeros((96,32), dtype=numpy.int64) distance = lambda x , y : numpy.absolute(x-y) for tile in range(96): for at in range(32): delay = calibrated_delays[tile,at] step = min(self.HBAT_bf_delay_step_delays,key=partial(distance,delay)) - HBAT_bf_delays[tile,at] = numpy.where(self.HBAT_bf_delay_step_delays==step)[0][0] - return HBAT_bf_delays + HBAT_bf_delay_steps[tile,at] = numpy.where(self.HBAT_bf_delay_step_delays==step)[0][0] + return HBAT_bf_delay_steps # -------- # Commands # -------- - @command(dtype_out=DevVarFloatArray) - @DebugIt() - @only_in_states([DevState.ON]) - def get_hbat_bf_delay_step_delays(self): - """ Return the property HBAT_bf_delay_step_delays """ - return self.HBAT_bf_delay_step_delays - - @command(dtype_out=DevVarFloatArray) - @DebugIt() - @only_in_states([DevState.ON]) - def get_hbat_reference_itrf(self): - """ Return the property HBAT_reference_itrf (96x3) into a flatten array """ - return self.HBAT_reference_itrf.flatten() - - @command(dtype_out=DevVarFloatArray) - @DebugIt() - @only_in_states([DevState.ON]) - def get_hbat_antenna_itrf(self): - """ Return the property HBAT_antenna_itrf (96x16x3) into a flatten array """ - return self.HBAT_antenna_itrf.flatten() - - @command(dtype_out=DevVarFloatArray) - @DebugIt() - @only_in_states([DevState.ON]) - def get_hbat_signal_input_delays(self): - """ Return the property HBAT_signal_input_delays (96x32) into a flatten array """ - return self.HBAT_signal_input_delays.flatten() @command(dtype_in=DevVarFloatArray, dtype_out=DevVarFloatArray) - @DebugIt() - @only_in_states([DevState.ON]) - def calculate_HBAT_bf_delays(self, delays: numpy.ndarray): + def calculate_HBAT_bf_delay_steps(self, delays: numpy.ndarray): """ converts a signal path delay (in seconds) to an analog beam weight """ # Reshape the flatten input array delays = numpy.array(delays).reshape(96,16) # Calculate the beam weight array - HBAT_bf_delays = self._calculate_HBAT_bf_delays(delays) + HBAT_bf_delay_steps = self._calculate_HBAT_bf_delay_steps(delays) - return HBAT_bf_delays.flatten() + return HBAT_bf_delay_steps.flatten() @command() @DebugIt() diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py b/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py index 5307b17045e7299964475a9051f10ce0e8fb1adb..f9e91e5e558e35351ebd56640a26e3ba30a6111f 100644 --- a/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py +++ b/tangostationcontrol/tangostationcontrol/devices/sdp/sdp.py @@ -149,8 +149,13 @@ class SDP(opcua_device): TR_tod_R = attribute_wrapper(comms_annotation=["TR_tod_R"], datatype=numpy.int64, dims=(2,)) TR_tod_pps_delta_R = attribute_wrapper(comms_annotation=["TR_tod_pps_delta_R"], datatype=numpy.double) + # TODO: needs to not be statically declared as this can change depending on the station and configuration S_pn = 12 # Number of ADC signal inputs per Processing Node (PN) FPGA. N_pn = 16 # Number of FPGAs per antenna band that is controlled via the SC - SDP interface. + A_pn = 6 + N_pol = 2 + N_beamlets_ctrl = 488 + N_pol_bf = 2 # OPC-UA MP only points for AIT FPGA_signal_input_mean_R = attribute_wrapper(comms_annotation=["FPGA_signal_input_mean_R"], datatype=numpy.double , dims=(S_pn, N_pn)) @@ -165,10 +170,42 @@ class SDP(opcua_device): FPGA_bsn_monitor_input_nof_packets_R = attribute_wrapper(comms_annotation=["FPGA_bsn_monitor_input_nof_packets_R"], datatype=numpy.int32, dims=(N_pn,)) FPGA_bsn_monitor_input_nof_valid_R = attribute_wrapper(comms_annotation=["FPGA_bsn_monitor_input_nof_valid_R"], datatype=numpy.int32, dims=(N_pn,)) FPGA_bsn_monitor_input_nof_err_R = attribute_wrapper(comms_annotation=["FPGA_bsn_monitor_input_nof_err_R"], datatype=numpy.int32, dims=(N_pn,)) - FPGA_signal_input_samples_delay_R = attribute_wrapper(comms_annotation=["FPGA_signal_input_samples_delay_R"], datatype=numpy.uint32, dims=(S_pn, N_pn)) FPGA_signal_input_samples_delay_RW = attribute_wrapper(comms_annotation=["FPGA_signal_input_samples_delay_RW"], datatype=numpy.uint32, dims=(S_pn, N_pn), access=AttrWriteType.READ_WRITE) + # List of OPC-UA CP for BF beamlets + + # cint16[N_pn][A_pn][N_pol][N_beamlets_ctrl] + # Co-polarization BF weights. The N_pol = 2 parameter index is: + # 0 for antenna polarization X in beamlet polarization X, + # 1 for antenna polarization Y in beamlet polarization Y. + FPGA_bf_weights_xx_yy_R = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xx_yy_R"], datatype=numpy.int16, dims=(A_pn * N_pol * N_beamlets_ctrl, N_pn)) + FPGA_bf_weights_xx_yy_RW = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xx_yy_RW"], datatype=numpy.int16, dims=(A_pn * N_pol * N_beamlets_ctrl, N_pn), access=AttrWriteType.READ_WRITE) + + # cint16[N_pn][A_pn][N_pol][N_beamlets_ctrl] + # Cross-polarization BF weights. The N_pol = 2 parameter index is (note that index pol in range 0:N_pol-1 is the antenna polarization, so index !pol is the beamlet polarization): + # 0 for antenna polarization X in beamlet polarization Y, + # 1 for antenna polarization Y in beamlet polarization X. + FPGA_bf_weights_xy_yx_R = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xy_yx_R"], datatype=numpy.int16, dims=(A_pn * N_pol * N_beamlets_ctrl, N_pn)) + FPGA_bf_weights_xy_yx_RW = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xy_yx_RW"], datatype=numpy.int16, dims=(A_pn * N_pol * N_beamlets_ctrl, N_pn), access=AttrWriteType.READ_WRITE) + + # cint16[N_pn][N_pol_bf][A_pn][N_pol][N_beamlets_ctrl] + # Full Jones matrix of BF weights. + FPGA_bf_weights_xx_xy_yx_yy_R = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xx_xy_yx_yy_R"], datatype=numpy.int16, dims=(N_pol_bf * A_pn * N_pol * N_beamlets_ctrl, N_pn)) + FPGA_bf_weights_xx_xy_yx_yy_RW = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xx_xy_yx_yy_RW"], datatype=numpy.int16, dims=(N_pol_bf * A_pn * N_pol * N_beamlets_ctrl, N_pn), access=AttrWriteType.READ_WRITE) + + # cint16[N_pn][A_pn][N_beamlets_ctrl] + # BF weights for separate access to respectively w_xx, w_xy, w_yx, and w_yy. + FPGA_bf_weights_xx_R = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xx_R"], datatype=numpy.int16, dims=(A_pn * N_beamlets_ctrl, N_pn)) + FPGA_bf_weights_xx_RW = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xx_RW"], datatype=numpy.int16, dims=(A_pn * N_beamlets_ctrl, N_pn), access=AttrWriteType.READ_WRITE) + FPGA_bf_weights_xy_R = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xy_R"], datatype=numpy.int16, dims=(A_pn * N_beamlets_ctrl, N_pn)) + FPGA_bf_weights_xy_RW = attribute_wrapper(comms_annotation=["FPGA_bf_weights_xy_RW"], datatype=numpy.int16, dims=(A_pn * N_beamlets_ctrl, N_pn), access=AttrWriteType.READ_WRITE) + FPGA_bf_weights_yx_R = attribute_wrapper(comms_annotation=["FPGA_bf_weights_yx_R"], datatype=numpy.int16, dims=(A_pn * N_beamlets_ctrl, N_pn)) + FPGA_bf_weights_yx_RW = attribute_wrapper(comms_annotation=["FPGA_bf_weights_yx_RW"], datatype=numpy.int16, dims=(A_pn * N_beamlets_ctrl, N_pn), access=AttrWriteType.READ_WRITE) + FPGA_bf_weights_yy_R = attribute_wrapper(comms_annotation=["FPGA_bf_weights_yy_R"], datatype=numpy.int16, dims=(A_pn * N_beamlets_ctrl, N_pn)) + FPGA_bf_weights_yy_RW = attribute_wrapper(comms_annotation=["FPGA_bf_weights_yy_RW"], datatype=numpy.int16, dims=(A_pn * N_beamlets_ctrl, N_pn), access=AttrWriteType.READ_WRITE) + + # -------- # overloaded functions diff --git a/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_beam.py b/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_beam.py index 4ff02dd4d81b6db49705f8464b2533dcb424fd9f..e1e5598a4e114b26759c0dbc57ff57a1a76d0527 100644 --- a/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_beam.py +++ b/tangostationcontrol/tangostationcontrol/integration_test/default/devices/test_device_beam.py @@ -61,14 +61,14 @@ class TestDeviceBeam(AbstractTestBases.TestDeviceBase): self.assertEqual(DevState.ON, self.proxy.state()) # Verify attribute is present (all zeros if never used before) - HBAT_delays_r1 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delays_RW').value) + HBAT_delays_r1 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delay_steps_RW').value) self.assertIsNotNone(HBAT_delays_r1) time.sleep(3) # Verify writing operation does not lead to errors - self.proxy.HBAT_set_pointing(numpy.array([["J2000","0deg","0deg"]] * 96).flatten()) # write values to RECV - HBAT_delays_r2 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delays_RW').value) + self.proxy.HBAT_set_pointing(self.pointing_direction) # write values to RECV + HBAT_delays_r2 = numpy.array(recv_proxy.read_attribute('HBAT_BF_delay_steps_RW').value) self.assertIsNotNone(HBAT_delays_r2) # Verify delays changed (to be discussed) diff --git a/tangostationcontrol/tangostationcontrol/test/devices/test_recv_device.py b/tangostationcontrol/tangostationcontrol/test/devices/test_recv_device.py index b4154a1467ae3cdbf6771520c3a31dd449f17fd6..1fde8856cf55a79a03aaec2cc53ba34a4ad818f0 100644 --- a/tangostationcontrol/tangostationcontrol/test/devices/test_recv_device.py +++ b/tangostationcontrol/tangostationcontrol/test/devices/test_recv_device.py @@ -8,7 +8,6 @@ # See LICENSE.txt for more info. from tango.test_context import DeviceTestContext -from tango import DeviceProxy, DevState from tangostationcontrol.devices import recv, lofar_device @@ -19,7 +18,8 @@ from tangostationcontrol.test import base class TestRecvDevice(base.TestCase): - recv_properties = {'OPC_Server_Name': 'ltspi.astron.nl', 'OPC_Server_Port': 4840, 'OPC_Time_Out': 5.0} + # some dummy values for mandatory properties + recv_properties = {'OPC_Server_Name': 'example.com', 'OPC_Server_Port': 4840, 'OPC_Time_Out': 5.0} def setUp(self): super(TestRecvDevice, self).setUp() @@ -32,42 +32,10 @@ class TestRecvDevice(base.TestCase): proxy_patcher.start() self.addCleanup(proxy_patcher.stop) - def init_device(self, proxy:DeviceProxy): - proxy.off() - proxy.initialise() - self.assertEqual(DevState.STANDBY, proxy.state()) - proxy.set_defaults() - proxy.on() - self.assertEqual(DevState.ON, proxy.state()) - - def test_get_hbat_bf_delay_step_delays(self): - """Verify can read delay step attribute and length matches without err""" - with DeviceTestContext(recv.RECV, properties=self.recv_properties, process=True, timeout=10) as proxy: - self.init_device(proxy) - self.assertEqual(32, len(proxy.get_hbat_bf_delay_step_delays())) - - def test_get_hbat_reference_itrf(self): - """Verify can read hbat reference itrf attribute and length matches without err""" - with DeviceTestContext(recv.RECV, properties=self.recv_properties, process=True, timeout=10) as proxy: - self.init_device(proxy) - self.assertEqual(288, len(proxy.get_hbat_reference_itrf())) # 96x3=288 - - def test_get_hbat_antenna_itrf(self): - """Verify can read hbat antenna itrf attribute and length matches without err""" - with DeviceTestContext(recv.RECV, properties=self.recv_properties, process=True, timeout=10) as proxy: - self.init_device(proxy) - self.assertEqual(4608, len(proxy.get_hbat_antenna_itrf())) # 96x16X3=4608 - - def test_get_hbat_signal_input_delays(self): - """Verify can read signal input delay attribute and length matches without err""" - with DeviceTestContext(recv.RECV, properties=self.recv_properties, process=True, timeout=10) as proxy: - self.init_device(proxy) - self.assertEqual(3072, len(proxy.get_hbat_signal_input_delays())) # 96x32=3072 - def test_calculate_HBAT_bf_delays(self): + def test_calculate_HBAT_bf_delay_steps(self): """Verify HBAT beamforming calculations are correctly executed""" - with DeviceTestContext(recv.RECV, properties=self.recv_properties, process=True, timeout=10) as proxy: - self.init_device(proxy) + with DeviceTestContext(recv.RECV, properties=self.recv_properties, process=True) as proxy: delays = numpy.random.rand(96,16).flatten() - HBAT_bf_delays = proxy.calculate_HBAT_bf_delays(delays) - self.assertEqual(3072, len(HBAT_bf_delays)) # 96x32=3072 + HBAT_bf_delay_steps = proxy.calculate_HBAT_bf_delay_steps(delays) + self.assertEqual(3072, len(HBAT_bf_delay_steps)) # 96x32=3072 diff --git a/tangostationcontrol/test-requirements.txt b/tangostationcontrol/test-requirements.txt index 16a9033db5279a246609fdc0f9c941d26c74792a..1c18f0949ae6a3059fa0dcce9059e016a9a76e22 100644 --- a/tangostationcontrol/test-requirements.txt +++ b/tangostationcontrol/test-requirements.txt @@ -7,6 +7,7 @@ bandit>=1.6.0 # Apache-2.0 coverage>=5.2.0 # Apache-2.0 doc8>=0.8.0 # Apache-2.0 flake8>=3.8.0 # MIT +flake8-bugbear>=22.1.11 # MIT flake8-breakpoint>=1.1.0 # MIT flake8-debugger>=4.0.0 #MIT flake8-mock>=0.3 #GPL diff --git a/tangostationcontrol/tox.ini b/tangostationcontrol/tox.ini index 31cf5a99eef2524b795fd06251c14888c176f911..5adb8cbed498a74c3296dc9e087fe3c273857582 100644 --- a/tangostationcontrol/tox.ini +++ b/tangostationcontrol/tox.ini @@ -76,5 +76,5 @@ commands = [flake8] filename = *.py,.stestr.conf,.txt -select = W292,B601,B602,T100,M001,F401 +select = W292,B601,B602,T100,M001,F401,B001,B002,B003,B004,B005,B006,B007,B008,B009,B010,B011,B012,B013,B014.B015,B016,B017,B018 exclude=.tox,.egg-info