Commands
Commands are parameter sets called Setup, Observe, and Wait. A command is created with the source of the command, given by a prefix, the name of the command, and an optional ObsId
. Parameters are added to the command as needed.
ObsId
An ObsID
, or observation ID, indicates the observation the command is associated with. It is a simple string.
Prefix
The source of the command is given by the prefix, which should be the full name of the component sending the command. A prefix can be constructed with a string, but must start with a valid subsystem as in Subsystem. A component developer should supply a valid prefix string and the subsystem will be automatically parsed from it. An example of a valid string prefix is “nfiraos.ncc.trombone”.
Type definition can be found @here
See below examples:
CommandName
Each command has a name given as a string. The string should be continuous with no spaces.
Setup Command
This command is used to describe a goal that a system should match. The component developer is required to supply following arguments to create a Setup
command.
- Prefix: the source of the command as described above
- CommandName: a simple string name for the command (no spaces)
- ObsId: an optional observation id.
- paramSet: Optional Set of Parameters. Default is empty.
Type definition for Setup Command can be found here
- Typescript
-
const obsId: string = 'Obs001' const prefix: Prefix = new Prefix('NFIRAOS', 'ncc.trombone') const commandName = 'move' const filterKey = intArrayKey('filter') const filterParam: Parameter<IntArrayKey> = filterKey.set([ [1, 2, 3], [4, 5, 6] ]) const setup: Setup = new Setup(prefix, commandName, [filterParam], obsId)
Observe Command
This command describes a science observation. It is intended to be sent only to Science Detector Assemblies and Sequencers.
Type definition for Observe Command can be found here
- Typescript
-
const obsId: string = 'Obs001' const prefix: Prefix = new Prefix('NFIRAOS', 'ncc.trombone') const commandName = 'move' const filterKey = intArrayKey('filter') const filterParam: Parameter<IntArrayKey> = filterKey.set([ [1, 2, 3], [4, 5, 6] ]) const observe: Observe = new Observe( prefix, commandName, [filterParam], obsId )
Wait Command
This command causes a Sequencer to wait until notified. It can only be sent to Sequencers.
Type definition for Wait Command can be found here
- Typescript
-
const obsId: string = 'Obs001' const prefix: Prefix = new Prefix('NFIRAOS', 'ncc.trombone') const commandName = 'move' const filterKey = intArrayKey('filter') const filterParam: Parameter<IntArrayKey> = filterKey.set([ [1, 2, 3], [4, 5, 6] ]) const wait: Wait = new Wait(prefix, commandName, [filterParam], obsId)
Unique Key constraint
By design, a ParameterSet in a Setup, Observe, or Wait command is optimized to store only unique keys. When using add
or madd
methods on commands to add new parameters, if the parameter being added has a key which is already present in the paramSet
, the already stored parameter will be replaced by the given parameter.
If the Set
is created by component developers and given directly while creating a command, then it will be the responsibility of component developers to maintain uniqueness with parameters based on key.
Here are some examples that illustrate this point:
- Typescript
-
const obsId: string = 'Obs001' const prefix: Prefix = new Prefix('NFIRAOS', 'ncc.trombone') const commandName = 'move' const filterKey = intArrayKey('filter') const randomKey = stringKey('directions') const filterParam: Parameter<IntArrayKey> = filterKey.set([[1, 2, 3]]) const param1 = randomKey.set(['east', 'west']) const param2 = randomKey.set(['north', 'south']) const wait: Wait = new Wait(prefix, commandName, [filterParam], obsId) wait.madd([param1, param2]) //duplicate keys will not be added. Should contain one randomKey and one Filter key wait.paramSet.forEach((x) => console.log(x.keyName))