5.4. 定义流量违反 DMN 决策逻辑
要计算细节并决定是否要暂停驱动程序,您可以使用 DMN 决策表和上下文框定义流量违反 DMN 决策逻辑。
图 5.8. 微调表达式
图 5.9. 是否应该暂停驱动程序的表达式
先决条件
- 您已将 DMN 自定义数据类型分配给 Business Central 中流量违反 DRD 中的相应决定和输入节点。
流程
要计算好的效果,在 DMN Designer canvas 中,选择 Fine 决定节点,然后单击 Edit 图标以打开 DMN 框的表达式设计程序。
图 5.10. 决定节点编辑图标
点 Select expression
Decision Table。 图 5.11. 选择 Decisiong Table 逻辑类型
- 对于 Violation.Date、Vaolation.Code 和 Violation.Speed Limit 列,右键单击每个字段的 Delete。
-
单击 Violation.Actual Speed 列标题,然后在 Expression 字段中输入表达式
Violation.Actual Speed - Violation.Speed Limit"。 在路由表的第一行中输入以下值:
-
violation.Type:
"speed" -
violation.Actual Speed - Violation.Speed Limit:
[10..30) -
数量:
500 点:
3右键点击第一行并选择
下面的 Insert来添加另一个行。
-
violation.Type:
在路由表的第二行中输入以下值:
-
violation.Type:
"speed" -
violation.Actual Speed - Violation.Speed Limit : &
gt;= 30 -
数量:
1000 点:
7右键单击第二行,再选择
下面的 Insert来添加另一个行。
-
violation.Type:
在路由表的第三个行中输入以下值:
-
violation.Type:
"parking" -
violation.Actual Speed - Violation.Speed Limit:
- -
数量
:100 点:
1右键单击第三行,再选择
下面的 Insert来添加另一个行。
-
violation.Type:
在路由表的第四行中输入以下值:
-
violation.Type:
"driving under the influence" -
violation.Actual Speed - Violation.Speed Limit:
- -
数量:
1000 -
点:
5
-
violation.Type:
- 点击 Save。
- 要定义驱动程序挂起规则,请返回到 DMN 设计器 canvas,选择 Should the driver is suspended? decision node,然后单击 Edit 图标以打开 DMN 框的表达式设计程序。
-
点 Select expression
Context。 -
点 ContextEntry-1,输入
Total Points作为 Name,然后从 Data Type 下拉菜单中选择数字。 -
单击 Total Points 旁边的单元格,从上下文菜单中选择
Literal 表达式,并输入Driver.Points + Fine.Points作为表达式。 -
在 Driver.Points + Fine.Points 下的单元格中,从上下文菜单中选择
Literal Expression,然后输入Total Points >= 20,然后"否"。 点击 Save。
您已定义如何计算调优和上下文,以决定何时暂停驱动程序。您可以导航到 traffic-violation 项目页面,再单击 Build 以构建示例项目,并解决 Alerts 面板中记录的任何错误。