LamaPLC: S7-1500 and Sicam Q200 Modbus TCP communication

Sicam Q200

S7-1500 and Sicam Q200 Modbus TCP communication The SICAM Q200 device is a multifunctional device with power quality class A and energy class 0.1S certifications.

The device measures voltages up to 480 V in 1-phase systems and in 3-wire and 4-wire systems (with neutral phase). The input circuits for voltage measurement can be used in IT, TT and TN networks. To ensure galvanic separation for current measurements, the lines connected to the current measurement inputs are galvanically separated from the current transformers.

If external voltage and current transformers are not used, the device can process rated input alternating voltages of up to VPh-N = 230 V (110 V for UL condition), VPh-Ph = 400 V (290 V for UL condition) and rated input alternating currents up to 5 A.

TIA Portal / Simatic S7-1500

Wiring schema

TIA Portal / Simatic S7-1500 Modbus communication wiring schema

  • Modbus communication is usually not part of the managed block of the TIA portal, so these modules do not need to be included in the TIA portal (they are not participants in the topology- or network view).
  • The communication to the connected switch can even be Profinet (or IE), the point is that the Switch is “visible” from the PLC (it is not necessary to use a managed switch)
  • It is important that each unit falls into a class 3 IP address range (the first three identifiers must match, e.g. 192.168.178.nn)
  • Both the PLC and the Modbus partner must be accessible with the PING command

Blocks (FBs, DBs)

TIA Portal / Simatic S7-1500 - Sicam Q200 CommunicationcallModbusQ200: main program for communication

ModbusQ200: measurements in real format

callModbusQ200_DB: instant DB from call main prg (automatic generated)

ModbusCommBlockQ200: communication parameters (IP,…)
  • The program should be called from OB1 (it has internal timing)
  • When calling FB, “callModbusQ200_DB” is the instant DB (recommended only)
  • The program does not query all data from Metrawatt (but can be expanded if necessary)
  • The Metrawatt modbus register list can be found here (here)
  • The program calls up the data slowly, the entire update takes 2 seconds (because that's enough for me). If faster data reading is required, the parameter t#1s in line 2 of “callModbusQ200” must be modified.

ModbusQ200 datablock

The figure below shows the values converted to REAL form in the ModbusQ200 datablock. The first two lines:

  • comOk (bool) : Communication with the Q200 unit is fine, it works
  • status (string): Textual status indication to the HMI ('OK', 'Battery error', 'SD error', 'device error', 'communication error')

The other lines contain the measured values in REAL form. Their content is updated every 2 seconds. The program does not read all the values from the Q200, only the marked (more important) measurements.

ModbusQ200 datablock / Simatic S7-1500 - Sicam Q200 Communication

callModbusQ200 functionsblock

callModbusQ200 functionsblock / Simatic S7-1500 - Sicam Q200 Communication

mbCli is a multiinstant (MB_CLIENT) Modbus call. The program calls this twice, with different parameters. If the status stays in the 700x range and changes continuously, then communication is working (You can find more information about status codes here).

ModbusCommBlockQ200

ModbusCommBlockQ200

The communication parameters of the Modbus connection can be set in the ModbusCommBlockQ200 DB:

InterfaceId: HW identifier of the PLC communication unit. If the PLC is communicating, this is typically 64.
ID: Number of the communication connection. In the case of several Modbus connections, it is worth paying attention, in the case of a single connection, 1.
ConnectionType: 11=TCP/IP, 19=UDP (17=TCP/IP), in this case 11 (B).
ActiveEstablished: The communication “active” party, i.e. TRUE.
ADDR: IP address of the partner (the Q200 unit). This must be set on the Q200, in this case: 192.168.178.64
RemotePort: 502, default.
LocalPort: 503, default.

Download

The SLC code contains all FBs, FCs and DBs required for the operation. The code was developed with TIA version 16. I cannot take responsibility for its use.

This code ensures communication for this equipment only. Good luck with your application! The code contains no restrictions, restrictions, 100% free!

If you need a modified or different code, find me here!

If you just want to throw me a coffee tip, you can do it here:

Donate

If you are a manufacturer and would like an example program similar to your product, you can find me here!

Download code here

This page has been accessed for: Today: 1, Until now: 41