Promotic
WikipediaLinkedInYoutubeTwitterFacebook

PmElgas2 - Driver for communication with Elgas devices

This driver is used for communication with devices manufactured by the ELGAS s r.o. company using the ELGAS-2 protocol. See Communication with Elgas devices (Czech republic).

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 transfers from gas meters)
- miniELCOR / maxiELCOR (battery operated gas meter designed for explosive environments)
 
Before using this driver in the PROMOTIC application it is highly recommended to read the chapter: Communicaton using the PROMOTIC drivers.
 
Basic properties of the driver:
- Using this driver is bound to purchase the license: PmElgas2. With the freeware version PmFree, or when developing the application (with development environment for tersting purposes), this component is always functional.
- The communication is done via Ethernet or via standard serial link (COM1, COM2 ...). Sending the same data via Ethernet and via serial link is currently 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 (i.e. it initiates the data transfer) from this communication point of view.
- The driver is incorporated into the PROMOTIC system by means of the PmComm object.

This driver supports the usage of the objects:

- PmCommData for reading current values from the device.
- PmCommMsg for reading archives, obteining 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 communication 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, both address parts may equal to 0. The address is defined in the objects PmCommData and PmCommMsg.

- Network Device Address Part 1: Two-byte address (0-65535) defines the end device in the network. The value 0 represents any device and is relevant only if a single device is present in the current network.
- Network Device Address Part 2: One-byte address (0-255) that defines the network number. The value 0 represents any network and is relevant only if a single network is used.
 
 

Recommended parameters values:

Recommended values for the Serial link parameters:
Baud ratefrom 9600 Bd to 38400 Bd
Number of data bits8
ParityNO
Number of stop bits1
RTS flow controllog.1.

The deice 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 controllog.1.

See the note "RTS flow control".

 
Recommended values for the Ethernet parameters:
Sending the same data via Ethernet and via serial link is currently implemented. The Ethernet parameters can be set accorting to the Eternet/serial link converter in this case.
 
Description and recommended values for the Protocol parameters:
Response receipt timeout1000 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, the transfer of the message is terminated (event onEndOfTransfer fires with error 24 or 66).

Data Packet Max. Size2048.

If a modem with limited data packet size is used for communication, then it is possible to set a received data packet shorter that 2048 bytes. In such case, the driver would demand the device to receive messages divided into multiple smaller packets.

Recommended packet sizes:

2048 - Connection by cable, IR head, telephone modem, GSM/CSD communication
1024 - GSM/GPRS communiaction
512 - Connections with limited data bandwidth, radio communication
Number of Packet Leading Wake-up Zeroes40.

In order to ensure maximum energy eficiency, the device switches to suspend mode (sleep). The device wakes-up from the sleep (based on manufacturer infomation) 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 the PmCommData objects

The PmCommData object is used for reading current values of selected variables. Each variable is defined by object name and the object instance number.
 
The variables in the PmCommData object (or even better the variables in the PmData object with ExtComm data extension) can be of arbitrary number, type and order. The driver uses optimalised internal communication messages for reading the data from the device.

All variables are read (if the Data refresh enabled configurator is enabled). Writing variables into the device is not enabled for this driver.

 
Description of the ItemID configurator:

ItemId is the text identifier of the item that is used for addressing the value in the device. The ItemID configurator tells the driver how to receive or send the item value. The text can be 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 while the application is launching).

The ItemID syntax is ObjectIdentifier.ObjectInstanceNumber, where the ObjectIdentifier may be:

AnalogVal: Analog Value
Counter: Counter
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
Status: Status
 
Description of the PmCommData > Parameters > Special Parameters configurator:
Network Device Address Part 1See Device addressing
Network Device Address Part 2See Device addressing

The communication description by the PmCommMsg objects

The PmCommMsg object supports the following messages:
 
It is recommended to use the preconfigurations for creating these messages: that creates the preconfigured objects, panels, scripts in events, etc.
- 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 page:
Addr1
Addr2 - see Device addressing
There are following variables on the Data-received page:
ObjectList - The variable that would contain the text string after data transfer.
 
An 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 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 byte The information regarding record size of each archive is related to the maximum lenght of received data packet from the device when reading archives. The driver has a buffer of 8192 byte reserved for packet 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. Based on the fact that 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 user 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 byte
Month Archive Record Length: 57 byte

- Data Archive Reading:
- Day Archive Reading:
- Month Archive Reading:
- 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 page:
Addr1
Addr2 - see Device addressing
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 page:
Header - Variable of the Array type (two-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 time stamp and attribute.
The second row contains value names in the device.
Archive - Variable of the Array type (two-dimensional array) containing the archive data. Each 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 the measured data.
ArchiveRowsCount - Number of rows (number of records) in the archive
ArchiveColumnsCount - Number of columns in the archive
FWvers - Device firmware version

- Extreme Archive Reading:

The message can be used for reading the minimum/maximum values archive

 
There are following variables on the Data-sent page:
Addr1
Addr2 - see Device addressing
There are following variables on the Data-received page:
Header - Variable of the Array type (two-dimensional array) containing the extreme archive rows 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 second row contains value names in the device.
Archive - Variable of the Array type (two-dimensional array) containig the archive data. Each array row represents the extremes of one value.
1st column: time stamp of the minimum (Date type)
2nd column: minimum value
3rd column: time stamp of the maximum (Date type)
4th column: maximum value
ArchiveRowsCount - Number of rows (number of records) in the archive
ArchiveColumnsCount - 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 page:
Addr1
Addr2 - see Device addressing
There are following variables on the Data-received page:
Time - Read device time (Date type)
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice