Appearance
Integration in Coldwave
Coldwave Script does not operate in isolation—it is tightly integrated with the hardware and cloud services of the Coldwave platform. Integration is achieved through specialized function blocks that encapsulate the respective interfaces:
- Bus blocks (e.g., CANopen, Modbus, digital I/O) connect field devices and signals.
- The Coldwave Block provides a unified interface for telemetry and service-based communication (sending/reading values over the platform).
This chapter explains the core principles and the role of the Coldwave Block. Details of bus‑specific blocks are covered in their respective hardware manuals.
Integration Layers
Between scripts and physical signals, there are three layers:
Hardware and Field Buses
Devices on CANopen, Modbus, digital inputs/outputs, analog inputs, etc.Coldwave Abstraction (Services, Telemetry, Mapping)
- Fieldbus signals are aggregated into logical properties/services.
- Each service is uniquely identified (e.g., via UUID).
- The platform handles transport, retries, persistence, and historical storage.
Script Layer (Blocks and Variables)
- Bus‑specific blocks represent devices or registers (CANopen PDOs, Modbus registers, digital I/O).
- The Coldwave Block enables asynchronous SET/GET operations on telemetry and services.
Scripts operate exclusively on layer 3; layers 1 and 2 are handled by Coldwave modules and the backend.
The Coldwave Block (Telemetry, SET/GET)
The Coldwave Block is implemented in the VM as an asynchronous function block. It performs SET/GET operations on a service identified by a UUID.
Purpose
- SET mode: explicitly send a value to a service (setpoint, actuator command).
- GET mode: retrieve the current value from the platform.
The implementation ensures:
- clean asynchronous execution (BUSY/ACK),
- filtering/deduplication (repeated identical SET values are not re‑sent),
- clear error reporting (invalid UUID, missing service, busy, etc.).
Inputs and Outputs (Conceptual Signature)
| Name | Type | Meaning |
|---|---|---|
| ID | UINT | Identifier of the datapoint within the service |
| MOD | UINT | Sub‑address / modifier (channel, index, etc.) |
| IN | DWORD | Value to send in SET mode |
| SRV_UUID | STRING | UUID of the service ("550e8400-e29b-41d4-a716-446655440000") |
| EN | BOOL | Block active only when TRUE |
| TRIG | BOOL | Rising edge triggers request |
| MODE | DINT | 0 = SET, 1 = GET |
Outputs:
| Name | Type | Meaning |
|---|---|---|
| OUT | ANY | Returned value in GET mode |
| BUSY | BOOL | TRUE while request is in progress |
| ACK | BOOL | TRUE for one cycle when request completes successfully |
| ERR | INT | Error code (0 = OK; otherwise errno/platform code) |
Internally, state is stored in CW_State, tracking last value, latch state, errors, async requests, etc.
SET Mode (MODE = 0)
- Rising edge on
TRIGlatches theINvalue. - If no request is active, an async SET request is started.
- On success,
ACK = TRUE, and the last value is stored. Identical future values are suppressed. - On error,
ERRis set, value remains latched, retry on next cycle.
GET Mode (MODE = 1)
- Rising edge triggers async GET request.
- On success:
OUTupdated,ACK = TRUE,ERR = 0. - On error:
ERR != 0,ACK = FALSE.
Example: SET to Platform
vb
DIM CW AS COLDWAVE_BLOCK
CONST TargetId AS UINT = 10
CONST TargetMod AS UINT = 0
CONST SrvUuid AS STRING = "550e8400-e29b-41d4-a716-446655440000"
CW(ID := TargetId, MOD := TargetMod, SRV_UUID := SrvUuid)
PROGRAM
DIM value AS DINT = 42
DIM doWrite AS BOOL
IF SomeCondition THEN
doWrite = TRUE
ELSE
doWrite = FALSE
END IF
CW(IN := value, EN := TRUE, TRIG := doWrite, MODE := 0)
IF CW.ACK THEN
PRINT "Value sent successfully."
END IF
IF CW.ERR <> 0 THEN
PRINT "Error sending value, code=", CW.ERR
END IF
END PROGRAMExample: GET from Platform
vb
DIM CW AS COLDWAVE_BLOCK
CONST TargetId AS UINT = 20
CONST TargetMod AS UINT = 0
CONST SrvUuid AS STRING = "550e8400-e29b-41d4-a716-446655440000"
CW(ID := TargetId, MOD := TargetMod, SRV_UUID := SrvUuid)
PROGRAM
DIM doRead AS BOOL
doRead = TRUE
CW(EN := TRUE, TRIG := doRead, MODE := 1)
IF CW.ACK THEN
PRINT "Current value:", CW.OUT
END IF
IF CW.ERR <> 0 THEN
PRINT "Error reading value, code=", CW.ERR
END IF
END PROGRAMInteraction with Bus Blocks
Bus blocks expose signals both:
- locally to scripts (
IN/OUT, block fields), - and as Coldwave services available via the platform.
Two common patterns:
Local logic, cloud only receives data
Script logic runs on local I/O; Coldwave Block only mirrors data.Cloud‑configured parameters
Values from the cloud adjust behavior of local logic (thresholds, modes, timers).
Service mapping is configured remotely in the Coldwave backend and depends on device definitions.