Notes on the documentation

This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the following notes and explanations are followed when installing and commissioning these components.

The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.

Disclaimer

The documentation has been prepared with care. The products described are, however, constantly under development.
For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics.
In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning.
No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation.

Trademarks

Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE® and XFC® are registered trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.

Patent Pending

The TwinCAT Technology is covered, including but not limited to the following patent applications and patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.

Copyright

© Beckhoff Automation GmbH & Co. KG, Germany.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


Overview

The MBus library is a comprehensive TwinCAT PLC library for reading M-Bus devices.

The application of this PLC library significantly simplifies the engineering in these areas of building technical equipment.

The function blocks are object-oriented and characterised by a self-contained, more or less complex function.

The input parameters form the interface to the user. The parameters can be used to adapt the function block to its specific task within the associated system.

Thanks to strongly object-oriented encapsulation of complex system functions within the function blocks, comprehensive system programs can be set up with a few function blocks. The blocks are linked to each other via a small number of PLC variables.

The status of all objects is indicated through a large number of different output variables at the function blocks. The simplifies the connection of HMI and visualisation systems.

These features offer the following benefits for system programmers during system setup and for system operators during operation:

  • Faster creation of system programs.
  • Faster system parameterisation and commissioning.
  • Guarantee of a very large range of system functions at all times.
  • Improved readability of programs (prerequisite for long-term maintainability and expandability of the systems)
  • Improved reusability of templates for systems or system components
  • Easier familiarisation of personnel.
  • Easier extension of existing systems.
  • Programs are easier to document.


Target groups

This software library is intended for building automation system partners of Beckhoff Automation GmbH. The system partners operate in the field of building automation and are concerned with the installation, commissioning, expansion, maintenance and service of measurement, control and regulating systems for the technical equipment of buildings.


User requirement profile

The user of this library requires basic knowledge of the following.

  • TwinCAT PLC-Control
  • TwinCAT System Manager
  • PCs and networks
  • Structure and properties of the Beckhoff Embedded PC and its Bus Terminal system
  • Technology of M-Bus devices
  • Relevant safety regulations for building technical equipment


Introduction

M-Bus = Meter-Bus

The M-Bus is a fieldbus for the recording consumption data (e.g. energy meters). Further details about M-Bus can be found under www.m-bus.com. The M-Bus is European standard and is described in the EN1434 standard. The data are sent serially from a slave (measuring device) to a master (M-Bus master terminal KL6781). Master and slave are connected via a two-wire cable that is protected against polarity reversal. Up to 40 slaves can be connected to a KL6781 with any topology (star or line). Devices from different manufacturers can be operated on the same bus.

The M-Bus master (KL6781) controls the communication on the bus by requesting data from the slaves. The slaves can respond with a fixed or variable data structure. The M-Bus library only evaluates data with variable data structure (low byte first). The slaves do not communicate with each other. The data have to be requested sequentially from the slaves.

Overview


TwinCAT PLC Lib: M-Bus

Overview


Topology

Star, line and tree topology

Ring topology

Note 		Ring topology not supported
Ring topology is possible for M-Bus, but not recommended and therefore also not supported by Beckhoff.


Functionality of the function block

Three ways to read out M-Bus counters are offered:

  1. Via the variable tMinSendTime > t#0s the counter block is read out automatically after the time has elapsed. Internally this variable is set to t#2s.
  2. At rising edge of the counter block's variable bStart, the counter is read out once.
  3. At rising edge of the block FB_MBUS_KL6781()'s variable bStart, all counters are read out once.

If several counter blocks get a start command simultaneously, they are started in order of their calling within the PLC.

The bReady variable will be True for one cycle, if the block has received data.

If an error has occurred, bError will be True. This Error is described with eError.

If the counter should be read out after a start/restart of the PLC, the variable bReadInit is set to True; otherwise to False. This variable is internally set to True per default.

eBaudrate: This variable is internally set to 2400 per default. If the counter should be read out with this baud rate (2400 baud), the variable has not to be set explicitly. At baud rate change the KL6781 is reparameterized automatically. This allows to read out counter with different baud rate in one M-Bus network. The baud rate of the counters are not changed. They have to be able to operate with the given baud rate. Some counters operate with automatic baud rate detection. Please take information about this from the manual of the counter

bSND_NKE: This variable is internally set to True per default. SND_NKE is a special telegram to the slave. This telegram causes an initializing of the receiver. This telegram is important for counters sending several telegrams. After a SND_NKE these counters respond with the first telegram. If True the telegram is sent before the real request, if False the SND_NKE telegram is not sent.

With bDisabled = True the execution of the block can be interrupted. A started query of the counter will be finished.


Long set

Data is sent to the M-bus device with a long set. The long set is composed of a maximum of 255 bytes and is transferred to the counter with the FB_MBUS_General_Send block.

Structure of the protocol:

Byte | Long set | Description | Assignment in the ‘FB_MBUS_General_Send’ block
1 | Start character | 68hex | Is added in the block
2 | L field | Length of user data plus 3 | Is added in the block
3 | L field | Length of user data plus 3 | Is added in the block
4 | Start character | 68hex | Is added in the block
5 | C field | Function field | Is transferred to the ‘byC_Field’ input variable
6 | A field | Primary address of the M-Bus device | Is transferred to the ‘usiAddress’ input variable
7 | CI Field | Identifier field | Is transferred to the ‘byCI_Field’ input variable
8..x | User data (0 – 240) | User data | Are transferred to the ‘arrData’ input variable
x+1 | Checksum | Checksum | Is added in the block
x+2 | Stop character | 16hex | Is added in the block

Only the bytes marked in bold letters need to be transferred to the block.

The user data in the arrData array must contain ‘16hex’ as the last character. It is important to ensure that the subsequent bytes are empty.

Example: Changing the primary address at address 14, old address is 0.

(*Transfer of user data*)
fbSend.arrData[0] := 16#01;     (*DIF / Data format 8 -bit integer*)
fbSend.arrData[1] := 16#7A;     (*VIF / Change address*)
fbSend.arrData[2] := 14;        (*New address = 14*)
fbSend.arrData[3] := 16#16;     (*Do not transfer stop character/checksum; they will be calculated in the block*)

fbSend.byC_Field  := 16#53;     (*C field*)
fbSend.byCI_Field := 16#51;     (*CI field*)
fbSend.usiAddress := 0;         (*Old address*)

fbSend(iComId := 1,             (*Block call*)
       bStart := bStart,
       bInit  := TRUE);

Sending is started with the bStart variable. The bStart variable is reset in the block after sending is complete.

Download sample program for PC/CX systems:

Download sample program for BC systems:

Download sample program for BX systems:


Primary address

The counters are addressed via the primary address. This can be set on the device, via the manufacturer’s software or with the FB_MBUS_ChangeAdr or FB_MBUS_General_Send block.

All M-Bus devices must have a unique address (0-255).

Address 0 - 250 Addresses of the devices

Address 251 Not used at present

Address 252 Not used at present

Address 253 Use of secondary addressing

Address 254 Send to all M-Bus devices with response (E5 hexadecimal). If several devices are connected, all of them will respond, leading to data collision. Therefore, this address should only be used if only one device is connected.

Address 255 Send to all M-Bus devices without response.


Secondary address

The secondary address like also the primary address is used to identify the device. The advantage of the secondary addressing is among other things a bigger number of addresses (slaves). Only by the identification number 100 million different values can be build. Furthermore the assignment of primary addresses is not applicable.

According to M-Bus standard a secondary address has the following structure:
Ident-No.: 4 Byte / 8-digit BCD device identification number
Herstellerkürzel : 2 Byte / vendor short symbol
Version: 1 Byte / Generation number of the vendor
Medium: 1 Byte / Medium

If the secondary address should be used, the primary address is set to 253.

The secondary address is given to the function block via the structure "stSecAdr" (ST_MBUS_SecAdr).

Vendor short symbol, version and Medium are each internally set to 16#FF by default. So these values have not to be set explicitly.

Request example:

stSecAdr1.udiIdNumbe     := 16#12345678;
stSecAdr1.uiManufacturer := 16#FFFF;
stSecAdr1.usiMedium      := 16#FF;
stSecAdr1.usiVersion     := 16#FF;

fbmeter(usiAddress := 253,
        stSecAdr.udiIdNumber := stSecAdr1,
        stCom := stComKL6781_1);

or also

fbmeter.stSecAdr.udiIdNumber := 16#12345678;
fbmeter(usiAddress := 253,
        stCom := stComKL6781_1);

Download example program:


Overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT". If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
General | Communication with KL6781 |  | FB_MBUSKL6781
General | Electricity meter | all electricity meter | FB_MBUS_General_Electricity
 | Heat meter | all heat meter | FB_MBUS_General_Heat
 | Water meter | all water meter | FB_MBUS_General_Water
 | Raw data | all | FB_MBUS_RawData
 | max. 40 values from the first telegram | all | FB_MBUS_General
 | all telegrams, all values | all | FB_MBUS_General_Ext
 | parameterized values | all | FB_MBUS_General_Param
 | universal send | all | FB_MBUS_General_Send
 | Scan M-Bus | all | FB_MBUS_Scan
 | Change address | all | FB_MBUS_ChangeAdr
ABB | Electricity meter | DELTAplus DZ+ | FB_MBUS_ABB_DZ
Actaris | Heat meter | CF-Echo II | FB_MBUS_ACW_CF
 | Heat calculator | CF-51 | FB_MBUS_ACW_CF
 | Heat calculator | CF-55 | FB_MBUS_ACW_CF
 | Water meter | MB +M | FB_MBUS_ACW_PlusM
Aquametro | Water meter | SAPHIR | FB_MBUS_AMT_SAPHIR
 | Heat meter | CALEC | FB_MBUS_AMT_CALEC
 | Heat meter | CALEC ST, version C4 | FB_MBUS_AMT_CALEC_STC4
 | Heat meter | AMTRON | FB_MBUS_AMT_AMTRON
 | Pulse collector | AMBUS | FB_MBUS_AMT_AMBUS
 | Heat meter | AMTRON SONIC D | FB_MBUS_HYD_Sharky, FB_MBUS_HYD_Sharky_00
Berg | Electricity meter | DZ+ | FB_MBUS_BEC_DZ
 | Electricity meter | DCMi | FB_MBUS_BEC_DCMi
Brunata | Heat meter | HGQ / HGS | FB_MBUS_BHG_HGx
 | Heat meter | Optuna H (775) | FB_MBUS_HYD_Sharky, FB_MBUS_HYD_Sharky_00
Carlo Gavazzi | Energy calculator | EM24 | FB_MBUS_GAV_EM24
Cynox | Pulse counter | MCount2C | FB_MBUS_CYN_MCount2C
Elster | Gas meter | Encoder Z6 | FB_MBUS_ELS_EncoderZ6
elvaco | Temperature and humidity sensor | CMa10 & CMa20 | FB_MBUS_ELV_CMa10_20
EMH | Electricity meter | DIZ | FB_MBUS_EMH_DIZ
 | Electricity meter | EIZ-E | FB_MBUS_EMH_EIZE
 | Electricity meter | EIZ-G | FB_MBUS_EMH_EIZG
 | Electricity meter | MIZ | FB_MBUS_EMH_MIZ
EMU | Electricity meter | EMU32x7 | FB_MBUS_EMU_32x7
 | Electricity meter | EMU32x7 | FB_MBUS_EMU_32x7_Option8
 | Electricity meter | Allrounder 3/5 | FB_MBUS_EMU_3_5_Allrounder
 | Electricity meter | DHZ 5/63 | FB_MBUS_EMU_DHZ_5_63
Engelmann | Heat meter | SENSOSTAR 2C | FB_MBUS_EFE_SensoStar2C
Gossen Metrawatt | Electricity meter | U128x | FB_MBUS_GMC_Electricity
 | Electricity meter | U138x | FB_MBUS_GMC_Electricity
GWF | Water meter |  | FB_MBUS_GWF_Coder
 | Gas meter | S1 | FB_MBUS_GWF_Coder
 | Gas meter | Z1 | FB_MBUS_GWF_Coder
Hydrometer | 2 pulse inputs | HYDRO-PORT Pulse | FB_MBUS_HYD_PortPulse
 | 2 analog inputs 1 temperature sensor | HYDRO-PORT Analog | FB_MBUS_HYD_PortAnalog
 | Water meter | Flypper | FB_MBUS_HYD_Flypper
 | Heat meter | Sharky 773 | FB_MBUS_HYD_Sharky, FB_MBUS_HYD_Sharky_00
 | Heat meter | Sharky 775 | FB_MBUS_HYD_Sharky, FB_MBUS_HYD_Sharky_00
ista | Water meter | domaqua® m | FB_MBUS_IST_Istameter
 | Water meter | istameter® m | FB_MBUS_IST_Istameter
 | Water meter | istameter III | FB_MBUS_IST_IstameterIII
 | Pulse input | pulsonic II | FB_MBUS_IST_PulsonicII
 | Heat meter | sensonic II | FB_MBUS_IST_SensonicII
Janitza | Electricity meter | UMG96S | FB_MBUS_JAN_UMG96S
Kamstrup | Electricity meter | Kamstrup 162 | FB_MBUS_KAM_KamstrupE
 | Electricity meter | Kamstrup 351 | FB_MBUS_KAM_KamstrupE
 | Electricity meter | Kamstrup 382 | FB_MBUS_KAM_KamstrupE
 | Heat/cold meter | Maxical III | FB_MBUS_KAM_Maxical_III
 | Heat/cold meter | Multical 401 | FB_MBUS_KAM_Multical
 | Heat/cold meter | Multical 402 | FB_MBUS_KAM_Multical402
 | Water meter | Multical 41 | FB_MBUS_KAM_Multical41
 | Heat/cold meter | Multical 601 | FB_MBUS_KAM_Multical601
KUNDO | Heat/cold meter | Compact WMZ G20 | FB_MBUS_KST_G20
 | Heat/cold meter | Compact WMZ G21 | FB_MBUS_KST_G20
 | External M-Bus module | him1s | FB_MBUS_KST_him1
 | External M-Bus module | him1plus | FB_MBUS_KST_him1
 | Pulse input | him1plus | FB_MBUS_KST_him1Puls
Landis & Gyr | Heat/cold meter | ULTRAHEAT 2WR5 | FB_MBUS_LUG_Heat
 | Heat/cold meter | ULTRAHEAT 2WR6 | FB_MBUS_LUG_Heat
 | Heat/cold meter | ULTRAHEAT UH50 | FB_MBUS_LUG_Heat
Metrima | Heat meter | F22 (standard values) | FB_MBUS_SVM_F22
 | Heat meter | F22 (with additional output values) | FB_MBUS_SVM_F22_Ext
NZR | Electricity meter | EcoCount „S“ | FB_MBUS_TIP_SINUS85M
 | Pulse memory module | IC-M2 | FB_MBUS_NZR_ICM2
 | Pulse memory module | IC-M2C | FB_MBUS_NZR_ICM2
 | Water meter | Modularis 2 | FB_MBUS_NZR_Modularis2
OPTEC | Electricity meter | ECS Typ 2 | FB_MBUS_OPT_ECSType2
Relay | 1-4 analog inputs | AnDi 1-4 | FB_MBUS_REL_AnDi
 | 4 digital inputs | PadIn 4 | FB_MBUS_REL_PadIn4
 | 1-way pulse adapter | PadPuls M1 | FB_MBUS_REL_PadPulsM1
 | 1-way pulse adapter | PadPuls M1C | FB_MBUS_REL_PadPulsM1
 | 2-way pulse adapter | PadPuls M2 | FB_MBUS_REL_PadPulsM2
 | 2-way pulse adapter | PadPuls M2C | FB_MBUS_REL_PadPulsM2
 | 4-way pulse adapter | PadPuls M4 | FB_MBUS_REL_PadPulsM4
 | 4-way pulse adapter | PadPuls M4L | FB_MBUS_REL_PadPulsM4
Saia-Burgess | Electricity meter | ALD1 | FB_MBUS_SBC_ALD1
 | Electricity meter | ALE3 | FB_MBUS_SBC_ALE3
 | Electricity meter | AWD3 | FB_MBUS_SBC_ALE3
Schlumberger | Heat meter | Integral-Mk MaXX | FB_MBUS_SLB_MK_MaXX
 | Heat meter | CF Echo I | FB_MBUS_SLB_CFEchoI
Sensus | Heat/cold meter | PolluStat E | FB_MBUS_SEN_Pollu
 | Heat/cold meter | PolluTherm | FB_MBUS_SEN_Pollu
 | Heat/cold meter | PolluCom E | FB_MBUS_SEN_Pollu
 | Water meter |  | FB_MBUS_SEN_Water
Sontex | Heat/cold meter | Supercal 531 (standard values) | FB_MBUS_SON_Supercal531
TIP | Electricity meter | SINUS 85 M | FB_MBUS_TIP_SINUS85M
Zenner | Energy calculator | multidataWR3 | FB_MBUS_ZRM_multidataWR3
 | Heat/cold meter | zelsiusZR | FB_MBUS_ZRM_zelsiusZR


TwinCAT library for the M-Bus

TwinCAT PLC Lib: M-Bus

General information

Note 		Installation
Beginning with TwinCAT 2.11 Build 2229 (R3 and x64 Engineering), the libraries "TcMBus.lib/.lb6/.lbx" will be installed automatically.

Note 		Name of the library
This library replaces the "TcKL6781.lib/.lb6./.lbx".

Hardware documentation in Beckhoff Information System: KL6781 - M-Bus master terminal

Note 		Incompatibility
The TcMBus library isn't compatible to the version older as V2.0.0 and also not usable within the same PLC program.
From Version V2.0.0 the level converters (e.g. PW3, PW20 oder PW60) of the Relay Company are no longer suppported.
Further libraries are required

For PC systems (x86) and Embedded-PCs (CXxxxx):

  • Standard.lib

For Bus Terminal Controller of BCxx00 series:

  • Standard.lb6

For Bus Terminal Controller of BCxx50, BCxx20, BC9191 and BXxx00 series:

  • Standard.lbx

Note 		Memory usage
By linking the library PLC program memory is already consumed. Depending on the application program the remaining memory can not be sufficient.

Note 		Rounding error
M-Bus devices may supply very large values (the DWord value range may be exceeded). They are therefore output in string format. Conversions to Real format may lead to inaccuracies/invalid values. Conversions to LReal format are therefore preferable. However, this is not possible for controllers from the BC/BX series. If the values have to be provided in a number format, controllers from the BC/BX series are unsuitable, if the values exceed the DWord value range.


