High Level Command Language Language Overview · These variables have an initial default value that...

34
HLCL High Level Command Language Language Overview Franz Kruse Astrium Bremen, IO 62 Franz.Kruse@astrium–space.com 2002Ć06Ć24

Transcript of High Level Command Language Language Overview · These variables have an initial default value that...

Page 1: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

HLCLHigh Level Command Language

Language Overview

Franz KruseAstrium Bremen, IO 62

Franz.Kruse@astrium–space.com

2002�06�24

Page 2: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

Please note:

This is not a tutorial, but just a collection of slides used as the course material for an

introductory language training course.

Please contact the author for a training course at your premises.

Page 3: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

1

HLCL: High Level Command Language

HLCL = UCLwith specific features for interactive commanding

� abbreviations

� different relaxations for simpler input

� help functions

� Interactive command language

� Interpreted textually, no compilation

� Usage in ground system

� Runs on workstations (in different applications):

� VICOS HCI

� CSS MOCS

� Command window with special features:

� command history, easy command repetition

� command line editing

� command interrupt

� specific buttons and displays

� Hidden command interpreters in synoptic displays and Explorer

� Single interactive command input as well as automated command

sequences

Page 4: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

2

HLCL Command Window

Command window in HCI:

Command window in simulator:

Page 5: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

3

Hidden HLCL Interpreters

Control elements in synoptic displays

Menu items in VICOS HCI Explorer

Page 6: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

4

Command and Function Classes

HLCL provides most of the basic language material of UCL, as well as HLCL specific exten�

sions. In HLCL, statements and other syntactic entities are usually referred to as com�

mands. The basic UCL statements constitute the primary command set of HLCL.

The application that provides the HLCL command window may add its own application

specific command set.

HLCL �inherits" all executable objects in the Columbus database and make them transpar�

ently available as commands or functions, respectively.

� Import statements

As defined in the UCL Reference Manual.

� Declarations

As defined in the UCL Reference Manual, but HLCL does not support the declarationof procedures and functions.

� Assignments

As defined in the UCL Reference Manual.

� Standard procedures and functions ("intrinsics")

As defined in the UCL Reference Manual, but HLCL has additional standard proce�dures and functions.

� Simple commands and functions

HLCL has a primary command set, but the underlying application (VICOS, CSS) candefine its own additional commands and functions.

� Inherited commands and functions

All executable objects in the Columbus database are accessible as quasi-HLCLcommands. They are called in the same syntax as primary commands and functions.

� automated procedures (APs, are commands)

� UCL library procedures and functions (are commands and functions, respec�

tively).

� Command sequences

Command sequences kept in the database or in files may be called like single com�mands.

� A help facility.

Page 7: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

5

Interactive Commanding

Commands without parentheses

Commands are given without parentheses around their parameters.

But functions and parameterized parameters have parentheses.

Issue \APM\EGSE\SYSTEM\SET_TEMP (20.0)LIST VARIABLES

No semicolon at end of command

The terminating semicolon can be omitted, the end of line acts as a command terminator.

PUT X –– no semicolong neededX := Y + Z; PUT X –– 2 commands on a line, semicolon needed

Abbreviations

Identifiers may be abbreviated arbitrarily (but uniquely) by cutting off word tails.

In compound identifiers each component can be abbreviated separately.

Voltage � Voltag, Volta, Volt, VolAssign_Picture � Ass_Pic, Ass_P, A_P, AssSend_TM_Message � Send_TM, S_TM_Mes, S_T_M

UCL keywords (reserved words) can be abbreviated only when starting a command.

var I : INTconst Pi : REAL := 3.14

Measurement units

Measurement units may be omitted in many cases, they are added from the context.

type Voltage = REAL [V] –– from a library

procedure P (X : REAL); ... –– “ “ “procedure Q (X : Voltage); ... –– “ “ “

var R : REALvar V : Voltage

V := 10.0 –– unit implicitly addedR := V –– unit discarded

P V –– unit discardedQ R –– unit implicitly added

Parameters may be omitted

� Omitted in parameters are prompted for, if no default.

� Omitted out parameters are output in the command window.

(Not for open array and open string parameters)

Structure commands

Structured command (if , case , loop , ...) are allowed only in command sequences.

Page 8: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

6

Command Sequences

A ommand sequence is a series of commands kept in the database or in a file.

It can be executed like a single command.

Structured commands (if , case , loop , ...) can be used only in command sequences.

Command sequences in the database

can be edited and compiled with the CLS Editor. Compilation performs only a syntax

check. A syntax check can also be performed with the HLCL command CHECK.

Command sequences in files

can be edited with the CLS Editor as well, but also with any text editor. In the latter case

a ompilation step is not avavailable, but a syntax check can be performed with the HLCL

command CHECK.

Page 9: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

7

CLS Editor Command Line

When the CLS Editor is to be used to edit command sequences in files, it must be called

directly from the command line:

Call:

$CLS_HOME/bin/sun5/cls_editor <pathname> <options>

