DCS Interface & Behaviors

DCS HW Interface and Operations



1. Hardware / PLC commands:
Format: COMMAND ( parameter1, parameter2, ... parameterN) = <description>

PV GET / SET:
  • GET ( <list of PV names>, <reply-to address>)
    • Requests cached value information.
    • Reply instantly with the value from the in-memory copy, with name-value pairs for the requested PVs.
    • If reply-to address exists, reply to the private address instead of a public channel.
  • SET ( <list of PV name-value pairs> )
    • Set values for the provided channels, if allowed to by internal configuration

PV SCANS:
  • SCAN ( <list of PV names>, <group_reply = true|false>, <time_interval>, <reply-to address> )
    • Requests one-time (if time_interval = 0) or periodic (if time_interval != 0) scan of live values.
    • Register SCAN in a scan list: read out live values one by one.
    • If group = true, reply once when all channels are scanned, otherwise send out individual updates.
    • Reply instantly with registered SCAN_ID. If reply-to address provided, reply to the private channel instead of a public one.
  • SCAN_CANCEL ( <SCAN_ID> )
    • cancel existing scan for SCAN_ID if exists
  • SCAN_MODIFY ( <SCAN_ID>, <group_reply = true|false>, <time_interval = milliseconds>, <reply-to address> )
    • modify parameters of the defined scan

INFORMATIONAL:
  • INFO_SYSTEM ()
    • return the following:
      • current state of the HW;
      • configuration information for this HW;
  • INFO_PV ( < pv_name = undefined | list of pv names > )
    • if < pv_name = undefined >, return list of all configured PVs and their types;
  • INFO_SCAN ( < scan_id = undefined | list of scan_ids > )
    • if < scan_id = undefined > return list of all configured periodic scans from scan list, otherwise return specified scan details;
    • if < scan_id = undefined > return list of all one-time scans remaining in a scan queue, otherwise return specified scan details;

OPERATIONAL:
  • RESET ()
    • clear all internal state variables, re-read configuration, restart operations from clean state.
  • REBOOT ()
    • request physical reboot of the device, if possible.
    • reply with "confirmed" / "not available"
  • ON ()
    • request power up the device, if possible
    • reply with "confirmed" / "not available"
  • OFF ()
    • request power off the device, if possible
    • reply with "confirmed" / "not available"



2. HW internal organization:
NOTE: global variables, related to controller operations
  • CONFIGURATION = list of [ < pv_name = STR > , <pv_type = INT | DBL | STR > , <pv_initial_value> , <pv_current_value> , <pv_flag = READ | WRITE | RW > ]
    • i.e. list of controlled parameters;
  • SCAN_LIST = list of < scan_item = [ ID, list of PV names, group = true | false, time_interval != 0, reply-to address, last_scan_ts ] >
    • List/vector of registered periodic scans;
  • SCAN_QUEUE = queue of <scan_item = [ ID, list of PV names, group = true | false, time_interval = 0, reply-to address ] >
    • Queue of requested one-time scans;
  • DEVICE_STATE = < int = ON | OFF >
    • current global state of the controlled device
  • DEVICE_OPERATION = < IDLE | GETTING | SETTING | SCANNING | POWERING_UP | POWERING_DOWN | RESETTING | REBOOTING >
    • device current operation flag
  • DEVICE_ID = < char_string >
    • unique id of the controlled device



3. HW internal operations:
NOTE: implemented using FSM

I. BOOT sequence
  1. INITIALIZE core parameters (device info, scan list/queue, device state)
  2. POPULATE list of controlled variables
  3. SETUP persistent scans, if requested
  4. GO to OPERATING sequence

II. OPERATING sequence
  1. LISTEN for incoming commands for <N> microseconds (aka IDLE)
    1. if NETWORK ERROR occurs = pause OPERATING sequence, try RECONNECT to MQ in <N> seconds
    2. if RECONNECT succeeded = resume OPERATING sequence
    3. else GO to (1.1)
  2. IF external <comand> received within time interval, call <command> processing code
  3. ELSE proceed with <scan_queue> and <scan_list> processing
  4. LOOP to (1)

III. SHUTDOWN sequence
  1. CLEANUP internal state
  2. DESTROY internal objects
  3. DISCONNECT from MQ service
  4. call POWER OFF routine