Coupling with the Real World

Updated: 2026-04-30

Until now, we have worked by building models that operated within a closed and controlled universe inside the GPSS-Plus engine. The simulation engine decided when time advanced, what happened at each moment, and how the system elements behaved. It was a logical, deterministic, and autonomous environment.

We are going to break away from all that with the introduction of the real world. Nothing will be the same: the engine's focus changes, entities will live according to other patterns, and flows will no longer be solely under our control.

Entities should not advance because a random number decides so, but because a physical sensor has detected their presence.

Time

One of the first consequences of this opening to the outside is that time no longer belongs to us.

We can no longer arbitrarily accelerate or pause it. If the engine wants to read from a sensor, it must wait as long as that sensor takes to respond. If reading a file is delayed, the simulation will be as well. Therefore, when working with the real world, execution must be in real-time.

What was previously just a "moment" is now strictly one second on the system clock. It is declared as follows:

SYSTEM {TYPE:OPTIONS, REAL_TIME:1}

An ADVANCE 10 means exactly a wait of 10 real seconds.

From there, there is no turning back: everything happens at the rhythm of the physical world, and the simulation becomes a subordinate part of reality.
The engine ceases to be a pure simulator and starts behaving as an orchestrator of real processes.

The New System Architecture

We can now identify three major components of the system:

  • GPSS-Plus and the BRIDGER resource, which entities will use to issue and receive commands.
  • The Outside World, which can include sensors, databases, file systems, or physical/virtual devices. Even other simulation engines.
  • The middleware.js, which is a new bidirectional software that knows how to communicate with the BRIDGER and any element of the outside world.

THE BRIDGER:

From an entity's point of view, in addition to the BRIDGER COMMAND, it only has 5 BLOCKS:

  • BRIDGE_READ
  • BRIDGE_WRITE
  • BRIDGE_SUBSCRIBE
  • BRIDGE_BROWSE
  • BRIDGE_CALL

These BLOCKS are the ones that communicate with middleware.js.

 

THE MIDDLEWARE.js

Available in the downloads chapter.

It is a set of JavaScript files to run in a node.js environment that receives instructions from the BRIDGER and retransmits them to the external device and vice versa.

In summary, middleware.js functions as an exchange layer between protocols, transforming the five blocks defined in GPSS-Plus into messages compatible with MQTT (the most widely used, based on topics) and OPC-UA (the most complete, with hierarchical structures and defined data types).

For initial testing, there is an operational public service at:

wss://bridger.gpss-plus.com:3000

 

The Outside World

These are all the sensors, actuators, devices, and external resources.

For testing, you have a virtual OPC-UA client that represents a set of simulated sensors and services.

Its address is: opc.tcp://opcua.gpss-plus.com:4840

It contains a scale, a door sensor, distance sensors, PID control, file reading and writing, and even background program execution.

Naturally, you can modify and expand the code to add your own services.

The Topology:

These three elements are distributed as follows:

gpss-plus           192.168.x.x           192.168.n.m
BRIDGER       <->  middleware.js    <->  Temperature Sensor 
192.168.a.b    |                         File System
(The browser)  |                         MySQL Database
               |
               |                         192.168.n.m
               |   192.168.y.y           Random number generator
              <->  middleware.js    <->  Neural network
               |                         OPC-UA Motion detector
               |
               |
               |   192.168.z.z           192.168.n.m
              <->  middleware.js    <->  Inter-system semaphore
                                     

In summary, the browser running GPSS-Plus must be able to access the IP where middleware.js is installed, and this, in turn, must access the external device or service.
The most stable configuration is to have middleware.js on the same network as the sensors.

In the following chapters, we will see how to handle the BRIDGER step by step and we will build our own physical devices.