3.2. 停止ルールの条件の設定
ドライバーの違反を判断するために使用する 停止 ルールの条件を設定します。
前提条件
運転免許停止ルールを作成した。
手順
-
WHEN ラベルの横にある (
) をクリックして、Add a condition to the rule ウィンドウを開きます。
Driver を選択して Ok をクリックします。
図3.3 新しいガイド付きルールの作成ウィンドウ
- There is a Driver ラベルをクリックして Modify constraints for Driver ウィンドウを開きます。
-
Variable name フィールドに
driver
と入力し、Set をクリックします。 - There is a Driver[driver] をクリックし、Expression editor をクリックします。
- [not bound] をクリックし、Expression editor を開きます。
-
Bind the Expression to a new variable フィールドに
previousPts
と入力し、Set をクリックします。 - Choose メニューから totalPoints を選択します。
-
1 行目 (previousPts ラベル) の横にある (
) をクリックして、Add a condition to the rule ウィンドウを開きます。
- From Accumulate を選択し、Ok をクリックします。
- From Accumulate ラベルの上にある click to add pattern をクリックし、 choose fact type メニューから Number を選択します。
- There is a number ラベルをクリックして Modify contraints for Number ウィンドウを開きます。
- Expression editor をクリックし、[not bound]: Choose メニューから intValue() を選択します。
- [not bound] をクリックし、Expression editor を開きます。
-
Bind the Expression to a new variable フィールドに
totalNewPoints
と入力し、Set をクリックします。 - click to add pattern をクリックし、choose fact type メニューから Violation を選択します。
- All Violation with: をクリックして Modify contraints for Violation ウィンドウを開き、Add a restriction on a field メニューから point を選択します。
- points ラベルの横にある please choose をクリックして、greater than を選択します。
-
(
) をクリックした後、Literal value をクリックします。
- points ラベルをクリックして、Add a field ウィンドウを開きます。
-
vPoints
と入力し、Set をクリックします。 -
Function フィールドに
sum(vPoints)
と入力します。 -
totalNewPoints
please choose メニューから greater than or equal to を選択します。 -
(
) をクリックし、New formula をクリックして、新しいフィールドに
20-previousPts
と入力します。 - Save をクリックした後、Save をクリックして変更を確認します。
図3.4 停止ルールの条件