KL6781 - Linking to the System Manager

  1. Link the PLC program and click with the right mouse button on the data structure.

    Figure 1
  2. Select "All Types" and "Continuous" (see Figure 2).

    Figure 2
  3. Click with the mouse on the first variable of the M-Bus master terminal KL6781 ‘Status’. Then press the <SHIFT> key, and hold it down.
  4. Move the mouse pointer over the last variable of the KL6781 ‘Data In 21’ and click again with the left mouse button.
  5. Now release the <SHIFT> key again. All the terminal's data should now be highlighted (see Figure 2).
  6. Press button OK.
  7. Check the links. To do this go onto the KL6781 and open it. All the terminal's data should now be marked by a small arrow (see Figure 3). If that is the case, then proceed in exactly the same way with the outputs.

    Figure 3


Integration in TwinCAT (CX9020)

This example describes how a simple PLC program for M-Bus can be written in TwinCAT and how it is linked with the hardware. The task is to read a counter with four digital inputs.

Unpacking the example files

Hardware

Setting up the components

The following hardware is required:

  • 1x Embedded PC CX9020
  • 1x M-Bus master terminal KL6781
  • 1x end terminal KL9010

Set up the hardware and the M-Bus components as described in the associated documentation.

This example assumes that the counter address is known.

Software

Creation of the PLC program

Create a new PLC project for PC-based systems (ARM) and add the TcMBus.lib library.

Next, generate the following global variables:

VAR_GLOBAL
    stComIn     AT%I* : ST_KL6781inData22B;
    stComOut    AT%Q* : ST_KL6781outData22B;
    stCom             : ST_MBUS_Communication;
END_VAR

stComIn: Input variable for the M-Bus terminal.

stComOut: Output variable for the M-Bus terminal.

stCom: Required for communication with M-Bus.

Then create a program (CFC) for background communication with M-Bus. The FB_MBUSKL6781() block is called in this program. Make sure to link the communication block with stComIn, stComOut and stCom.

Create a MAIN program (CFC) in which the block FB_MBUS_REL_PadIn4 is called up. Link the input usiAddress of the counter block with the local variable usiAddress and stCom with the global variable stCom.

Go to the task configuration and give the task a lower interval time. More detailed information can be found in the FB_MBUSKL6781() block description.

Load the project to the CX as the boot project and save it.

Configuration in the System Manager

Create a new System Manager project, select the CX as the target system, and search for the associated hardware.

Add the PLC program created above under PLC configuration. The two tasks are listed when the PLC project is expanded in the tree view. However, since the variables stComIn and stComOut are to be processed faster, move them to the background communication task via drag & drop.

Now link the global variables of the PLC program with the Bus Terminal inputs and outputs, create the allocations, and activate the configuration. Then start the device in run mode.
Your CX is now ready for use.

After starting the PLC, the current values are regularly read by the counter.


Integration into TwinCAT (BC9191)

This example describes how a simple PLC program for M-Bus can be written in TwinCAT and how it is linked with the hardware. The task is to read a counter with four digital inputs.

Unpacking the example files

Hardware

Setting up the components

The following hardware is required:

  • 1x Bus Terminal Controller BC9191
  • 1x potential feed terminal 24V DC
  • 1x M-Bus master terminal KL6781
  • 1x end terminal KL9010

Set up the hardware and the M-Bus components as described in the associated documentation.

This example assumes that the counter address is known.

Software

Creation of the PLC program

Create a new PLC project for BC-based systems (BCxx50 via AMS) and add the library TcMBus.lbx. Then navigate to Project → Options... → Build and select Treat LREAL as REAL.

Next, generate the following global variables:

VAR_GLOBAL
    stComIn     AT%I* : ST_KL6781inData22B;
    stComOut    AT%Q* : ST_KL6781outData22B;
    stCom             : ST_MBUS_Communication;
END_VAR

stComIn: Input variable for the M-Bus terminal.

stComOut: Output variable for the M-Bus terminal.

stCom: Required for communication with M-Bus.

Since BC devices can only process one task, communication with M-Bus cannot run separately.

Therefore, create a MAIN program (CFC) in which the FB_MBUSKL6781() and FB_MBUS_REL_PadIn4 function blocks are called. Make sure to link the communication block with stComIn, stComOut and stCom.

Link the input usiAddress of the counter block with the local variable usiAddress and stCom with the global variable stCom.

Go to the task configuration and give the task a lower interval time. More detailed information can be found in the FB_MBUSKL6781() block description.

Now load the project as a boot project to the BC and save it.

Configuration in the System Manager

Create a new System Manager project, select the BC as the target system, and search for the associated hardware.

Add the PLC program created above under PLC configuration.

Now link the global variables of the PLC program with the Bus Terminal inputs and outputs, create the allocations, and activate the configuration. Then start the device in run mode.
Your BC is now ready for use.

After starting the PLC, the current values are regularly read by the counter.


FB_MBUSKL6781

Application

This function block is used for reading M-Bus devices via a serial KL6781 Bus Terminal.

The block can only be used in conjunction with at least one meter block.

An instance of this block is required for each serial KL6781 terminal.

The minimum cycle time for reading the serial interface depends on the baud rate. Guide value for 2400 baud: 10 ms max. For programs with a higher cycle time, the blocks be called in a faster task (see also here).

VAR_INPUT

usiRetries      : USINT;
bStart          : BOOL;
bDisabled       : BOOL := FALSE;

usiRetries: Number of retries on error. If usiRetries is not assigned or set to 0, the value is set to 3 internally.

bStart: Positive edge on this input, all meters is read out once.

bDisabled: TRUE = disable the function block

VAR_OUTPUT

bBusy           : BOOL;
bReady          : BOOL;
bError          : BOOL;
eError          : E_MBUS_ERROR;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

VAR_IN_OUT

stComIn         : ST_KL6781inData22B;
stComOut        : ST_KL6781outData22B;
stCom           : ST_MBUS_Communication;

stComIn: Is linked to the terminal in the System Manager.

stComOut: Is linked to the terminal in the System Manager.

stCom: About this structure, the block is connected to the meter function blocks.


ABB overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
ABB | Electricity meter | DELTAplus DZ+ | FB_MBUS_ABB_DZ


FB_MBUS_ABB_DZ

Application

This block is used for reading electricity meters from ABB:

-DELTAplus DZ+

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress            : USINT;
stSecAdr              : ST_MBUS_SecAdr;
eBaudrate             : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                : BOOL;
bSND_NKE              : BOOL := TRUE;
bReadInit             : BOOL := TRUE;
tMinSendTime          : TIME := t#2s;
usiUnit               : USINT;
bDisabled             : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                 : BOOL;
bReady                : BOOL;
bError                : BOOL;
eError                : E_MBUS_ERROR;
dwIdNumber            : DWORD;
byStatus              : BYTE;
byGEN                 : BYTE;
byCounter             : BYTE;
usiRecivedAdr         : USINT;
eMedium               : E_MBUS_Medium;
sMan                  : STRING(3);
stActiveEnergy        : ST_MBus_Info;
stReactiveEnergy      : ST_MBus_Info;
stActivePower         : ST_MBus_Info;
stReactivePower       : ST_MBus_Info;
stCurrentL1           : ST_MBus_Info;
stCurrentL2           : ST_MBus_Info;
stCurrentL3           : ST_MBus_Info;
stPowerFactor         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stActiveEnergy: Meter reading, total active energy (see ST_MBus_Info).

stReactiveEnergy: Meter reading, total reactive energy (see ST_MBus_Info).

stActivePower: Current consumption, total active power (see ST_MBus_Info).

stReactivePower: Current consumption, total reactive power (see ST_MBus_Info).

stCurrentL1: Current L1 (see ST_MBus_Info).

stCurrentL2: Current L2 (see ST_MBus_Info).

stCurrentL3: Current L3 (see ST_MBus_Info).

stPowerFactor: Total power factor (see ST_MBus_Info).

VAR_IN_OUT

stCom                 : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: BCxx50 oder BX serial

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Actaris overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Actaris | Heat meter | CF-Echo II | FB_MBUS_ACW_CF
 | Heat calculator | CF-51 | FB_MBUS_ACW_CF
 | Heat calculator | CF-55 | FB_MBUS_ACW_CF
 | Water meter | BM +M | FB_MBUS_ACW_PlusM


FB_MBUS_ACW_CF

Application

This block is used for reading heat meters from Actaris:

-CF-Echo II

-CF-51

-CF-55

-CF-800

Up to two additional water meters can be connected to this device (optional).

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL:=TRUE;
bReadInit          : BOOL:=TRUE;
tMinSendTime       : TIME:=t#2s;
usiUnit            : USINT;
bDisabled          : BOOL:=FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 1200, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;
stVolume1          : ST_MBus_Info;
stVolume2          : ST_MBus_Info;
stColdEnergy       : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stVolume1: Meter reading of additional water meter 1 (option) (see ST_MBus_Info).

stVolume2: Meter reading of additional water meter 2 (option) (see ST_MBus_Info).

