MCS to HPS

The interface from the MCS to the HPS is largely in the form of communication between Tango devices running on either side.

The interface also currently consists of low-level SSH calls from the MCS to the Talon-DX boards, which are used to copy FPGA bitstreams and Tango device server binaries to the boards and start the HPS Master process. This functionality may be moved in the future, but for now it is implemented in the TalonDxComponentManager Class, which is instantiated by the CbfController.

MCS and HPS Master DS

The interface between the MCS and the HPS Master device server is primarily made up of the configure command sent from the MCS to the HPS master, which programs the FPGA and spawns the remaining HPS device servers. Before this command can be run, it is expected that the MCS has already copied the necessary bitstreams and binaries to the board and the HPS master has obviously been started. This is all handled automatically as part of the MCS On Command.

The configure command has one argument, which is a JSON-formatted string. An example of its contents can be seen below.

{
    "description": "Configures Talon DX to run VCC firmware and devices.",
    "target": "talon1",
    "ip_address": "169.254.100.1",
    "ds_hps_master_fqdn": "talondx-001/hpsmaster/hps-1",
    "fpga_path": "/lib/firmware",
    "fpga_dtb_name": "vcc3_2ch4.dtb",
    "fpga_rbf_name": "vcc3_2ch4.core.rbf",
    "fpga_label": "base",
    "ds_path": "/lib/firmware/hps_software/vcc_test",
    "server_instance": "talon1_test",
    "devices": [
        "dscircuitswitch",
        "dsdct",
        "dsfinechannelizer",
        "dstalondxrdma",
        "dsvcc"
    ]
}

MCS On Command

The following diagram shows the CbfController On command sequence and how it integrates with other components in the Mid.CBF system. The steps are outlined in detail in the Engineering Console.

From a MCS perspective, the On command sequence consists of the following steps:

  • Arrows 4-7: Power on the Talon-DX boards

  • Arrow 9: Attempt to connect to each board over SSH (see TalonDxComponentManager Class)

  • Arrows 8-9: Copy the relevant binaries and bitstreams to each board

  • Arrow 10: Start up the HPS Master on each board

  • Arrow 12: Send the configure to each HPS Master device server

../../_images/on-command-sequence.png

MCS On Command Sequence

Command Sequence

Off Sequence

The sequence diagram below shows the main sequence of calls in MCS when the Off command is called. Return calls are not shown.

@startuml
'https://plantuml.com/sequence-diagram
skinparam backgroundColor #EEEBDC
skinparam sequence {
ParticipantBorderColor DodgerBlue
ParticipantBackgroundColor DeepSkyBlue
ActorBorderColor DarkGreen
ActorBackgroundColor Green
BoxBorderColor LightBlue
BoxBackgroundColor #F0FFFF
}
skinparam collections {
  BackGroundColor LightBlue
  BorderColor DodgerBlue
}
skinparam database {
  BackgroundColor LightGreen
  BorderColor DarkGreen
}
title Off Command Sequence - Correlation\n
participant "CSP_Mid\n.LMC" as lmc
box "MCS"
participant "Mid.CBF\nController" as controller
participant "Mid.CBF\nSubarray" as subarray
collections "VCC" as vcc
collections "FSP" as fsp
collections "FSP\nCorr\nSubarray" as fspsubarray
participant "Talon\nLRU" as lru
participant "Power\nSwitch" as switch
end box
participant "PDU\n" as pdu
box "HPS"
participant "Linux\nOS" as os #LightGreen
participant "HPS\nMaster" as hpsmaster
collections "HPS\nDevices" as hpsdevices
end box
lmc        ->  controller    : Off()

note over controller         : clean up observing model:

loop until Subarray ObsState EMPTY or time exceeded
alt Subarray ObsState EMPTY
controller -> controller : Do nothing
else ObStates RESOURCING, RESTARTING, ABORTING,\nRESETTING
controller -> controller : Wait
else ObsStates IDLE\nCONFIGURING, READY,\nSCANNING
controller -> subarray   : Abort
else ObsState ABORTED, FAULT
controller -> subarray   : Restart
end loop
note over vcc            : VCC\nObsState IDLE
note over fspsubarray    : FSP Corr Subarray\nObsState IDLE

