====== LamaPLC: S7-1500 and Metrawatt EM2389 Modbus TCP communication ====== ===== Metrawatt EM2389 ===== {{ :com:metrawatt2.png?150|Metrawatt EM2389}} The MID approved meters can be used to acquire and bill active energy in industrial, household, commercial and building management applications.\\ \\ The new generation of ENERGYMID energy meters opens up entirely new levels of transparency within your electrical system. In addition to energy, up to 33 other mains parameters are acquired by the multifunctional variant.\\ \\ Communication via M-Bus, LON, [[com:basic_modbus#modbus_tcp|Modbus TCP]] / BACnet, [[com:basic_modbus#modbus_rtu|Modbus RTU]], pulse output possible. \\ \\ [[https://www.gmc-instruments.de/en/products/industrial-measuring-technology/energy-management/energy-meters/mid-certified-energy-meters/em2281-em2389/energymid-em2389/|>> More information]] ===== TIA Portal / Simatic S7-1500 ===== ==== Wiring schema === {{ :com:modbus:modbus_s7_1.png |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) === |{{:com:modbus:plc_metrawatt_1.jpg|TIA Portal / Simatic S7-1500 - Metrawatt EM2389 Communication}}|**metraWattFB**: main program for communication \\ \\ **metraWattDB**: measurements in real format\\ \\ **metraWattFB_DB**: instant DB from call main prg (automatic generated) \\ \\ **metraWDBModbus**: row readed data in word format \\ \\ **ModbusCommBlockMWatt**: communication parameters (IP,...)| * The program should be called from OB1 (it has internal timing) * When calling FB, //"metraWattFB_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 ({{ :com:modbus:em2281-em2389-tcp-sb_d.pdf |here}}) * The program calls up the data slowly, the entire update takes 4 seconds (because that's enough for me). If faster data reading is required, the parameter //t#1s// in line 2 of //"metraWattFB"// must be modified. {{tag>simatic s7 modbus communication metrawatt EM2389 source_code scl MID}} This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}