LANGUAGE REFERENCE
1.2 UCA2 Data Leaves, Scenario Variables and Named Constants 3
1.8.2 BEGIN_UPDATE - END_UPDATE Syntax:
END_IF;
DATE returns the current date $t := DATE;
IF DATE == "01.01.2001" THEN ...
This section lists all statements supported by the Equipment Simulator scenario language together with statement specific hints and examples. The statements are listed alphabetically.
1.8.1 Assignment Syntax:
<variable> := <expression>;
Description:
Assigns the value of an expression to a local or global scenario variable.
Examples:
$gi := 1;
$Operator := "TickTrick&Track";
$RandValue := RAND( 10 ) * 2 / 3;
$Uca2Value := $Server/LD/XCBR1$MX$Pres$f
1.8.2 BEGIN_UPDATE - END_UPDATE Syntax:
BEGIN_UPDATE;
...
END_UPDATE [<reason_for_inclusion_expression>];
Description:
These two statements group a series of data leaf updates and delay the sending of reports to clients by the UCA2 Agency until END_UPDATE is called. The Equipment Simulator caches the data leaf updates between BEGIN_UPDATE and END_UPDATE and sends all modifications to the UCA2 Agency at once when the END_UPDATE statement is reached.
<reason_for_inclusion expression> is evaluated then cast in a byte and used as a the value of the reason_for_inclusion parameter . Constant can be used as well.
Valid values for reason_for_inclusion are:
ODD_DATA_CHANGE = 0x40
ODD_QUALITY_CHANGE = 0x20
ODD_FOLLOWING_CONTROL = 0x8
ODD_CYCLIC = 0x2
The validity of the reason_for_inclusion’s value is not checked. If <expression> is omitted, ODD_DATA_CHANGE is used as reason_for_inclusion.
Example:
This statement indicates that a previous control operation is terminated. The acknowledgement leaf must be a $AckCode data leaf and is updated with the result expression, which must evaluate to an integer value and corresponds to the result of a direct control operation.
CONTROLTERMINATION must be called from an OnDirectControl handler. If the statement is used outside of an OnDirectControl handler an exception is thrown and the scenario is terminated.
CONTROLTERMINATION is only valid in server sessions.
Examples:
This statement performs a direct control operation by writing the data given by
<expression> to the data leaf given by <control leaf>. <operator expression>
and <origin expression> must evaluate to strings, <date/time expression> must be a valid date/time. All three parameters are sent to the server and are written to the respective data leaves by the server.
DIRECTCONTROL is only allowed from a client session. If called for a data leaf in a server session an exception is raised and the scenario is terminated.
DIRECTCONTROL returns 1 if the operation succeeded or 0 if the operation failed. The return value can be checked in an IF statement for example.
<control leaf> must be a valid UCA2 data leaf name, data object names are not allowed.
<operator expression>, <origin expression> and <date/time expression>
can be omitted. In this case default values which can be configured in the Equipment Simulator are used.
IF DIRECTCONTROL( $ODSw$OperDev, 0x40 ) == 1 THEN SLEEP( 1000 );
DIRECTCONTROLDONE is called from an OnDirectControl handler to return the result of the direct control operation to the UCA2 Agency.
If the statement is used outside of an OnDirectControl handler an exception is thrown and the scenario is terminated.
DIRECTCONTROLDONE is only valid in server sessions.
<result expression> controls the result of the direct control operation. If the expression evaluates to zero, an error is returned to the UCA2 Agency, if the expression evaluates to a value unequal to zero, the operation is finished with success.
Examples:
DIRECTCONTROLDONE( 1 );
DIRECTCONTROLDONE( 0 );
DIRECTCONTROLDONE( %nSuccess );
1.8.6 EXIT Syntax:
EXIT;
Description:
The EXIT statement either leaves the innermost FOR or WHILE loop or the scenario if used outside of a loop. <local file expression>, <remote file expression>
);
Description:
This statement reads a file from the specified server and stores the file on the local file system.
<server expression> must be the name of a valid server, which is in a client session of the Equipment Simulator.
<local file expression> and <remote file expression> are strings which contain valid path and file names on the local and remote file systems.
FILEGET is only allowed from a client session. If called from a server session an exception is raised and the scenario is terminated.
FILEGET returns 1 if the operation was successful or 0 if the operation failed. The return value can be checked in an IF statement for example.
Examples:
IF FILEGET( "SRV", %local, %remote ) <> 1 THEN EXIT;
END_IF;
1.8.8 FILEPUT Syntax:
FILEPUT (
<server expression>, <local file expression>, <remote file expression>
);
Description:
This statement writes a file from the local file system to the specified server.
<server expression> must be the name of a valid server, which is in a client session of the Equipment Simulator.
<local file expression> and <remote file expression> are strings which contain valid path and file names on the local and remote file systems.
FILEPUT is only allowed from a client session. If called from a server session an exception is raised and the scenario is terminated.
FILEPUT returns 1 if the operation was successful or 0 if the operation failed. The return value can be checked in an IF statement for example.
Examples:
IF FILEPUT( "SRV", %local, %remote ) <> 1 THEN EXIT;
END_IF;
1.8.9 FOR Loop Syntax:
FOR <variable> := <expr1> TO <expr2> [STEP BY <expr3>] DO ...
END_FOR;
Description:
Repeats a group of statements a specified number of times. If the STEP BY clause is omitted, the <variable> is increased by 1 by default.
Examples:
1.8.10 GETGOOSEBITPAIR Syntax:
GetGooseBitPair();
GetGooseBitPair(<NamedBitPair Expression >) ;
GetGooseBitPair(<SendingServer Expression>,<NamedBitPair Expression>) ;
Description:
The GetGooseBitPair built-in function allows the scenario to get a specific bit pair from an incoming Goose
The GetGooseBitPair built-in function returns a BSTR8. The bit 7 of the BSTR8 is cleared if the specified incoming Goose has been received once at least. It the bit 7 of the BSTR8 is cleared, the bits 0 and 1 of the BSTR8 are set to the last value of the specified bitpair received.
SendingServer expression is should a string. It is the name of the server that sends the incoming Goose. It can be omitted if the running scenario is attached to one of the server listed in the IncomingGoose Node or to a Named BitPair under it.
NamedBitPair expression is should a string. It is the name of the bitpair that is going to be read. It can be omitted along with the sending server name if the running scenario is attached to a Named BitPair.
Examples:
LOCALS
BSTR8 : % IcomGoose ; BSTR2 : %BitPair ; END_LOCALS;
%IcomGoose :=GetGooseBitPair(«CALCUL1 », « LD1/BAY1$ST$SWDS ») ; IF %IcomGoose [7] then
Leaves the normal path of execution and jumps to the specified label.
Examples:
1.8.12 IF Statement
Conditionally executes a group of statements, depending on the value of <expression>. If
<expression> evaluates to true, the group of statements after the THEN clause is executed. If <expression> evaluates to false, the group of statements following the ELSE clause is executed. If the ELSE clause is not given, no statements are executed in this case.
Examples:
This statement performs a SBO select operation for the given <select leaf>.
<operator expression> and <origin expression> must evaluate to strings,
<date/time expression> must be a valid date/time. All four parameters are sent to the server and are written to the respective data leaves by the server.
SBOSELECT is only allowed from a client session. If called for a data leaf in a server session an exception is raised and the scenario is terminated.
SBOSELECT returns 1 if the operation was successful or 0 if the operation failed. The return value can be checked in an IF statement for example.
<select leaf> must be a valid UCA2 data leaf name, data object names are not allowed.
<operator expression>, <origin expression> and <date/time expression>
can be omitted. In this case default values, which can be configured in the Equipment Simulator, are used.
<controlType expression> can be omitted too. In this case, no control type is written on the server. If one or more of the three first parameters are omitted but the Control Type, commas should be used in the parameters list.
Examples:
IF SBOSELECT( $ODSw$SBO,,,,0x80 ) == 1 THEN SLEEP( 1000 );
SBOSELECTDONE is called from an OnSboSelect handler to return the result of the SBO select operation to the UCA2 Agency.
If the statement is used outside of an OnSboSelect handler an exception is thrown and the scenario is terminated.
SBOSELECTDONE is only valid in server sessions.
<result expression> controls the result of the SBO select operation. If the expression evaluates to zero, an error is returned to the UCA2 Agency, if the expression evaluates to a value unequal to zero, the operation is finished with success.
Examples:
This statement performs a SBO deselect operation for the given <select leaf>.
<operator expression> and <origin expression> must evaluate to strings,
<date/time expression> must be a valid date/time. All three parameters are sent to the server and are written to the respective data leaves by the server.
SBODESELECT is only allowed from a client session. If called for a data leaf in a server session an exception is raised and the scenario is terminated.
SBODESELECT returns 1 if the operation was successful or 0 if the operation failed. The return value can be checked in an IF statement for example.
<select leaf> must be a valid UCA2 data leaf name, data object names are not allowed.
<operator expression>, <origin expression> and <date/time expression>
can be omitted. In this case default values which can be configured in the Equipment Simulator are used.
Examples:
IF SBODESELECT( $ODSwSBO$SBOState ) == 1 THEN SLEEP( 1000 );
This statement suspends the execution of the scenario by the specified amount of time.
<expression> must be given in milliseconds.
Examples:
This function call turns on the run-time scenario log for the calling scenario, starting at the calling site until the end of the instance of the scenario or until the scenario reaches the calling site of a NOTRACE function call.
The NOTRACE function call can be omitted: the NOTRACE function is called automatically at the end of each periodic or event call of the scenario.
To be active, the run-time Scenario Logs boxes should be checked (see "Erreur ! Source du renvoi introuvable." on page Erreur ! Signet non défini.) and the TRACE function should be called.
1.8.18 WHILE Loop
Executes a series of statements as long as the condition given by <expression> is true.
Exemples:
<UCA2 data leaf> := <expression>;
Description:
Assigns the value of an expression to one or more UCA2 data leaves.
If the assignment take place outside a BEGIN_UPDATE – END_UPDATE section on a simulated server, the overall parent data object is sent to the client.
The Equipment Simulator can assign the result of the expression to a specific data leaf by its name or to multiple data leaves by using the asterisk (*) as a wildcard character in the data leaf name. For example if the expression is assigned to the UCA2 data leaf $*$*$q and the scenario which contains this statement is assigned to a brick, the result value is assigned to the q data leaves of all data objects of all functional components of the concerned brick.
Exemples:
BLANK PAGE
APPLICATION
CONTENT
1. SCOPE OF THE DOCUMENT 3
2. ORGANIZATION OF SCENARIOS 4
3. THE SCENARIO WINDOW 6
3.1 The Control Center 6
3.2 The Code Section 7
3.3 The Log Section 7
4. MANAGING SCENARIOS 8
4.1 Scenario Files 8
4.2 Scenarios 9
5. WRITING SCENARIOS 12
5.1 General Structure of Scenarios 12
5.2 Using Variables in Scenarios 13
5.3 Referencing UCA2 Data Leaves 14
5.4 Using Named Constants 16
5.5 Event Handler 17
5.6 Other Topics 20
BLANK PAGE