Skip to content
Snippets Groups Projects
Commit db58e3b2 authored by Elisabetta Giani's avatar Elisabetta Giani
Browse files

CT-60: Finalized work on Configure. Start working on GoToIdle command.

Updated HISTORY and release files for csp commons and mid packages.
parent 9d909e1e
No related branches found
No related tags found
No related merge requests found
Pipeline #10434 canceled
0.6.2
- Finalized support for Configure command.
- Added GoToIdle command subclassing the ActionCommand class.
0.6.1 0.6.1
- adding support for Configure command - adding support for Configure command
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"""Release information for Python Package""" """Release information for Python Package"""
name = """csp-lmc-common""" name = """csp-lmc-common"""
version = "0.6.1" version = "0.6.2"
version_info = version.split(".") version_info = version.split(".")
description = """SKA CSP.LMC Common Software""" description = """SKA CSP.LMC Common Software"""
author = "INAF-OAA" author = "INAF-OAA"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"""Release information for Python Package""" """Release information for Python Package"""
name = """csplmc-common""" name = """csplmc-common"""
version = "0.6.1" version = "0.6.2"
version_info = version.split(".") version_info = version.split(".")
description = """SKA CSP.LMC Common Classe""" description = """SKA CSP.LMC Common Classe"""
author = "E.G" author = "E.G"
...@@ -18,5 +18,5 @@ license = """BSD-3-Clause""" ...@@ -18,5 +18,5 @@ license = """BSD-3-Clause"""
url = """www.tango-controls.org""" url = """www.tango-controls.org"""
copyright = """""" copyright = """"""
release=0.6.1 release=0.6.2
tag=csp-lmc-common-0.6.1 tag=csp-lmc-common-0.6.2
0.6.2
- use csp-lmc-common version 0.6.2
0.6.1 0.6.1
- use csp-lmc-common version 0.6.1 - use csp-lmc-common version 0.6.1
......
...@@ -95,7 +95,7 @@ class MidCspSubarrayBase(CspSubarray): ...@@ -95,7 +95,7 @@ class MidCspSubarrayBase(CspSubarray):
# NOTE: To remove when CBF Subarray implements the correct state # NOTE: To remove when CBF Subarray implements the correct state
def do(self): def do(self):
self.logger.info("dev_State:{}".format(self.state_model.dev_state)) self.logger.info("dev_State:{}".format(self.state_model.dev_state))
#super().do() super().do()
return (ResultCode.OK, "On command completed OK") return (ResultCode.OK, "On command completed OK")
class AddReceptorsCommand(SKASubarray.AssignResourcesCommand): class AddReceptorsCommand(SKASubarray.AssignResourcesCommand):
...@@ -305,7 +305,7 @@ class MidCspSubarrayBase(CspSubarray): ...@@ -305,7 +305,7 @@ class MidCspSubarrayBase(CspSubarray):
def do(self,argin): def do(self,argin):
self.logger.info("Call Mid CspSubarray Configure") self.logger.info("Call Mid CspSubarray Configure")
try: try:
super().do(argin) return super().do(argin)
except tango.DevFailed as tango_err: except tango.DevFailed as tango_err:
log_msg = ("Configure Command failure. Reason: {} " log_msg = ("Configure Command failure. Reason: {} "
"Desc: {}".format(tango_err.args[0].reason, "Desc: {}".format(tango_err.args[0].reason,
...@@ -403,7 +403,7 @@ class MidCspSubarrayBase(CspSubarray): ...@@ -403,7 +403,7 @@ class MidCspSubarrayBase(CspSubarray):
:return: None :return: None
""" """
self.logger.info("MidCspSubarray") self.logger.info("MidCspSubarray")
CspSubarray.update_subarray_state(self) if CspSubarray.update_subarray_state(self):
if self.get_state() == DevState.ON: if self.get_state() == DevState.ON:
if self._sc_subarray_obs_state[self.CbfSubarray] == ObsState.IDLE: if self._sc_subarray_obs_state[self.CbfSubarray] == ObsState.IDLE:
self._addreceptors_cmd_obj.succeeded() self._addreceptors_cmd_obj.succeeded()
...@@ -411,6 +411,7 @@ class MidCspSubarrayBase(CspSubarray): ...@@ -411,6 +411,7 @@ class MidCspSubarrayBase(CspSubarray):
if self._sc_subarray_obs_state[self.CbfSubarray] == ObsState.EMPTY: if self._sc_subarray_obs_state[self.CbfSubarray] == ObsState.EMPTY:
self._removereceptors_cmd_obj.succeeded() self._removereceptors_cmd_obj.succeeded()
self.logger.info("MidCsp subarray state: {} obsState: {}".format(self.get_state(), self.state_model.obs_state)) self.logger.info("MidCsp subarray state: {} obsState: {}".format(self.get_state(), self.state_model.obs_state))
return True
def _get_cbfsubarray_assigned_receptors(self): def _get_cbfsubarray_assigned_receptors(self):
""" """
...@@ -495,7 +496,7 @@ class MidCspSubarrayBase(CspSubarray): ...@@ -495,7 +496,7 @@ class MidCspSubarrayBase(CspSubarray):
self._cmd_execution_state[cmd_name] = CmdExecState.IDLE self._cmd_execution_state[cmd_name] = CmdExecState.IDLE
self.logger.info("AddReceptors end!") self.logger.info("AddReceptors end!")
#self.AddReceptorsCommand.succeeded() #self.AddReceptorsCommand.succeeded()
self._addreceptors_cmd_obj.succeeded() return self._addreceptors_cmd_obj.succeeded()
# PROTECTED REGION END # // MidCspSubarrayBase.private_methods # PROTECTED REGION END # // MidCspSubarrayBase.private_methods
...@@ -573,8 +574,8 @@ class MidCspSubarrayBase(CspSubarray): ...@@ -573,8 +574,8 @@ class MidCspSubarrayBase(CspSubarray):
# reset the command exeuction state # reset the command exeuction state
self._sc_subarray_cmd_exec_state[device][cmd_name] = CmdExecState.IDLE self._sc_subarray_cmd_exec_state[device][cmd_name] = CmdExecState.IDLE
self._cmd_execution_state[cmd_name] = CmdExecState.IDLE self._cmd_execution_state[cmd_name] = CmdExecState.IDLE
self._removereceptors_cmd_obj.succeeded()
self.logger.info("CspSubarray monitor_remove end") self.logger.info("CspSubarray monitor_remove end")
return self._removereceptors_cmd_obj.succeeded()
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"""Release information for Python Package""" """Release information for Python Package"""
name = """mid-csp-lmc""" name = """mid-csp-lmc"""
version = "0.6.1" version = "0.6.2"
version_info = version.split(".") version_info = version.split(".")
description = """SKA MID CSP.LMC""" description = """SKA MID CSP.LMC"""
author = "INAF-OAA" author = "INAF-OAA"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"""Release information for Python Package""" """Release information for Python Package"""
name = """MID CSP.LMC""" name = """MID CSP.LMC"""
version = "0.6.1" version = "0.6.2"
version_info = version.split(".") version_info = version.split(".")
description = """SKA MID CSP.LMC Classes""" description = """SKA MID CSP.LMC Classes"""
author = "E.G" author = "E.G"
...@@ -18,5 +18,5 @@ license = """BSD-3-Clause""" ...@@ -18,5 +18,5 @@ license = """BSD-3-Clause"""
url = """www.tango-controls.org""" url = """www.tango-controls.org"""
copyright = """""" copyright = """"""
release=0.6.1 release=0.6.2
tag=mid-csp-lmc-0.6.1 tag=mid-csp-lmc-0.6.2
...@@ -61,9 +61,8 @@ class TestCspSubarray(TestBase): ...@@ -61,9 +61,8 @@ class TestCspSubarray(TestBase):
""" """
Set the subarray state to ON-EMPTY Set the subarray state to ON-EMPTY
""" """
subarray_state = self.midcsp_subarray01.State() master_state = self.midcsp_master.State()
LOGGER.info("setup_subarray state:{}".format(subarray_state)) if master_state == DevState.STANDBY:
if subarray_state == DevState.DISABLE:
self.midcsp_master.On("") self.midcsp_master.On("")
prober_subarray_state = Probe(self.midcsp_subarray01, "State", DevState.OFF, f"CSP Master not ON") prober_subarray_state = Probe(self.midcsp_subarray01, "State", DevState.OFF, f"CSP Master not ON")
Poller(4, 0.2).check(prober_subarray_state) Poller(4, 0.2).check(prober_subarray_state)
...@@ -82,22 +81,29 @@ class TestCspSubarray(TestBase): ...@@ -82,22 +81,29 @@ class TestCspSubarray(TestBase):
self.midcsp_subarray01.ObsReset() self.midcsp_subarray01.ObsReset()
prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.IDLE, f"CSP Subarray not IDLE") prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.IDLE, f"CSP Subarray not IDLE")
Poller(4, 0.2).check(prober_obs_state) Poller(4, 0.2).check(prober_obs_state)
obs_state = self.midcsp_subarray01.obsState
if obs_state == ObsState.EMPTY: if obs_state == ObsState.EMPTY:
return return
else: if obs_state == ObsState.READY:
self._goto_idle()
obs_state = self.midcsp_subarray01.obsState
if obs_state == ObsState.IDLE:
self._release_all_receptors() self._release_all_receptors()
def _setup_subarray_off(self): def _setup_subarray_off(self):
subarray_state = self.midcsp_subarray01.State() subarray_state = self.midcsp_subarray01.State()
LOGGER.info("setup_subarray_off state:{}".format(subarray_state)) LOGGER.info("setup_subarray_off state:{}".format(subarray_state))
if subarray_state == DevState.DISABLE: #if subarray_state == DevState.DISABLE:
self.midcsp_master.On("") # self.midcsp_master.On("")
prober_subarray_state = Probe(self.midcsp_subarray01, "State", DevState.OFF, f"CSP Master not ON") # prober_subarray_state = Probe(self.midcsp_subarray01, "State", DevState.OFF, f"CSP Master not ON")
Poller(4, 0.2).check(prober_subarray_state) # Poller(4, 0.2).check(prober_subarray_state)
if subarray_state == DevState.OFF: if subarray_state == DevState.OFF:
return return
if subarray_state == DevState.ON: if subarray_state == DevState.ON:
obs_state = self.midcsp_subarray01.obsState obs_state = self.midcsp_subarray01.obsState
if obs_state == ObsState.READY:
self._goto_idle()
obs_state = self.midcsp_subarray01.obsState
if obs_state == ObsState.IDLE: if obs_state == ObsState.IDLE:
self._release_all_receptors() self._release_all_receptors()
subarray_state = self.midcsp_subarray01.State() subarray_state = self.midcsp_subarray01.State()
...@@ -139,9 +145,13 @@ class TestCspSubarray(TestBase): ...@@ -139,9 +145,13 @@ class TestCspSubarray(TestBase):
Remove all the receptors from the subarray. Remove all the receptors from the subarray.
The final subarray state is ON-EMPTY The final subarray state is ON-EMPTY
""" """
LOGGER.info("release_all_receptors")
obs_state = self.midcsp_subarray01.obsState obs_state = self.midcsp_subarray01.obsState
assert obs_state == ObsState.IDLE assert obs_state == ObsState.IDLE
try:
self.midcsp_subarray01.RemoveAllReceptors() self.midcsp_subarray01.RemoveAllReceptors()
except Exception as e:
LOGGER.info(str(e))
# wait for the transition to EMPTY # wait for the transition to EMPTY
prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.EMPTY, f"CSP Subarray is not EMPTY") prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.EMPTY, f"CSP Subarray is not EMPTY")
Poller(4, 0.2).check(prober_obs_state) Poller(4, 0.2).check(prober_obs_state)
...@@ -150,15 +160,26 @@ class TestCspSubarray(TestBase): ...@@ -150,15 +160,26 @@ class TestCspSubarray(TestBase):
time.sleep(0.5) time.sleep(0.5)
receptor_list = self.midcsp_master.unassignedReceptorIDs receptor_list = self.midcsp_master.unassignedReceptorIDs
LOGGER.info(f"release_all_receptors:Unassigned receptors:{receptor_list}") LOGGER.info(f"release_all_receptors:Unassigned receptors:{receptor_list}")
if self.midcsp_subarray01.State() == DevState.OFF: #if self.midcsp_subarray01.State() == DevState.OFF:
self.midcsp_subarray01.On() # self.midcsp_subarray01.On()
def test_state_AFTER_initialization(self): def _goto_idle(self):
"""
"""
LOGGER.info("Call to GoToIdle")
obs_state = self.midcsp_subarray01.obsState
assert obs_state == ObsState.READY
self.midcsp_subarray01.GoToIdle()
# wait for the transition to IDLE
prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.IDLE, f"CSP Subarray is not IDLE")
Poller(4, 0.2).check(prober_obs_state)
LOGGER.info("End GoToIdle")
def test_AFTER_initialization(self):
""" """
Test for State after CSP startup. Test for State after CSP startup.
The CspSubarray State at start is OFF. The CspSubarray State at start is OFF.
""" """
state = self.midcsp_subarray01.Init()
state = self.midcsp_subarray01.State() state = self.midcsp_subarray01.State()
LOGGER.info("subarray state:{}".format(state)) LOGGER.info("subarray state:{}".format(state))
prober_subarray_state = Probe(self.midcsp_subarray01, "State", DevState.OFF, f"CSP Subarray not OFF") prober_subarray_state = Probe(self.midcsp_subarray01, "State", DevState.OFF, f"CSP Subarray not OFF")
...@@ -360,7 +381,6 @@ class TestCspSubarray(TestBase): ...@@ -360,7 +381,6 @@ class TestCspSubarray(TestBase):
assert_that(obs_state).described_as("CSP Subarray obsState has wrong value ({obs_state}").is_equal_to(ObsState.FAULT) assert_that(obs_state).described_as("CSP Subarray obsState has wrong value ({obs_state}").is_equal_to(ObsState.FAULT)
#assert obs_state == ObsState.FAULT, f"CSP Subarray obsState is not EMPTY" #assert obs_state == ObsState.FAULT, f"CSP Subarray obsState is not EMPTY"
'''
def test_send_configure_to_cbf_and_json_stored(self): def test_send_configure_to_cbf_and_json_stored(self):
""" """
Configure the CSP Subarray with a JSon string including Configure the CSP Subarray with a JSon string including
...@@ -374,19 +394,20 @@ class TestCspSubarray(TestBase): ...@@ -374,19 +394,20 @@ class TestCspSubarray(TestBase):
LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name))
# exercise the device # exercise the device
LOGGER.info(f"Configuring CSP subarray01") LOGGER.info(f"Configuring CSP subarray01")
self.midcsp_subarray01.Configure(f.read().replace("\n", "")) (result_code, msg) = self.midcsp_subarray01.Configure(f.read().replace("\n", ""))
f.close() f.close()
# check # check
prober_subarray_obstate = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, prober_subarray_obstate = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY,
f"Wrong CSP Subarray obsState {self.midcsp_subarray01.obsState}") f"Wrong CSP Subarray obsState {self.midcsp_subarray01.obsState}")
Poller(5, 0.2).check(prober_subarray_obstate) Poller(5, 0.2).check(prober_subarray_obstate)
stored_json = self.midcsp_subarray01.validScanConfiguration obs_state = self.midcsp_subarray01.obsState
assert stored_json == configuration_string LOGGER.info("obs_state:{}".format(obs_state))
json_dict = json.loads(configuration_string) #json_dict = json.loads(configuration_string)
configID = json_dict["id"] #configID = json_dict["id"]
stored_id = self.midcsp_subarray01.configurationID #stored_id = self.midcsp_subarray01.configurationID
assert stored_id == configID #assert stored_id == configID
'''
def test_configureScan(self, midcsp_subarray01, midcsp_master): def test_configureScan(self, midcsp_subarray01, midcsp_master):
""" """
Test that the Configure() command is issued when the Subarray Test that the Configure() command is issued when the Subarray
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment