Prev Next

Simulate DMN Model

A DMNSimConfiguration Artifact contains information to define the simulation of a DMN model depicted by Decision Requirements diagrams, using the DMN Simulation window.

Access

Ribbon

Simulate > Decision Analysis > DMN > Open DMN Simulation | Simulate tab

Other

Double-click on a DMNSimConfiguration element |Simulate tab

DMNSimConfiguration Artifact

To create a DMNSimConfiguration element:

  • Open a Decision Requirements Diagram
  • Drag the 'Simulation Configuration' icon from the toolbox onto the diagram

By default, all DMN elements in the current Package (Decision, BusinessKnowledgeModel, InputData and ItemDefinition) will be loaded to the DMN Simulation window.

Simulation Overview

When a target Decision is specified, the 'Simulation' tab will list the related Decisions, in dependency order.

When executing or 'stepping through' the Decision Hierarchy, the Decisions will be evaluated in order and:

  • The runtime result will show in the 'Value' column
  • The runtime result will be displayed as overlaid text on the diagram
  • The Decision logic and input/output data will be presented in the DMN Expression window

Simulation run and stepping through

You can perform a full run of the simulation using the icon. You can step into each Decision to see the invocation sequence using the Step into icon icon.

For example, in the 'Simulate' tab of our illustration, you can see that:

  • The Decision 'Pre-bureau affordability' invokes the BusinessKnowledgeModel 'Affordability calculation'
  • BusinessKnowledgeModel 'Affordability calculation' further invokes another BusinessKnowledgeModel 'Credit contingency factor table'

Decision List

When a Package is loaded, a Decision Requirements Graph (DRG) and decision dependency list is created. The DMN InformationRequirement connectors determine the list order.

  • All the decisions will be listed in the drop-down for the toolbar data entry field

Data Set & Input Data

When the target Decision is selected, all the dependent InputDatas are added to the 'Element' column.  You can then choose from the data sets defined for each InputData element, using the drop-down lists in the 'Value' column. Each data set provides runtime values to use in the simulation.

An example of choosing a Dataset for DMN simulation using Enterprise Architect.

Advanced Debugging

Although Enterprise Architect provides a validation feature to help you locate many modeling issues and DMN expression issues, the simulation might still fail (rarely but possible) due to uncaught issues.

However, Enterprise Architect provides the ability to debug the code that is running behind the simulation. You can also modify the code and run it in cycles until the issue is found and fixed.

The drop-down arrow for the Execute button on the toolbar displays a menu with these options:

  • Generate new Script (Scripting Window)
  • Update Selected Script (Scripting Window)
  • Run Selected Script (Scripting Window)
  • Edit DMN Template

If you select 'Generate New Script (Scripting Window)', the Scripting window displays showing a script created in a Package named 'DMN'.

An example of expanding the view of the Invocation Hierarchy in a DMN Simulation run using Sparx Systems Enterprise Architect.

  • The default script name is composed of these parameters: 'ArtifactName - TargetDecision - InputData1(DataSet)_ InputData2(DataSet)_...'

Double-click on this file to open it in the Enterprise Architect Script editor, set a breakpoint, and debug the file.

By selecting the script in the Scripting Window, and if the script matches the model (by the 'Simulation Script Identifier' in the script), you enable the menu option 'Run Selected Script'.

You can customize the DMN Template to generate the correct script for simulation.

Learn more