Triangular function

Updated: 2025-09-17

The triangular distribution lets you define a value’s minimum, maximum, and most likely (mode). It has a triangular shape, where the mode is the most frequent value and the extremes are less likely.

It’s useful when you have an approximate idea of how a process behaves, but not enough data to justify a more complex distribution.

“A delivery usually takes 3 days, but it could take 2 or 5.”

That kind of uncertainty is ideal for a triangular distribution.

Parameters

Function {Name:tfun1, TYPE:TRIANGULAR, Min:20, Max:40, Mode:30}

 

  • Min: Minimum possible value.
  • Max: Maximum possible value.
  • Mode: Most likely value (peak of the distribution).

This example compares three triangular functions with different peak positions. All share the same range, but produce different distributions:

 

Function {Name:tfun1, TYPE:TRIANGULAR, Min:20, Max:40, Mode:30} ; Centered peak
Function {Name:tfun2, TYPE:TRIANGULAR, Min:20, Max:40, Mode:25} ; Left-skewed peak
Function {Name:tfun3, TYPE:TRIANGULAR, Min:20, Max:40, Mode:35} ; Right-skewed peak

 

Graph

Example

/*

  	 	Triangular
 
*/
SYSTEM {TYPE:OPTIONS, Speed:5}

Facility {NAME:VENTANILLA1,X:165,Y:184,E_BIN_start:0,E_BIN_SIZE:1,E_BIN_COUNT:80,capacity:10}

Facility {NAME:VENTANILLA2,X:343,Y:185,E_BIN_start:0,E_BIN_SIZE:1,E_BIN_COUNT:80,capacity:10}

Facility {NAME:VENTANILLA3,X:535,Y:183,E_BIN_start:0,E_BIN_SIZE:1,E_BIN_COUNT:80,capacity:10}

POSITION {NAME:POS1, X:250, Y:381}
POSITION {NAME:POS2, X:423, Y:383}
POSITION {NAME:POS3, X:566, Y:384}

Function {Name:tfun1, TYPE:TRIANGULAR, Min:20, Max:40, Mode:30}
Function {Name:tfun2, TYPE:TRIANGULAR, Min:20, Max:40, Mode:25}
Function {Name:tfun3, TYPE:TRIANGULAR, Min:20, Max:40, Mode:35}

START 500

GENERATE 10,0,0,0 {NAME:GEN1, X:91, Y:383}

; WINDOW 1 – Centered triangle
ADVANCE 20,4 {TO:VENTANILLA1}
SEIZE VENTANILLA1
ADVANCE FN$tfun1
RELEASE VENTANILLA1
ADVANCE 20,0 {TO:POS1}

; WINDOW 2 – Triangle with the peak to the left
ADVANCE 20,0 {TO:VENTANILLA2}
SEIZE VENTANILLA2
ADVANCE FN$tfun2
RELEASE VENTANILLA2
ADVANCE 20,0 {TO:POS2}

; WINDOW 3 – Triangle with the peak to the right
ADVANCE 20,0 {TO:VENTANILLA3}
SEIZE VENTANILLA3
ADVANCE FN$tfun3
RELEASE VENTANILLA3
ADVANCE 20,0 {TO:POS3}

ENDGENERATE 1