stColdEnergy: Meter reading, cold energy (option) (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: BCxx50 oder BX serial

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_ACW_PlusM

Application

This block is used for reading water meters from Actaris:

-BM +M

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL:=TRUE;
bReadInit          : BOOL:=TRUE;
tMinSendTime       : TIME:=t#2s;
bDisabled          : BOOL:=FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, water consumption (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: BCxx50 oder BX serial

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Aquametro overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Aquametro | Water meter | SAPHIR | FB_MBUS_AMT_SAPHIR
 | Heat meter | CALEC | FB_MBUS_AMT_CALEC
 | Heat meter | CALEC ST, version C4 | FB_MBUS_AMT_CALEC_STC4
 | Heat meter | AMTRON | FB_MBUS_AMT_AMTRON
 | Pulse collector | AMBUS | FB_MBUS_AMT_AMBUS
 | Heat meter | AMTRON SONIC D | FB_MBUS_HYD_Sharky, FB_MBUS_HYD_Sharky_00


FB_MBUS_AMT_AMBUS

Application

This block is used for reading pulse collectors from Aquametro:

-AMBUS IS

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stValue            : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue: Meter reading (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_AMT_AMTRON

Application

This block is used for reading heat meters from Aquametro:

-AMTRON

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_AMT_CALEC

Application

This block is used for reading heat meters from Aquametro:

-CALEC

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_AMT_CALEC_STC4

Application

This block is used for reading heat meters from Aquametro:

-CALEC ST, version C4

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress           : USINT;
stSecAdr             : ST_MBUS_SecAdr;
eBaudrate            : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart               : BOOL;
bSND_NKE             : BOOL := TRUE;
bReadInit            : BOOL := TRUE;
tMinSendTime         : TIME := t#2s;
usiUnit              : USINT;
bDisabled            : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                : BOOL;
bReady               : BOOL;
bError               : BOOL;
eError               : E_MBUS_ERROR;
dwIdNumber           : DWORD;
byStatus             : BYTE;
byGEN                : BYTE;
byCounter            : BYTE;
usiRecivedAdr        : USINT;
eMedium              : E_MBUS_Medium;
sMan                 : STRING(3);
stEnergyPos          : ST_MBus_Info;
stVolumePos          : ST_MBus_Info;
stEnergyNeg          : ST_MBus_Info;
stVolumeNeg          : ST_MBus_Info;
stPower              : ST_MBus_Info;
stFlow               : ST_MBus_Info;
stForwardTemp        : ST_MBus_Info;
stReturnTemp         : ST_MBus_Info;
stDiffTemp           : ST_MBus_Info;
stPulsecounter1      : ST_MBus_Info;
stPulsecounter2      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergyPos: Meter reading, energy consumption (positive) (see ST_MBus_Info).

stVolumePos: Meter reading, water consumption (positive) (see ST_MBus_Info).

stEnergyNeg: Meter reading, energy consumption (negative) (see ST_MBus_Info).

stVolumeNeg: Meter reading, water consumption (negative) (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stPulsecounter1: Pulse counter 1 (see ST_MBus_Info).

stPulsecounter2: Pulse counter 2 (see ST_MBus_Info).

VAR_IN_OUT

stCom                : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_AMT_SAPHIR

Application

This block is used for reading water meters from Aquametro:

-Saphir

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Berg overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Berg | Electricity meter | DZ+ | FB_MBUS_BEC_DZ
 | Electricity meter | DCMi | FB_MBUS_BEC_DCMi


FB_MBUS_BEC_DCMi

Application

This block is used for reading electricity meters from Berg:

-DCMi

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stDeviceError      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_BEC_DZ

Application

This block is used for reading electricity meters from Berg:

-DZ+

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress            : USINT;
stSecAdr              : ST_MBUS_SecAdr;
eBaudrate             : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                : BOOL;
bSND_NKE              : BOOL := TRUE;
bReadInit             : BOOL := TRUE;
tMinSendTime          : TIME := t#2s;
usiUnit               : USINT;
bDisabled             : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                 : BOOL;
bReady                : BOOL;
bError                : BOOL;
eError                : E_MBUS_ERROR;
dwIdNumber            : DWORD;
byStatus              : BYTE;
byGEN                 : BYTE;
byCounter             : BYTE;
usiRecivedAdr         : USINT;
eMedium               : E_MBUS_Medium;
sMan                  : STRING(3);
stActiveEnergy        : ST_MBus_Info;
stReactiveEnergy      : ST_MBus_Info;
stActivePower         : ST_MBus_Info;
stReactivePower       : ST_MBus_Info;
stCurrentL1           : ST_MBus_Info;
stCurrentL2           : ST_MBus_Info;
stCurrentL3           : ST_MBus_Info;
stPowerFactor         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stActiveEnergy: Meter reading, total active energy (see ST_MBus_Info).

stReactiveEnergy: Meter reading, total reactive energy (see ST_MBus_Info).

stActivePower: Current consumption, total active power (see ST_MBus_Info).

stReactivePower: Current consumption, total reactive power (see ST_MBus_Info).

stCurrentL1: Current L1 (see ST_MBus_Info).

stCurrentL2: Current L2 (see ST_MBus_Info).

stCurrentL3: Current L3 (see ST_MBus_Info).

stPowerFactor: Total power factor (see ST_MBus_Info).

VAR_IN_OUT

stCom                 : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Brunata overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Brunata | Heat meter | HGQ / HGS | FB_MBUS_BHG_HGx
 | Heat meter | Optunha H (775) | FB_MBUS_HYD_Sharky, FB_MBUS_HYD_Sharky_00


FB_MBUS_BHG_HGx

Application

This block is used for reading heat meters from Brunata:

-HGQ

-HGS

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress           : USINT;
stSecAdr             : ST_MBUS_SecAdr;
eBaudrate            : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart               : BOOL;
bSND_NKE             : BOOL := TRUE;
bReadInit            : BOOL := TRUE;
tMinSendTime         : TIME := t#2s;
usiUnit              : USINT;
bDisabled            : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                : BOOL;
bReady               : BOOL;
bError               : BOOL;
eError               : E_MBUS_ERROR;
dwIdNumber           : DWORD;
byStatus             : BYTE;
byGEN                : BYTE;
byCounter            : BYTE;
usiRecivedAdr        : USINT;
eMedium              : E_MBUS_Medium;
sMan                 : STRING(3);
stEnergy             : ST_MBus_Info;
stVolume             : ST_MBus_Info;
stVolume2            : ST_MBus_Info;
stForwardTemp        : ST_MBus_Info;
stReturnTemp         : ST_MBus_Info;
stDiffTemp           : ST_MBus_Info;
stFlow               : ST_MBus_Info;
stPower              : ST_MBus_Info;
stPulsecounter1      : ST_MBus_Info;
stPulsecounter2      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stVolume2: Volume from flow sensor (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stPulsecounter1: Pulse counter 1 (aux1) (see ST_MBus_Info).

stPulsecounter2: Pulse counter 2 (aux2) (see ST_MBus_Info).

VAR_IN_OUT

stCom                : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Carlo Gavazzi overview

Hint: These modules output only a selection of the most common data. See the description of these data below "VAR_OUT". If more or all data are necessary, use the modules FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Notice that these modules are not executable on BC, BX systems. If data have to be send to the device (e.g. setting of the primary address), use the module FB_MBUS_General_Send.

Manufacturer | Type | Device | Block
Carlo Gavazzi | Energy calculator | EM24 | FB_MBUS_GAV_EM24


FB_MBUS_GAV_EM24

Application

This module is used to readout energy calculators of the manufacturer Carlo Gavazzi.

It can only be used together with the module FB_MBUSKL6781()

Functionality of the module

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stKWh_TOT               : ST_MBus_Info;
stKWh_L1                : ST_MBus_Info;
stKWh_L2                : ST_MBus_Info;
stKWh_L3                : ST_MBus_Info;
stW_Sum                 : ST_MBus_Info;
stV_L_N_Sum             : ST_MBus_Info;
stV_L_L_Sum             : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stKWh_TOT: See manufacturer information (see ST_MBus_Info).

stKWh_L1: See manufacturer information (see ST_MBus_Info).

stKWh_L2: See manufacturer information (see ST_MBus_Info).

stKWh_L3: See manufacturer information (see ST_MBus_Info).

stW_Sum: See manufacturer information (see ST_MBus_Info).

stV_L_N_Sum: See manufacturer information (see ST_MBus_Info).

stV_L_L_Sum: See manufacturer information (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Development environment | Target system type | PLC libraries to include
TwinCAT 2.11 R3/x64 higher than Build 2234 | PC/CX, BX or BC | TcMBus-Library higher than V2.1.0


Cynox overview

Hint: These modules output only a selection of the most common data. See the description of these data below "VAR_OUT". If more or all data are necessary, use the modules FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Notice that these modules are not executable on BC, BX systems. If data have to be send to the device (e.g. setting of the primary address), use the module FB_MBUS_General_Send.

Manufacturer | Type | Device | Block
Cynox | Pulse counter | MCount2C | FB_MBUS_CYN_MCount2C


FB_MBUS_CYN_MCount2C

Application

This module is used to readout pulse counter of the manufacturer Cynox.

It can only be used together with the module FB_MBUSKL6781()

Functionality of the module

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stCurrent1              : ST_MBus_Info;
stCurrent2              : ST_MBus_Info;
stCurrent3              : ST_MBus_Info;
stCurrent4              : ST_MBus_Info;
stHistorical1           : ST_MBus_Info;
stHistorical2           : ST_MBus_Info;
stHistorical3           : ST_MBus_Info;
stHistorical4           : ST_MBus_Info;
stNextDeadline          : ST_MBus_Info;
stLastDeadline          : ST_MBus_Info;
stCurrentTime           : ST_MBus_Info;
stOperatingTime         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stCurrent1: Current value 1 (see ST_MBus_Info).

stCurrent2: Current value 2 (see ST_MBus_Info).

stCurrent3: Current value 3 (see ST_MBus_Info).

stCurrent4: Current value 4 (see ST_MBus_Info).

stHistorical1: Historical value 1 (see ST_MBus_Info).

stHistorical2: Historical value 2 (see ST_MBus_Info).

stHistorical3: Historical value 3 (see ST_MBus_Info).

stHistorical4: Historical value 4 (see ST_MBus_Info).

stNextDeadline: Next deadline (see ST_MBus_Info).

stLastDeadline: Last deadline (see ST_MBus_Info).

stCurrentTime: Current time (see ST_MBus_Info).

stOperatingTime: Operating time (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Development environment | Target system type | PLC libraries to include
TwinCAT 2.11 R3/x64 higher than Build 2250 | PC/CX, BX or BC | TcMBus-Library higher than V2.5.0


Elster overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Elster | Gas meter | Encoder Z6 | FB_MBUS_ELS_EncoderZ6


FB_MBUS_ELS_EncoderZ6

Application

This block is used for reading meters from Elster:

-Gas meter Encoder Z6

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


elvaco overview

Hint: These modules output only a selection of the most common data. See the description of these data below "VAR_OUT". If more or all data are necessary, use the modules FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Notice that these modules are not executable on BC, BX systems. If data have to be send to the device (e.g. setting of the primary address), use the module FB_MBUS_General_Send.

Manufacturer | Type | Device | Block
elvaco | Temperature and humidity sensor | CMa10 / CMa20 | FB_MBUS_ELV_CMa10_20


FB_MBUS_ELV_CMa10_20

Application

This module is used to readout energy calculators of the manufacturer elvaco.

Usable with sensors CMa10 and CMa20.

It can only be used together with the module FB_MBUSKL6781()

Functionality of the module

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
strRelHumi              : ST_MBus_Info;
strRelHumiMin           : ST_MBus_Info;
strRelHumiMax           : ST_MBus_Info;
strTemp                 : ST_MBus_Info;
strTempMin              : ST_MBus_Info;
strTempMax              : ST_MBus_Info;
strTempAvg1h            : ST_MBus_Info;
strTempAvg24h           : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

strRelHumi: Instantaneous relative humidity (see ST_MBus_Info).

strRelHumiMin: Lowest instantaneous relative humidity since last min/max reset command (see ST_MBus_Info).

strRelHumiMax: Highest instantaneous relative humidity since last min/max reset command (see ST_MBus_Info).

strTemp: Instantaneous temperature (see ST_MBus_Info).

strTempMin: Lowest instantaneous temperature since last min/max reset command (see ST_MBus_Info).

strTempMax: Highest instantaneous temperature since last min/max reset command (see ST_MBus_Info).

strTempAvg1h: 1-hour temperature rolling average (see ST_MBus_Info).

strTempAvg24h: 24-hour temperature rolling average (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Development environment | Target system type | PLC libraries to include
TwinCAT 2.11 R3/x64 higher than Build 2234 | PC/CX, BX or BC | TcMBus-Library higher than V2.2.0


EMH overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
EMH | Electricity meter | DIZ | FB_MBUS_EMH_DIZ
 | Electricity meter | EIZ-E | FB_MBUS_EMH_EIZE
 | Electricity meter | EIZ-G | FB_MBUS_EMH_EIZG
 | Electricity meter | MIZ | FB_MBUS_EMH_MIZ


FB_MBUS_EMH_DIZ

Application

This block is used for reading electricity meters from EMH:

-DIZ

Unidirectional tariff meter only.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stDeviceError      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_EMH_EIZE

Application

This block is used for reading electricity meters from EMH:

-EIZ-E

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stDeviceError      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_EMH_EIZG

Application

This block is used for reading electricity meters from EMH:

-EIZ-G

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stDeviceError      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_EMH_MIZ

Application

This block is used for reading electricity meters from EMH:

-MIZ

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVoltage          : ST_MBus_Info;
stCurrent          : ST_MBus_Info;
stFrequency        : ST_MBus_Info;
stPowerfactor      : ST_MBus_Info;
stDeviceError      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVoltage: Voltage (see ST_MBus_Info).

stCurrent: Current (see ST_MBus_Info).

stFrequency: Frequeny (see ST_MBus_Info).

stPowerfactor: Power factor (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


EMU overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
EMU | Electricity meter | EMU32x7 | FB_MBUS_EMU_32x7
 | Electricity meter | EMU32x7 | FB_MBUS_EMU_32x7_Option8
 | Electricity meter | Allrounder 3/5 | FB_MBUS_EMU_3_5_Allrounder
 | Electricity meter | DHZ 5/63 | FB_MBUS_EMU_DHZ_5_63


FB_MBUS_EMU_32x7

Application

This block is used for reading electricity meters from EMU:

-EMU32.x7

Only the standard meter data will be read. The meter transmits this data in the standard EMU parameterisation, or if the parameter set is set in the device to 00000 hexadecimal. Please refer to the meter documentation for further information regarding this.

Note: In the normal version, the current consumption of the M-Bus interface is equivalent to 3 standard loads. If an M-Bus master interface is used that is designed, for example, for up to 120 standard loads, a maximum of 40 EMU M-Bus meters can be connected. The meter can optionally be supplied with 230 V. The current consumption of the M-Bus interface is then equivalent to one standard load.

The transmission of data from the EMU meter to the M-Bus protocol computer only works if the EMU meter is connected to at least two phases of the mains voltage network.

The EMU meter transmits current data to the device’s M-Bus interface every 40 seconds, so that the readout data is approx. 40 - 45 seconds old.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress            : USINT;
stSecAdr              : ST_MBUS_SecAdr;
eBaudrate             : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                : BOOL;
bSND_NKE              : BOOL := TRUE;
bReadInit             : BOOL := TRUE;
tMinSendTime          : TIME := t#2s;
usiUnit               : USINT;
bDisabled             : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                 : BOOL;
bReady                : BOOL;
bError                : BOOL;
eError                : E_MBUS_ERROR;
dwIdNumber            : DWORD;
byStatus              : BYTE;
byGEN                 : BYTE;
byCounter             : BYTE;
usiRecivedAdr         : USINT;
eMedium               : E_MBUS_Medium;
sMan                  : STRING(3);
stOperatingHours      : ST_MBus_Info;
stEnergy              : ST_MBus_Info;
stPower               : ST_MBus_Info;
stInitCounter         : ST_MBus_Info;
stDeviceError         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stOperatingHours: Operating hours of EMU meter (see ST_MBus_Info).

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stInitCounter: Number of voltage outages on EMU meter (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom                 : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_EMU_32x7_Option8

Application

This block is used for reading electricity meters from EMU:

-EMU32.x7

The block can only be used in conjunction with the block FB_MBUSKL6781().

The parameter set must be set in the device to 70000 hexadecimal (variant 8) in order to read out this data. Please refer to the meter documentation for further information regarding this.

Note: In the normal version, the current consumption of the M-Bus interface is equivalent to 3 standard loads. If an M-Bus master interface is used that is designed, for example, for up to 120 standard loads, a maximum of 40 EMU M-Bus meters can be connected. The meter can optionally be supplied with 230 V. The current consumption of the M-Bus interface is then equivalent to one standard load.

The transmission of data from the EMU meter to the M-Bus protocol computer only works if the EMU meter is connected to at least two phases of the mains voltage network.

The EMU meter transmits current data to the device’s M-Bus interface every 40 seconds, so that the readout data is approx. 40 - 45 seconds old.

Functionality of the function block

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
usiUnit                 : USINT;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stOperatingHours        : ST_MBus_Info;
stActiveEnergyT1        : ST_MBus_Info;
stActiveEnergyT2        : ST_MBus_Info;
stReactiveEnergyT1      : ST_MBus_Info;
stReactiveEnergyT2      : ST_MBus_Info;
stTariff                : ST_MBus_Info;
stActivePowerL1         : ST_MBus_Info;
stActivePowerL2         : ST_MBus_Info;
stActivePowerL3         : ST_MBus_Info;
stReactivePowerL1       : ST_MBus_Info;
stReactivePowerL2       : ST_MBus_Info;
stReactivePowerL3       : ST_MBus_Info;
stActivePowerMaxT1      : ST_MBus_Info;
stActivePowerMaxT2      : ST_MBus_Info;
stVoltageL1             : ST_MBus_Info;
stVoltageL2             : ST_MBus_Info;
stVoltageL3             : ST_MBus_Info;
stCurrentL1             : ST_MBus_Info;
stCurrentL2             : ST_MBus_Info;
stCurrentL3             : ST_MBus_Info;
stFrequency             : ST_MBus_Info;
stPowerFactorL1         : ST_MBus_Info;
stPowerFactorL2         : ST_MBus_Info;
stPowerFactorL3         : ST_MBus_Info;
stInitCounter           : ST_MBus_Info;
stDeviceError           : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stOperatingHours: Operating hours of EMU meter (see ST_MBus_Info).

stActiveEnergyT1: Meter reading, active energy tariff 1 (see ST_MBus_Info).

stActiveEnergyT2: Meter reading, active energy tariff 2 (see ST_MBus_Info).

stReactiveEnergyT1: Meter reading, reactive energy tariff 1 (see ST_MBus_Info).

stReactiveEnergyT2: Meter reading, reactive energy tariff 2 (see ST_MBus_Info).

stTariff: Tariff presently operating (see ST_MBus_Info).

stActivePowerL1: Instantaneous active power L1 (see ST_MBus_Info).

stActivePowerL2: Instantaneous active power L2 (see ST_MBus_Info).

stActivePowerL3: Instantaneous active power L3 (see ST_MBus_Info).

stReactivePowerL1: Instantaneous reactive power L1 (see ST_MBus_Info).

stReactivePowerL2: Instantaneous reactive power L2 (see ST_MBus_Info).

stReactivePowerL3: Instantaneous reactive power L3 (see ST_MBus_Info).

stActivePowerMaxT1: Maximum demand active power tariff 1 (see ST_MBus_Info).

stActivePowerMaxT2: Maximum demand active power tariff 2 (see ST_MBus_Info).

stVoltageL1: Instantaneous voltage L1 (see ST_MBus_Info).

stVoltageL2: Instantaneous voltage L2 (see ST_MBus_Info).

stVoltageL3: Instantaneous voltage L3 (see ST_MBus_Info).

stCurrentL1: Instantaneous current L1 (see ST_MBus_Info).

stCurrentL2: Instantaneous current L2 (see ST_MBus_Info).

stCurrentL3: Instantaneous current L3 (see ST_MBus_Info).

stFrequency: Instantaneous network frequency (see ST_MBus_Info).

stPowerFactorL1: Instantaneous power factor L1 (cos phi) (see ST_MBus_Info).

stPowerFactorL2: Instantaneous power factor L2 (cos phi) (see ST_MBus_Info).

stPowerFactorL3: Instantaneous power factor L3 (cos phi) (see ST_MBus_Info).

stInitCounter: Number of voltage outages on EMU meter (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_EMU_3_5_Allrounder

Application

This module is used to readout electricity meters of the manufacturer EMU.

It can only be used together with the module FB_MBUSKL6781()

Functionality of the module

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300..9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stActiveEnergyTariff1   : ST_MBus_Info;
stActiveEnergyTariff2   : ST_MBus_Info;
stActivePowerL1         : ST_MBus_Info;
stActivePowerL2         : ST_MBus_Info;
stActivePowerL3         : ST_MBus_Info;
stActivePowerTotal      : ST_MBus_Info;
stVoltageL1             : ST_MBus_Info;
stVoltageL2             : ST_MBus_Info;
stVoltageL3             : ST_MBus_Info;
stCurrentL1             : ST_MBus_Info;
stCurrentL2             : ST_MBus_Info;
stCurrentL3             : ST_MBus_Info;
stCurrentTotal          : ST_MBus_Info;
stDeviceError           : ST_MBus_Info;

stActiveEnergyTariff1: Active energy tariff 1 (see ST_MBus_Info).

stActiveEnergyTariff2: Active energy tariff 2 (see ST_MBus_Info).

stActivePowerL1: Actual active power L1 (see ST_MBus_Info).

stActivePowerL2: Actual active power L2 (see ST_MBus_Info).

stActivePowerL3: Actual active power L3 (see ST_MBus_Info).

stActivePowerTotal: Total active power (see ST_MBus_Info).

stVoltageL1: Voltage L1 (see ST_MBus_Info).

stVoltageL2: Voltage L2 (see ST_MBus_Info).

stVoltageL3: Voltage L3 (see ST_MBus_Info).

stCurrentL1: Current L1 (see ST_MBus_Info).

stCurrentL2: Current L2 (see ST_MBus_Info).

stCurrentL3: Current L3 (see ST_MBus_Info).

stCurrentTotal: Total current (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Development environment | Target system type | PLC libraries to include
TwinCAT 2.11 R3/x64 higher than Build 2234 | PC/CX, BX or BC | TcMBus-Library higher than V2.3.0


FB_MBUS_EMU_DHZ_5_63

Application

This module is used to readout electricity meters of the manufacturer EMU.

It can only be used together with the module FB_MBUSKL6781()

Functionality of the module

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300..9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stEnergy1               : ST_MBus_Info;
stEnergy2               : ST_MBus_Info;
stVoltage               : ST_MBus_Info;
stCurrent               : ST_MBus_Info;
stPower                 : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy1: Energy 1 (see ST_MBus_Info).

stEnergy2: Energy 2 (see ST_MBus_Info).

stVoltage: Mains voltage (see ST_MBus_Info).

stCurrent: Current (see ST_MBus_Info).

stPower: Active power (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Development environment | Target system type | PLC libraries to include
TwinCAT 2.11 R3/x64 higher than Build 2234 | PC/CX, BX or BC | TcMBus-Library higher than V2.3.0


Engelmann overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Engelmann | Heat meter | SENSOSTAR 2C | FB_MBUS_EFE_SensoStar2C


FB_MBUS_EFE_SensoStar2C

Application

This block is used for reading heat meters from Engelmann:

-SENSOSTAR 2C

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress           : USINT;
stSecAdr             : ST_MBUS_SecAdr;
eBaudrate            : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart               : BOOL;
bSND_NKE             : BOOL := TRUE;
bReadInit            : BOOL := TRUE;
tMinSendTime         : TIME := t#2s;
usiUnit              : USINT;
bDisabled            : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                : BOOL;
bReady               : BOOL;
bError               : BOOL;
eError               : E_MBUS_ERROR;
dwIdNumber           : DWORD;
byStatus             : BYTE;
byGEN                : BYTE;
byCounter            : BYTE;
usiRecivedAdr        : USINT;
eMedium              : E_MBUS_Medium;
sMan                 : STRING(3);
stEnergy             : ST_MBus_Info;
stColdEnergy         : ST_MBus_Info;
stPower              : ST_MBus_Info;
stVolume             : ST_MBus_Info;
stFlow               : ST_MBus_Info;
stForwardTemp        : ST_MBus_Info;
stReturnTemp         : ST_MBus_Info;
stDiffTemp           : ST_MBus_Info;
stTariff1            : ST_MBus_Info;
stTariff2            : ST_MBus_Info;
stPulsecounter1      : ST_MBus_Info;
stPulsecounter2      : ST_MBus_Info;
stDeviceError        : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stColdEnergy: Meter reading, cold energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stTariff1: Tariff register 1 (see ST_MBus_Info).

stTariff2: Tariff register 2 (see ST_MBus_Info).

stPulsecounter1: Pulse counter 1 (see ST_MBus_Info).

stPulsecounter2: Pulse counter 2 (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom                : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Overview of general device blocks

Manufacturer | Type | Device | Block
General | Electricity meter | all electricity meter | FB_MBUS_General_Electricity
 | Heat meter | all heat meter | FB_MBUS_General_Heat
 | Water meter | all water meter | FB_MBUS_General_Water
 | Raw data | all | FB_MBUS_RawData
 | max. 40 values from the first telegram | all | FB_MBUS_General
 | all telegrams, all values | all | FB_MBUS_General_Ext
 | parameterized values | all | FB_MBUS_General_Param
 | universal send | all | FB_MBUS_General_Send
 | scan | all | FB_MBUS_Scan
 | Change address | all | FB_MBUS_ChangeAdr


FB_MBUS_ChangeAdr

Application

This block is used to change the primary address of a meter.

The block can only be used in conjunction with the block FB_MBUSKL6781().

VAR_INPUT

usiAdrOld      : USINT;
usiAdrNew      : USINT;
eBaudrate      : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart         : BOOL;
bDisabled      : BOOL := FALSE;

usiAdrOld: Old primary address of the counter.

usiAdrNew: New primary address of the counter.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge of this input, the primary address of the meter is changed.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy          : BOOL;
bReady         : BOOL;
bError         : BOOL;
eError         : E_MBUS_ERROR;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

VAR_IN_OUT

stCom          : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_General

Application

This block is used for reading any M-Bus devices. The variable arrData supplies a maximum of cMBUS_MaxData of the first telegram. String values and manufacturer-specific information are not shown correctly.

Note:

This block is not suitable for BC / BX.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
arrData            : ARRAY [1..cMBUS_MaxData] OF ST_MBus_Data;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

arrData: Maximum cMBUS_MaxData values of the first telegram (see ST_MBus_Data). The meaning of the values are explained in the M-Bus protocol of the device.

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Example view:

Download sample program for PC/CX systems:


FB_MBUS_General_Electricity

Application

This block is used for reading electricity meters.

Note: The power is not transmitted by all electricity meters. The corresponding structure remains empty.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:


FB_MBUS_General_Ext

Application

There are devices that send values distributed to several telegrams. With this function block all messages can be read by any device.

The variable arrTelegram[1..cMBUS_MaxTelegrams].arrData[1..cMBUS_MaxData] provides a maximum of cMBUS_MaxTelegrams telegrams maximum cMBUS_MaxData data.

The number of telegrams to be read can be changed by the constant cMBUS_MaxTelegrams.

The number of data per telegram can be changed by the constant cMBUS_MaxData.

Note:

This block is not suitable for BC / BX.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
arrTelegram        : ARRAY [1..cMBUS_MaxTelegrams] OF ST_MBus_Data2;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

arrTelegram: Maximum cMBUS_MaxTelegrams telegrams (see ST_MBus_Data2). The meaning of the values are explained in the M-Bus protocol of the device.

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Example view:

Download sample program for PC/CX systems:


FB_MBUS_General_Heat

Application

This block is used for reading heat meters.

Note: The flow is not transmitted by all water meters. The corresponding structure remains empty.

The block can only be used in conjunction with the block FB_MBUSKL6781()

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_General_Param

Application

This block is used for reading any M-Bus devices. The variable arrData supplies cMBUS_MaxDataParam values.

These values can be parameterised in the input array arrConfigData. String values and manufacturer-specific information are not shown correctly.

Note:

This block is not suitable for BC / BX.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;
arrConfigData      : ARRAY [1..cMBUS_MaxDataParam] OF WORD;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

arrConfigData: maximum of cMBUS_MaxDataParam input parameters for specifying which values are to be displayed in the output array arrData. See example below.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
arrData            : ARRAY [1..cMBUS_MaxDataParam] OF ST_MBus_Data;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

arrData: Maximum cMBUS_MaxDataParam values. The values can be configured via the input variable arrConfigData. The meaning of the values is explained in the M-Bus protocol for the device.

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Sample VAR_INPUT arrConfigData

arrConfigData[x]:=T T V V; T T= telegram 2 digits (<=99), V V = value 2 digits (maximum cMBUS_MaxData <=99)

Sample arrConfigData:

MBUS.arrConfigData[1]:=0101; (telegram 1, value 1)

MBUS.arrConfigData[2]:=0102; (telegram 1, value 2)

MBUS.arrConfigData[3]:=0309; (telegram 3, value 9)

MBUS.arrConfigData[3]:=1510; (telegram 15, value 10)

MBUS.arrConfigData[4]:=511; (telegram 5, value 11)

MBUS.arrConfigData[x]:=10; false, too few digits (minimum 3)

MBUS.arrConfigData[x]:=12345; false, too many digits (maximum 4)

Incorrect assignment results in the corresponding field in the output array (arrData) remaining empty (no error message).

Download sample program for PC/CX systems:


FB_MBUS_General_Send

Application

This block serves to send data to any M-Bus devices. (for example, the primary address of the meter can be changed with this block)

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the funcion block

VAR_INPUT

usiAddress      : USINT;
stSecAdr        : ST_MBUS_SecAdr;
eBaudrate       : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart          : BOOL;
bSND_NKE        : BOOL := TRUE;
bDisabled       : BOOL := FALSE;
byC_Field       : USINT:=16#53;
byCI_Field      : USINT:=16#51;
arrData         : ARRAY [0..240] OF BYTE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bDisabled: TRUE = disable the function block.

byC_Field: C-Field / Control field.

byCI_Field: CI-Field / Control information field.

arrData: The data to be sent must be transferred to this variable.

VAR_OUTPUT

bBusy           : BOOL;
bReady          : BOOL;
bError          : BOOL;
eError          : E_MBUS_ERROR;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

VAR_IN_OUT

stCom           : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_General_Water

Application

This block is used for reading water meters.

Note: The flow is not transmitted by all water meters. The corresponding structure remains empty.

The block can only be used in conjunction with the block FB_MBUSKL6781()

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_RawData

Application

This block is used for reading any M-Bus devices. The variable arrData supplies the raw data of the M-Bus device. Only the first telegram is evaluated.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
iLen               : INT;
arrData            : ARRAY [0..259] OF BYTE;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

iLen: Number of transferred bytes.

arrData: Raw data of the first telegram.

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_Scan

Application

The M-Bus can be scanned with this function-block. All primary-addresses (0..255) will be polled one by another and the basic information of each device will be stored into the array arrDevice.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Note:

This block is not suitable for BC / BX.

VAR_INPUT

bStart          : BOOL;
bStop           : BOOL;
eBaudrate       : E_MBUS_Baudrate := eMBUS_Baud2400;
bDisabled       : BOOL := FALSE;

bStart: Positive edge on this input starts the scanning process.

bStop: Positive edge on this input stops the scanning process.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy           : BOOL;
bReady          : BOOL;
bError          : BOOL;
eError          : E_MBUS_ERROR;
usiAddress      : USINT;
usiCount        : USINT;
arrDevice       : ARRAY [0..250] OF ST_MBus_Scan;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

usiAddress: Primary address of the meter.

usiCount: Amount of devices recognized as valid.

arrDevice: Information about the scanned devices.

VAR_IN_OUT

stCom           : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Gossen Metrawatt overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Gossen Metrawatt | Electricity meter | U128x | FB_MBUS_GMC_Electricity
 | Electricity meter | U138x | FB_MBUS_GMC_Electricity


FB_MBUS_GMC_Electricity

Application

This block is used for reading electricity meters from Gossen Metrawatt:

-U128x

-U138x

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stDeviceError      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


GWF overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
GWF | Water meter |  | FB_MBUS_GWF_Coder
 | Gas meter | S1 | FB_MBUS_GWF_Coder
 | Gas meter | Z1 | FB_MBUS_GWF_Coder


FB_MBUS_GWF_Coder

Application

This block is used for reading meters from GWF:

-Water meter

-Gas meter S1

-Gas meter Z1

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Hydrometer overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Hydrometer | 2 pulse inputs | HYDRO-PORT Pulse | FB_MBUS_HYD_PortPulse
 | 2 analog inputs + 1 temperature sensor | HYDRO-PORT Analog | FB_MBUS_HYD_PortAnalog
 | Water meter | Flypper | FB_MBUS_HYD_Flypper
 | Heat meter | Sharky 773 | FB_MBUS_HYD_Sharky, FB_MBUS_HYD_Sharky_00
 | Heat meter | Sharky 775 | FB_MBUS_HYD_Sharky, FB_MBUS_HYD_Sharky_00


FB_MBUS_HYD_Flypper

Application

This block is used for reading water meters from Hydrometer:

-Flypper

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_HYD_PortAnalog

Application

This block is used for reading energy meters with analog output from Hydrometer:

-HYDRO-PORT analog (2x0/4-20 mA / 1xPT temperature sensor)

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stValue1           : ST_MBus_Info;
stValue2           : ST_MBus_Info;
stTemperatur       : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue1: Meter reading 1 (see ST_MBus_Info).

stValue2: Meter reading 2 (see ST_MBus_Info).

stTemperatur: Temperature (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_HYD_PortPulse

Application

This block is used for reading energy meters with pulse output from Hydrometer:

-HYDRO-PORT Pulse

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stValue1           : ST_MBus_Info;
stValue2           : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue1: Meter reading 1 (see ST_MBus_Info).

stValue2: Meter reading 2 (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_HYD_Sharky

Application

This block is used for reading energy meters with pulse output from:

Hydrometer:

-Sharky 773

-Sharky 775

-ENERGY INT 6

Brunata:

-Brunata Optuna H (775)

Aquametro:

-AMNTRONIC SONIC D

Only the common values (see VAR_OUTPUT) of the following telegrams:

00 ( Application Reset-Subcode 00 / All )

10 ( Application Reset-Subcode 10 / User data)

20 ( Application Reset-Subcode 20 / Simple billing)

30 ( Application Reset-Subcode 30 / Enhanced billing)

40 ( Application Reset-Subcode 40 / Multi tariff billing)

or 50 ( Application Reset-Subcode 50 / Instant values)

will be read. The device has to be switched to one of these telegrams specifically.

If further data is needed, the function-block FB_MBUS_HYD_Sharky_00() can be used. It is also possible to select the requested telegram with FB_MBUS_General_Send() and read all its information with FB_MBUS_General().

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stTariff1          : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stTariff1: Energy tariff 1 (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_HYD_Sharky_00

Application

This block is used for reading energy meters with pulse output from:

Hydrometer:

-Sharky 773

-Sharky 775

-ENERGY INT 6

Brunata:

-Brunata Optuna H (775)

Aquametro:

-AMNTRONIC SONIC D

All values of telegram #00 ( Application Reset-Subcode 00 / All ) will be read. The device will switch itself into the proper mode.

stPulsecounter1 and stPulsecounter2 will only be shown, if the pulse-modue is plugged in.

If more telegrams are needed, it is possible to select a specific telegram using the function-block FB_MBUS_General_Send() and read its contents with FB_MBUS_General().

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress            : USINT;
stSecAdr              : ST_MBUS_SecAdr;
eBaudrate             : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                : BOOL;
bSND_NKE              : BOOL := TRUE;
bReadInit             : BOOL := TRUE;
tMinSendTime          : TIME := t#2s;
usiUnit               : USINT;
bDisabled             : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                 : BOOL;
bReady                : BOOL;
bError                : BOOL;
eError                : E_MBUS_ERROR;
dwIdNumber            : DWORD;
byStatus              : BYTE;
byGEN                 : BYTE;
byCounter             : BYTE;
usiRecivedAdr         : USINT;
eMedium               : E_MBUS_Medium;
sMan                  : STRING(3);
stEnergy              : ST_MBus_Info;
stTariff1             : ST_MBus_Info;
stTariff2             : ST_MBus_Info;
stVolume              : ST_MBus_Info;
stPower               : ST_MBus_Info;
stFlow                : ST_MBus_Info;
stForwardTemp         : ST_MBus_Info;
stReturnTemp          : ST_MBus_Info;
stDiffTemp            : ST_MBus_Info;
stOperatingHours      : ST_MBus_Info;
stDateTime            : ST_MBus_Info;
stDueDay1             : ST_MBUS_DueDayHYD1;
stDueDay2             : ST_MBUS_DueDayHYD1;
stPulsecounter1       : ST_MBus_Info;
stPulsecounter2       : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stTariff1: Meter reading, tariff 1 (see ST_MBus_Info).

stTariff2: Meter reading, tariff 2 (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stOperatingHours: Operating hours (see ST_MBus_Info).

stDateTime: Date / Tiime (see ST_MBus_Info).

stDueDay1: Values due day 1 (see ST_MBUS_DueDayHYD1).

stDueDay2: Values due day 2 (see ST_MBUS_DueDayHYD1).

stPulsecounter1: Meter reading, pulse counter 1 (see ST_MBus_Info).

stPulsecounter2: Meter reading, pulse counter 2 (see ST_MBus_Info).

VAR_IN_OUT

stCom                 : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


ista overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
ista | Water meter | domaqua® m | FB_MBUS_IST_Istameter
 | Water meter | istameter® m | FB_MBUS_IST_Istameter
 | Water meter | istameter III | FB_MBUS_IST_IstameterIII
 | Pulsecounter | pulsonic II | FB_MBUS_IST_PulsonicII
 | Heat meter | sensonic II | FB_MBUS_IST_SensonicII


FB_MBUS_IST_Istameter

Application

This block is used for reading water meters from Ista:

-istameter® m

-domaqua® m

The block can only be used in conjunction with the block FB_MBUSKL6781().

Note: The devices are supplied from a battery. The number of read operations is therefore limited. An internal meter prevents communication exceeding 96 times per day on average. The user must make sure that excessive queries are prevented.

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;
stDeviceError      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_IST_IstameterIII

Application

This block is used for reading water meters from Ista:

-istameter III

The block can only be used in conjunction with the block FB_MBUSKL6781().

Note: The devices are supplied from a battery. The number of read operations is therefore limited. An internal meter prevents communication exceeding 96 times per day on average. The user must make sure that excessive queries are prevented.

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stDeviceError      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_IST_PulsonicII

Application

This block is used for reading pulse module from ista:

-Pulsonic II

The block can only be used in conjunction with the block FB_MBUSKL6781().

Note: The devices are supplied from a battery. The number of read operations is therefore limited. An internal meter prevents communication exceeding 96 times per day on average. The user must make sure that excessive queries are prevented.

Functionality of the function block

VAR_INPUT

usiAddress          : USINT;
stSecAdr            : ST_MBUS_SecAdr;
eBaudrate           : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart              : BOOL;
bSND_NKE            : BOOL := TRUE;
bReadInit           : BOOL := TRUE;
tMinSendTime        : TIME := t#2s;
usiUnit             : USINT;
bDisabled           : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy               : BOOL;
bReady              : BOOL;
bError              : BOOL;
eError              : E_MBUS_ERROR;
dwIdNumber          : DWORD;
byStatus            : BYTE;
byGEN               : BYTE;
byCounter           : BYTE;
usiRecivedAdr       : USINT;
eMedium             : E_MBUS_Medium;
sMan                : STRING(3);
stValue             : ST_MBus_Info;
stCurrentValue      : ST_MBus_Info;
stDeviceError       : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue: Meter reading (see ST_MBus_Info).

stCurrentValue: Current flow / power (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom               : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_IST_SensonicII

Application

This block is used for reading heat meters from Ista:

-Sensonic II

The block can only be used in conjunction with the block FB_MBUSKL6781().

Note: The devices are supplied from a battery. The number of read operations is therefore limited. An internal meter prevents communication exceeding 96 times per day on average. The user must make sure that excessive queries are prevented.

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stColdEnergy       : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;
stDeviceError      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stColdEnergy: Meter reading, cold energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Janitza overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Janitza | Electricity meter | UMG96S | FB_MBUS_JAN_UMG96S


FB_MBUS_JAN_UMG96S

Application

This block is used for reading electricity meters from Janitza:

-UMG96S

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress                   : USINT;
stSecAdr                     : ST_MBUS_SecAdr;
eBaudrate                    : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                       : BOOL;
bSND_NKE                     : BOOL := TRUE;
bReadInit                    : BOOL := TRUE;
tMinSendTime                 : TIME := t#2s;
usiUnit                      : USINT;
bDisabled                    : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                        : BOOL;
bReady                       : BOOL;
bError                       : BOOL;
eError                       : E_MBUS_ERROR;
dwIdNumber                   : DWORD;
byStatus                     : BYTE;
byGEN                        : BYTE;
byCounter                    : BYTE;
usiRecivedAdr                : USINT;
eMedium                      : E_MBUS_Medium;
sMan                         : STRING(3);
stActiveEnergy               : ST_MBus_Info;
stActiveEnergyTariff1        : ST_MBus_Info;
stActiveEnergyTariff2        : ST_MBus_Info;
stReactiveEnergy             : ST_MBus_Info;
stReactiveEnergyTariff1      : ST_MBus_Info;
stReactiveEnergyTariff2      : ST_MBus_Info;
stApparentEnergy             : ST_MBus_Info;
stActivePower                : ST_MBus_Info;
stActivePowerL1              : ST_MBus_Info;
stActivePowerL2              : ST_MBus_Info;
stActivePowerL3              : ST_MBus_Info;
stReactivePower              : ST_MBus_Info;
stApparentPower              : ST_MBus_Info;
stCurrent                    : ST_MBus_Info;
stCurrentL1                  : ST_MBus_Info;
stCurrentL2                  : ST_MBus_Info;
stCurrentL3                  : ST_MBus_Info;
stVoltageL1                  : ST_MBus_Info;
stVoltageL2                  : ST_MBus_Info;
stVoltageL3                  : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stActiveEnergy: Meter reading, active energy (telegram 2, data point 14) (see ST_MBus_Info).

stActiveEnergyTariff1: Meter reading, active energy, tariff 1(telegram 2, data point 15) (see ST_MBus_Info).

stActiveEnergyTariff2: Meter reading, active energy, tariff 2(telegram 2, data point 16) (see ST_MBus_Info).

stReactiveEnergy: Meter reading, reactive energy (telegram 2, data point 17) (see ST_MBus_Info).

stReactiveEnergyTariff1: Meter reading, reactive energy, tariff 1(telegram 2, data point 18) (see ST_MBus_Info).

stReactiveEnergyTariff2: Meter reading, reactive energy, tariff 2(telegram 2, data point 19) (see ST_MBus_Info).

stApparentEnergy: Meter reading, apparent energy (telegram 2, data point 20) (see ST_MBus_Info).

stActivePower: Active power (telegram 2, data point 29) (see ST_MBus_Info).

stActivePowerL1: Active power phase L1 (telegram 2, data point 38) (see ST_MBus_Info).

stActivePowerL2: Active power phase L2 (telegram 2, data point 39) (see ST_MBus_Info).

stActivePowerL3: Active power phase L3 (telegram 2, data point 40) (see ST_MBus_Info).

stReactivePower: Reactive power (telegram 2, data point 30) (see ST_MBus_Info).

stApparentPower: Apparent power (telegram 2, data point 31) (see ST_MBus_Info).

stCurrent: Current (telegram 2, data point 28) (see ST_MBus_Info).

stCurrentL1: Current phase L1 (telegram 2, data point 35) (see ST_MBus_Info).

stCurrentL2: Current phase L2 (telegram 2, data point 36) (see ST_MBus_Info).

stCurrentL3: Current phase L3 (telegram 2, data point 37) (see ST_MBus_Info).

stVoltageL1: Voltage phase L1 (telegram 2, data point 32) (see ST_MBus_Info).

stVoltageL2: Voltage phase L2 (telegram 2, data point 33) (see ST_MBus_Info).

stVoltageL3: Voltage phase L3 (telegram 2, data point 34) (see ST_MBus_Info).

VAR_IN_OUT

stCom                        : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Kamstrup overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Kamstrup | Electricity meter | Kamstrup 162 | FB_MBUS_KAM_KamstrupE
 | Electricity meter | Kamstrup 351 | FB_MBUS_KAM_KamstrupE
 | Electricity meter | Kamstrup 382 | FB_MBUS_KAM_KamstrupE
 | Heat/cold meter | Maxical III | FB_MBUS_KAM_Maxical_III
 | Heat/cold meter | Multical 401 | FB_MBUS_KAM_Multical
 | Heat/cold meter | Multical 402 | FB_MBUS_KAM_Multical402
 | Water meter | Multical 41 | FB_MBUS_KAM_Multical41
 | Heat/cold meter | Multical 601 | FB_MBUS_KAM_Multical601


FB_MBUS_KAM_KamstrupE

Application

This block is used for reading electricity meters from Kamstrup:

-Kamstrup 162

-Kamstrup 351

-Kamstrup 382

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_KAM_Maxical_III

Application

This block is used for reading heat/cold meters from Kamstrup:

-Maxical III

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_KAM_Multical

Application

This block is used for reading heat/cold meters from Kamstrup:

-Multical 401

-Multical 601

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_KAM_Multical402

Application

This module is used to readout energy calculators of the manufacturer Kamstrup.

It can only be used together with the module FB_MBUSKL6781()

Functionality of the module

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stEnergyHeating         : ST_MBus_Info;
stVolume                : ST_MBus_Info;
stOnTime                : ST_MBus_Info;
stTempFlow              : ST_MBus_Info;
stTempReturn            : ST_MBus_Info;
stTempDiff              : ST_MBus_Info;
stPowerActual           : ST_MBus_Info;
stPowerMax              : ST_MBus_Info;
stFlowActual            : ST_MBus_Info;
stFlowMax               : ST_MBus_Info;
stTariff2               : ST_MBus_Info;
stTariff3               : ST_MBus_Info;
stPulseInputA           : ST_MBus_Info;
stPulseInputB           : ST_MBus_Info;
stEnergyCooling         : ST_MBus_Info;
stDateTime              : ST_MBus_Info;
stEnergyHeatingTarget   : ST_MBus_Info;
stVolumeTarget          : ST_MBus_Info;
stPowerMaxTarget        : ST_MBus_Info;
stFlowMaxTarget         : ST_MBus_Info;
stTariff2Target         : ST_MBus_Info;
stTariff3Target         : ST_MBus_Info;
stPulseInputATarget     : ST_MBus_Info;
stPulseInputBTarget     : ST_MBus_Info;
stEnergyCoolingTarget   : ST_MBus_Info;
stDateTarget            : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergyHeating: Heat energy (see ST_MBus_Info).

stVolume: Volume (see ST_MBus_Info).

stOnTime: Operating hours (see ST_MBus_Info).

stTempFlow: Flow temperature (see ST_MBus_Info).

stTempReturn: Return temperature (see ST_MBus_Info).

stTempDiff: Temperature difference (see ST_MBus_Info).

stPowerActual: Actual active power (see ST_MBus_Info).

stPowerMax: Active power (maximum) (see ST_MBus_Info).

stFlowActual: Actual flow (see ST_MBus_Info).

stFlowMax: Flow (maximum) (see ST_MBus_Info).

stTariff2: Tariff 2 (see ST_MBus_Info).

stTariff3: Tariff 3 (see ST_MBus_Info).

stPulseInputA: Pulse input A (see ST_MBus_Info).

stPulseInputB: Pulse input B (see ST_MBus_Info).

stEnergyCooling: Cooling energy (see ST_MBus_Info).

stDateTime: Date and time (see ST_MBus_Info).

stEnergyHeatingTarget: See manufacturer information (see ST_MBus_Info).

stVolumeTarget: See manufacturer information (see ST_MBus_Info).

stPowerMaxTarget: See manufacturer information (see ST_MBus_Info).

stFlowMaxTarget: See manufacturer information (see ST_MBus_Info).

stTariff2Target: See manufacturer information (see ST_MBus_Info).

stTariff3Target: See manufacturer information (see ST_MBus_Info).

stPulseInputATarget: See manufacturer information (see ST_MBus_Info).

stPulseInputBTarget: See manufacturer information (see ST_MBus_Info).

stEnergyCoolingTarget: See manufacturer information (see ST_MBus_Info).

stDateTarget: See manufacturer information (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Development environment | Target system type | PLC libraries to include
TwinCAT 2.11 R3/x64 higher than Build 2234 | PC/CX, BX or BC | TcMBus-Library higher than V2.3.0


FB_MBUS_KAM_Multical41

Application

This block is used for reading water meters from Kamstrup:

-Multical 41

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_KAM_Multical601

Application

This block is used for reading heat/cold meters from Kamstrup:

-Multical 601

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress           : USINT;
stSecAdr             : ST_MBUS_SecAdr;
eBaudrate            : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart               : BOOL;
bSND_NKE             : BOOL := TRUE;
bReadInit            : BOOL := TRUE;
tMinSendTime         : TIME := t#2s;
usiUnit              : USINT;
bDisabled            : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                : BOOL;
bReady               : BOOL;
bError               : BOOL;
eError               : E_MBUS_ERROR;
dwIdNumber           : DWORD;
byStatus             : BYTE;
byGEN                : BYTE;
byCounter            : BYTE;
usiRecivedAdr        : USINT;
eMedium              : E_MBUS_Medium;
sMan                 : STRING(3);
stEnergy             : ST_MBus_Info;
stPower              : ST_MBus_Info;
stVolume             : ST_MBus_Info;
stFlow               : ST_MBus_Info;
stForwardTemp        : ST_MBus_Info;
stReturnTemp         : ST_MBus_Info;
stDiffTemp           : ST_MBus_Info;
stCoolingEnergy      : ST_MBus_Info;
stEnergyT2           : ST_MBus_Info;
stEnergyT3           : ST_MBus_Info;
stPulsecounter1      : ST_MBus_Info;
stPulsecounter2      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stCoolingEnergy: Meter reading, cooling energy consumption (see ST_MBus_Info).

stEnergyT2: Meter reading, energy consumption tariff 2 (see ST_MBus_Info).

stEnergyT3: Meter reading, energy consumption tariff 3 (see ST_MBus_Info).

stPulsecounter1: Pulse counter 1 (see ST_MBus_Info).

stPulsecounter2: Pulse counter 2 (see ST_MBus_Info).

VAR_IN_OUT

stCom                : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Kundo overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
KUNDO | Heat/cold meter | Compact WMZ G20 | FB_MBUS_KST_G20
 | Heat/cold meter | Compact WMZ G21 | FB_MBUS_KST_G20
 | External M-Bus module | him1s | FB_MBUS_KST_him1
 | External M-Bus module | him1plus | FB_MBUS_KST_him1
 | Pulse input | him1plus | FB_MBUS_KST_him1Puls


FB_MBUS_KST_G20

Application

This block is used for reading heat/cold meters from KUNDO System Technik:

-Kompakt WZM G20 (with internal M-Bus module)

-Kompakt WZM G21 (with internal M-Bus module)

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_KST_him1

Application

This block is used for reading M-Bus modules from KUNDO System Technik:

-him1s

-him1plus

These modules can be used for reading consumption data from a KUNDO arithmetic unit.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_KST_him1Puls

Application

This block is used for reading M-Bus modules from KUNDO System Technik:

-him1plus (pulse input)

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stValue            : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue: Meter reading (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Landis & Gyr overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Landis & Gyr | Heat/cold meter | ULTRAHEAT 2WR5 | FB_MBUS_LUG_Heat
 | Heat/cold meter | ULTRAHEAT 2WR6 | FB_MBUS_LUG_Heat
 | Heat/cold meter | ULTRAHEAT UH50 | FB_MBUS_LUG_Heat


FB_MBUS_LUG_Heat

Application

This block is used for reading heat/cold meters from Landis & Gyr:

-2WR5

-2WR6

-UH50

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 1200, 2400, 4800 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Metrima overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Metrima | Heat meter | F22 (standard values) | FB_MBUS_SVM_F22
 |  | F22 (with additional output values) | FB_MBUS_SVM_F22_Ext


FB_MBUS_SVM_F22

Application

This block is used for reading heat meters from Metrima:

-F22

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress           : USINT;
stSecAdr             : ST_MBUS_SecAdr;
eBaudrate            : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart               : BOOL;
bSND_NKE             : BOOL := TRUE;
bReadInit            : BOOL := TRUE;
tMinSendTime         : TIME := t#2s;
usiUnit              : USINT;
bDisabled            : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                : BOOL;
bReady               : BOOL;
bError               : BOOL;
eError               : E_MBUS_ERROR;
dwIdNumber           : DWORD;
byStatus             : BYTE;
byGEN                : BYTE;
byCounter            : BYTE;
usiRecivedAdr        : USINT;
eMedium              : E_MBUS_Medium;
sMan                 : STRING(3);
stEnergy             : ST_MBus_Info;
stVolume             : ST_MBus_Info;
stVolume2            : ST_MBus_Info;
stForwardTemp        : ST_MBus_Info;
stReturnTemp         : ST_MBus_Info;
stDiffTemp           : ST_MBus_Info;
stFlow               : ST_MBus_Info;
stPower              : ST_MBus_Info;
stPulsecounter1      : ST_MBus_Info;
stPulsecounter2      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stVolume2: Volume according to energy (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stPulsecounter1: Pulse counter 1 (see ST_MBus_Info).

stPulsecounter2: Pulse counter 2 (see ST_MBus_Info).

VAR_IN_OUT

stCom                : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_SVM_F22_Ext

Application

This block is used for reading heat meters from Metrima:

-F22

The block can only be used in conjunction with the block FB_MBUSKL6781().

Note: This block is not suitable for BC / BX.

Functionality of the function block

VAR_INPUT

usiAddress            : USINT;
stSecAdr              : ST_MBUS_SecAdr;
eBaudrate             : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                : BOOL;
bSND_NKE              : BOOL := TRUE;
bReadInit             : BOOL := TRUE;
tMinSendTime          : TIME := t#2s;
usiUnit               : USINT;
bDisabled             : BOOL := FALSE;
bMonthstorages        : BOOL;
byMonthstorages       : BYTE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

bMonthstorages:

byMonthstorages:

VAR_OUTPUT

bBusy                 : BOOL;
bReady                : BOOL;
bError                : BOOL;
eError                : E_MBUS_ERROR;
dwIdNumber            : DWORD;
byStatus              : BYTE;
byGEN                 : BYTE;
byCounter             : BYTE;
usiRecivedAdr         : USINT;
eMedium               : E_MBUS_Medium;
sMan                  : STRING(3);
stEnergy              : ST_MBus_Info;
stVolume              : ST_MBus_Info;
stVolume2             : ST_MBus_Info;
stForwardTemp         : ST_MBus_Info;
stReturnTemp          : ST_MBus_Info;
stDiffTemp            : ST_MBus_Info;
stFlow                : ST_MBus_Info;
stPower               : ST_MBus_Info;
stPulsecounter1       : ST_MBus_Info;
stPulsecounter2       : ST_MBus_Info;
arrAccountAccums      : ARRAY [1..2] OF ST_MBus_F22;
arrMonthlyAccums      : ARRAY [1..37] OF ST_MBus_F22;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stVolume2: Meter reading, volume (Corresponding to energy registers) (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stPulsecounter1: Pulse counter 1 (see ST_MBus_Info).

stPulsecounter2: Pulse counter 2 (see ST_MBus_Info).

arrAccountAccums: 2 Account (Energy, Volume from watermeter, Volume according to energy, Pulse counter 1 H.C.A coded, Pulse counter 2 H.C.A coded, Date). Values are read only if bMonthstorages = true.

arrMonthlyAccums: Max. 37 monthstorages (Energy, Volume from watermeter, Volume according to energy, Pulse counter 1 H.C.A coded, Pulse counter 2 H.C.A coded, Date). Values are read only if bMonthstorages = true. The number of values depends on the variable byMonthstorages.

VAR_IN_OUT

stCom                 : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:


NZR overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
NZR | Electricity meter | EcoCount „S“ | FB_MBUS_TIP_SINUS85M
 | 2-way pulse adapter | IC-M2 | FB_MBUS_NZR_ICM2
 | 2-way pulse adapter | IC-M2C | FB_MBUS_NZR_ICM2
 | Water meter | Modularis 2 | FB_MBUS_NZR_Modularis2


FB_MBUS_NZR_ICM2

Application

This block is used for reading energy meters with pulse output from NZR:

-IC-M2

-IC-M2C

The block can only be used in conjunction with the block FB_MBUSKL6781().

Up to 2 encoder can be connected simultaneously to an IC-M2 / IC-M2C. The IC-M2 / IC-M2C behaves like 2 independent slaves.

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stValue            : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue: Meter reading (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_NZR_Modularis2

Application

This block is used for reading water meters from NZR:

-Modularis 2

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


OPTEC overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
OPTEC | Electricity meter | ECS Typ 2 | FB_MBUS_OPT_ECSType2


FB_MBUS_OPT_ECSType2

Application

This block is used for reading electricity meters from OPTEC:

-ECS (Default values type 2)

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress            : USINT;
stSecAdr              : ST_MBUS_SecAdr;
eBaudrate             : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                : BOOL;
bSND_NKE              : BOOL := TRUE;
bReadInit             : BOOL := TRUE;
tMinSendTime          : TIME := t#2s;
usiUnit               : USINT;
bDisabled             : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                 : BOOL;
bReady                : BOOL;
bError                : BOOL;
eError                : E_MBUS_ERROR;
dwIdNumber            : DWORD;
byStatus              : BYTE;
byGEN                 : BYTE;
byCounter             : BYTE;
usiRecivedAdr         : USINT;
eMedium               : E_MBUS_Medium;
sMan                  : STRING(3);
stEnergyT1_L1         : ST_MBus_Info;
stEnergyT1_L2         : ST_MBus_Info;
stEnergyT1_L3         : ST_MBus_Info;
stEnergyT1_Total      : ST_MBus_Info;
stEnergyT2_L1         : ST_MBus_Info;
stEnergyT2_L2         : ST_MBus_Info;
stEnergyT2_L3         : ST_MBus_Info;
stEnergyT2_Total      : ST_MBus_Info;
stPowerL1             : ST_MBus_Info;
stPowerL2             : ST_MBus_Info;
stPowerL3             : ST_MBus_Info;
stPowerTotal          : ST_MBus_Info;
stActiveTariff        : ST_MBus_Info;
stStatusByte4         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergyT1_L1: Meter reading, active energy, tariff 1, phase L1 (see ST_MBus_Info).

stEnergyT1_L2: Meter reading, active energy, tariff 1, phase L2 (see ST_MBus_Info).

stEnergyT1_L3: Meter reading, active energy, tariff 1, phase L3 (see ST_MBus_Info).

stEnergyT1_Total: Meter reading, active energy, tariff 1, total (see ST_MBus_Info).

stEnergyT2_L1: Meter reading, active energy, tariff 2, phase L1 (see ST_MBus_Info).

stEnergyT2_L2: Meter reading, active energy, tariff 2, phase L2 (see ST_MBus_Info).

stEnergyT2_L3: Meter reading, active energy, tariff 2, phase L3 (see ST_MBus_Info).

stEnergyT2_Total: Meter reading, active energy, tariff 2, total (see ST_MBus_Info).

stPowerL1: Active power, phase L1 (see ST_MBus_Info).

stPowerL2: Active power, phase L2 (see ST_MBus_Info).

stPowerL3: Active power, phase L3 (see ST_MBus_Info).

stPowerTotal: Active power, total (see ST_MBus_Info).

stActiveTariff: Current tariff (see ST_MBus_Info).

stStatusByte4: Range overflow alarms (see ST_MBus_Info).

VAR_IN_OUT

stCom                 : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Relay overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Relay | 1-4 analog inputs | AnDi 1-4 | FB_MBUS_REL_AnDi
 | 4 digital inputs | PadIn 4 | FB_MBUS_REL_PadIn4
 | 1-way pulse adapter | PadPuls M1 | FB_MBUS_REL_PadPulsM1
 | 1-way pulse adapter | PadPuls M1C | FB_MBUS_REL_PadPulsM1
 | 2-way pulse adapter | PadPuls M2 | FB_MBUS_REL_PadPulsM2
 | 2-way pulse adapter | PadPuls M2C | FB_MBUS_REL_PadPulsM2
 | 4-way pulse adapter | PadPuls M4 | FB_MBUS_REL_PadPulsM4
 | 4-way pulse adapter | PadPuls M4L | FB_MBUS_REL_PadPulsM4


FB_MBUS_REL_AnDi

Application

This block is used for reading analog converters from Relay:

-AnDi 1 (1x 0/4-20 mA or 0-10 V)

-AnDi 2 (2x 0/4-20 mA or 0-10 V)

-AnDi 3 (3x 0/4-20 mA or 0-10 V)

-AnDi 4 (4x 0/4-20 mA or 0-10 V)

The block can only be used in conjunction with the block FB_MBUSKL6781().

Up to 4 sensors can be connected simultaneously to an AnDi 1/2/3/4. The AnDi 1/2/3/4 behaves like 4 independent slaves.

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stValue            : ST_MBus_Info;
stMax              : ST_MBus_Info;
stOffset           : ST_MBus_Info;
byInfo             : BYTE;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue: Meter reading (see ST_MBus_Info).

stMax: Maximum value (see ST_MBus_Info).

stOffset: Offset (see ST_MBus_Info).

byInfo: Byte with the following information:
nBit7-4: Information about the available modules in AnDi4
nBit3: protection bit (1: protected)
nBit2-1: no. of selected channel (0: Port1 ... 3: Port4)
nBit0: operating mode (1: current, 2: voltage)

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_REL_PadIn4

Application

This block is used for reading digital inputs from Relay:

-PadIn 4 (4 digital inputs)

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
bDataIn1           : BOOL;
bDataIn2           : BOOL;
bDataIn3           : BOOL;
bDataIn4           : BOOL;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

bDataIn1: Input 1.

bDataIn2: Input 2.

bDataIn3: Input 3.

bDataIn4: Input 4.

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_REL_PadPulsM1

Application

This block is used for reading energy meters with pulse output from Relay:

-PadPuls M1

-PadPuls M1C

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stValue            : ST_MBus_Info;
byNumerator        : BYTE;
byDenominator      : BYTE;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue: Meter reading (see ST_MBus_Info).

byNumerator: Numerator Impulse value.

byDenominator: Denominator Impulse value.

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_REL_PadPulsM2

Application

This block is used for reading energy meters with pulse output from Relay:

-PadPuls M2

-PadPuls M2C

The block can only be used in conjunction with the block FB_MBUSKL6781().

Up to 2 encoder can be connected simultaneously to an PadPuls M2 / PadPuls M2C. The PadPuls M2 / PadPuls M2C behaves like 2 independent slaves.

Functionality of the function block

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
usiUnit                 : USINT;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stValue                 : ST_MBus_Info;
stDateTime              : ST_MBus_Info;
stValueDueDay           : ST_MBus_Info;
stDateDueDay            : ST_MBus_Info;
stDateFutureDueDay      : ST_MBus_Info;
byInfo                  : BYTE;
byNumerator             : BYTE;
byDenominator           : BYTE;
byPStat                 : BYTE;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue: Meter reading (see ST_MBus_Info).

stDateTime: Current date (see ST_MBus_Info).

stValueDueDay: Due-date counter (see ST_MBus_Info).

stDateDueDay: Last due-date, date of the due-date counter (see ST_MBus_Info).

stDateFutureDueDay: Next (future) due-date (see ST_MBus_Info).

byInfo: 1 byte with information about tariff and sampling method.

byNumerator: Numerator of pulse increment (1..99).

byDenominator: denominator of pulse increment (1..255, 0 -> 256).

byPStat: State of inputs (current input state of the ports).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_REL_PadPulsM4

Application

This block is used for reading energy meters with pulse output from Relay:

-PadPuls M4

-PadPuls M4L

The block can only be used in conjunction with the block FB_MBUSKL6781().

Up to 4 encoder can be connected simultaneously to an PadPulse M4 / PadPulse M4L. The PadPulse M4 / PadPulse M4L behaves like 4 independent slaves.

Functionality of the function block

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
usiUnit                 : USINT;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stValue                 : ST_MBus_Info;
stDateTime              : ST_MBus_Info;
stValueDueDay           : ST_MBus_Info;
stDateDueDay            : ST_MBus_Info;
stDateFutureDueDay      : ST_MBus_Info;
byInfo                  : BYTE;
byNumerator             : BYTE;
byDenominator           : BYTE;
byPStat                 : BYTE;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stValue: Meter reading (see ST_MBus_Info).

stDateTime: Current date (see ST_MBus_Info).

stValueDueDay: Due-date counter (see ST_MBus_Info).

stDateDueDay: Last due-date, date of the due-date counter (see ST_MBus_Info).

stDateFutureDueDay: Next (future) due-date (see ST_MBus_Info).

byInfo: 1 byte with information about tariff and sampling method.

byNumerator: Numerator of pulse increment (1..99).

byDenominator: Denominator of pulse increment (1..255, 0 -> 256).

byPStat: State of inputs (current input state of the ports).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Saia-Burgess overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Saia-Burgess | Electricity meter | ALD1 | FB_MBUS_SBC_ALD1
 | Electricity meter | ALE3 | FB_MBUS_SBC_ALE3
 | Electricity meter | AWD3 | FB_MBUS_SBC_ALE3


FB_MBUS_SBC_ALD1

Application

This block is used for reading electricity meters from Saia-Burgess:

-ALD1

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress           : USINT;
stSecAdr             : ST_MBUS_SecAdr;
eBaudrate            : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart               : BOOL;
bSND_NKE             : BOOL := TRUE;
bReadInit            : BOOL := TRUE;
tMinSendTime         : TIME := t#2s;
usiUnit              : USINT;
bDisabled            : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                : BOOL;
bReady               : BOOL;
bError               : BOOL;
eError               : E_MBUS_ERROR;
dwIdNumber           : DWORD;
byStatus             : BYTE;
byGEN                : BYTE;
byCounter            : BYTE;
usiRecivedAdr        : USINT;
eMedium              : E_MBUS_Medium;
sMan                 : STRING(3);
stEnergyTotal        : ST_MBus_Info;
stEnergyPartial      : ST_MBus_Info;
stVoltage            : ST_MBus_Info;
stCurrent            : ST_MBus_Info;
stPower              : ST_MBus_Info;
stReactivPower       : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergyTotal: Meter reading, total energy (see ST_MBus_Info).

stEnergyPartial: Meter reading, energy partial (see ST_MBus_Info).

stVoltage: Voltage (see ST_MBus_Info).

stCurrent: Electric current (see ST_MBus_Info).

stPower: Power (see ST_MBus_Info).

stReactivPower: Reactive power (see ST_MBus_Info).

VAR_IN_OUT

stCom                : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_SBC_ALE3

Application

This block is used for reading electricity meters from Saia-Burgess:

-ALE3

-AWD3

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress                : USINT;
stSecAdr                  : ST_MBUS_SecAdr;
eBaudrate                 : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                    : BOOL;
bSND_NKE                  : BOOL := TRUE;
bReadInit                 : BOOL := TRUE;
tMinSendTime              : TIME := t#2s;
usiUnit                   : USINT;
bDisabled                 : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                     : BOOL;
bReady                    : BOOL;
bError                    : BOOL;
eError                    : E_MBUS_ERROR;
dwIdNumber                : DWORD;
byStatus                  : BYTE;
byGEN                     : BYTE;
byCounter                 : BYTE;
usiRecivedAdr             : USINT;
eMedium                   : E_MBUS_Medium;
sMan                      : STRING(3);
stEnergyT1total           : ST_MBus_Info;
stEnergyT1partial         : ST_MBus_Info;
stEnergyT2total           : ST_MBus_Info;
stEnergyT2partial         : ST_MBus_Info;
stVoltageL1               : ST_MBus_Info;
stCurrentL1               : ST_MBus_Info;
stPowerL1                 : ST_MBus_Info;
stReactivPowerL1          : ST_MBus_Info;
stVoltageL2               : ST_MBus_Info;
stCurrentL2               : ST_MBus_Info;
stPowerL2                 : ST_MBus_Info;
stReactivPowerL2          : ST_MBus_Info;
stVoltageL3               : ST_MBus_Info;
stCurrentL3               : ST_MBus_Info;
stPowerL3                 : ST_MBus_Info;
stReactivPowerL3          : ST_MBus_Info;
stCurrTransFactor         : ST_MBus_Info;
stPowerTotal              : ST_MBus_Info;
stReactivePowerTotal      : ST_MBus_Info;
stTariff                  : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergyT1total: Meter reading, total energy, tariff 1 (see ST_MBus_Info).

stEnergyT1partial: Meter reading, energy partial, tariff 1 (see ST_MBus_Info).

stEnergyT2total: Meter reading, total energy, tariff 1 (see ST_MBus_Info).

stEnergyT2partial: Meter reading, energy partial, tariff 2 (see ST_MBus_Info).

stVoltageL1: Voltage phase 1 (see ST_MBus_Info).

stCurrentL1: Electric Current phase 1 (see ST_MBus_Info).

stPowerL1: Power phase 1 (see ST_MBus_Info).

stReactivPowerL1: Reactive power phase 1 (see ST_MBus_Info).

stVoltageL2: Voltage phase 2 (see ST_MBus_Info).

stCurrentL2: Electric Current phase 2 (see ST_MBus_Info).

stPowerL2: Power phase 2 (see ST_MBus_Info).

stReactivPowerL2: Reactive power phase 2 (see ST_MBus_Info).

stVoltageL3: Voltage phase 3 (see ST_MBus_Info).

stCurrentL3: Electric Current phase 3 (see ST_MBus_Info).

stPowerL3: Power phase 3 (see ST_MBus_Info).

stReactivPowerL3: Reactive power phase 3 (see ST_MBus_Info).

stCurrTransFactor: Transformation factor of the current transformer (=0 for ALE3 device) (see ST_MBus_Info).

stPowerTotal: Power total (see ST_MBus_Info).

stReactivePowerTotal: Reactive Power total (see ST_MBus_Info).

stTariff: Current tariff (=0 for AWD3 device) (see ST_MBus_Info).

VAR_IN_OUT

stCom                     : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Schlumberger overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Schlumberger | Heat meter | Integral-Mk MaXX | FB_MBUS_SLB_MK_MaXX
 | Heat meter | CF Echo I | FB_MBUS_SLB_CFEchoI


FB_MBUS_SLB_CFEchoI

Application

This block is used for reading heat meters from Schlumberger:

-CF Echo I

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_SLB_MK_MaXX

Application

This block is used for reading heat meters from Schlumberger:

-Integral-MK Maxx / Up to 4 additional water meters can be connected to this device.

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;
stVolume1          : ST_MBus_Info;
stVolume2          : ST_MBus_Info;
stVolume3          : ST_MBus_Info;
stVolume4          : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

stVolume1: Meter reading of additional water meter 1 (see ST_MBus_Info).

stVolume2: Meter reading of additional water meter 2 (see ST_MBus_Info).

stVolume3: Meter reading of additional water meter 3 (see ST_MBus_Info).

stVolume4: Meter reading of additional water meter 4 (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Sensus overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Sensus | Heat/cold meter | PolluStat E | FB_MBUS_SEN_Pollu
 | Heat/cold meter | PolluTherm | FB_MBUS_SEN_Pollu
 | Heat/cold meter | PolluCom E | FB_MBUS_SEN_Pollu
 | Water meter |  | FB_MBUS_SEN_Water


FB_MBUS_SEN_Pollu

Application

This block is used for reading heat/cold meters from Sensus:

-PolluStat E

-PolluCom E

-PolluTherm

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
usiUnit            : USINT;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stEnergy           : ST_MBus_Info;
stPower            : ST_MBus_Info;
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;
stForwardTemp      : ST_MBus_Info;
stReturnTemp       : ST_MBus_Info;
stDiffTemp         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDiffTemp: Temperature difference (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


FB_MBUS_SEN_Water

Application

This block is used for reading water meters from Sensus

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress         : USINT;
stSecAdr           : ST_MBUS_SecAdr;
eBaudrate          : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart             : BOOL;
bSND_NKE           : BOOL := TRUE;
bReadInit          : BOOL := TRUE;
tMinSendTime       : TIME := t#2s;
bDisabled          : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy              : BOOL;
bReady             : BOOL;
bError             : BOOL;
eError             : E_MBUS_ERROR;
dwIdNumber         : DWORD;
byStatus           : BYTE;
byGEN              : BYTE;
byCounter          : BYTE;
usiRecivedAdr      : USINT;
eMedium            : E_MBUS_Medium;
sMan               : STRING(3);
stVolume           : ST_MBus_Info;
stFlow             : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

VAR_IN_OUT

stCom              : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


Sontex overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
Sontex | Heat/cold meter | Supercal 531 (standard values) | FB_MBUS_SON_Supercal531


FB_MBUS_SON_Supercal531

Application

This block is used for reading heat/cold meters from Sontex:

-Supercal 531

The block can only be used in conjunction with the block FB_MBUSKL6781().

Functionality of the function block

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
usiUnit                 : USINT;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stEnergy                : ST_MBus_Info;
stPower                 : ST_MBus_Info;
stVolume                : ST_MBus_Info;
stFlow                  : ST_MBus_Info;
stForwardTemp           : ST_MBus_Info;
stReturnTemp            : ST_MBus_Info;
stEnergyTariff1         : ST_MBus_Info;
stVolumeTariff1         : ST_MBus_Info;
stEnergyTariff2         : ST_MBus_Info;
stVolumeTariff2         : ST_MBus_Info;
stTypTariff1            : ST_MBus_Info;
stLimitLowTariff1       : ST_MBus_Info;
stLimitHighTariff1      : ST_MBus_Info;
stTypTariff2            : ST_MBus_Info;
stLimitLowTariff2       : ST_MBus_Info;
stLimitHighTariff2      : ST_MBus_Info;
stDeviceError           : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stVolume: Meter reading, volume (see ST_MBus_Info).

stFlow: Current flow (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stEnergyTariff1: Meter reading, energy consumption tariff 1 (see ST_MBus_Info).

stVolumeTariff1: Meter reading, water consumption tariff 1 (see ST_MBus_Info).

stEnergyTariff2: Meter reading, energy consumption tariff 2 (see ST_MBus_Info).

stVolumeTariff2: Meter reading, water consumption tariff 2 (see ST_MBus_Info).

stTypTariff1: Type tariff 1 (see ST_MBus_Info).

stLimitLowTariff1: Lower limit value tariff 1 (see ST_MBus_Info).

stLimitHighTariff1: Upper limit value tariff 1 (see ST_MBus_Info).

stTypTariff2: Type tariff 2 (see ST_MBus_Info).

stLimitLowTariff2: Lower limit value tariff 2 (see ST_MBus_Info).

stLimitHighTariff2: Upper limit value tariff 2 (see ST_MBus_Info).

stDeviceError: Error message from the device (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"


TIP overview

Please note: These function-blocks will only show a selection of the common device-information. A detailed description of this information can be found on the particular pages under "VAR_OUT" . If more or all data is needed, the following function-blocks can be used: FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Please note, that these function-blocks will not work on BC- and BX-Systems. In order to send data to a device (e.g. setting the primary address), the function-block FB_MBUS_General_Send can be used.

Manufacturer | Type | Device | Block
TIP | Electricity meter | SINUS 85 M | FB_MBUS_TIP_SINUS85M


FB_MBUS_TIP_SINUS85M

Application

This module is used to readout electricity meters of the manufacturer Thüringer Industrie Produkte GmbH.

Compatible to EcoCount „S“ of manufacturer NZR.

It can only be used together with the module FB_MBUSKL6781().

Functionality of the module

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stActivePowerTariff1    : ST_MBus_Info;
stActivePowerTariff2    : ST_MBus_Info;
stApparentPowerL1       : ST_MBus_Info;
stApparentPowerL2       : ST_MBus_Info;
stApparentPowerL3       : ST_MBus_Info;
stApparentPowerTotal    : ST_MBus_Info;
stActivePowerL1         : ST_MBus_Info;
stActivePowerL2         : ST_MBus_Info;
stActivePowerL3         : ST_MBus_Info;
stActivePowerTotal      : ST_MBus_Info;
stReactivePowerL1       : ST_MBus_Info;
stReactivePowerL2       : ST_MBus_Info;
stReactivePowerL3       : ST_MBus_Info;
stReactivePowerTotal    : ST_MBus_Info;
stVoltageL1             : ST_MBus_Info;
stVoltageL2             : ST_MBus_Info;
stVoltageL3             : ST_MBus_Info;
stPowerLineFrequency    : ST_MBus_Info;
stCurrentTariff         : ST_MBus_Info;
stCurrentL1             : ST_MBus_Info;
stCurrentL2             : ST_MBus_Info;
stCurrentL3             : ST_MBus_Info;
stCurrentTotal          : ST_MBus_Info;
stPowerFactorL1         : ST_MBus_Info;
stPowerFactorL2         : ST_MBus_Info;
stPowerFactorL3         : ST_MBus_Info;
stPowerFactorTotal      : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the counter (secondary address).

byStatus: Status of the counter.

byGEN: Counter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stActivePowerTariff1: Active power import tariff 1 (see ST_MBus_Info).

stActivePowerTariff2: Active power import tariff 2 (see ST_MBus_Info).

stApparentPowerL1: Actual apparent power L1 (see ST_MBus_Info).

stApparentPowerL2: Actual apparent power L2 (see ST_MBus_Info).

stApparentPowerL3: Actual apparent power L3 (see ST_MBus_Info).

stApparentPowerTotal: Actual apparent power total (see ST_MBus_Info).

stActivePowerL1: Actual active power phase L1 (see ST_MBus_Info).

stActivePowerL2: Actual active power phase L2 (see ST_MBus_Info).

stActivePowerL3: Actual active power phase L3 (see ST_MBus_Info).

stActivePowerTotal: Actual active power total (see ST_MBus_Info).

stReactivePowerL1: Actual reactive power phase L1 (see ST_MBus_Info).

stReactivePowerL2: Actual reactive power phase L2 (see ST_MBus_Info).

stReactivePowerL3: Actual reactive power phase L3 (see ST_MBus_Info).

stReactivePowerTotal: Actual reactive power total (see ST_MBus_Info).

stVoltageL1: Actual voltage phase L1 (see ST_MBus_Info).

stVoltageL2: Actual voltage phase L2 (see ST_MBus_Info).

stVoltageL3: Actual voltage phase L3 (see ST_MBus_Info).

stPowerLineFrequency: Actual power line frequency (see ST_MBus_Info).

stCurrentTariff: Actual tariff (see ST_MBus_Info).

stCurrentL1: Actual current phase L1 (see ST_MBus_Info).

stCurrentL2: Actual current phase L2 (see ST_MBus_Info).

stCurrentL3: Actual current phase L3 (see ST_MBus_Info).

stCurrentTotal: Actual current total (see ST_MBus_Info).

stPowerFactorL1: Actual power factor phase L1 (cos Phi) (see ST_MBus_Info).

stPowerFactorL2: Actual power factor phase L2 (cos Phi) (see ST_MBus_Info).

stPowerFactorL3: Actual power factor phase L3 (cos Phi) (see ST_MBus_Info).

stPowerFactorTotal: Actual power factor total (cos Phi) (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Development environment | Target system type | PLC libraries to include
TwinCAT 2.11 R3/x64 higher than Build 2242 | PC/CX, BX or BC | TcMBus-Library higher than V2.4.0


Zenner overview

Hint: These modules output only a selection of the most common data. See the description of these data below "VAR_OUT". If more or all data are necessary, use the modules FB_MBUS_General, FB_MBUS_General_Ext or FB_MBUS_General_Param from the folder General. Notice that these modules are not executable on BC, BX systems. If data have to be send to the device (e.g. setting of the primary address), use the module FB_MBUS_General_Send.

Manufacturer | Type | Device | Block
Zenner | Energy calculator | multidataWR3 | FB_MBUS_ZRM_multidataWR3
 | Heat/cold meter | zelsiusZR | FB_MBUS_ZRM_zelsiusZR


FB_MBUS_ZRM_multidataWR3

Application

This module is used to readout energy calculators of the manufacturer Zenner.

It can only be used together with the module FB_MBUSKL6781().

Functionality of the module

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stEnergy                : ST_MBus_Info;
stVolumeInput1          : ST_MBus_Info;
stVolumeInput2          : ST_MBus_Info;
stDeviceError           : ST_MBus_Info;
stTimepoint             : ST_MBus_Info;
stEnergyTimepoint       : ST_MBus_Info;
stCounterInput1         : ST_MBus_Info;
stCounterInput2         : ST_MBus_Info;
stVolume                : ST_MBus_Info;
stFlow                  : ST_MBus_Info;
stPower                 : ST_MBus_Info;
stForwardTemp           : ST_MBus_Info;
stReturnTemp            : ST_MBus_Info;
stDeviceClock           : ST_MBus_Info;
stBatteryEndDate        : ST_MBus_Info;
stFlowMaxTimepoint      : ST_MBus_Info;
stFlowMax               : ST_MBus_Info;
stPowerMaxTimepoint     : ST_MBus_Info;
stPowerMax              : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the counter (secondary address).

byStatus: Status of the counter. Please refer to device description for meanings.

byGEN: Counter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Counter reading, energy consumption (see ST_MBus_Info).

stVolumeInput1: Volume input 1 (see ST_MBus_Info).

stVolumeInput2: Volume input 2 (see ST_MBus_Info).

stDeviceError: Error state M-Bus output (see ST_MBus_Info).

stTimepoint: Deadline (date and time of the next deadline) (see ST_MBus_Info).

stEnergyTimepoint: Heat energy at the deadline (see ST_MBus_Info).

stCounterInput1: Counter value input 1 at the deadline (see ST_MBus_Info).

stCounterInput2: Counter value input 2 at the deadline (see ST_MBus_Info).

stVolume: Volume (see ST_MBus_Info).

stFlow: Actual flow rate (see ST_MBus_Info).

stPower: Current energy consumption (see ST_MBus_Info).

stForwardTemp: Flow temperature (see ST_MBus_Info).

stReturnTemp: Return temperature (see ST_MBus_Info).

stDeviceClock: Actual counter time (see ST_MBus_Info).

stBatteryEndDate: Probable durability of the battery (see ST_MBus_Info).

stFlowMaxTimepoint: Storage time maximum value flow rate (absolute) (see ST_MBus_Info).

stFlowMax: Maximum value flow rate (absolute) (see ST_MBus_Info).

stPowerMaxTimepoint: Storage time maximum value power (absolute) (see ST_MBus_Info).

stPowerMax: Maximum value power (absolute) (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"

Development environment | Target system type | PLC libraries to include
TwinCAT 2.11 R3/x64 higher than build 2234 | PC/CX, BX or BC | TcMBus-library higher than V2.1.0


FB_MBUS_ZRM_zelsiusZR

Application

This module is used to readout heat/cold meter of the manufacturer Zenner.

It can only be used together with the module FB_MBUSKL6781().

Functionality of the module

VAR_INPUT

usiAddress              : USINT;
stSecAdr                : ST_MBUS_SecAdr;
eBaudrate               : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart                  : BOOL;
bSND_NKE                : BOOL := TRUE;
bReadInit               : BOOL := TRUE;
tMinSendTime            : TIME := t#2s;
bDisabled               : BOOL := FALSE;

usiAddress: Primary address of the counter, that shall be readout with this module.

stSecAdr: Secondary address of the counter, that shall be readout with this module.

eBaudrate: 300, 2400, 9600 baud.

bStart: Positive edge on this input, the meter is read out once.

bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).

bReadInit: After restarting the PLC, the meter is read out once.

tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy                   : BOOL;
bReady                  : BOOL;
bError                  : BOOL;
eError                  : E_MBUS_ERROR;
dwIdNumber              : DWORD;
byStatus                : BYTE;
byGEN                   : BYTE;
byCounter               : BYTE;
usiRecivedAdr           : USINT;
eMedium                 : E_MBUS_Medium;
sMan                    : STRING(3);
stEnergy                : ST_MBus_Info;
stVolumeInput1          : ST_MBus_Info;
stVolumeInput2          : ST_MBus_Info;
stDeviceError           : ST_MBus_Info;
stTimepoint             : ST_MBus_Info;
stEnergyTimepoint       : ST_MBus_Info;
stCounterInput1         : ST_MBus_Info;
stCounterInput2         : ST_MBus_Info;

bBusy: The bBusy output is TRUE while the meter is being read.

bReady: The bReady output is TRUE for one cycle, once meter reading is completed.

bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.

eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).

dwIdNumber: Serial number of the meter (secondary address).

byStatus: Status of the meter. Please refer to device description for meanings.

byGEN: Meter software version.

byCounter: Transmission counter (number of transmitted RSP_UD).

usiRecivedAdr: Received primary address (0-250).

eMedium: Medium (see E_MBUS_Medium).

sMan: Manufacturer code.

stEnergy: Meter reading, energy consumption (see ST_MBus_Info).

stVolumeInput1: Volume Input 1 (see ST_MBus_Info).

stVolumeInput2: Volume Input 2 (see ST_MBus_Info).

stDeviceError: Error state M-Bus output (see ST_MBus_Info).

stTimepoint: Deadline (date and time of the next deadline) (see ST_MBus_Info).

stEnergyTimepoint: Heat energy at the deadline (see ST_MBus_Info).

stCounterInput1: Counter value input 1 at the deadline (see ST_MBus_Info).

stCounterInput2: Counter value input 2 at the deadline (see ST_MBus_Info).

VAR_IN_OUT

stCom                   : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems:

Download sample program for BX systems:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"

Development environment | Target system type | PLC libraries to include
TwinCAT 2.11 R3/x64 higher than Build 2234 | PC/CX, BX or BC | TcMBus-library higher than V2.1.0


Data types

TwinCAT PLC Lib: M-Bus

Datat types/General

Data types | Description
ST_MBus_Data | Value information
ST_MBus_Data2 | Structure of the output values in the block FB_MBUS_General_Ext
ST_MBus_Scan | Information while scanning

Datat types/Hardware Types

Data types | Description
ST_KL6781inData22B | Process image of the inputs
ST_KL6781outData22B | Process image of the outputs

Datat types/Hydrometer

Data types | Description
ST_MBus_DueDayHYD1 | Structure of due day values in the block FB_MBUS_HYD_Sharky_00

Datat types/Metrima

Data types | Description
ST_MBus_F22 | Structure of the monthly values in the block FB_MBUS_SVM_F22_Ext

Data types | Description
E_MBus_Baudrate | Baudrate
E_MBus_Error | Error massage
E_MBus_Fct | Function of the value
E_MBus_Medium | Medium
ST_MBus_Communication | Internal structure
ST_MBus_Info | Value information
ST_MBus_SecAdr | Secundary address


General

Data types | Description
ST_MBus_Data | Value information
ST_MBus_Data2 | Structure of the output values in the block FB_MBUS_General_Ext
ST_MBus_Scan | Information while scanning


ST_MBus_Data

Value information.

TYPE ST_MBus_Data :
STRUCT
  sValue   : STRING(25);
  sUnit    : STRING(20);
  sInfo    : STRING;
  eFct     : E_MBus_Fct;
  iTariff  : INT;
  iStorNo  : INT;
  iUnit    : INT;
  byVIFE   : BYTE;
END_STRUCT
END_TYPE

sValue: Value.

sUnit: Unit.

sInfo: Information.

eFct: Funktion.

iTariff: Tariff.

iStorNo: Storage number.

iUnit: Unit (integer).

byVIFE: VIFE.


ST_MBus_Data2

Structure of the output values in the block FB_MBUS_General_Ext.

TYPE ST_MBus_Data2 :
STRUCT
  arrData  : ARRAY[1..cMBUS_MaxData] OF ST_MBus_Data;
END_STRUCT
END_TYPE

arrData: Values.


ST_MBus_Scan

Information while scanning.

TYPE ST_MBus_Scan :
STRUCT
  usiAddress  : USINT;
  dwIdNumber  : DWORD;
  byStatus    : BYTE;
  eMedium     : E_MBUS_Medium;
  sMan        : STRING(3);
  byGEN       : BYTE;
END_STRUCT
END_TYPE

usiAddress: Primary address of the meter.

dwIdNumber: Serial number of the meter.

byStatus: Status of the meter. Please refer to device description for meanings.

eMedium: Medium.

sMan: Manufacturer code.

byGEN: Meter software version.


Hardware Types

Data types | Description
ST_KL6781inData22B | Process image of the inputs
ST_KL6781outData22B | Process image of the outputs


ST_KL6781inData22B

Process image of the inputs

Is linked to the terminal in the System Manager.

TYPE ST_KL6781inData22B :
STRUCT
  Status  : WORD;
  D       : ARRAY[0..21] OF BYTE;
END_STRUCT
END_TYPE

Status: Status word

D: 22 bytes for input data of the M-Bus


ST_KL6781outData22B

Process image of the outputs.

Is linked to the terminal in the System Manager.

TYPE ST_KL6781outData22B :
STRUCT
  Ctrl  : WORD;
  D     : ARRAY[0..21] OF BYTE;
END_STRUCT
END_TYPE

Ctrl: Control word

D: 22 bytes for output data of the M-Bus


Hydrometer

Data types | Description
ST_MBus_DueDayHYD1 | Structure of due day values in the block FB_MBUS_HYD_Sharky_00


ST_MBus_DueDayHYD1

Structure of due day values in the block FB_MBUS_HYD_Sharky_00.

TYPE ST_MBus_DueDayHYD1 :
STRUCT
  stEnergy            : ST_MBus_Info;
  stVolume            : ST_MBus_Info;
  stTariff1           : ST_MBus_Info;
  stTariff2           : ST_MBus_Info;
  stDate              : ST_MBus_Info;
  stDateFutureDueDay  : ST_MBus_Info;
END_STRUCT
END_TYPE

stEnergy: Meter reading, energy.

stEnergy. sValue: Value.

stEnergy. sUnit: Unit.

stEnergy. eFct: E_MBus_Fct / function.

stVolume: Meter reading, volume.

stVolume. sValue: Value.

stVolume. sUnit: Unit.

stVolume. eFct: E_MBus_Fct / function.

stTariff1: Meter reading, tariff 1.

stTariff1. sValue: Value.

stTariff1. sUnit: Unit.

stTariff1. eFct: E_MBus_Fct / function.

stTariff2: Meter reading, tariff 2.

stTariff2. sValue: Value.

stTariff2. sUnit: Unit.

stTariff2. eFct E_MBus_Fct / function.

stDate: Date.

stDate. sValue Value.

stDate. sUnit: Unit.

stDate. eFct: E_MBus_Fct / function.

stDateFutureDueDay: Date future due day.

stDateFutureDueDay. sValue: Value.

stDateFutureDueDay. sUnit: Unit.

stDateFutureDueDay. eFct E_MBus_Fct / function.


Metrima

Data types | Description
ST_MBus_F22 | Structure of the monthly values in the block FB_MBUS_SVM_F22_Ext


ST_MBus_F22

Structure of the monthly values in the block FB_MBUS_SVM_F22_Ext.

TYPE ST_MBus_F22 :
STRUCT
  stEnergy         : ST_MBus_Info;
  stVolume         : ST_MBus_Info;
  stVolume2        : ST_MBus_Info;
  stPulsecounter1  : ST_MBus_Info;
  stPulsecounter2  : ST_MBus_Info;
  stDate           : ST_MBus_Info;
END_STRUCT
END_TYPE

stEnergy: Meter reading, energy.

stEnergy. sValue: Value.

stEnergy. sUnit: Unit.

stEnergy. eFct: E_MBus_Fct / function.

stVolume: Meter reading, volume.

stVolume. sValue: Value.

stVolume. sUnit: Unit.

stVolume. eFct: E_MBus_Fct / function.

stVolume2: Meter reading, volume.

stVolume2. sValue: Value.

stVolume2. sUnit: Unit.

stVolume2. eFct: E_MBus_Fct / function.

stPulsecounter1: Meter reading, pulse counter 1.

stPulsecounter1. sValue: Value.

stPulsecounter1. sUnit: Unit.

stPulsecounter1. eFct: E_MBus_Fct / function.

stPulsecounter2: Meter reading, pulse counter 2.

stPulsecounter2. sValue: Value.

stPulsecounter2. sUnit: Unit.

stPulsecounter2. eFct: E_MBus_Fct / function.

stDate: Date.

stDate. sValue: Value.

stDate. sUnit: Unit.

stDate. eFct: E_MBus_Fct / function.


E_MBus_Baudrate

Baudrate.

TYPE E_MBus_Baudrate :
(
  eMBUS_NoBaudrate  := 0,
  eMBUS_Baud300     := 30,
  eMBUS_Baud600     := 60,
  eMBUS_Baud1200    := 120,
  eMBUS_Baud2400    := 240,
  eMBUS_Baud4800    := 480,
  eMBUS_Baud9600    := 960,
)
END_TYPE

eMBUS_NoBaudrate: =Standard =2400 baud.

eMBUS_Baud300: 300 baud.

eMBUS_Baud600: 600 baud.

eMBUS_Baud1200: 1200 baud.

eMBUS_Baud2400: 2400 baud.

eMBUS_Baud4800: 4800 baud.

eMBUS_Baud9600: 9600 baud.

M-Bus counters are generally supplied with 2400 baud.

The M-Bus master terminal KL6781 supports 300, 600, 1200, 2400, 4800, 9600 baud.

If the input eBaudrate is not assigned or set to 0, the Bus Terminal is set to 2400 baud.

These values are transferred to the terminal when the PLC is started or when a change takes place at the eBaudrate input.

Not all M-Bus devices support baud rates above 2400. Devices that are set to a different baud rate than eBaudrate are not read.


E_MBus_Error

Error massage.

TYPE E_MBus_Error :
(
  eMBUS_no_error                           := 0,
  eMBUS_busy                               := 1,
  eMBUS_Disabled                           := 3,
  eMBUS_FBKL6781_Disabled                  := 4,

  eMBUSERROR_CIField_wrong_72hex_expected  := 101,
  eMBUSERROR_no_data_received              := 102,
  eMBUSERROR_error_checksum                := 103,
  eMBUSERROR_error_in_head_data            := 104,
  eMBUSERROR_usiAddress_over_250           := 105,
  eMBUSERROR_send_error                    := 106,
  eMBUSERROR_received_address_wrong        := 108,
  eMBUSERROR_cMBUS_MaxCom_below_1          := 109,
  eMBUSERROR_iComId_over_cMBUS_MaxCom      := 110,
  eMBUSERROR_manufacturer_sign_wrong       := 111,
  eMBUSERROR_baudrate_wrong                := 112,
  eMBUSERROR_ReceiveBufferFull             := 113,
  eMBUSERROR_E5hex_no_received             := 114,
  eMBUSERROR_no_stop_character             := 115,
  eMBUSERROR_length_wrong                  := 116,
  eMBUSERROR_wrong_terminal                := 117,
  eMBUSERROR_Terminal_is_not_initialized   := 118,
  eMBUSERROR_stSecAdr_udiIdNumber_wrong    := 119,
  eMBUSERROR_missing_parts_telegram        := 120,
  eMBUSERROR_no_stop_character_received    := 121,
  eMBUSERROR_too_many_characters           := 122,
  eMBUSERROR_TimeOut_FB_KL6781             := 123,
  eMBUSERROR_TimeOut_MeterFB               := 124,

  eMBUSERROR_COM_PARAMETERCHANGED          := 201,
  eMBUSERROR_COM_TXBUFFOVERRUN             := 202,
  eMBUSERROR_COM_STRINGOVERRUN             := 210,
  eMBUSERROR_COM_ZEROCHARINVALID           := 211,
  eMBUSERROR_COM_INVALIDPOINTER            := 220,
  eMBUSERROR_COM_INVALIDRXPOINTER          := 221,
  eMBUSERROR_COM_INVALIDRXLENGTH           := 222,
  eMBUSERROR_COM_DATASIZEOVERRUN           := 223,
  eMBUSERROR_COM_INVALIDBAUDRATE           := 16#1001,
  eMBUSERROR_COM_INVALIDNUMDATABITS        := 16#1002,
  eMBUSERROR_COM_INVALIDNUMSTOPBITS        := 16#1003,
  eMBUSERROR_COM_INVALIDPARITY             := 16#1004,
  eMBUSERROR_COM_INVALIDHANDSHAKE          := 16#1005,
  eMBUSERROR_COM_INVALIDNUMREGISTERS       := 16#1006,
  eMBUSERROR_COM_INVALIDREGISTER           := 16#1007,
  eMBUSERROR_COM_TIMEOUT                   := 16#1008,
)
END_TYPE

eMBUS_no_error: No error is present at the block. The block is currently not querying a counter.

eMBUS_busy: The block is querying a meter.

eMBUS_Disabled: FB is disabled.

eMBUS_FBKL6781_Disabled: Function block FB_MBUSKL6781() is disabled.

eMBUSERROR_CIField_wrong_72hex_expected: The 7th byte in the response telegram contains the CI field. In this byte the hexadecimal number 72 is expected. It stands for variable data structure, low byte is sent first. Only this data structure is supported.

eMBUSERROR_no_data_received: No data was received. This can different have causes, e.g. invalid address, invalid baud rate, incorrect wiring.

eMBUSERROR_error_checksum: The response telegram includes a checksum (sum of all bytes from byte 5). The received checksum does not match the calculated checksum. This happens if the protocol was not received cleanly (e.g. in the event of interference on the cable or if the cable is too long).

eMBUSERROR_error_in_head_data: The first 4 bytes are not included in the checksum. These 4 bytes are monitored separately.

eMBUSERROR_usiAddress_over_250: Addresses higher than 250 are not permitted. The input usiAdress of the meter block was assigned a higher value than 250.

eMBUSERROR_send_error: Error message for error during sending.

eMBUSERROR_received_address_wrong: Received address does not match the sent address.

eMBUSERROR_cMBUS_MaxCom_below_1: Reserve.

eMBUSERROR_iComId_over_cMBUS_MaxCom: Reserve.

eMBUSERROR_manufacturer_sign_wrong: The response telegram includes a manufacturer code. This code is allocated to the meter blocks. This message appears if the received manufacturer code does not match the block used.

eMBUSERROR_baudrate_wrong: Input eBaudrate of the block was assigned invalid values. Only E_MBUS_Baudrate are allowed.

eMBUSERROR_ReceiveBufferFull: The receive buffer of the serial interface is full. This may happen with long telegrams and/or long cycle times. The PLC is unable to read the data quick enough from the receive buffer, resulting in data loss. The situation may be resolved by reducing the cycle time.

eMBUSERROR_E5hex_no_received: E5 no received.

eMBUSERROR_no_stop_character: No stop character.

eMBUSERROR_length_wrong: Data lenght wrong.

eMBUSERROR_wrong_terminal: Wrong terminal.

eMBUSERROR_Terminal_is_not_initialized: Terminal is not initilalized.

eMBUSERROR_stSecAdr_udiIdNumber_wrong: The input variable stSecAdr.udiIdNumber is not used.

eMBUSERROR_missing_parts_telegram: Values (bytes) are missing.

eMBUSERROR_no_stop_character_received: Stop sign was not received (16hex).

eMBUSERROR_too_many_characters: Too many characters have been received.

eMBUSERROR_TimeOut_FB_KL6781: Timeout FB_KL6781.

eMBUSERROR_TimeOut_MeterFB: Timeout meter function block.

eMBUSERROR_COM_PARAMETERCHANGED: Input parameters changed during reception.

eMBUSERROR_COM_TXBUFFOVERRUN: String > transmit buffer.

eMBUSERROR_COM_STRINGOVERRUN: End of string.

eMBUSERROR_COM_ZEROCHARINVALID: String cannot receive zero characters.

eMBUSERROR_COM_INVALIDPOINTER: Invalid data pointer, e. g. zero.

eMBUSERROR_COM_INVALIDRXPOINTER: Invalid data pointer for ReceiveData.

eMBUSERROR_COM_INVALIDRXLENGTH: Invalid length for ReceiveData, e. g. zero

eMBUSERROR_COM_DATASIZEOVERRUN: End of data block.

eMBUSERROR_COM_INVALIDBAUDRATE: Invalid baudrate.

eMBUSERROR_COM_INVALIDNUMDATABITS: Invalid data bits.

eMBUSERROR_COM_INVALIDNUMSTOPBITS: Invalid stop bits.

eMBUSERROR_COM_INVALIDPARITY: Invalid parity.

eMBUSERROR_COM_INVALIDHANDSHAKE: Invalid handshake.

eMBUSERROR_COM_INVALIDNUMREGISTERS: Invalid numregister.

eMBUSERROR_COM_INVALIDREGISTER: Invalid register.

eMBUSERROR_COM_TIMEOUT: COM timeout.


E_MBus_Fct

Function of the value.

TYPE E_MBus_Fct :
(
  eMBUS_ValueNull              := -1,
  eMBUS_InstantaneousValue     := 0,
  eMBUS_Max                    := 1,
  eMBUS_Min                    := 2,
  eMBUS_ValueDuringErrorState  := 3,

  eMBUS_ManufacturerSpecific   := 256,
)
END_TYPE

eMBUS_ValueNull: Unassigned.

eMBUS_InstantaneousValue: Instantaneous value.

eMBUS_Max: Maximum value.

eMBUS_Min: Minimum value.

eMBUS_ValueDuringErrorState: Value during error state.

eMBUS_ManufacturerSpecific: Manufacturer specific.


E_MBus_Medium

Medium.

TYPE E_MBus_Medium :
(
  eMBUS_MediumNull                       := -1,
  eMBUS_MediumOther                      := 0,
  eMBUS_MediumOil                        := 1,
  eMBUS_MediumElectricity                := 2,
  eMBUS_MediumGas                        := 3,
  eMBUS_MediumHeat_Outlet                := 4,
  eMBUS_MediumSteam                      := 5,
  eMBUS_MediumHot_Water                  := 6,
  eMBUS_MediumWater                      := 7,
  eMBUS_MediumHeat_Cost_Allocator        := 8,
  eMBUS_MediumCompressed_Air             := 9,
  eMBUS_MediumCooling_load_meter_outlet  := 10,
  eMBUS_MediumCooling_load_meter_intlet  := 11,
  eMBUS_MediumHeat_inlet                 := 12,
  eMBUS_MediumHeat_cooling_load_Meter    := 13,
  eMBUS_MediumBusSystem                  := 14,
  eMBUS_MediumUnknownMedium              := 15,
  eMBUS_MediumReserved16                 := 16,
  eMBUS_MediumReserved17                 := 17,
  eMBUS_MediumReserved18                 := 18,
  eMBUS_MediumReserved19                 := 19,
  eMBUS_MediumReserved20                 := 20,
  eMBUS_MediumReserved21                 := 21,
  eMBUS_MediumColdWater                  := 22,
  eMBUS_MediumDualWater                  := 23,
  eMBUS_MediumPressure                   := 24,
  eMBUS_MediumA_D_Converter              := 25,
  eMBUS_MediumReserved26                 := 26,
  eMBUS_MediumReserved27                 := 27,
  eMBUS_MediumReserved28                 := 28,
  eMBUS_MediumReserved29                 := 29,
  eMBUS_MediumReserved30                 := 30,
)
END_TYPE

eMBUS_MediumNull: Unassigned.

eMBUS_MediumOther: Other.

eMBUS_MediumOil: Oil.

eMBUS_MediumElectricity: Electricity.

eMBUS_MediumGas: Gas.

eMBUS_MediumHeat_Outlet: Heat outlet.

eMBUS_MediumSteam: Steam.

eMBUS_MediumHot_Water: Hot water.

eMBUS_MediumWater: Water.

eMBUS_MediumHeat_Cost_Allocator: Heat cost allocator.

eMBUS_MediumCompressed_Air: Compressed air.

eMBUS_MediumCooling_load_meter_outlet: Cooling load meter (outlet).

eMBUS_MediumCooling_load_meter_intlet: Cooling load meter (intlet).

eMBUS_MediumHeat_inlet: Heat (inlet).

eMBUS_MediumHeat_cooling_load_Meter: Heat / cooling load meter.

eMBUS_MediumBusSystem: Bus / system.

eMBUS_MediumUnknownMedium: Unknown medium.

eMBUS_MediumReserved16: Reserved.

eMBUS_MediumReserved17: Reserved.

eMBUS_MediumReserved18: Reserved.

eMBUS_MediumReserved19: Reserved.

eMBUS_MediumReserved20: Reserved.

eMBUS_MediumReserved21: Reserved.

eMBUS_MediumColdWater: Cold water.

eMBUS_MediumDualWater: Dual water.

eMBUS_MediumPressure: Pressure.

eMBUS_MediumA_D_Converter: A/D converter.

eMBUS_MediumReserved26: Reserved.

eMBUS_MediumReserved27: Reserved.

eMBUS_MediumReserved28: Reserved.

eMBUS_MediumReserved29: Reserved.

eMBUS_MediumReserved30: Reserved.


ST_MBus_Communication

Internal structure.

About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks.

TYPE ST_MBus_Communication :
STRUCT
  bStart            : BOOL;
  bBusy             : BOOL;
  bSND_NKE          : BOOL;
  bSend             : BOOL;
  bStartManuell     : BOOL;
  bBlockadeSecAdr   : BOOL;
  usiAddress        : USINT;
  byCField          : BYTE;
  stSecAdr          : ST_MBUS_SecAdr;
  eError            : E_MBUS_ERROR;
  eBaudrate         : E_MBUS_Baudrate := eMBUS_Baud2400;
  arrMBusLongFrame  : ARRAY[1..260] OF BYTE;
  bySendByte        : BYTE;
  uiMaxCount        : UINT;
  uiCount           : UINT;
  stKomRxBuffer     : ST_KL6781ComBuffer;
  stKomTxBuffer     : ST_KL6781ComBuffer;
END_STRUCT
END_TYPE

bStart: Start.

bBusy: This bit is set for as long as the block is active.

bSND_NKE: Send SNDK_NKE.

bSend: Send datas.

bStartManuell: Manual start.

bBlockadeSecAdr: Lock in secondary addressing.

usiAddress: Primary address.

byCField: C field.

stSecAdr: Secondary address.

stSecAdr. udiIdNumber: Serial number of the meter.

stSecAdr. uiManufacturer: Manufacturer code.

stSecAdr. usiVersion: Meter software version.

stSecAdr. usiMedium: Medium.

eError: Error massage.

eBaudrate: Baudrate.

arrMBusLongFrame: Received bytes.

bySendByte: Number of bytes.

uiMaxCount: Maximum number of read commands.

uiCount: Current read command.

stKomRxBuffer: Receive buffer.

stKomTxBuffer: Send buffer.


ST_MBus_Info

Value information.

TYPE ST_MBus_Info :
STRUCT
  sValue  : STRING(25);
  sUnit   : STRING(20);
  eFct    : E_MBus_Fct;
END_STRUCT
END_TYPE

sValue: Value.

sUnit: Unit.

eFct: Function.

M-Bus devices may supply very large values, which cannot be displayed or can only be displayed inaccurately as numbers on BC/BX systems. The values are therefore supplied as strings (sValue).

 LREAL is the preferred format for the conversion to a number format, since conversion to REAL (STRING_TO_REAL) would return inaccurate/invalid values if the DWORD value range is exceed. LREAL values cannot be used on BC/BX systems.

Example view of the values of a heat meter:


ST_MBus_SecAdr

Secondary address.

TYPE ST_MBus_SecAdr :
STRUCT
  udiIdNumber     : UDINT:=16#FFFFFFFF;
  uiManufacturer  : UINT:=16#FFFF;
  usiVersion      : USINT:=16#FF;
  usiMedium       : USINT:=16#FF;
END_STRUCT
END_TYPE

udiIdNumber: Serial number of the meter.

uiManufacturer: Manufacturer code.

usiVersion: Meter software version.

usiMedium: Medium.


Resources

TwinCAT PLC Lib: M-Bus

Resources | Description
Globale_Variablen_MBUS | Constants used in the library


Globale_Variablen_MBUS

This constants only included in TcMBus.lib.

If they are being declared in the program, a warning message is generated during program compilation, since the constant already exists. This warning can be ignored.

VAR_GLOBAL CONSTANT
  cMBUS_MaxData       := 40,
  cMBUS_MaxTelegrams  := 2,
  cMBUS_MaxDataParam  := 10,
END_VAR

cMBUS_MaxData: The constant applies to all instances of the blocks FB_MBUS_General(), FB_MBUS_General_Ext() and FB_MBUS_General_Param(). This constant indicates the maximum data volume expected in a meter telegram.

cMBUS_MaxTelegrams: The constant applies to all instances of the FB_MBUS_General_Ext() block. This constant indicates the maximum number of telegrams to be expected.

cMBUS_MaxDataParam: The constant applies to all instances of the FB_MBUS_General_Param() blocks. This constant indicates the maximum number of values to be displayed by the instances of FB_MBUS_General_Param().


Task Configuration

A Task is a time unit in the processing of an IEC program. It is defined by a name, a priority and by a type determining which condition will trigger the start of the task. This condition can be defined by a time only (cyclic).

For each task you can now specify a series of programs that will be started by the task.

The combination of priority and condition will determine in which choronological order the tasks will be executed.

In the Online Mode the task processing can be monitored in a diagram.

The Task Configuration is found as an object in the Resources register card the Object Organizer. The Task editor is opened in a bipartited window.

In the left part of the window the tasks are represented in a configuration tree. At the topmost position you will always find the entry 'Taskconfiguration'. Below there are the entries for the particular tasks, represented by the task name. Below each task entry the assigned program calls are inserted.

In the right part of the window a dialog will be displayed which belongs to the currently marked entry in the configuration tree. Here you can configure the tasks and program calls.

Note
Please do not use the same string function in several tasks, because this may cause program faults by overwriting.

Working with the Task Configuration

The most important commands you find in the context menu (right mouse button).

At the heading of the task configuration are the words "Task Configuration." If a plus sign is located before the words, then the sequence list is closed. By doubleclicking on the list or pressing <Enter>, you can open the list. A minus sign now appears. By doubleclicking once more, you can close the list again.
  • For every task, there is a list of program call-ups attached. Likewise, you can open and close this list the same way.
  • With the "Insert" "Insert Task" command, you can insert a task.
  • With the "Insert" "Append Task" command, you can insert a task at the end of the configuration tree.
  • With the "Insert" "Insert Program Call", a program call will be inserted.

Furtheron for each entry in the configuration tree an appropriate configuration dialog will appear in the right part of the window. There options can be activated/deactivated resp. inputs to editor fields can be made. Depending on which entry is selected in the configuration tree, there will be the dialog for defining the 'Taskattributes' or the dialog for defining a 'Program Call'. The settings made in the dialogs will be taken over to the configuration tree as soon as the focus is set to the tree again.

A task name or program name can also get edited in the configuration tree. For this perform a mouseclick on the name or select the entry and press the <Space> button to open an edit frame.

You can use the arrow keys to select the previous or next entry in the configuration tree.

'Insert' 'Insert Task' or 'Insert' 'Append Task'

With this command you can insert a new task into the task configuration. If a task is selected, then the "Insert Task" command will be at your disposal. The new task will be inserted after the selected one. If the words Task Configuration are selected, then the "Append Task" is available, and the new task will be appended to the end of the existing list. The dialog box will open for you to set the task attributes.

Insert the desired attributes:

  • Name: a name for the task; with this name the task is represented in the configuration tree; the name can be edited there after a mouseclick on the entry or after pressing the <Space> key when the entry is selected.
  • Priority (0-3): (a number between 0 and 31; 0 is the highest priority, 31 is the lowest),
  • Type:
    • cyclic: The task will be processed cyclic according to the time definition given in the field 'Interval'.

Freewheeling, triggered by event or triggered by external event: These task types are not supported!

Properties:

  • Interval (for type 'cyclic'): the period of time, after which the task should be restarted. If you enter a number, then you can choose the desired unit in the selection box behind the edit field: milliseconds [ms] or microseconds [µs]. Inputs in [ms]-format will be shown in the TIME format (e.g. "t#200ms") as soon as the window gets repainted; but you also can directly enter the value in TIME format. Inputs in [ms] will always be displayed as a pure number (e.g. "300").

'Insert' 'Insert Program Call' or 'Insert' 'Append Program Call'

With these commands you will open the dialog box for entering a program call to a task in the task configuration. With "Insert Program Call", the new program call is inserted in front of the cursor, and with "Append Program Call", the program call is appended to the end of the existing list.

In the field, specify a valid program name for your project, or open the Input Assistant with the button... or with <F2> to select a valid program name. The program name can also get edited in the configuration tree. For this perform a mouseclick on the name or select the entry and press the <Space> button to open an edit frame. If the selected program requires input variables, then enter these in their usual form and of the declared type (for example, prg(invar:=17)).

'Extras' 'Set Debug Task'

With this command a debugging task can be set in Online mode in the task configuration. The text [DEBUG] will appear after the set task.
The debugging capabilities apply, then, only to this task. In other words, the program only stops at a breakpoint if the program is gone through by the set task. The setting of the Debug Task is stored in the project and will be set again automatically at log in / download.

Cancel the Debug Mode

To cancel the "Debug-Mode"

  • choose "Task configuration"
  • open the Context menu
  • choose „Set Debug Task“

'Extras' 'Display Callstack'

If the program is stopped at a breakpoint during debugging, then this command can be used to show the callstack of the corresponding POU. For this purpose the debug task must be selected in the task configuration tree. The window 'Callstack of task <task name>' will open. There you get the name of the POU and the breakpoint position (e.g. "prog_x (2)" for line 2 of POU prog_x) . Below the complete call stack is shown in backward order. If you press button 'Go To', the focus will jump to that position in the POU which is currently marked in the callstack.


Configuration with 2 tasks

Right-click Resources (1)/Task configuration (2)/Task configuration (3) and select "Append Task".

Perhaps rename the new task (here "FastTask")

Right-click on "FastTask" and select "Append program call".

Now click on the button to right of the program call and select the program block that calls the block FB_MBUSKL6781() (here "P_Zaehler").

Then set the task time (here 10 ms) and the priority (standard 1, FastTask 0 ).

After a new task was added in PLC Control, the project has to be recompiled and reloaded into the System Manager. The inputs and outputs of the serial interface are then inserted manually into the fast task (here "FastTask").

Finally you have to select the three marked buttons:

1.Check configuration

2.Actvate configuration

3.Set/Reset TwinCAT to Run Mode

Further information on task configuration


Download PC/CX

TwinCAT PLC Lib: M-Bus

Download Beispieldateien für PC/CX

Hersteller | Download
Allgemein |
ABB |
Actaris |
Aquametro |
Berg |
Brunata |
Elster |
EMH |
EMU |
Engelmann |
Gossen Metrawatt |
GWF |
Hydrometer |
ista |
Janitza |
Kamstrup |
KUNDO |
Landis & Gyr |
Metrima |
NZR |
OPTEC |
Relay |
Saia |
Schlumberger |
Sensus |
Sontex |


BX download

TwinCAT PLC Lib: M-Bus

Download sample files for BX

Manufacturer | Download
General |
ABB |
Actaris |
Aquametro |
Berg |
Brunata |
Elster |
EMH |
EMU |
Engelmann |
Gossen Metrawatt |
GWF |
Hydrometer |
ista |
Janitza |
Kamstrup |
KUNDO |
Landis & Gyr |
Metrima |
NZR |
OPTEC |
Relay |
Saia |
Schlumberger |
Sensus |
Sontex |


BC download

TwinCAT PLC Lib: M-Bus

Download sample files for BC

BCxx00 must be set to "Large Model" in the TwinCAT PLC Control under "Project/Options/Controller Settings".

Manufacturer | Download
General |
ABB |
Actaris |
Aquametro |
Berg |
Brunata |
Elster |
EMH |
EMU |
Engelmann |
Gossen Metrawatt |
GWF |
Hydrometer |
ista |
Janitza |
Kamstrup |
KUNDO |
Landis & Gyr |
Metrima |
NZR |
OPTEC |
Relay |
Saia |
Schlumberger |
Sensus |
Sontex |


Further sample downloads

TwinCAT PLC Lib: M-Bus

Download special applications for PC/CX

Description | Download
Read 20 meters with one instance of a meter block |
20x3 meter types |
Secondary addressing |


Support and Service

Beckhoff and their partners around the world offer comprehensive support and service, making available fast and competent assistance with all questions related to Beckhoff products and system solutions.

Beckhoff's branch offices and representatives

Please contact your Beckhoff branch office or representative for local support and service on Beckhoff products!

The addresses of Beckhoff's branch offices and representatives round the world can be found on her internet pages:
http://www.beckhoff.com

You will also find further documentation for Beckhoff components there.

Beckhoff Headquarters

Beckhoff Automation GmbH

Huelshorstweg 20
33415 Verl
Germany

Phone: | +49(0)5246/963-0
Fax: | +49(0)5246/963-198
e-mail: | info@beckhoff.com
Beckhoff Support

Support offers you comprehensive technical assistance, helping you not only with the application of individual Beckhoff products, but also with other, wide-ranging services:

  • support
  • design, programming and commissioning of complex automation systems
  • and extensive training program for Beckhoff system components
Hotline: | +49(0)5246/963-157
Fax: | +49(0)5246/963-9157
e-mail: | support@beckhoff.com
Beckhoff Service

The Beckhoff Service Center supports you in all matters of after-sales service:

  • on-site service
  • repair service
  • spare parts service
  • hotline service
Hotline: | +49(0)5246/963-460
Fax: | +49(0)5246/963-479
e-mail: | service@beckhoff.com