ControlForge Simple Universal Gateway Guide
James M. Belcher October 2026 | ControlForge v1.0.1869
1. What it is
The gateway moves values between devices with no ST. It has two parts:
- Driver points (southbound). Each client driver declares the values it reads and writes, by name, in the protocol config. A read point is a tag with a type and a quality that follows its link; a write point sends its tag's value to the device when the value changes. The Modbus server declares points too, to publish tags to its clients at chosen registers, and the BACnet server, to publish them to a building management system as named objects.
- Routes. Each route moves one source tag to one destination tag through a transform. The route table lives in the project and moves with a Download.
Tags from driver points are ordinary variables, so what serves variables
serves them too: the OPC UA server (when protocols.opcua.enabled), the
MQTT publisher (filtered by its publish_prefixes), the NATS publisher,
the historian, HMI pages. NATS streams a tag only when the historian would
keep it: a driver tag has no task or pragma behind it, so it needs
historian.log_all or a historian.tags pattern that matches it.
Over OPC UA, a driver's read point is read-only (its driver overwrites it
every sync, so a client write would only fight the device); a write point
is writable, and a client's write reaches the device. MQTT subscribers log
in to the node's broker as ControlForge users when REST authentication is
on; point the runtime's publisher at it with mqtt.broker: embedded.
2. Driver points
Each driver has a list, one entry per device, each with points:. An entry
with a bad point is not started (the log says why); the others run. A point
name is used once across all drivers. A device is polled by one entry.
Access is read (default) or write. There is no both: the input sync
republishes the device's value every cycle, so a value written to the same
tag could be overwritten before it was sent. Declare a read point and a
write point at the same address instead.
Modbus TCP — modbus_clients
modbus_clients:
- name: meter1
host: 10.0.0.50
port: 502
unit_id: 3
points:
- {name: MTR1_KW, area: holding, address: 100, type: REAL, byte_order: CDAB}
- {name: MTR1_RUN, area: discrete, address: 7}
- {name: MTR1_SP, area: holding, address: 200, type: DINT, access: write}
Areas holding, input, coil, discrete. Types BOOL (coils and
discrete inputs), INT, UINT, WORD, DINT, UDINT, DWORD, REAL, LINT, ULINT,
LWORD, LREAL. byte_order in ABCD notation: ABCD (default), CDAB (words
swapped), BADC (bytes swapped), DCBA.
Modbus RTU — modbus_rtu_clients
One entry per slave; entries naming the same device share the serial port.
modbus_rtu_clients:
- name: meter3
device: /dev/ttyUSB0
baud: 19200
parity: E
unit_id: 3
points:
- {name: M3_KW, area: holding, address: 100, type: REAL}
Siemens S7 — s7_clients
s7_clients:
- name: line1
host: 10.0.0.60
rack: 0
slot: 1
points:
- {name: L1_SPEED, address: DB10.DBW2, type: INT}
- {name: L1_RUNNING, address: DB10.DBX0.3}
- {name: L1_SP, address: DB10.DBD20, type: REAL, access: write}
Siemens addresses: DB<n>.DBX<byte>.<bit>, DB<n>.DBB/DBW/DBD<byte>, and
I, Q, M with X (or none) and .bit, B, W, D. The type must fit
the width and is required for W and D. A bit write changes that bit only.
EtherNet/IP — enip_scanners
enip_scanners:
- name: press4
host: 10.0.0.70
slot: 0
points:
- {name: P4_SPEED, tag: Motor.Speed, type: REAL}
- {name: P4_COUNT, tag: Program:Main.Count, type: DINT}
- {name: P4_SP, tag: SpeedSetpoint, type: REAL, access: write}
The type is required and is checked against the tag's own type in the controller; a mismatch is refused, not decoded as something else.
Omron FINS — fins_clients
fins_clients:
- name: cj2m
host: 10.0.0.80
points:
- {name: OV_TEMP, address: D100, type: INT}
- {name: OV_RUN, address: 0.05}
- {name: OV_SP, address: D200, type: REAL, access: write}
- {name: OV_LAMP, address: H3.07, access: write}
Addresses as CX-Programmer writes them: D100, D100.05, 0.05 (CIO),
W10, H5, A448, E0_100. Multi-word values are low word first, as an
Omron CPU keeps them; word_order: high_first for a device that does not.
Modbus TCP server — modbus_servers
The node's own Modbus server can publish tags at registers you choose, and take values its clients write.
modbus_servers:
- name: scada
port: 502
points:
- {name: GW_KW, area: input, address: 100, type: REAL}
- {name: GW_RUN, area: coil, address: 5}
- {name: GW_SP, area: holding, address: 200, type: INT, access: write}
On a server, access says what a client on the wire may do. read (the
default) publishes the tag: a route or ST writes it, clients read it, and a
client's write to any address it covers gets exception 02, so a published
value has one writer (a malformed multiple write gets exception 03).
write takes a client's value into the tag (holding
or coil only). The tag is a route source, and it is BAD until a client has
written it, so a route never sends its zero downstream. Areas, types and
byte orders are the client's. Two points may not share an address in one
area. An entry with points has no fixed %QW0..99 block, and an entry
with count above 1 cannot declare points. Servers start before the
client drivers, so a name a server and a client both declare is refused
for the client.
BACnet server — bacnet
The node's BACnet/IP device can publish tags as named objects to a building management system, and take the setpoints it commands.
bacnet:
enabled: true
port: 47808
device_id: 4100
device_name: DC1-GW
points:
- {name: BMS_CRAC01_SUPPLY_T, object: "ai:1", units: degC, description: CRAC01 supply air, cov_increment: 0.2}
- {name: BMS_CRAC01_RUN, object: "bi:1"}
- {name: BMS_CRAC01_SP, object: "av:1", access: write, units: degC}
Each point is one object, ai, ao, av, bi, bo or bv with an
instance 0..4194302; its Object_Name is the tag name. An analog object
is a REAL tag, a binary one a BOOL. read (the default) publishes the
tag: a route or ST writes it, the BMS reads it, and a BMS write of its
Present_Value is refused (write-access-denied), so it has one writer. It
must be an input or a value (ai, av, bi, bv). write makes the
object commandable (av, ao, bv, bo): the BMS writes it at a
priority 1–16 (6 is refused, as BACnet reserves it), the highest
priority wins, and a NULL write relinquishes. The tag is a route source,
BAD until the BMS has commanded the point once (a relinquish is not a
command, so an "auto" on a point never commanded sends nothing); after
that it is the object's Present_Value: the highest command, or, when all
are relinquished, the point's relinquish_default (0, or inactive, when
it is not given). Set relinquish_default to the value the device should
get when the BMS lets go.
units is the point's engineering units text, given to the BMS as the
BACnet units code: degC, degF, K, %, %RH, kW, W, MW,
kWh, Wh, MWh, V, kV, mV, A, mA, VA, kVA, var,
kvar, PF, Hz, Pa, kPa, bar, psi, inWC, cfm, l/s,
l/min, gpm, m3/h, m/s, rpm, ppm, TR, h, min, s, in
any case except MW, MWh and mV, whose case is their meaning (mW
or MV is not taken for them). A few spellings are also known
(amps, RH, tons, °C, C, °F, F, hr, sec, m³/h, in wc);
no units text is no-units. For a text it does not know, give the code itself as bacnet_units; a
text the server does not know, with no code, stops the server (the log
says which point). cov_increment is how far an analog value moves
before a subscribed BMS is told (omitted: any change). scale,
offset, description and the alarm columns work as on any point.
What the BMS sees: the device answers Who-Is (within its range),
ReadProperty,
ReadPropertyMultiple, WriteProperty and SubscribeCOV. Its Object_List
names every point, so a discovery pass finds them. It does not segment:
a reply longer than the BMS accepts is aborted, and the BMS reads the
list element by element instead. Declared points replace the server's
fixed BACNET_QW0.. analog values. A name a server and a client both
declare is refused for the client. Not yet: alarms over BACnet
(intrinsic reporting) and routed (multi-network) requests.
Tested with YABE, an open-source BACnet explorer, on v1.0.1874 and v1.0.1875 (2026-11-03): discovery, the object list, ReadPropertyMultiple, commands at a priority, refused writes, COV and a lost device. YABE and the server ran on one machine over loopback, through a relay that shared the port. Relinquish was sent by hand, as YABE's property grid cannot send NULL. YABE is an explorer, not a BMS: no Niagara or Metasys front end has been tested.
When a device is lost, a point says so. A published point whose route has
lost its source reads Reliability = communication-failure with the FAULT
status flag set, whatever the route's on_loss, and a COV subscriber is told
at once, so a held or zeroed value cannot pass for a live one. See "When a
device is lost" below.
Engineering units and alarm limits — any point
Any point may also carry:
| Column | Meaning |
|---|---|
scale, offset | the tag holds raw × scale + offset; a write point sends (value − offset) / scale, rounded for an integer raw |
units, description | the tag's metadata, served with the variables' metadata and in the gateway pick list (GET /api/gateway points); not yet on OPC UA nodes |
alarm_lolo, alarm_lo, alarm_hi, alarm_hihi | the tag's alarm limits, armed by the alarm engine as a pragma's would be |
priority | critical, high, medium or low |
A scaled point's tag is a REAL when its raw type is 16 bits or fewer (or
REAL, or left to the driver's default), an LREAL otherwise, so a scaled
32-bit counter keeps its digits. /api/iomemory shows the raw value. A
point declared BOOL with a scale, scale 0, and limits out of order are
refused; a scale on a bit point whose type is left to the driver is ignored
and logged. A limit removed later leaves its alarm in
place until it is deleted, as for a pragma.
Device templates — one file per device model
A template is a vendor map: one CSV file per device model, one row per
point, in a directory project's devices/ folder (devices/<name>.csv).
The first line names the driver; the header names the columns, which are
that driver's point columns plus the engineering ones above:
DEVICE_TEMPLATE modbus
name,area,address,type,access,scale,units,alarm_lo,alarm_hi,priority,description
SUPPLY_T,holding,0,INT,,0.1,degC,15,28,high,Supply air temperature
FAN_PCT,holding,2,UINT,,,%,,,,Fan speed
SP,holding,4,INT,write,0.1,degC,,,,Supply setpoint
Drivers: modbus (columns area, address, type, byte_order),
s7 (address, type), enip (tag, type), fins (address,
type, word_order); name and access for all. Lines starting with
# are comments. A file saved by Excel as "CSV UTF-8" is read as it is.
A template's name is its file name: letters, digits, _ and -.
An entry instantiates a template with template: instead of points:.
The entry's name is the device, and each point is the tag
<name>.<point>:
modbus_clients:
- {name: CRAC01, host: 10.1.0.11, unit_id: 1, template: liebert_crac}
- {name: CRAC02, host: 10.1.0.12, unit_id: 1, template: liebert_crac}
That gives CRAC01.SUPPLY_T, CRAC02.SUPPLY_T and so on: tags like any
other driver tag, for routes, OPC UA, MQTT, the historian and HMI pages.
ST that wants them declares the device as a named GVL
(VAR_GLOBAL (CRAC01) SUPPLY_T : REAL; END_VAR) and is fed the
engineering value. A template works for modbus_clients,
modbus_rtu_clients, s7_clients, enip_scanners and fins_clients.
An entry naming a template that does not exist, a template of another
driver, or both a template and points, is not started (the log says
why); the others run. A templated entry's name must be letters, digits
and _.
In a single-file project the templates are under
protocols.device_templates, by name, each the file's text.
Driver points live in the protocol config. Applying a change restarts the protocol drivers, so it goes through a project Download.
3. Routes
The table is edited in the IDE's Gateway tab (with CSV import and export), through the API, or by the AI assistant's tools, and saved in the project. As the API takes it:
{"routes": [
{"name": "flow_to_sp", "source": "MTR1_KW", "dest": "L1_SP", "scale": 0.1, "on_loss": "hold"},
{"name": "run_lamp", "source": "L1_RUNNING", "dest": "OV_LAMP", "on_loss": "zero"}
]}
| Field | Meaning |
|---|---|
source, dest | Tags. A destination is usually a write point. |
scale, offset | value × scale + offset |
min, max | clamp |
invert | BOOL: write NOT source |
deadband | skip numeric changes within it |
min_period_ms, max_period_ms | never write more often / rewrite at least this often |
on_loss | required: hold, zero or refuse |
enabled | false keeps the route but does not run it |
A source is lost when it is absent or its quality is BAD: its driver's
link is down, or its driver has not delivered a value since its tags were
last declared (at start, after a protocol restart, after a rebind): a
client before its first poll, a server point no client has written. Then the route does what on_loss says: hold keeps writing the
last good value, zero writes the type's zero, refuse stops writing.
When a device is lost
A command to a device that is not connected is refused, not kept: nothing lands late when the link comes back. A client writing a server's write point, or an OPC UA client writing a tag, is refused at once while a route from that point, or the tag itself, reaches a device whose driver is not connected:
| Server | The client gets |
|---|---|
| BACnet | Error class device, code operational-problem. A relinquish is refused too. |
| Modbus TCP | Exception 0B, gateway target device failed to respond |
| OPC UA | BadNoCommunication |
The server's value stays as it was, so it still shows what the device last
took. A route whose destination's device is down writes nothing, counts
dest_down rather than moved, and shows the reason as its error. When the
link returns, the driver sends the last value the device was given, and the
route sends its source's value of that moment. The health is checked every 20
I/O syncs (200 ms at the default 10 ms sync), and a command sent before the
driver has noticed the loss is accepted. If one source feeds routes to several
devices, one of them being down refuses commands to that source for all of
them. Writes from ST and through the REST API are not refused. A server with no
client attached (an IEC 104 server, a DNP3 outstation) is not a lost device:
routes keep writing its points.
Refused when the table is loaded: no on_loss, two routes writing one
destination, a destination that ST assigns, a destination that is a
driver's input (its driver writes it every sync). A refused edit changes
nothing; the routes that were running keep running. On a failover standby
no route writes.
4. From the AI assistant
| Tool | Does |
|---|---|
controlforge_gateway_get | the table, each route's live state, every driver's points |
controlforge_gateway_route_set | add a route or replace one by name (asks first) |
controlforge_gateway_route_delete | remove a route (asks first) |
controlforge_gateway_point_check | judge a drafted point by its driver's own rules |
Read the points before writing a route: a route's source should be a point
with direction in, its destination one with direction out.
5. HTTP API
| Method | Path | Role |
|---|---|---|
| GET | /api/gateway | viewer |
| PUT | /api/gateway (whole table) | engineer |
| PUT | /api/gateway/routes/{name} | engineer |
| DELETE | /api/gateway/routes/{name} | engineer |
| POST | /api/gateway/points/check | engineer |