controller ->  subarray      : Off
subarray   ->  fspsubarray   : Off
fspsubarray->  fspsubarray   : PowerMode OFF
subarray   ->  subarray      : PowerMode OFF
controller ->  vcc           : Off
vcc        ->  vcc           : PowerMode OFF
controller ->  fsp           : Off
fsp        ->  fspsubarray   : Off
fspsubarray->  fspsubarray   : PowerMode OFF
fsp        ->  fsp           : PowerMode OFF

note over subarray       : Subarray\nObsState EMPTY
controller ->  hpsmaster     : Shutdown(3)
group no Tango exception on Shutdown
hpsmaster  ->  hpsdevices !! : kill pid
hpsmaster  ->  os !!         : system "shutdown now"
controller ->  controller    : wait 4 sec
end group
controller ->  lru           : PowerOff
lru        ->  switch        : Off()
switch     ->  pdu           : Off(outlets)

controller ->  controller    : PowerMode OFF
@enduml

Configure Scan Sequence

The sequence diagram below shows the main sequence of calls in MCS to configure a correlation scan. Return calls are not shown.

@startuml
'https://plantuml.com/sequence-diagram

skinparam backgroundColor #EEEBDC
skinparam sequence {
ParticipantBorderColor DodgerBlue
ParticipantBackgroundColor DeepSkyBlue
ActorBorderColor DarkGreen
ActorBackgroundColor Green
BoxBorderColor LightBlue
BoxBackgroundColor #F0FFFF
}

title MCS Correlation Configure Scan\n

participant "TMC\n" as tmc
participant "CSP_Mid\n.LMC" as lmc

box "MCS"
participant "Mid.CBF\nController" as controller
participant "Mid.CBF\nSubarray" as subarray
participant "VCC\n" as vcc
participant "FSP\n" as fsp
participant "FspCorr\nSubarray" as fspcorr
end box

participant "HPS\nDevices" as hps

lmc         -> subarray     : ConfigureScan(json_str)
subarray    -> subarray     : validateInput

group Each FSP
subarray    -> fsp          : Unsubscribe to state/healthstate
end group

subarray    -> tmc          : Unsubscribe all events
subarray    -> vcc          : GoToIdle
subarray    -> fspcorr      : GoToIdle
subarray    -> fsp          : RemoveSubarrayMembership(subarrayID)
subarray    -> vcc          : ConfigureBand(int)
subarray    -> vcc          : ConfigureScan(json_str)
vcc         -> hps          : configure HPS VCC

group Delay model subscription point
subarray    -> tmc          : subscribe delay model
end group

group Doppler subscription point
subarray    -> tmc          : subscribe Doppler phase correction
end group

group Jones matrix subscription point
subarray    -> tmc          : subscribe Jones matrix
end group

group Timing beam subscription point
subarray    -> tmc          : subscribe timing beam weights
end group

group SearchWindow
subarray    ->vcc           : ConfigureSearchWindow(data)
end group

group Each FSP
subarray    -> fsp          : AddSubarrayMembership(subarrayID)
subarray    -> fsp          : SetFunctionMode(str)
subarray    -> fsp          : subscribe to state/healthstate changes
fsp         -> hps          : configure HPS FSP
end group

group Each FSP Corr
subarray    -> fspcorr          : ConfigureScan(json_str)
fspcorr         -> hps          : configure HPS FSP Corr
end group

@enduml

The sequence diagram below shows additional detail for configuration of the VCC for a correlation scan.

@startuml
'https://plantuml.com/sequence-diagram

skinparam backgroundColor #EEEBDC
skinparam sequence {
ParticipantBorderColor DodgerBlue
ParticipantBackgroundColor DeepSkyBlue
ActorBorderColor DarkGreen
ActorBackgroundColor Green
BoxBorderColor LightBlue
BoxBackgroundColor #F0FFFF
}

title MCS Correlation Configure Scan Band 1 - VCC Detail\n

box "MCS"
participant "Mid.CBF\nSubarray" as subarray
participant "VCC\n" as vcc
participant "FSP\n" as fsp
end box

box "HPS"
participant "HPS VCC\nController" as hpsvcc
participant "HPC VCC\nBand1&2" as vccband1
participant "Circuit\nSwitch" as cs
participant "VCC\n" as vccdevice
participant "Wide Band\nInput Buffer" as wb
end box


