$Revision: 1.12 $
$Date: 2001/01/21 16:40:00 $
Composes and sends a command to instrument, test equipment or internally to IEGSE.
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| YES
| |
@nmemonic [parameter_list]
,) separated list. The parameter types and order are defined by the database record associated with nmemonic.If any discrepency is found between the database parameter list specification and that received the statement fails.
CRITICAL confirmation is
required from the operator before it is dispatched. Sending such a command from the
operator window results in an explicit prompt. When a procedure encounters
a class CRITICAL command it enters a wait state. The operator
sends a GO to allow the command to be dispatched and the procedure to continue.
CSTOL> @hir_ipu_settime 1, X#ffff, 0
hir_ipu_settime
which requires three integer parameters.
CSTOL> @gse_sample_eng off
gse_sample_eng
which requires one logical parameter.
proc comtest7
declare variable $current_count = 0 DN
begin
; use local variable to store current value of SCCMDS_RCVCT
let $current_count = SCCMDS_RCVCT
; send command
@HIR_SSH_SAFE
write "Command sent"
oo:
; wait for telemetry parameter SCCMDS_RCVCT to change to indicate
; command received
if ($current_count = SCCMDS_RCVCT)
write "Current count = :", $current_count
; 1/2 second polling wait
wait 0:0:0.5
goto oo:
end if
write "Current count = :", SCCMDS_RCVCT
end proc
Requests user input in response to a prompt string. The input is stored in a STOL local variable and can therefore be used to control the flow of execution of a procedure.
Applicable Environment | IEGSE Extension |
|---|---|
| Procedure | NO |
ASK $local_variable text_string
proc ask_demo2
declare variable $count = 0.0
begin
ask $count "Real value please "
if ($count < 0.0)
write $count, " is Negative"
else
write $count, " is Positive"
endif
end proc
Produces the following output in the procedure I/O window
Ask-Question> Real value please
Ask-Response> 6.52
6.52 is Positive
Procedure ask_demo2 exited. Code : NORMAL
Denotes the start of the executable section of a STOL procedure.
Applicable Environment | IEGSE Extension |
|---|---|
| Procedure | NO |
BEGIN
None
Like the OASIS-CC implementation the use of the BEGIN statement is not mandatory, merely recommended.
The use of the BEGIN statement is shown in all the example procedures in this document.
Compiles a STOL procedure into an intermediate object format which can be run by using the START directive.
Applicable Environment | IEGSE Extension |
|---|---|
Operator| NO
| |
COMPILE procedure_list
,). The procedure name only is given, i.e. the first part of the filename (without the .pro extension).
pro where name is the name of the procedure in lowercase. COMPILE searches for the file name.pro in the following locations
- The directories specified by the
[stol]:srcdir configuration variable.
- The users directory
$HOME/stol.
- The compiled object code is written a file. This object file is
named name
.obj. This is in contrast to OASIS-CC
where compiled procedures are registered and stored in dynamic memory after
compilation.
- The object file is written to the first directory specified by the configuration file variable
[stol]:objdir for which the user has write
permission, or if that fails the directory where the source file was located.
If the user does not have write permission to any of these directories the
statement fails.
CSTOL>compile ask_demo1, ask_demo2
proc starter
; procedure to compile and run another procedure
begin
compile kk
start kk
end proc
Defines the type of procedure input parameters and declares local variables and constants for use within a STOL procedure.
Applicable Environment | IEGSE Extension |
|---|---|
| Procedure | NO |
DECLARE mode var_name = def_value
$).
proc demo1 $ident $count
;
; Procedure showing a variety of declare statements
;
; A procedure that takes two input arguments :
; The first is an identifier passed as string.
; The second is a integer providing a number of times a loop is to be
; completed. If the the loop count goes beyond limit which is set below the
; procedure waits for the operator for further instructions.
;
declare input $count = 0
declare input $ident = "string"
declare variable $done = 0
declare variable $limit = 2
declare constant $pause_time = 0:0:2.5
begin
write "Identifier : ", $ident
; top of loop
loop $count
let $done = $done + 1
write "Times through = ", $done
if ($done > $limit)
write "Limit passed (Maximum ", $limit,")"
wait
end if
wait $pause_time
end loop
; bottom of loop
end proc
Denotes the start of a clause within a IF conditional control structure.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | NO |
ELSE [ IF clause_expression ]
If no arguments are supplied ELSE identifies the actions which occur if none of the clause expressions of an IF structure evaluate as TRUE. Otherwise the clause expression is supplied as described in the IF reference page.
There does not need to be a space between the ELSE and the IF if a clause expression is to be used. It is slightly unclear from the OASIS-CC documentation, but it is probable that a space may be required in CSTOL. Hence it is recommended in the interests of compatibility that a space is inserted between the ELSE and the IF.
proc else_show $k
declare input $k = 0
begin
if ($k > 0)
write "Positive"
else if ($k < 0)
write "Negative"
else
write "Must be zero"
end if
end proc
Denotes the end of a program structure.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | NO |
END structure
structure may take the following values.
There does not need to be a space between the END and structure a clause expression is to be used. It is slightly unclear from the OASIS-CC documentation, but it is probable that a space may be required in CSTOL. Hence it is recommended in the interests of compatibility that a space is inserted between the END directive and structure.
proc end_demo $k
declare input $k = 0
declare variable $i = 0
begin
loop 10
write $i
let $i = $i + 1
end loop
if ($k > 0)
write "Positive"
else if ($k < 0)
write "Negative"
else
write "Must be zero"
end if
end proc
Provides a method of breaking out of a LOOP structure. ESCAPE is used in conjunction with an IF statement. The statement only has meaning in the context of a LOOPand will generate a compile error if used anywhere else in a procedure.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | NO |
ESCAPE
None
None
proc escape1
declare variable $aa = 0
begin
; break out of counted loop
loop 5
let $aa = $aa + 1
if ($aa > 3)
write "condition hit $aa = ", $aa
write "going to escape"
escape
end if
end loop
write "escaped out of loop $aa = ", $aa
end proc
Used by the operator to instruct the current procedure to continue after a suspension. The suspension may have been initiated by the operator or be the result of an unconditional WAIT statement in the procedure, a child procedure exiting on error or the procedure requiring confirmation before sending a restricted command.
Applicable Environment | IEGSE Extension |
|---|---|
| OPERATOR | NO |
GO
None
None
None
Provides a means of performing an unconditional branch.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | NO |
GOTO label
label is the location within the procedure where execution is redirected to by the GOTO statement.
proc goto_demo
declare variable $count = 2
begin
label1:
let $count = $count + 1
write $count
if ($count > 10)
goto end:
end if
goto label1:
end:
write "finished"
end proc
Used to determine which database a given parameter is being sourced from. A message is written to the standard output, hence it will be captured in the output log if logging is activated.
This statement is intended for diagnostic purposes and to indicate the current status following the use of the IEGSE_ENG_DATA statement.
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| YES
| |
IEGSE_DB_SOURCE parameter
None.
CSTOL> iegse_dbsource ipstat_1
IPSTAT_1 sourced from HIRDLS_SCI_TELEMETRY database
CSTOL> iegse_dbsource ipstat_pp
Not associated with a database
If set ON makes STOL search the HIRDLS engineering data first for the any subsequent telemetry parameters. By default the science data is searched first.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | YES |
IEGSE_ENG_DATA ON | OFF
None.
proc s1
iegse_eng_data on
begin
iegse_dbsource SCCMDS_RCVCT
write SCCMDS_RCVCT
iegse_eng_data off
iegse_dbsource SCCMDS_REJCT
write SCCMDS_RCVCT
end proc
Global variables received in raw (data number) form can converted to engineering unit or state type values. In which case their type is deemed to be either to be that associated with the conversion. This directive forces STOL to treat the global variable as type data number (raw).
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | YES |
IEGSE_FORCE_RAW ON | OFF
None.
proc ex_rawforce
declare variable $my_pthresh = 12.0 V
declare variable $my_nthresh = -12.0 V
begin
write "PSS_PCU_P15V (Engineering) ", PSS_PCU_P15V
if (PSS_PCU_P15V < $my_pthresh)
write "PSS +15V Out of range", PSS_PCU_P15V , "( < ", $my_pthresh, ")"
end if
iegse_force_raw on
write "PSS_PCU_P15V (Raw) ", PSS_PCU_P15V
iegse_force_raw off
if (PSS_PCU_N15V > $my_nthresh)
write "PSS -15V Out of range", PSS_PCU_N15V , "( > ", $my_nthresh, ")"
end if
end proc
Before commands are dispatched to the instrument STOL checks the values of any parameters to ensure that they are within a range specified in the command's database record.
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| YES
| |
IEGSE_HIRCMD_LIMITS ON | OFF
proc hc_limit
begin
; By default HIRDLS command limit checking is ON
; Turn HIRDLS command limit checking OFF
;
iegse_hircmd_limits off
; Send command with an out of range parameter
@hir_ipu_chopfreq 17000
write "Out of range parameter sent"
; This time send command with another out of range parameter, but whose
; value is within defined bit pattern for parameter
@hir_ipu_chopfreq 2000
write "Another out of range parameter sent"
; Turn HIRDLS command limit checking back ON
iegse_hircmd_limits on
; Whichever of the two commands tried now will fail.
; @hir_ipu_chopfreq 17000
@hir_ipu_chopfreq 2000
; Procedure should never get to this line
write "Something went wrong"
end proc
Produces a logfile which contains configuration information about the IEGSE and instrument software and databases. All output from the procedure is recorded in the logfile. Logging can be controlled within the procedure by using the IEGSE_LOGGING statement. The use of IEGSE_LOGFILE causes logging to be turned on.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | YES |
IEGSE_LOGFILE log_output_file
.log) is optional if log_output_file is
not a full pathname (i.e. doesn't start with a / character).
$HOME/stol/log.
OLD_nn, where nn is an integer.
proc comlog
declare variable $current_count = 0 DN
; log information will be written to xxx.log in directory ~/stol/log
iegse_logfile "xxx"
begin
let $current_count = SCCMDS_RCVCT
@HIR_SSH_SAFE
write "Command HIR_SSH_SAFE sent "
write "Initial command count = :", $current_count
; turn logging off
iegse_logging off
oo:
if ($current_count = SCCMDS_RCVCT)
write "Current count = :", $current_count
wait 0:0:0.5
goto oo:
end if
; turn logging back on
iegse_logging on
write "New command count = :", SCCMDS_RCVCT
end proc
Controls whether logging in active or not within a procedure.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | YES |
IEGSE_LOGGING ON | OFF
The current logfile must have been identified by a IEGSE_LOGFILE call.
See example associated with IEGSE_LOGFILE above.
If set off causes STOL not to print the DN identifier to data number
variables and expressions output using the WRITE command.
By default STOL will print the DN identifier.
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| YES
| |
IEGSE_OUTDN_ID ON | OFF
proc outdn
begin
write "SIG_DAT_13 ==> ", SIG_DAT_13
iegse_outdn_id off
write "SIG_DAT_13 ==> ", SIG_DAT_13
end proc
Produces the following output in the procedure I/O window.
SIG_DAT_13 ==> 12 DN
SIG_DAT_13 ==> 12
Procedure outdn exited. Code : NORMAL
If set on causes STOL to format any integer or data number (raw) type variables and expressions as hexadecimal when output using the WRITE directive. By default STOL formats these variables and expressions as decimals.
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| YES
| |
IEGSE_OUTHEX ON | OFF
proc outhex
begin
write "SIG_DAT_13 ==> ", SIG_DAT_13
iegse_outhex on
write "SIG_DAT_13 ==> ", SIG_DAT_13
iegse_outdn_id off
write "SIG_DAT_13 ==> ", SIG_DAT_13
end proc
Produces the following output in the procedure I/O window.
SIG_DAT_13 ==> 12 DN
SIG_DAT_13 ==> X#c DN
SIG_DAT_13 ==> X#c
Procedure outhex exited. Code : NORMAL
Activates/deactivates the mechanism which causes STOL to generate an error if a global variable (telemetry item) is accessed when it is considered stale because it has not been subject to an acquisition update for longer than a period specified in the input_data database record.
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| YES
| |
IEGSE_STALE ON | OFF
proc t_out
iegse_stale on
begin
loop 10
write SIG_DAT_02
wait 0:0:1
end loop
end proc
IF is the main conditional control structure available in CSTOL. Each IF must have an associated END IF, and there may be optional ELSE and ELSE IF clauses.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | NO |
IF clause_expression
clause_expression is a relational expression protected by a pair of brackets - ( ... ). See the IEGSE STOL User Guide for more details of STOL
expressions.
In CSTOL the enclosing ( ... ) brackets may be
optional. In the IEGSE implementation they must be used.
proc if_show $k
declare input $k = 0
begin
; if with else / else if
if ($k > 0)
write "Positive"
else if ($k < 0)
write "Negative"
else
write "Must be zero"
end if
; "bare" if
if ($k = 0)
write "Was Zero"
end if
end proc
Assign a value to a local or special variable.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | NO |
LET var = expression
proc let_demo
declare variable $count = 2
begin
label1:
let $count = $count + 1
write $count
if ($count > 10)
goto end:
end if
goto label1:
end:
write "finished"
end proc
Send a file containing HIRDLS command packets to the instrument. This file will have been prepared using the uplink_p utility.
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| NO
| |
LOAD [upload_file]
.upl) is optional if upload_file is
not a full pathname (i.e. doesn't start with a / character).
[stol]:upldir.
$HOME/stol. This is where uplink_p places upload files by default.
CSTOL>LOAD "/tmp/my_up.upl"
CSTOL>LOAD "new_sci_form"
new_sci_form.upl as described
in the above IEGSE Implementation Notes.
LOOP must have an associated END LOOP.
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | NO |
LOOP [count]
If count is not given the ESCAPE or a GOTO must be used to break out
an indefinite iteration. If count is given there will be a maximum
of count cycles of the loop. count must be a positive
integer. The special variable
Identifies the start of a STOL procedure.
$$LOOP_COUNT contains the number
of cycles the loop has completed.
$$LOOP_COUNT is initialised to zero at the start of each
Applicable Environment | IEGSE Extension |
|---|---|
| PROCEDURE | NO |
PROC proc_name [parameter_list]
.pro where name is proc_name converted to lowercase.
proc my_proc $text $count
; Procedure that takes two parameters
; $text : string
; $count : integer
;
declare input $text="word"
declare input $count=0
begin
loop $count
write $count, $text
end loop
end proc
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| NO
| |
RETURN [ALL]
ALL is specified the current procedure either return or is killed and all it's ancestors in the current procedure chain are killed.
A sub-procedure should use RETURN to return control to the parent in the case of successful completion. There is no method of returning a value (error code) to the parent procedure. If an error return is required it is better to use WRITE to write an error message and WAIT to place the procedure in an unconditional wait.
Loads a STOL procedure object file and if successful starts execution.
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| NO
| |
START proc_name [parameter_list]
[stol]:objdir. If a file name name.obj
is not found in a directory specified by [stol]:objdir, the
search for the file continues in directories given by
[stol]:srcdir and then finally in
the users own directory $HOME/stol.
CSTOL>start comtest1
comtest1 which requires no parameters
CSTOL>start my_proc "typing", 6
my_proc which requires two parameters
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| NO
| |
WAIT [expression]
CSTOL>WAIT
CSTOL>WAIT (SVA_STATUS /= 8 DN)
Conditional waits not allowed from operator console
proc com_wait
declare variable $current_count = 0 DN
declare variable $period = 0:0:10
declare variable $timeout = /-0:0:0
begin
let $current_count = SCCMDS_RCVCT
@HIR_SSH_SAFE
let $timeout = $$current_time + $period
; Wait on either telemetry point incrementing indicating command received
; or a timeout (specified by local variable "$period") occuring.
wait ((SCCMDS_RCVCT > $current_count) or ($$current_time > $timeout))
; Check if timeout caused conditional WAIT to evaluate TRUE
if ($current_count = SCCMDS_RCVCT)
write "Command timed out"
; Use unconditional WAIT to get operator intervention
; because command has not been sent
wait
end if
end proc
Writes STOL expressions to standard output.
Applicable Environment | IEGSE Extension |
|---|---|
OPERATOR| NO
| |
WRITE list
proc time
; Procedure demonstrating arithmetic and use of write.
declare variable $ww = 10:0:0.0
declare variable $xx = 10:0:0.0
declare variable $del = 10:0:0.0
declare variable $clk = 1995/1-10:0:0.0
declare variable $cc = 1995/1-10:0:0.0
declare variable $dd = 1995/1-10:0:0.0
declare variable $ee = 0
declare variable $ff = 0
begin
write "56 + 90 =",56 + 90
let $ee = 10
write "some number = ",$ee
let $ff = 9
write "some other number = ",$ff
write "first / second = ",$ee/$ff
let $ww = ::10.0
let $xx = ::11.0
let $cc = 1995/234-11:23:00.0
let $dd = 1995/234-11:26:45.3
let $clk = /-0:0:0.0
let $del = 0:0:0.0
write "add delta to delta ",$ww,"+",$xx," = ",$ww + $xx
let $del = $ww + $xx
write "delta", $del
write "sub delta from delta ",$ww,"-",$xx," = ",$ww - $xx
let $del = $ww - $xx
write "delta", $del
write "add delta to clock ",$ww,"-",$cc," = ",$ww + $cc
let $clk = $ww + $cc
write "clock", $clk
write "mul delta by int ",$ww,"*",$ff," = ",$ww * $ff
let $del = $ww * $ff
write "delta", $del
write "div delta by int ",$ww,"/",$ff," = ",$ww / $ff
let $del = $ww / $ff
write "delta", $del
write "sub delta from clock ",$cc,"-",$ww," = ",$cc - $ww
let $clk = $cc - $ww
write "clock", $clk
write "sub clock from clock ",$dd,"-",$cc," = ",$dd - $cc
let $del = $dd - $cc
write "delta", $del
let $del = $del * 12
write "delta * 12 = ", $del
let $clk = $clk + ::25.1
write "clock + ::25.1 = ", $clk
end proc
The IEGSE STOL implementation is exactly compliant with the OASIS-CC v02.05.12 documentation in this respect. In the following tables the row indicates the type of the first (left) operand and the column indicates the type of the second (right) operand. Where a combination results in a blank cell the operation is not allowed. The cell gives the result type of the operation (except for assignment where the results follows from the row type).
For example in the following code segment
declare variable $margin = 0.1
declare variable $high_val = 0.0
declare input $para = 2
begin
let $high_val = ($para * $margin) + $para
the multiplication is (integer * real) hence the multiplication
below indicates that the result will be of type real real. This means the next expression is (real + integer) and looking at the addition table indicates that the result will be real.
| integer | real | clock | delta | state | text | dn | eu | unsigned | |
|---|---|---|---|---|---|---|---|---|---|
| integer | OK | OK | OK | OK | |||||
| real | OK | OK | OK | OK | |||||
| clock | OK | ||||||||
| delta | OK | ||||||||
| state | OK | ||||||||
| text | OK | ||||||||
| dn | OK | OK | |||||||
| eu | OK | OK | |||||||
| unsigned | OK | OK |
| integer | real | clock | delta | state | text | dn | eu | unsigned | |
|---|---|---|---|---|---|---|---|---|---|
| integer | integer | real | unsigned | ||||||
| real | real | real | real | ||||||
| clock | clock | ||||||||
| delta | clock | delta | |||||||
| state | |||||||||
| text | text | ||||||||
| dn | dn | ||||||||
| eu | eu | ||||||||
| unsigned | unsigned | real | unsigned |
| integer | real | clock | delta | state | text | dn | eu | unsigned | |
|---|---|---|---|---|---|---|---|---|---|
| integer | integer | real | unsigned | ||||||
| real | real | real | real | ||||||
| clock | delta | clock | |||||||
| delta | delta | ||||||||
| state | |||||||||
| text | |||||||||
| dn | dn | ||||||||
| eu | eu | ||||||||
| unsigned | unsigned | real | unsigned |
| integer | real | clock | delta | state | text | dn | eu | unsigned | |
|---|---|---|---|---|---|---|---|---|---|
| integer | integer | real | delta | eu | unsigned | ||||
| real | real | real | eu | real | |||||
| clock | |||||||||
| delta | delta | ||||||||
| state | |||||||||
| text | |||||||||
| dn | |||||||||
| eu | eu | eu | |||||||
| unsigned | unsigned | real | unsigned |
| integer | real | clock | delta | state | text | dn | eu | unsigned | |
|---|---|---|---|---|---|---|---|---|---|
| integer | integer | real | unsigned | ||||||
| real | real | real | real | ||||||
| clock | |||||||||
| delta | delta | ||||||||
| state | |||||||||
| text | |||||||||
| dn | |||||||||
| eu | eu | eu | |||||||
| unsigned | unsigned | real | unsigned |
Only applicable to integer operands producing integer result.
Exponent operand must be an integer, the other operand can be of either integer or real type and the operation result id of that type.
Only applicable to integer operands producing integer result (bitwise operations), or boolean operands producing boolean result.
Operands must of same type except in case where one operand can be integer and the other one real.
As above except not allowed for text and state type operands.
Return to IEGSE Home
Modified --> $Revision: 1.12 $ $Date: 2001/01/21 16:40:00 $
HIRDLS IEGSE Support