$CLS_HOME/bin/sun5/cls_editor <file_name> <options>

Options:

–environment <environment>

defines the database user environment. If omitted, it will be obtained from the envi�ronment variable MDA_ENVIRONMENT in the same syntactic form:

<environment> ::=CCU <element_config> <mission> <system_tree_version> <ccu> |CDU <element_config> <mission> <system_tree_version> <cdu>

<ccu> ::=<pathname> <ccu_name> <version>.<issue>.<revision>

<cdu> ::=<pathname> <version>.<issue>.<revision> <test_version><instance>

Example:

–env “CCU APM DUMMY_MISSION 1 \APM\EGSE\CLS TEST 1.0.0”

–unit <unit>

the type of compilation unit contained in a file. If omitted, the type will be determinedby the file name suffix:UCL spec.: xyz_.ucl , UCL body: xyz.ucl , HLCL seq.: xyz.hlcl .

<unit> ::= HLCL_SEQUENCE | FWDU_COMMAND_TABLE

–file–database

If the parameter cannot be uniquely identified as a file name or database pathname(e. g. file name starting with '\'), these options can be used to resolve the ambiguity.

–make

compile in make mode.

–batch

indicates that the CLS Editor is to be called in batch mode.

–error_list [ <filename> ]

generate an error listin a file. File name derived from input file, if omitted.

<name>.err

–listing [ <filename> [ <filename> ] ]

generate listing in a file. For user libraries separate listings for specification and body.

<name>_.list for the specification<name>.list for the body (and all non–library units)

Page 10: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

8

HLCL Specific Extensions to UCL

Alias Declaration

An alias may also be assigned to a string constant. The string alias must designate the

name of a file that contains a command sequence. This allows to call a command se�

quence contained in a file by an alias.

alias Shutdown = ”/usr/columbus/users20/vicos/shutdown.hlcl”

...

Shutdown

Standard procedures & functions

HLCL predefines additional standard procedures and functions (intrinsics).

procedure DELETE

HLCL allows to delete (undeclare) user declared objects (constant, variable, type, ...)

Predefined, imported and local objects cannot be deleted.

DELETE identifier deletes a declared object (constant, variable, type, ...)

DELETE unit deletes a unit, e.g. [km]

procedure TRIGGER

This procedure triggers objects of type PULSE and BURST_PULSE. It has two forms:

TRIGGER pulse triggers a PULSE object,

or BURST_PULSE object, incrementing by 1.

TRIGGER burst_pulse, increment triggers a BURST_PULSE object, incrementing

its value by some selectable increment > 0.

function IMPORTED

This functions tests whether an importable item (e. g. a library) has been imported:

IMPORTED(p) returns TRUE if the database item p has been imported

in the current session or sequence

Path names

Path names may start with \\ , which stands for the predefined variable DEFAULT_PATH.

DEFAULT_PATH := \APM\EGSE\UCL\LIBSimport \\GROUND_LIBRARY

Page 11: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

9

HLCL Specific Extensions to UCL (2)

Type conversions

HLCL defines new type conversions:

PULSE -> BOOLEANBURST_PULSE-> UNSIGNED_INTEGER.

String conversions

Like in UCL, but not restricted, works for all types.

Put “X = “ + string (X)

Type overloading

HLCL allows command parameters to be of more than one type. An overloaded parameter

accepts values of any of its types. If it is an open array parameter, the list of values may

contain a mixture of values of any of the allowed types.

Put item –– item may be of any type

Check sequence –– sequence may be string or pathname

Page 12: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

10

Predefined Types

HLCL predefines some additional types, an application may add its own application specif�

ic types.

type OBJECTS = Objects to be listed (see LIST command):

(CONSTANTS, all constants (including enumeration literals)

LITERALS, all enumeration literals (subset of CONSTANTS)VARIABLES, all variables

TYPES, all types

ALIASES, all alias names

PARAMETERS, all parameters of the currently running sequence

UNITS, all measurement units

COMMANDS, all commands (including intrinsic and other procedures)

FUNCTIONS, all functions (including intrinsic functions)

INTRINSICS , all standard ("intrinsic") procedures and functions

IMPORTS, all imported UCL libraries

SUBTREES, the set of database subtrees authorized for the user

ITEM_TYPES, the set of database item types authorized for the user

CALL_STACK) the stack of loaded command sequences

An enumeration type that defines the objects that may be listed with the LIST command.

type PULSE

A binary event used by a simulator (CSS) function block to trigger the execution of

another function block.

Objects of type PULSE cannot be declaredare only defined in the database. They

They have no operators and connot be assigned.

The standard procedure TRIGGER. us used to trigger the event.

May be converted to BOOLEAN (TRUE = triggered, FALSE = not triggered)

type BURST_PULSE

A counting event used by a simulator (CSS) function block to trigger the execution of

another function block, like a pulse. Triggering the event increments its value.

Objects of type BURST_PULSE cannot be declared, only defined in the database. They

have no operations and cannot be assigned.

The standard procedure TRIGGER. us used to trigger (= increment) the event.

May be converted to UNSIGNED_INTEGER.

Page 13: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

11

Predefined Variables

HLCL predefines some variables with a special meaning. These variables have an initial

default value that may be changed by the user with an assignment.

variable DEFAULT_PATH: pathname := application defined

Wherever a path name is prefixed with \\ , the prefix is expanded with the current value

of the variable DEFAULT_PATH. This variable has an initial value defined by the underly�

ing application.

variable DEFAULT_NODE: pathname := application defined

The default node used to start APs and call library routines. This variable has an initial

value defined by the underlying application.

variable ECHO: BOOLEAN := FALSE

This variable defines whether commands executed from command sequences are

echoed on the screen. If set to false, only start and stop of command sequences are

reported. This variable is initially set to false.

variable TRAP: BOOLEAN := FALSE

This variable determines the error handling mechanism within command sequences.

When set to true, an error in a command sequence interrupts execution of the sequence

and returns control to the session. The sequence remains loaded and may be resumed

with the RESUME command. When set to false, errors in a command sequence do not

interrupt execution of the sequence.

variable STEP: BOOLEAN := FALSE

This variable selects single-step execution of command sequences. When set to true,

each command from a command sequence must be confirmed before execution.

variable DEBUG: BOOLEAN := FALSE

This variable selects debug mode. In debug mode all commands are displayed in ex�

panded form (abbrevations resolved, defaults inserted etc.), and confirmation is re�

quested before execution.

variable KEEP: BOOLEAN := TRUE

This variable controls command logging mode. When set to true (and a log file is open),

all interactively typed commands are logged in expanded form in a command log file

(see the OPEN and CLOSE commands). When set to false, nothing is logged, even if a

log file is open.

Page 14: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

12

Predefined CommandsDisplay Commands

LIST Display list of objects

Display a list of all objects of a certain class.

Parameters:

in CLASS: OBJECTS

the class of objects to be displayed. It is given as a value of the predefined enumer�

ation type OBJECTS.

in SCOPE: pathname := \\

This parameter allows to restrict the list to objects of a specific library scope deter�

mined by the path name of a library: only objects declared in that library are then

listed. If no scope is given (\\ ), all scopes (i.e. the session and all imported li�

braries) are listed.

The following classes of objects can be listed (type OBJECTS):

(CONSTANTS, all constants (including enumeration literals)

LITERALS, all enumeration literals (subset of CONSTANTS)VARIABLES, all variables

TYPES, all types

ALIASES, all alias names

PARAMETERS, all parameters of the currently running sequence

UNITS, all measurement units

COMMANDS, all commands (including intrinsic and other procedures)

FUNCTIONS, all functions (including intrinsic functions)

INTRINSICS , all standard ("intrinsic") procedures and functions

IMPORTS, all imported UCL libraries

SUBTREES, the set of database subtrees authorized for the user

ITEM_TYPES, the set of database item types authorized for the user

CALL_STACK) the stack of loaded command sequences

Page 15: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

13

Predefined CommandsCommand Sequence Control Commands

CHECK Check a command sequence

Check a command sequence for syntactical correctness. Note that problems resulting

from execution of the command sequence in different session environments and from

possibly violated semantical conditions between actual parameters and between com�

mands themselves cannot be checked.

Parameter:

in SEQUENCE: pathname | string

Name of the command sequence (path name if in the database, string if in a file).

SUSPEND Suspend execution of a command sequence

Suspend command sequence execution and return to interactive input. The sequence

may later be resumed at the suspension point. This command can only be used within

a command sequence.

RESUME Resume a suspended command sequence

Resume command sequence execution which was suspended by the SUSPEND com�

mand, by error or user interrupt.

CANCEL Cancel the command sequence call stack

Remove the command sequence call stack, i.e all currently loaded (and suspended)

command sequences. This command can only be used interactively when no com�

mand sequence is active. RESUME is then no longer possible.

Page 16: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

14

Predefined CommandsInput/Output Commands

These commands are intended for interaction with the user from within a command se�

quence.

GET Read input value from keyboard

Read a value from the keyboard, optionally write a prompt before reading. The type of

the value is determined by the actual parameter. Invalid input will be reported as an error,

and reading will be repeated until a correct value has been read.

Parameters:

in PROMPT: string := ””

The prompt to be written.

out ITEM: any type

The item to be read.

PUT Display the value of an item

Display the value of the parameter as an output line on the screen. The parameter may

be an expression of any type. (Several items may be combined into a line by converting

them to string and concatenating them with the + operator). Values of low-level types

(BYTE, WORD, LONG_WORD) are shown as byte string literals.

Parameter:

in ITEM: any type

The item to be displayed.

Page 17: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

15

Predefined CommandsCommand Logging Commands

These commands are used to control command logging.

OPEN Open a command log file

Open a new command log file and generate a command sequence in it. The syntactical

form of the commands in the command sequence to be generated may be specified

by several parameters. This command is only allowed when no log file is currently open.

Parameters:

in FILE: string

Name of the log file to be created.

in SEQUENCE: string

Name of the command sequence to be created in the log file.

in EXCLUDE: string := ””

List of commands to be excluded from logging. Command names are separated

by comma or blank. Assignment is given as := , the help facility as ?, the different

declaration statements as the respective keyword.

in NAMED: BOOLEAN := TRUE

Specifies whether command parameters are to be generated in named notation.

in EVALUATED: BOOLEAN := FALSE

Specifies whether parameters are to be evaluated and given as values, or expres�

sions are to be kept.

in FORMATTED: BOOLEAN := FALSE

Specifies whether commands are to be formatted with each parameter on a sepa�

rate line, or unformatted with the whole command in one line.

CLOSE Close the command log file

The currently open command log file is closed, the generated command sequence is

syntactically completed first. This command is only allowed when a log file is currently

open.

Page 18: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

16

Predefined Functions

There are no predefined HLCL functions, only the standard functions from UCL.

But an application may add its own application specifc functions.

Application Specific Commands

Each application that uses the HLCL Interpreter may add its own specific set of commands

and functions to the predefined HLCL commands.

All application specific commands obey the basic UCL syntax.

Applications currently using HLCL are: VICOS HCI and CSS (the simulator).

See the CGS documentation for details.

Inherited commands and functions

HLCL inherits all executable objects from the database as commands and functions, resp.:

Automated procedures (APs)

Activation of an AP can be expressed as an inherited quasi-HLCL command, the com�

mand name is the pathname:

\PAYLOAD\EQUIPMENT\UNIT_A\COMMAND MODE: 3

The predefined variable DEFAULT_NODE must be set to define the computer node in the

network where the AP is to be executed.

UCL library procedures and functions

UCL library procedures and functions are called like in UCL.

The predefined variable DEFAULT_NODE must be set to define the computer node in the

network where the procedure or function is to be executed.

\APM\EGSE\UCL\GROUND_LIBRARY.Enable_Monitoring ...Enable_Monitoring ...

Command sequences

Command sequences stored in the database can be called in the same form as an AP. They

are immediately executed in the local workstation.

Command sequences from files are called with their file name as the command name. The

file name is given as a string constant:

“/usr/egse/hlcl/seq_1” Value : 3.14

Page 19: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

17

Application Specific Commands

VICOS HCI and the simulator (CSS) define the following application specific commands.

See the CGS User Manual for details.

VICOS HCI

The HCI command window allows to command both VICOS and the simulator.

ABORT –– Abort an automated procedureABORT_ALL_APS –– Abort all APs on a test nodeASSIGN_PICTURE –– Create a synoptic displayGET_ENVIRONMENT –– Obtain value for environment nameHISTORY –– Display command historyPRINT –– Print a fileSTART_HCI_APPLICATION –– Start an application

Simulator (CSS)

The simulator command window provides simulator specific commands only.

ABORT_SIMULATION –– Abort the simulationACTIVATE –– Activate actual definitionBROADCAST –– Send message to usersCONNECT_TO_CSS_KERNEL –– Connect to a CSS kernelCONNECT_TO_CSS_UI –– Connect to a userinterface.DEACTIVATE –– Deactivate actual definitionDISCONNECT_FROM_CSS_KERNEL –– Disconnect from a CSS kernelDISCONNECT_FROM_CSS_UI –– Disconnect from a userinterfaceFREEZE –– Freeze model item valueGRANT –– Grant privilege to user on hostLOAD –– Load complete simulation stateLOAD_TABLE –– Load tableLOG –– Log model itemREACTIVATE –– Switch to item calculationSET_ASSIGN –– Set parameters for assignmentsSET_MINFRAME –– Set simulator minframeSET_SIMULATION_ATTRIBUTES –– Select simulation attributesSET_TIME –– Set initial mission timeSNAPSHOT –– Write model item value onceSTART_CSS_KERNEL –– Start the CSS kernelSTART_CSS_UI –– Start the CSS user inteface.START_SIMULATION –– Start or continue a simulationSTOP_CSS_KERNEL –– Stop the CSS kernel.STOP_CSS_UI –– Stop the CSS user interface.STOP_SIMULATION –– Suspend a running simulationSTORE –– Store complete simulation stateTRACE –– Trace function block executionUNMONITOR –– Stop monitoring an itemWAIT –– Suspend command executionWITHDRAW –– Withdraw privilege for user

Page 20: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

18

Special Commanding ModesDebug Mode

The user may switch between normal mode and debug mode by setting the predefined

variable DEBUG:

DEBUG := FALSE –– normal mode, immediate executionDEBUG := TRUE –– debug mode

In debug mode, each command is first displayed in expanded and evaluated form:

� abbreviations expanded

� expressions evaluated

� defaults inserted

� parameters in named notation

The user is then asked for confirmation before executing the command, he may confirm

or reject the command.

Example:

HLCL: ?issue

command ISSUE ...

in ITEM : ISSUE_ITEM_NAME () in PRIO : PRIORITY := LOW in AT_TIME : TIME := ~:~ in BASE : TIME_BASE := LOCAL_TIME in OB_EXEC_TIME : TIME := ~:~ in TIMEOUT : DURATION := 0.5 [s] out STATUS : UCL_RETURN

HLCL: DEBUG := TRUEHLCL: issue \apm\egse\onboard\stim_1 (3.14), time : 10.0 [s]Debug:

ISSUE ITEM: \APM\EGSE\ONBOARD\STIM_1, PRIO: LOW, AT_TIME: ~:~, BASE: LOCAL_TIME, OB_EXEC_TIME: ~:~, TIMEOUT: 10.0 [s]

<[Y]/N>:

Page 21: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

19

Special Commanding ModesCommand Logging

Interactively typed commands may be collected in a log file to automatically build a com�

mand sequence which may then be executed again.

For this purpose the user can open and close command log files with the OPEN and CLOSEcommands. Whenever a new file is opened, a new command sequence is built.

OPEN “seq_1.hlcl”, SEQ: “Seq_1”, EXCLUDE: “?”

...

... (these commands are logged)

...

CLOSE

Command logging mode can be controlled with the predefined variable KEEP.:

KEEP := FALSE –– don’t log interactive commandsKEEP := TRUE –– log interactive commands

This may be used for selective command logging.

Note that this command logging provided by the HLCL Interpreter itself is independent of

any logging functionality that may be provided by the applications using the HLCL Inter�

preter.

Example:

These interactive commands:

HLCL: OPEN “seq_1.hlcl”, SEQ: “Seq_1”, EXCLUDE: “?”HLCL: type velocity = real [m/s]HLCL: var v : veloHLCL: ?vvariable V : VELOCITY = <undefined>HLCL: v := 10.0HLCL>: ?vvariable V : VELOCITY = 10.0 [m/s]HLCL: put ”V = ” + string (v)V = 10.0 [m/s]HLCL: close

produce the following output: in file seq_1.hlcl :

sequence SEQ_1; type VELOCITY = REAL [m/s]; variable V : VELOCITY; V := 10.0 [m/s]; PUT ITEM: ”V = ” + string (V);end SEQ_1;

Page 22: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

20

Help facilityHLCL provides a �what is" facility:

? item –– what is item ?? –– list all visible identifiers

item may be one of the following:

?A single question mark lists all visible identifiers (predefined, declared, imported).

? identifierIf the identifier is unique, detailed information is displayed, e. g. the parameter list of a

command.

If the identifier could be an abbreviation for more than one identifier, a list of matching

identifiers with short information is displayed.

? identifier ...Same, but list recursively: All identifiers that appear in the displayed information, are

also resolved.

? expressionThe expression in expanded form is displayed together with its value.

? unitThe engineering unit is displayed in terms of the 7 SI base units.

? pathnameIf pathname is a subtree, one level of nodes in the subtree is displayed.

If pathname is an end item, the general data of the end item is displayed.

? pathname ( item_types )Same, but only items of the given item types are considered.

item_types is a list of item types, possibly abbreviated, separated by commas.

? pathname ...? pathname ... ( item_types )

Same, but the subtree is listed recursively down to end item level.

Examples:

? –– Display list of all identifiers? ASS_PIC –– Display command ASSIGN_PICTURE? ASS_PIC ... –– Display ASSIGN_PICTURE recursively? MIN (INTEGER) –– Display value of an expression? (X + y) * Z –– Display value of an expression? [km/h] –– Display [km/h] in terms of [m/s]? \APM\VICOS... –– Display database subtree recursively? \APM\VICOS... (UCL,HLCL) –– Display all UCL/ HLCL items in subtree? (\APM\VICOS\MEAS_1) –– Display value of an expression!

Page 23: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

21

Command SequencesSimple form

Command sequences allow a sequence of commands to be executed automatically.

They are kept in the database or in files.

sequence name ( parameters);imports

declarations

commands

...

end name;

imports take effect in session

objects are declared in session scope

leave with return

implies: return

� Command sequence is formally part of the session.

� Commands have the same effect as given interactively.

� Imports take effect within the session.

� Declarations declare global objects in the session scope.

� Session environment is visible within the command sequence.

� No interactive command input during execution of a sequence.

� Sequences may call other sequences, caller waits for termination.

� (Stack of) sequences may be suspended and resumed.

� Suspension directly returns to the session, interactive commands possible.

� Stack of sequences remains loaded and may be resumed.

� Interactively starting a new sequence cancels the sequence stack.

� Session specific relaxations and extensions do not apply in sequences

� Abbreviations not allowed.

� End of line is not a command terminator (semicolon required.

� Only optional parameters may be omitted.

� Engineering units must not be omitted.

Page 24: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

22

Command Sequenceswith external and local part

Command sequences may have an import part before their header, as well as a local im�

port and declaration part.

imports

declarations (no variables)

sequence name ( parameters);imports

declarations

...

beginimports

declarations

commands

...

end name;

visible only in sequence and param. list

local imports and declarations

global part

imports take effect in session

objects are declared in session scope

imports take effect in sequence only

lifetime of objects is the sequence

external imports and declarations

Example:

import \APM\GROUND\UCL\GROUND_LIBRARY;

type Switch = statecode ($OFF, $ON);

sequence Check (Measurement : Discrete_Value_Item; State : Switch);

variable Value : statecode ;

begin Read_Discrete Measurement, Value...;

...

if Value <> State then Send_Message ...; return ; end if ;

...

end Check;

Page 25: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

23

Command SequencesSpecial Usage

Echo mode

The predefined variable ECHO controls echo mode:

� ECHO = TRUE: Commands are echoed on the screen before execution.

� ECHO = FALSE: Commands are not echoed.

Error handling

When an error occurs in a command sequence, the effect depends on the predefined TRAPvariable:

� TRAP = TRUE: The error interrupts the command sequence.

Execution can be resumed with the RESUME command.

� TRAP = FALSE : The error is reported, execution continues

Single step mode

Command sequences may be executed in single step mode. This is controlled via the pre�

defined variable STEP.

� STEP = TRUE : Each command is shown before execution. The user is

asked for confirmation, he may confirm or reject the

command.

� STEP = FALSE : Commands are exectuted without user interaction

Login/logout sequences

The underlying application may provide for login/logout sequences.

Login sequences are automatically executed when opening a command window.

Logout sequences are executed when closing the command window.

Page 26: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

24

HLCL Sequence UsageLogin Sequences

When a command window is started, an HLCL login sequence, if it exists, will be executed

automatically. This can be used to perform an initial global setup of the session.

The HLCL Interpreter technically allows for several login and logout sequences, but this

is not used by CGS.

VICOS HCI

The login sequence must be named

$HOME/.user/hlcl_login.seq

The directory for the login sequence may be reconfigered in HCI.

sequence Session_Setup;

import \APM\EGSE\UCL\SYSTEM\GROUND_LIBRARY; import \APM\EGSE\UCL\SYSTEM\GROUND_TO_OB_LIB; import \APM\EGSE\UCL\USER\SUPPORT_LIBRARY;

...

end Session_Setup;

Simulator (CSS ICP)

The login sequence must be named

$HOME/.hlcl

An example sequence to start the simulator kernel automatically:

sequence ICP_Setup;

variable Input: CHARACTER;

begin

GET ”Starting CSS Kernel on csf–1 [y|n] ”, Input;

if Input = ’y’ then PUT ”Start CSS kernel, please wait...”; START_CSS_KERNEL ”csf–1”,””; PUT ”Loading Default...”; LOAD ”DEFAULT”; GET ”Load Observer SIM_TABLE [y|n]”,Input;

if Input = ’y’ then LOAD_TABLE ”SIM_TABLE”; end if ;

PUT ”Activate Monitoring & Logging”; ACTIVATE MONITORING; ACTIVATE LOGGING; end if ;

end ICP_Setup;

Page 27: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

25

HLCL Sequence UsageSupervisor Sequences

A supervisor sequence activates a series of one-task sequences, e. g. a number of single

tests, each performed by a separate command sequence.

sequence All_Tests;

Put “Execution of all tests ...”;

...

\...\Test_1;

...

\...\Test_2;

...

\...\Test_3;

...

end All_Tests;

Each single sequence performs one specific test. It can as well be invoked manually.

\...\Test_1:

sequence Test_1; ...begin

Put “Test 1”;

Put “This test performs ...”;

...

end Test_1;

\...\Test_2:

sequence Test_2; ...begin

Put “Test 2”;

Put “This test performs ...”;

...

end Test_2;

\...\Test_3:

...

Page 28: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

26

HLCL Sequence UsageMenu Driver Sequences

A menu driver displays a menu of possible tasks for selection by the user.

sequence Menu;

import \...\SUPPORT_LIBRARY;

variable Answer : string (20); variable Number : INTEGER;

begin Put “Select one of the following tasks:”;

Put “[1] Task 1”; Put “[2] Task 2”; Put “[3] Task 3”; ... Put “[ n] Task n”; Put “[0] All tasks”;

loop Get “Select: “, Answer; Text_To_Integer Answer, Number; if Support_Library.OK then exit ; end if ; end loop ;

if Number = 0 then \...\TASK_1; \...\TASK_2; \...\TASK_3; ... \...\TASK_ n; else case Task when 1 : \...\TASK_1; when 2 : \...\TASK_2; ... when n : \...\TASK_ n; else Put “Invalid task number “ + string (Task); end case ; end if;end Menu;

Each task in a separate command sequence (or AP, or library procedure):

\...\TASK_ i :

sequence Task_ i ; ...begin Put “Task i : ...”;

...

end Task_ i ;

Page 29: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

27

HLCL Sequence UsageMacro Sequences

Macro sequences are built around complex system calls or other complex task, in order

to simplify the call, or to create higher-level system calls. A set of utility macros may be

set up this way.

Example: Create a simple Start_SWOP call:

sequence Start_SWOP ( in SWOP_ID : pathname ; in SWRU_ID : pathname ; in Execution_Instance : pathname ; in Onboard_Computer : string ; out SWOP_Status : INTEGER; out Ground_Status : INTEGER; out Onboard_Status : INTEGER);

import \APM\EGSE\UCL\GROUND_TO_OB_LIB;

alias SPC = \APM\ONBOARD\SYSTEM\SPC;

variable L_SWOP_Status : INTEGER; variable L_Ground_Status : INTEGER; variable L_Onboard_Status : INTEGER;

begin Issue_SW_Command SPC\GET_SWOP_STATUS (SWOP_ID, ..., SWOP_Status : L_SWOP_Status), ...; Result : L_Onboard_Status, Status : L_Ground_Status;

if L_SWOP_Status = Stored then Issue_SW_Command SPC\LOAD_SWOP (SWOP_ID, ...), ...; Issue_SW_Command SPC\GET_SWOP_STATUS (SWOP_ID, ...), ...; end if ;

...

if L_SWOP_Status = Passive then Issue_SW_Command SPC\START_SWOP (...), ...; Issue_SW_Command SPC\GET_SWOP_STATUS (SWOP_ID, ...), ...; end if ;

...

if L_SWOP_Status = Ready then Issue_SW_Command SPC\RESUME_SWOP (...), ...; Issue_SW_Command SPC\GET_SWOP_STATUS (SWOP_ID, ...), ...; end if ;

...

SWOP_Status := L_SWOP_Status; Ground_Status := L_Ground_Status; Onboard_Status := L_Onboard_Status;

end Start_SWOP;

Page 30: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

28

HLCL Sequence UsageMacro Sequences (2)

Example: Decode the onboard execution status (integer -> text)

–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– Decoding of the onboard status from number to text ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

sequence Decode_Onboard_Status ( in Status : INTEGER; out Text : string);

import \APM\EGSE\UCL\GROUND_TO_OB_LIB;

begin

case Status when ONB_RESULT_SUCCESS: Text := ”NO Error”;

when ONB_RESULT_SEQUENCE_COUNT_ANOMALY: Text := ”SEQUENCE_COUNT_ANOMALY”;

when ONB_RESULT_NOT_AUTHORIZED: Text := ”NOT_AUTHORIZED”;

when ONB_RESULT_UNKNOWN_COMMAND: Text := ”UNKNOWN_COMMAND”;

when ONB_RESULT_COMMAND_NOT_VALID: Text := ”COMMAND_NOT_VALID”;

when ONB_RESULT_PARAMETERS_INCOMPLETE: Text := ”PARAMETERS_INCOMPLETE”;

when ONB_RESULT_PARAMETERS_NOT_VALID: Text := ”PARAMETERS_NOT_VALID”;

when ONB_RESULT_SEQUENCE_COUNT_REPETITION: Text := ”SEQUENCE_COUNT_REPETITION”;

when ONB_RESULT_SEQUENCE_COUNT_MISMATCH: Text := ”SEQUENCE_COUNT_MISMATCH”;

when ONB_RESULT_CHECKSUM_ERROR: Text := ”CHECKSUM_ERROR”;

when ONB_RESULT_TWO_STAGE_BUF_FULL: Text := ” TWO_STAGE_BUF_FULL”;

when ONB_RESULT_TWO_STAGE_SOURCE_MISMATCH: Text := ”TWO_STAGE_SOURCE_MISMATCH”;

else Text := ”<invalid status>”; end case ;

end Decode_Onboard_Status;

Page 31: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

29

HLCL Sequence UsageMacro Sequences with Global Status

These two sequences maintain a global status between a pair of calls:

sequence Start_SAS_1 ( out Status : INTEGER); import \EURECA\EGSE\UCL\Ground_Library;

alias Synoptics = \EURECA\EGSE\TC_GENERAL_DATA\SYNOPTICS; alias Measurements = \EURECA\EGSE\TC_GENERAL_DATA\MEASUREMENTS;

begin variable SAS_1_ID : INTEGER; variable SAS_1_Picture : INTEGER; variable SAS_1_Status : INTEGER; Status := 1;

Load_Application ”SAS_1”, \\, ”4”, SAS_1_ID, SAS_1_Status;

if SAS_1_Status = 1 then Init_Application SAS_1_ID, ””, SAS_1_Status; else Status := SAS_1_Status; return ; end if; if SAS_1_Status = 1 then Start_Application SAS_1_ID, SAS_1_Status; else Status := SAS_1_Status; return ; end if ;

if SAS_1_Status = 1 then Display_Picture Synoptics\CALIBRATION, \\, SAS_1_Picture, SAS_1_Status; else Status := SAS_1_Status; return ; end if ;

if SAS_1_Status = 1 then Start_Acquisition Measurements\CALIBRATION, SAS_1_Status; else Status := SAS_1_Status; return ; end if ;end Start_SAS_1;

sequence Stop_SAS_1 ( out STATUS : INTEGER); import \EURECA\EGSE\UCL\Ground_Library;

alias Measurements = \EURECA\EGSE\TC_GENERAL_DATA\MEASUREMENTS;

begin Status := 1; Unload_Application SAS_1_ID, SAS_1_Status; Remove_Picture SAS_1_Picture, \\, SAS_1_Status; Stop_Acquisition Measurements\CALIBRATION, SAS_1_Status;

Status := SAS_1_Status;

Delete SAS_1_ID; Delete SAS_1_Status; Delete SAS_1_Picture;end Stop_SAS_1;

Page 32: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

30

HLCL Sequence UsageUniform Test Framework

This approach uses command sequences as a framework for automated test execution.

The framework sequences declare/delete global variables, print headers and test results.

Main test sequence (actual test steps marked in bold):

–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– <Description of the test procedure>––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

sequence TP;

alias Macros = \path\to\test\macros; alias Tests = \path\to\test\procedures;

variable Step_Result : BOOLEAN; ...

begin –– Test procedure initialization ––––––––––––––––––––––––––

Macros\TP_HEADER ID : ”<proc_id>”, Title : ”<proc_title>”;

–– Specific test step execution and verification ––––––––––

Macros\STEP_HEADER ”<step_title>”, FALSE; Tests\TEST_STEP_1 ... <parameters> ... Macros\STEP_VERIFY Step_Result, Automatic : FALSE;

Macros\STEP_HEADER ”<step_title>”, Automatic : FALSE; Tests\TEST_STEP_2 ... <parameters> ... Macros\STEP_VERIFY Step_Result, Automatic : FALSE;

...

Macros\STEP_HEADER ”<step_title>”, Automatic : FALSE; Tests\TEST_STEP_ n ... <parameters> ... Macros\STEP_VERIFY Step_Result, Automatic : FALSE;

–– Test result presentation ––––––––––––––––––––––––––––––––

Macros\TP_TRAILER;end TP;

Page 33: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

31

HLCL Sequence UsageUniform Test Framework (2)

Test procedure header:

Displays procedure header lines and declares/initializes global variables.

sequence TP_Header ( in ID : string := ”<no ID>”; in Title : string := ”<no title>”);

variable Curr_Time : TIME;

begin if ~ IMPORTED (\APM\EGSE\UCL\GROUND_LIBRARY) then import \APM\EGSE\UCL\GROUND_LIBRARY; end if ;

–– Declare global variables ––––––––––––––––––––––––––––––

variable TP_ID : string (50); –– procedure ID variable TP_Step : INTEGER := 0; –– step counter variable TP_Error_Count : INTEGER := 0; –– error counter

TP_ID := ID;

–– Print procedure header ––––––––––––––––––––––––––––––––

Curr_Time := Ground_Library.Clock;

PUT ””; PUT TP_ID + ”: ” + Title; PUT TP_ID + ” start: ” + string (Curr_Time); PUT ””;end TP_Header;

Test procedure trailer:

Evaluates error counter, presents results and deletes global variables.

sequence TP_Trailer;

variable Curr_Time : TIME;

begin –– Print test procedure results ––––––––––––––––––––––––––

if TP_Error_Count > 0 then PUT ”Execution of test procedure ” + TP_ID + ” was NOT successful (No. of errors: ” + string (TP_Error_Count) + ”)”; else PUT ”Execution of test procedure ” + TP_ID + ” was successful”; end if ;

Curr_Time := Ground_Library.Clock;

PUT ””; PUT TP_ID + ” end: ” + string (Curr_Time);

–– Delete global variables –––––––––––––––––––––––––––––––

DELETE TP_ID; DELETE TP_Step; DELETE TP_Error_Count;end TP_Trailer;

Page 34: High Level Command Language Language Overview · These variables have an initial default value that may be changed by the user with an assignment. variable DEFAULT_PATH: pathname

32

HLCL Sequence UsageUniform Test Framework (3)

Test step header:

Displays header lines for a single test step.

sequence Step_Header ( in Title : string := ”<no title>”; in Automatic : BOOLEAN := FALSE);

variable Dummy : string (10);

begin INC TP_Step; PUT TP_ID + ’–’ + string (Proc_Step) + ’ ’ + Title; PUT ””;

if ~ Automatic then GET ”Press Return to continue: ”, Dummy; end if ;end Step_Header;

Test step verification:

Displays verification results for a single test step.

sequence Step_Verify ( in Step_Result : BOOLEAN := FALSE; in Automatic : BOOLEAN := FALSE);

variable Answer : string (10); variable Step_OK : BOOLEAN := FALSE;

begin if ~ Automatic then GET ”Verification successful? [y|n] ”, Answer;

while Answer <> ”y” & Answer <> ”n” & Answer <> ”Y” & Answer <> ”N” do GET ”[y|n] ”, Answer; end while ;

Step_OK := Answer = ”y” | Answer = ”Y”; end if ;

if Step_Result = TRUE | Step_OK then PUT ”... Test step OK.”; else INC Proc_Error_Count; PUT ”... ERROR: Test step failed.”; end if ;end Step_Verify;