subarray    -> vcc          : GoToIdle
vcc         -> hpsvcc       : Unconfigure
hpsvcc      -> vccband1     : Unconfigure
hpsvcc      -> vccband1     : Disable
subarray    -> vcc          : ConfigureBand(int)
vcc         -> hpsvcc       : ConfigureBand(json_str)
vcc         -> vccband1     : SetInternalParameters(json_str)
subarray    -> vcc          : ConfigureScan(json_str)
vcc         -> vccband1     : ConfigureScan(json_str)
vccband1    -> cs           : write_attribute(input_select)
vccband1    -> vccdevice    : write_attribute(frame_count)
vccband1    -> wb           : write_attributes(stream_rate, packet_rate, etc)


@enduml

The sequence diagram below shows details of calls to configure a FSP for a correlation scan.

@startuml
'https://plantuml.com/sequence-diagram

skinparam backgroundColor #EEEBDC
skinparam sequence {
ParticipantBorderColor DodgerBlue
ParticipantBackgroundColor DeepSkyBlue
ActorBorderColor DarkGreen
ActorBackgroundColor Green
BoxBorderColor LightBlue
BoxBackgroundColor #F0FFFF
}

title HPS Configure FSP for Correlation Scan\n

box "MCS"
participant "\nFspCorr\nSubarray" as fspcorr
end box

box "HPS"
participant "FSP\nCorr\n" as hpsfspcorr
participant "Packet\nStream\nRepair" as psr
participant "Resampler\nDelay\nTracker" as rdt
participant "Fine\nChannelizer\n" as channelizer
participant "DDR4Corner\nTurner\n" as dct
participant "Correlator\n\n" as correlator
end box

fspcorr     -> hpsfspcorr   : ConfigureScan(json_str)

group Receptor ID
hpsfspcorr  -> psr         : write packet rate
hpsfspcorr  -> rdt         : stop
hpsfspcorr  -> rdt         : write attributes
hpsfspcorr  -> rdt         : set input sample rate
hpsfspcorr  -> rdt         : set output sample rate
hpsfspcorr  -> rdt         : start
hpsfspcorr  -> channelizer : write gain
end group

group Corner Turner
hpsfspcorr -> dct : read number of samples
hpsfspcorr -> dct : write attributes
end group

hpsfspcorr -> correlator : write attributes
hpsfspcorr -> correlator : program long term accumulator

@enduml

Abort Sequence

The sequence diagram below shows the main sequence of calls in MCS to Abort from a correlation scan. Return calls are not shown.

@startuml
'https://plantuml.com/sequence-diagram

skinparam backgroundColor #EEEBDC
skinparam sequence {
ParticipantBorderColor DodgerBlue
ParticipantBackgroundColor DeepSkyBlue
ActorBorderColor DarkGreen
ActorBackgroundColor Green
BoxBorderColor LightBlue
BoxBackgroundColor #F0FFFF
}

skinparam collections {
  BackGroundColor LightBlue
  BorderColor DodgerBlue
}

skinparam database {
  BackgroundColor LightGreen
  BorderColor DarkGreen
}

title Abort Command Sequence - Correlation\n

participant "CSP_Mid\n.LMC" as lmc

box "MCS"
participant "Mid.CBF\nSubarray" as subarray
collections "VCC" as vcc
collections "FSP" as fsp
collections "FSP\nCorr\nSubarray" as fspsubarray
end box

box "HPS"
participant "HPS\nVCC\nController" as hpsvcc
participant "HPS\nVCC\nBand1&2" as hpsvccband
participant "HPS FSP\nCorr App" as hpsfsp
collections "HPS\nLow Level\nDevices" as hpsdevices
end box

lmc        ->  subarray      : Abort

subarray   ->  vcc           : Abort
vcc        ->  hpsvccband    : Abort
note over hpsvccband         : (TBD)
subarray   <-- vcc           : Success
note over vcc                : VCC\nObsState ABORTED
subarray   ->  fspsubarray   : Abort
fspsubarray->  hpsfsp        : Abort (stub)
note over hpsfsp             : (TBD)
subarray   <-- fspsubarray   : Success
note over fspsubarray        : FSP Corr Subarray\nObsState ABORTED


