This driver serves for communication with devices by the
Elgas company
by the ELGAS-2 protocol. See
Communication with meters by the Elgas company (Czechia). For example for the following devices:
- ELCOR-2 (gas meter)
- DATCOM-2 (electronic logger for saving gas pressures and temperatures)
- DATCOM-RTU (technological process monitoring system, limit values monitor, slow process regulator ...)
- DATCOM-AMR2 / 3 (GSM/GPRS communicator for remote data transfer from gas meters)
- miniELCOR / maxiELCOR (battery operated gas meter designed for explosive environments)
- ELCORlite (single channel gas meter)
Before using this driver in the PROMOTIC application it is highly recommended to watch "
PROMOTIC video tutorial 4 - Communication drivers".
Basic properties of the driver:
- Usage of this driver requires purchase of the
PmElgas2 licence. When developing the application in the freeware mode
PmFree, or with
development environment and while testing it in runtime, this component is always functional.
- The communication is done for Ethernet (PROMOTIC application is client) or for serial link (COM1, COM2 ...). For now, sending the same data via Ethernet as for serial link is implemented.
Even if the device does not have the Ethernet interface it is possible to connect it by "serial link-Ethernet" converter and let it communicate with the PROMOTIC application via Ethernet.
- The PROMOTIC application is the Master (it means that it initiates the data transfer) from this communication point of view.
- The driver is incorporated into the PROMOTIC system by means of the
PmaComm object.
This driver supports the usage of the object:
-
PmaCommGroup for reading current values of variables from the device.
-
PmaCommMsg for reading archives, reading current device configuration and reading device time.
For easy integration of this driver into the application it is handy to use:
Preconfigurations in group "ELGAS devices"
Device addressing:
The device is equiped with serial port
RS-232 by default, but it can have also the
RS-485. In such case, multiple devices can be located in the network and it is necessary to address them. The device address consists of two parts. If multiple devices are not present, then both address parts may equal to 0. The address is defined in objects
PmaCommGroup and
PmaCommMsg.
- Network device address - Part 1: Two-byte address (0-65535) specifies the end device in the network. Value 0 means any device and is meaningful only if only a single device is present in the current network.
- Network device address -Part 2: One-byte address (0-255) that specifies the network number. The value 0 means any network and is meaningful only if only a single network is used.
Recommended values of the PmaComm object parameters:
Baud rate | from 9600 Bd to 38400 Bd |
Number data bits | 8 |
Parity | NO |
Number of stop bits | 1 |
RTS flow control | log.1.
The device design requires external interface circuit power supply. It can be powered by link signals RTS and DTR (logical 1) directly from the PC serial interface. The alternative solution is to power the interface circuits from external power supply +6V to +12V connected to one of the link signal pair RTS or DTR. |
DTR flow control | log.1.
See the note "RTS flow control". |
---|
For now, sending the same data via Ethernet as for serial link is implemented. In this case, the Ethernet parameters can be set accorting to the Eternet/serial link converter.
Description and recommended values for the Protocol parameters:
Response receipt timeout | 1000 ms.
Only for serial link. The time (in milliseconds) the driver is waiting for the response on sending the message.
If no response comes during this time, then the transmission of the message is terminated (the onEndOfTransfer event is triggered with error 24 or 66). |
Data Packet Max. Size | 2048.
If a modem with limited data packet size is used for communication, then can be set a received data packet shorter that 2048 bytes. In such case, the driver would demand the device to receive message divided into multiple smaller packets.
Recommended packet sizes:
2048 - Connection by cable, IR head, telephone modem, GSM/CSD communication
1024 - GSM/GPRS communication
512 - Connections with limited data bandwidth, radio communication |
Number of Packet Leading Wake-up Zeroes | 40.
In order to ensure maximum energy eficiency, the device switches to suspend mode (sleep). The device wakes-up from the sleep (based on manufacturer information) approx. 100ms after receiving any character. The driver uses a set of zero characters for this purpose. It has been tested, that 40 zeroes sent by 38400Bd speed (approx. 10.5 ms) are enough to wake the device up. |
---|
The communication description by means of the PmaCommGroup object
The
PmaCommGroup object serves for
reading current values of selected variables. Each variable is defined by object name and the object instance number.
The variables in the
PmaCommGroup object (or even better the variables in the
PmaData object with
ExtComm data extension) can be of arbitrary number, type and order. The driver uses optimized internal communication messages for reading the data from the device.
All variables are read (if the "
Data refresh enabled" configurator is checked). Writing variables into the device is not enabled for this driver.
Each read variable will also have the
PmVar.TimeSource property set, which is the date and time in the device.
Description of the "ItemId" configurator:
ItemId is the text identifier of the item that is used for addressing the item in the device. The "
ItemId" configurator tells the driver how to receive or send the item value.
The text can be either written manually, or it can be assembled in the window opened by the button to the right of the configurator.
Macro expression can be used for input (it is evaluated after the application is launched).
The
ItemId syntax is
ObjectIdentifier.ObjectInstanceNumber, where the
ObjectIdentifier can be:
CounterDbl: Counter Double
CounterOut: Output Counter
CounterInr: Internal Counter
CounterCor: Correctional Counter
CounterStd: Standardized Counter
CounterRes: Reserve Counter
CounterResDbl: Reserve Counter double
CounterResStd: Standardized Reserve counter
CounterTar: Tariff Counter
CounterTarStd: Standardized Tariff Counter
CounterDif: Differential Counter
CounterDifStd: Standardized Differential Counter
Flow: Flow
FlowStd: Standardized Flow
RecalcQ: Conversion coefficient
Compress: Degree of Compressibility
CompressZ: Degree of Compressibility Z
CompressZb: Degree of Compressibility Zb
FuelEff: Calorific Value
Energy: Energy
EnergyRes: Reserve Energy
BinaryVal: Two-State Variable
DeviceErr: Device Error
AlarmSum: Sum of Alarms
SetPoint: Set Point
AnalogStat: Statistical Analog Value
AnalogTimStat: Statistical Analog Time
FlowStat: Statistical flow
FlowTimStat: Statistical flow time
CounterStat: Statistical Counter
CounterStatStd: Statistical Counter Standardized
Timer: timer
TimePeriod: Time Period
Tariff: Tariff
The communication description by means of the PmaCommMsg object
The
PmaCommMsg object supports the following messages:
For creating these messages it is handy to use the preconfiguration:
that creates the preconfigured objects, panels, scripts in events, etc.
List and description of communication messages:
-
Available Object List Reading:
This message type creates a text string that provides the user with some basic device information.
There are following variables on the "
Data-sent" tab:
Addr1
There are following variables on the "
Data-received" tab:
ObjectList - The variable that will contain the text string after data transfer.
The example of created text string content:
Data contained in the text string |
meaning |
Station 1:2 |
(station) |
Workstation name |
|
Station 1:2 means that the device has network address of 1 and 2, see Device addressing. |
AnalogVal.0 |
(Analog Value) |
Pressure p1 kPa |
S,D,M,E |
In this section, there is a list of available objects
- 1st column: value ItemId (object instance)
- 2nd column: object name
- 3rd column: value name in the device
- 4th column: contains abbreviations indicating whether the value is saved in the archive or not:
S = data archive
D = daily archive
M = monthly archive
E = extreme archive |
AnalogVal.1 |
(Analog Value) |
Temperature t1 |
S,D,M,E |
Counter.0 |
(Counter) |
V1 |
S,D,M |
Status.0 |
(Status) |
Status |
S,D,M |
|
Device FW version: |
2.10 |
Device firmware information is stored here. See the device documentation. |
Data Archive Record Length: |
63 bytes |
The information regarding record size of each archive is related to the maximum length of received data packet from the device when reading archives. The driver has a buffer of 8192 bytes reserved for packet to receive. Around 8000 bytes of it can be used for the "real" data. One of the service parameters for reading archives is the number of records. Because the size of records may vary depending on the device configuration, it is handy to count the number of records of the corresponding archive that can be received by the driver in one reading. If the designer requests more records (bigger data packet) than the driver can receive based on the limited buffer size, then the driver dumps the data and signals error. |
Day Archive Record Length: |
57 bytes |
Month Archive Record Length: |
57 bytes |
-
Billing Archive Reading:
These 4 messages are used for reading archives (data, daily, monthly and balance). The messages have the same structure, the only difference is the number and writing time.
There are following variables on the "
Data-sent" tab:
Addr1
RecordsMax - Maximum number of records received in archive.
TimeFrom - The starting time for reading the records. Those records that follow exactly AFTER the defined time are read (i.e. the records with higher time).
There are following variables on the "
Data-received" tab:
Header - Variable of the
Array type (2-dimensional array) containing the archive columns description. The array always contains two rows.
The first row contains the list of measured values (identifiers ItemId) that are saved in the archive. The first two columns contain the timestamp and attribute.
The second row contains variable names in the device.
Archive - Variable of the
Array type (2-dimensional array) contains the archive data. Each array row represents one time record of the archive.
The first column contains the timestamp (Date type)
The second column contains the attribute. The values are representing the relation to the daylight-saving time:
0 = the device does not recognize the "daylight-saving time"
1 = the device does recognize the "daylight-saving time" and now is in the "standard time"
2 = the device does recognize the "daylight-saving time" and now is in the "daylight-saving time"
3 = the "daylight-saving time" recognition is deactivated in the device
The next columns contain values of the measured data.
ArchiveRowsCount - The number of rows (number of records) in the archive
ArchiveColumnsCount - The number of columns in the archive
FWvers - Device firmware version
-
Extreme Archive Reading:
The message serves for reading the minimum/maximum values archive
There are following variables on the "
Data-sent" tab:
Addr1
There are following variables on the "
Data-received" tab:
Header - Variable of the
Array type (2-dimensional array) containing the extreme archive rows description. The array always contains two rows.
The first row contains the list of measured of variables (identifiers ItemId) that are saved in the archive.
The second row contains variable names in the device.
Archive - Variable of the
Array type (2-dimensional array) contains the archive data. Each array row represents the extremes of one value.
1st column: timestamp of the minimum (of the Date type)
2nd column: minimum value
3rd column: timestamp of the maximum (of the Date type)
4th column: maximum value
ArchiveRowsCount - The number of rows (number of records) in the archive
ArchiveColumnsCount - The number of columns in the archive
FWvers - Device firmware version
-
Device Time Reading:
Returns the device time (date and time).
There are following variables on the "
Data-sent" tab:
Addr1
There are following variables on the "
Data-received" tab:
Time - Read device time (of the Date type)