The M-Bus protocol driver is used for integration of meters, like electrical energy, water, heat meters…, which communicate over the M-Bus protocol. It must be distinguished between
The PLCs in general do not provide physical M-Bus interface, and it is necessary to use a physical converter to connect M-Bus to the PLC, such as Domat M095 or M096. The converter connects to a RS232 interface, e.g. COM1 or COM2 at IPLC320. This COM port number is then entered in the driver properties.
Right-click the PLC to define a new channel. Set its properties in the right part of the program window:
M-Bus protocol parameters
Serial Line Parameters
Right click the channel to open the context menu. There are four ways to add a meter:
If the meter type and its address are known, i.e. the bus has been (or will be) configured in advance by the meter supplier who provided a table with meters and their addresses, the Add device function can be used with Add Group and after a Group has been defined, Add data point (or more data points one after another, depending on how many values have to be read from the device). For this, the DIF/VIF parameters and value offset in the telegram must be known. These data are provided by the meter manufacturer. Therefore it is easier to follow these steps instead:
Create a M-Bus meter from real device
In this case, only a single meter was found on the bus.
(The dialog allows to change or set the meter primary address. This may ease the commissioning process - the meters are readdressed immediately after scanning, and no other software with serial to M-Bus converter is necessary. Meter addressing can be thus executed also on a remote basis, through PLC in Commissioning mode.
Check the meters to import in the Import checkbox. Unchecked meters will be ignored and not imported. Individual selection may be chosen if extra meters are added to an already configured bus. If all meters would be selected, all of them would be imported and some duplicate devices would appear on the channel.
If a meter of the same type is found in the M-Bus meter library, the device is taken from this library and predefined variables are imported. If a detected meter should be imported as an independent device and variables should be selected individually from all available variables read from the meter, check the Create box at this meter. The meters are then imported one after another with selecting of variables for every meter separately.
The Add device function inserts an empty device into the channel, and all its parameters must be entered manually. This is used when a meter with defined parameters must be created prior to access to a functional M-Bus.
Add device from library inserts a preconfigured meter device from the Mervis M-Bus library. This library will be extended in futore Mervis IDE releases. As of now, it is possible to save custom meters by right click to a meter and selecting Create library. After a meter is inserted., remember to set meter primary or secondary address and select the address type to be used for communication.
Inserting meters in a library
As soon as a meter device has been created and tested, its prototype can be added to the library, and used for inserting instead of creating a meter from real device. To save a prototype to library, properties in Prototype definition and Device information must be completed.
Device properties
M-Bus Device Parameters
Prototype definition
Device info
Manual adding of meters and values
Apart from detection of M-Bus meters on the bus and automatic parsing of values, it is also possible to add values manually, in the same way as with other protocols. This brings more flexibility at meters which use segmentation:
Some M-Bus meters may split the response into more telegrams because the maximum telegram length is limited to 255 bytes. This is called segmentation. The standard segmentation process starts with sending an initial request SND_NKE. The meter acknowledges the request, and resets its internal segment counter. However, the master does not know in advance how many segments will follow, and has no means how to learn this. The way out is to dedicate a bit (FCB) in the data request (REQ_UD2) and use it as an indicator of requirement of the next telegram. The meter keeps the last received FCB, and if it does not match with the currently received FCB, it sends the next segment, and increments the segment counter. The master keeps sending REQ_UD2 and resetting FCB to obtain the next segment of the response. The last segment ends with a specific DIF (0F) and the master stops sending requests.
According to the M-Bus standard, if the meter response consists of two telegrams only, the FCB may indicate directly the segment number. This means that for FCB=0 the meter always returns the first segment of the response, and for FCB=1 the second segment. It is not necessary to initialize the meter, the meter needs no internal segment counter, the last FCB status needs not to be kept in the meter memory.
This is useful to know if the meter is configured manually. A data poing Group in a Device represents a segment. The “Telegram Number” parameter in a group is the segment number.
At the Variable definition in a Group, the most important parameters are DIF/VIF and Offset. They determine the position of the value in the telegram.