# Model 3a - Exclusive Gateways using Conditions

## Goals of this lesson

• Usage of exclusive gateways

## How-to

Model 3.a explains how to use exclusive gateways for a simulation. Contrary to parallel gateways a branching exclusive gateway needs a condition on every outgoing sequence flow depending on (a) process variable(s). During the simulation the conditions on the outgoing edges will be evaluated to determine exactly one edge as the next path element. You have to ensure that the conditions will determine exactly one sequence flow, otherwise (two or more edges meet the conditions) the simulation results will be useless due to this modeling fault.

Please refer to section Variables for a description of how to set up variables and conditions.

Figure 1. Model 3a - Exclusive Gateway / IYOPRO-Link

### Approach

Depending on our assignment of variables and conditions from the lessons Assigning Process Variables and Assigning Gateway Conditions, our variables and conditions look like this:

• For the model above we will define the variables x and y at the first activity

• x=1; which defines the variable x with a value of 1

• y=1; which defines the variable y with a value of 1

• At the second activity We will now increment x by one and define the new variable z that takes its value from y

• x=x+1; which increments x’s value by 1

• z=y; which defines a new variable z that will be given y’s value

• Our variables have now these values: `x = 2`, `y = 1`, `z = 1`

• Now declare the edge’s conditions behind the branching exclusive gateway:

• Upper edge: `x < y`

• Bottom edge: `x > y`

### Explanation

This configuration is quite static and always leads to the result, that the bottom sequence flow is being followed, and therefore the activity "Sub process 1" will never be executed. Simply simulate the model with this configuration and you will notice that the activity "Sub process 1" does not contain any statistical information.

• None of the edges' expressions test the equality of x and y.

• This is a common error in this type of condition.

• If x and y are equal, the gateway will not fire.

• It will not pass any token, which means that the process instance is trapped at the gateway.

• So, we will need to check for equality.

• Either by adding a third edge that checks for `x == y`

• or by extending one of our already existing edges' condition to `x >= y` or `x ⇐ y`.

 The latter can only be done for only one (edge’s) condition, because we must impose the exclusive restriction (an exclusive branching gateway must pass exactly one token!)

## Report

See below for the run configuration, which we set up to receive the report statistics from below.

### Run configuration

• Stochastic Seed: 12345

• Simulation start date: 1/1/2014 12:00:00 a.m.

• Simulation stop time: 240

• Simulation stop time unit: Hours

### Report statistics

• In this report you will find a new section in the report: Gateway details

• Note: When a model only contains parallel gateways, there will be no gateway details in the report

• Because there is no active decision making, which bases on any kind of information

• Figure 2 shows the report’s gateway details

• As you see, there was only one sequence flow that has been followed after the branching exclusive gateway

• This is precisely the circumstance, which we defined in our decision making

• Also if you look at Figure 3 further below, you will notice that the activity "Sub process 1#1" has never been reached

• Just like we intended to

• Since this model’s gateway details are not very extensive, have look at Model 3b’s report.

Figure 2. The report’s gateway details
Figure 3. The report’s activity run-times