Forum Replies Created
-
AuthorPosts
-
Simon
ParticipantHello,
I’m using Rapid SCADA 6.4 with DrvModbus (Master TCP), and I would like to use the ImportDB module to read commands from a SQL Server table and send them to the PLC (via Modbus TCP holding registers).Unfortunately, no commands are executed, and it’s not clear how ImportDB interacts with Devices, Channels, and Commands.
Could you please provide a complete working example showing how to configure ImportDB to read a table (e.g. rs_cmd) and send a command to a Modbus device?1️⃣ SQL Server table example
CREATE TABLE dbo.rs_cmd (
Id BIGINT IDENTITY(1,1) PRIMARY KEY,
CnlNum INT NOT NULL, — Rapid SCADA channel number
CmdVal FLOAT NULL, — numeric value to write (standard command)
CmdData VARBINARY(MAX) NULL, — optional binary data (binary command)
CmdType INT NOT NULL DEFAULT 1, — 1 = Standard, 2 = Binary
CreateDT DATETIME2 NOT NULL DEFAULT SYSUTCDATETIME(),
Sent BIT NOT NULL DEFAULT 0, — 0 = pending, 1 = sent
SentDT DATETIME2 NULL,
Note NVARCHAR(200) NULL
);Example of inserting a new command:
INSERT INTO dbo.rs_cmd (CnlNum, CmdVal, CmdType, Note)
VALUES (582, 100, 1, N’Setpoint command to holding register linked to channel 582′);2️⃣ Expected ImportDB behavior
ImportDB periodically executes a query such as
SELECT * FROM dbo.rs_cmd WHERE Sent = 0 ORDER BY IdIt reads CnlNum, CmdVal, CmdData, CmdType, and creates a command for the SCADA Server.
Rapid SCADA then routes the command to Communicator → Modbus device, performing the write operation (function code 06 or 16).
After successful execution, ImportDB (or its update query) should set
Sent = 1, SentDT = GETUTCDATE()
to avoid re-sending the same command.3️⃣ What I would like to clarify
Table schema expected by ImportDB:
Are the field names above (CnlNum, CmdVal, CmdData, CmdType) correct for Rapid SCADA 6.4?
If not, what are the exact column names ImportDB expects (e.g. KPNum, ObjNum, CmdNum, Val, Data, etc.)?
What are the valid values for CmdType (standard vs binary)?ImportDB configuration example:
Connection string or ODBC setup for MSSQL.
Example of the SQL select query.
Field mapping (columns → command properties).
Update query after successful sending.
Relation with Modbus device/template:
How should the Commands section in the Modbus device template be configured so that a Standard Command on CnlNum = 582 actually writes to the corresponding holding register (with proper Modbus address, function code, and byte order)?
Is the channel number (CnlNum) the correct key that links the DB record to the command in the Modbus device?
Flow confirmation:
ImportDB → SCADA Server → Communicator → Modbus TCP device
Is it correct that no “special” device for ImportDB is required — ImportDB just sends a command to SCADA Server, and the Server forwards it to the existing Modbus device?
Diagnostics and logging:
Where can we find detailed ImportDB logs (read row, build command, send result)?
Is it possible to log the SQL record Id along with the SCADA Command ID for traceability?
4️⃣ Environment
Rapid SCADA / Server / Communicator: 6.4.x
Module: ImportDB
Driver: DrvModbus TCP (Master)
Database: Microsoft SQL Server Express 2022
Goal: write a holding register (e.g., setpoint) for channel 582
A practical example (SQL + ImportDB config + Device Template Commands) would be extremely helpful to understand the correct workflow for sending commands from a SQL table to a Modbus PLC.
Thank you in advance for your help and for clarifying the intended usage of ImportDB in this scenario.
Best regards,
Simone -
AuthorPosts