lmc       <--  subarray      : Success
note over subarray           : Subarray\nObsState ABORTED


@enduml

ObsReset Sequence

The sequence diagram below shows the main sequence of calls in MCS to return to IDLE via the ObsReset command for a correlation scan. Return calls are not shown.

@startuml
'https://plantuml.com/sequence-diagram

skinparam backgroundColor #EEEBDC
skinparam sequence {
ParticipantBorderColor DodgerBlue
ParticipantBackgroundColor DeepSkyBlue
ActorBorderColor DarkGreen
ActorBackgroundColor Green
BoxBorderColor LightBlue
BoxBackgroundColor #F0FFFF
}

skinparam collections {
  BackGroundColor LightBlue
  BorderColor DodgerBlue
}

skinparam database {
  BackgroundColor LightGreen
  BorderColor DarkGreen
}

title ObsReset Command Sequence - Correlation\n

participant "CSP_Mid\n.LMC" as lmc

box "MCS"
participant "Mid.CBF\nSubarray" as subarray
collections "VCC" as vcc
collections "FSP" as fsp
collections "FSP\nCorr\nSubarray" as fspsubarray
end box

box "HPS"
participant "HPS\nVCC\nController" as hpsvcc
participant "HPS\nVCC\nBand1&2" as hpsvccband
participant "HPS FSP\nCorr App" as hpsfsp
collections "HPS\nLow Level\nDevices" as hpsdevices
end box

lmc         ->  subarray      : Obsreset

subarray    ->  subarray      : deconfigure
subarray    ->  vcc           : ObsReset
vcc         ->  hpsvccband    : ObsReset
note over vcc                 : VCC\nObsState IDLE
subarray    ->  fspsubarray   : ObsReset
note over fspsubarray         : FSP Corr Subarray\nObsState IDLE
subarray    ->  fsp           : RemoveSubarrayMembership

group no other subarray membership
fsp         ->  fspsubarray   : GoToIdle\n
end group

note over fspsubarray         : FSP Corr Subarray\nObsState IDLE
note over subarray            : Subarray\nObsState IDLE
lmc        <--  subarray      : Success


@enduml

Restart Sequence

The sequence diagram below shows the main sequence of calls in MCS to return to EMPTY via the Restart command for a correlation scan. Return calls are not shown.

@startuml
'https://plantuml.com/sequence-diagram

skinparam backgroundColor #EEEBDC
skinparam sequence {
ParticipantBorderColor DodgerBlue
ParticipantBackgroundColor DeepSkyBlue
ActorBorderColor DarkGreen
ActorBackgroundColor Green
BoxBorderColor LightBlue
BoxBackgroundColor #F0FFFF
}

skinparam collections {
  BackGroundColor LightBlue
  BorderColor DodgerBlue
}

skinparam database {
  BackgroundColor LightGreen
  BorderColor DarkGreen
}

title Restart Command Sequence - Correlation\n

participant "CSP_Mid\n.LMC" as lmc

box "MCS"
participant "Mid.CBF\nSubarray" as subarray
collections "VCC" as vcc
collections "FSP" as fsp
collections "FSP\nCorr\nSubarray" as fspsubarray
end box

box "HPS"
participant "HPS\nVCC\nController" as hpsvcc
participant "HPS\nVCC\nBand1&2" as hpsvccband
participant "HPS FSP\nCorr App" as hpsfsp
collections "HPS\nLow Level\nDevices" as hpsdevices
end box

lmc         ->  subarray      : Restart

subarray    ->  subarray      : deconfigure
subarray    ->  vcc           : ObsReset
vcc         ->  hpsvccband    : ObsReset
note over vcc                 : VCC\nObsState IDLE
subarray    ->  subarray      : remove_all_receptors
subarray    ->  fspsubarray   : ObsReset
note over fspsubarray         : FSP Corr Subarray\nObsState IDLE
subarray    ->  fsp           : RemoveSubarrayMembership

group no other subarray membership
fsp         ->  fspsubarray   : GoToIdle\n
end group

note over fspsubarray         : FSP Corr Subarray\nObsState IDLE
note over subarray            : Subarray\nObsState EMPTY
lmc        <--  subarray      : Success


@enduml