Tutorial Animation Tips: Difference between revisions

Line 49: Line 49:




[[file:ProB_Lift_OpPane_WithJump_Exec98.png|center||450px]]
[[file:ProB_Lift_OpPane_WithJump_Exec98.png|center||490px]]


Note: instead or in addition to providing concrete values, you can also specify a predicate that constrains the values of the parameters:
Note: instead or in addition to providing concrete values, you can also specify a predicate that constrains the values of the parameters:
[[file:ProB_Lift_ExecuteOperation_Dialog_Pred.png|center||490px]]
[[file:ProB_Lift_ExecuteOperation_Dialog_Pred.png|center||490px]]
The above predicate, <tt>level>96 & level mod 2 =0</tt> would select the same value <tt>98</tt> for level.
When there are multiple solutions, ProB will only execute the operation for the first solution found.

Revision as of 15:07, 15 December 2013


Make sure you have the Lift.mch model from the first part of the tutorial: Starting ProB and first animation steps.

Operation with many solutions for the parameters

Add the following operation to the Lift model:

jump(level) = PRE level : 0..99 THEN floor := level END

Now reload your model and initialise the machine. Your ProB window should now look as follows:


ProB LiftWithJump.png

As you can see, only 10 values for the level parameter of the jump operation are displayed in the "Enabled Operations" pane. The orange "max" button to the left of "Enabled Operation" tells you that not all possible parameter values for the operations were computed.

There are two solutions to overcome this.

Increasing MAX_OPERATIONS

First, you could increase the "MAX_OPERATIONS" preference of ProB by selecting the "Animation Preferences" command in the "Preferences" menu:

ProB Lift MAX OPERATIONS.png

You should then set the preference "" to at least 101 and then re-load the B machine.

ProB Lift OpPane WithJump101.png

Executing an Operation by Predicate

The alternative is to provide the parameter value for level yourself. For this, select the "Execute an Operation..." command in the animate menu:

ProB Lift ExecuteOperationMenu.png

After that, select the jump operation

ProB ExecuteOperation.png

and you will be provided with the following dialog:

ProB Lift ExecuteOperation Dialog.png

Type in 98 into the level field and hit the "Execute" button.


ProB Lift OpPane WithJump Exec98.png

Note: instead or in addition to providing concrete values, you can also specify a predicate that constrains the values of the parameters:

ProB Lift ExecuteOperation Dialog Pred.png

The above predicate, level>96 & level mod 2 =0 would select the same value 98 for level. When there are multiple solutions, ProB will only execute the operation for the first solution found.