Multi-Parameter Interpolation (2D/3D Surfaces)

Updated: 2026-01-27

While the previous example used a single parameter, we now move to multi-dimensional modeling. This allows us to represent much richer and more flexible scenarios.

In this case, we simulate three road sections where transit time depends on two variables: Section Length (P0) and Weather Conditions (P1).

Spatial Interpolation (IDW)

When using multiple parameters, mathematical interpolation is no longer a simple line; it becomes a multidimensional space. GPSS-Plus uses IDW (Inverse Distance Weighting) techniques to calculate the resulting Gaussian function.

This means that for any combination of distance and weather within the pre-calculated margins, GPSS-Plus will automatically generate a tailored time distribution function.

Why use QUEUERs?

In this model, we don't use FACILITYs (individual resources). Instead, we use ADVANCE with QUEUERs to collect statistics on the time spent in each section. This approach is ideal for modeling continuous flows like traffic or assembly lines where capacity isn't the primary bottleneck, but environmental conditions are.

Key Takeaways:

  • Scalability: You can define as many parameters as needed (P0, P1, P2...).
  • Non-Linearity: The system predicts complex interactions between variables.
  • Dynamic Integration: Parameters like 'Weather' could be changed in real-time by a Global Timer or an external API via Bridger.

Example

SYSTEM {TYPE:OPTIONS,Speed:5}

QUEUER {NAME:TRAMO1,X:66,Y:350,E_BIN_start:0,E_BIN_SIZE:1,E_BIN_COUNT:180}
QUEUER {NAME:TRAMO2,X:276,Y:554,E_BIN_start:0,E_BIN_SIZE:1,E_BIN_COUNT:180}
QUEUER {NAME:TRAMO3,X:664,Y:360,E_BIN_start:0,E_BIN_SIZE:1,E_BIN_COUNT:180}

POSITION {NAME:POS1,X:115,Y:92}
POSITION {NAME:POS2,X:146,Y:449}
POSITION {NAME:POS3,X:432,Y:506}
POSITION {NAME:POS4,X:756,Y:33}

; Behavior definitions (Multi-parameter)
; P0: Distance (km) | P1: Weather (0=Good, 1=Bad)
Function {behavior: tramo2D, type:GAUSS, p0:50, p1:0, Name:gName1, a:1, b:40, Sigma1:3.0, Sigma2:3.0}
Function {behavior: tramo2D, type:GAUSS, p0:50, p1:1, Name:gName2, a:1, b:60, Sigma1:5.0, Sigma2:5.0}
Function {behavior: tramo2D, type:GAUSS, p0:100, p1:0, Name:gName3, a:1, b:80, Sigma1:5.0, Sigma2:5.0}
Function {behavior: tramo2D, type:GAUSS, p0:100, p1:1, Name:gName4, a:1, b:120, Sigma1:10.0, Sigma2:10.0}

START 2000

;*****************************************************
GENERATE 2,0,0,0 {NAME:GEN1,X:55,Y:41}

ADVANCE 30,10 {TO:POS1}

queue TRAMO1
; Distance: 60km, Weather: 0.5 (Mixed)
ADVANCE BF$(tramo2D, 60, 0.5) {TO:POS2}
depart TRAMO1

queue TRAMO2
; Distance: 55km, Weather: 0.5
ADVANCE BF$(tramo2D, 55, 0.5) {TO:POS3}
depart TRAMO2

queue TRAMO3
; Distance: 90km, Weather: 0.5
ADVANCE BF$(tramo2D, 90, 0.5) {TO:POS4}
depart TRAMO3

TERMINATE 1