Adding a Test Instruction

You can use the Robotics language and use Case instruction to describe the logic. This provides a Case instruction in Behavior Modeler 2. Add a Case instruction in the DELMIA logic by importing logic with the Test/Case instruction.


Before you begin: The Sequence Editor window is opened.
See Also
About the Sequencing Editor
About the Sequential Panel
  1. To add a Test Instruction in a sequence, do one of the following:
    • Select Test Instruction in the toolbox and then click the blank page.
    • Drag Test Instruction to the blank page.

    In the procedure, the Test instruction is as follows:

    Var is selected by you. It could be an Input/Output or a Variable of the editing resource or an expression. It could also be of type Boolean, Integer, Double, or String.

    The conditions of the Case instruction can be set by you, the Case values can be expressions or literals that evaluate to the same data type as Var.

    Sequences in each Case can be edited you as in any other sequence.

    • The Test dialog box appears.
    • The Test instruction is added to the blank page.
  2. The GoTo Label enter One, and click OK.
    The newly created test appears.

    When adding a new instruction in the Test instruction, a popup appears and proposes you to add before or after the Test instruction or to add a new Case or a new Default Case.

    If the Default Case already exists, the last option is not proposed cause there is only one Default Case per Test instruction. It is going to be similar as the parallel instruction. Once choosing to add a new Case, a panel appears to allow you to set the condition or not if it is a Default Case.

    Note: Case set on each Test has to respect the same constraints than the expression for the If instruction.

    When moving an instruction from the current procedure to the Test Instruction, a panel appears and proposes you to move it before or after the Test instruction, or to move it in a new Case or in a new Default Case. If the Default Case already exists, the last option is not proposed cause there is only one Default Case per Test instruction.

    The Test instruction also displays in the Teach Editor:

    Instructions follow this behavior:

    • The TEST expression is evaluated and the matching Case Conditions value is found. The statements associated with that Case Conditions are then executed. If no Case Conditions match, then the DEFAULT statements are executed.
    • The TEST expression can evaluate to the following data type: integer, Boolean, double, string. The CASE values can be expressions or literals that evaluate to the same data type as the test expression.
    • If multiple Case Conditions match, only the 1st Case Conditions that match is executed.
    • There is no limit of number for the Case Conditions.
    • An optional list of DEFAULT instructions can be specified. If no Case Conditions matches, then the instructions in the DEFAULT section are executed if it exists, otherwise execution continues to after the TEST/CASE block (same as an empty DEFAULT section). DEFAULT section is unique if it exists.
    • A BREAK instruction in the list of instructions for a CASE causes the control to flow to the next instruction after the TEST/CASE block. A BREAK instruction is not mandatory and omitting it does not cause fall-through behavior to the next CASE like C++.
    • A GOTO instruction, can be added in a Case sequence but it cannot not be linked to an instruction that is in another Case sequence. A GOTO instruction that is outside a Case Instruction cannot be linked to an instruction that is inside.
    • It is impossible to create a Case Conditions anywhere else that under a Test instruction. For instance, one cannot create a Case Conditions under another Case Conditions.
    • The LCM language must be extended to support two new functionalities used in the Robotic language. The two news LCM instructions are:
      • Between operator “->”
      • Unary comparison operator “>” or “<”
    • The between operator added in LCM works as the following. For instance, if the variable on the Test instruction is ‘x’ and one of the Case Conditions is ‘4 -> 7’ then the Case Conditions is going to match if the value of ‘x’ is greater or equal to 4 and less or equal to 7.
    • LCM had the binary comparison operator greater than and less than, but for the Case Conditions we had to add the unary comparison operator. For instance, if the variable on the Test instruction is ‘x’ and one of the Case Conditions is ‘>8’ then the Case Conditions is going to match if the value of ‘x’ is strictly greater than 8.
    • To access the functionality set the following variable: AUT_ActivateCreateTestCase=1

    New APIs are available to allow programmers to create a new Case instruction and to edit it.

    API on AUTIBmSequence :
    -	CreateTest(const CATUnicodeString & iExpression, AUTIBmTest_var &ohCreatedTest, const int iIndex = -1)
    -	CreateTest (AUTIBmTest_var &ohCreatedTest, const int iIndex = -1)
    API on AUTIBmTest :
    -	GetTestExpression(CATUnicodeString& oTestExpression)
    -	SetTestExpression(CATUnicodeString iTestExpression)
    -	AddNewCase(AUTIBmCase_var& ohCase, CATUnicodeString iCondition, int iPosition = -1)
    -	GetDefaultCase(AUTIBmCase_var& ohDefaultCase, CATBoolean ibCreate = FALSE)
    -	GetCases(CATListValCATBaseUnknown_var& ohListCases)
    API on AUTIBmCase :
    -	GetCondition(CATUnicodeString& oCondition)
    -	SetCondition(CATUnicodeString iCondition)
    -	GetCaseSequence(AUTIBmSequence_var& ohCaseSequence)
    -	CATBoolean IsDefaultCase()