Device description
The Tango device included in this project
is implemented in the ska.cbf.tango_device.CbfSubarray
class.
Commands
This class inherits from ska.base.SKASubarray
and as such it implements the Observation State Machine.
This implies that it supports commands
like Configure
and Scan
,
which is where the action happens.
In particular the following commands
are meaningful in this device:
Configure
triggers the automatic download of the Measurement Set that will be sent by the emulator sender, if not already present on disk. The device will stay inCONFIGURING
state until the Measurement Set is downloaded and expanded. In case of any error the device transitions toFAULT
. See Configuration for a description of the input for theConfigure
command. Also duringCONFIGURING
the device will resolve the target hostname into its corresponding IP address to avoid name resolution errors atScan
time.
Scan
starts the transmission of the Measurement Set to the configured endpoint. While the sending is happening the device stays in theSCANNING
state. After the sending finishes the device moves back toREADY
, unless an error occurs, in which case it moves toFAULT
.
EndScan
cancels the current data sending, if any is occurring at the time.
Abort
is likeEndScan
but can be invoked at any time.
Attributes
The following attributes are supported by CbfSubarray
:
sending
(bool): indicates whether data sending is currently in progress or not. It should closely reflect the device being inSCANNING
state or not.
Configuration
Configuration of the Tango device
occurs when the Configure
command is called.
Configure
accepts a single string input,
which must correspond to a JSON string.
Its contents must be of the form
agreed during the PSO-944 conversations
as shown here.
The following options must be present
in the fsp
object within the cbf
object
of the root JSON content
to configure the behavior of the data sender
underlying the Tango device.
Most of these options relate to options exposed by the cbf-sdp-emulator
codebase,
so please refer to its documentation
for more information about them:
outputHost
(list[list[int, str]]
) a list of pairs, where the second element is the target host. It maps totransmission.target_host
, defaults to127.0.0.1
. Only the first element of the outer list is currently considered.
outputPort
(list[list[int, ulong]]
) a list of pairs, where the second element is the target port. It maps totransmission.target_port_start
, defaults to 41000. Only the first element of the outer list is currently considered.
transmission_source
(string) points to the Measurement Set on disk to send, defaults tosim-vis.ms
.
integrationTime
(int) Integration time for the correlation products, specified in milliseconds. It maps totransmission.time_interval
, defaults to0
.As a current extension, the following extra options are supported as well:
transmission_rate
(ulong) maps totranmission.rate
, defaults to 14750.
transmission_num_channels
(ulong) maps totransmission.channels_per_stream
and toreader.num_channels
, defaults to 1.
transmission_source_url
points to the URL from where the Measurement Set to be sent can be downloaded from. It defaults tohttps://gitlab.com/ska-telescope/cbf-sdp-emulator/-/raw/master/data/<transmission_source>.tar.gz
.
name_resolution_max_tries
(int): the maximum number of times the code should try to resolve the hostname received viaoutputHost
to an IP. Defaults to 100.
name_resolution_retry_period
(float): the period between each name resolution retry, in seconds. Defaults to 0.2.
transmission_channels_per_stream
(int): transmit multiple streams with specified number of channels per stream. The destination URL is the same but port is incremented by 1 per stream.
reader_num_repeats
(int): re-transmit the dataset the given number of times. THe interval and rate is maintained - but the data is repeated.
reader_num_timestamps
(int): only read the given number of timestamps
Running
To start the server, you can run:
$> python -m ska.cbf.tango_device <instance_name>
By default Tango servers will try to connect to a central database, which involves extra setup prior to launching the command above. If one is simply testing the device on its own this can be avoided though via extra command-flags:
$> python -m ska.cbf.tango_device <instance_name> -ORBendPoint giop:tcp:127.0.0.1:10000 -nodb -dlist a/b/c
This will start the server without connecting to the central database,
exposing the server at the given ip/port combination,
and “registering” it with the a/b/c
name.
An even simpler approach is to use one of Tango’s built-in utilities for exactly this purpose:
$> python -m tango.test_context ska.cbf.tango_device.CbfSubarray
[...]
Ready to accept request
CbfSubarray started on port 8888 with properties {}
Device access: tango://127.0.0.1:8888/test/nodb/cbfsubarray#dbase=no
Server access: tango://127.0.0.1:8888/dserver/CbfSubarray/cbfsubarray#dbase=no
Clients can then connect to the device and its server with the provided URLs.