Example is placed in the folder: /Pm/Examples/Commun/Landis&Gyr_RWP
. Communication was tested with the RWP80
- RWP.PRA is a Promotic example for calling functions from the DLL library LGCON1.DLL.
- For communication with the Landis&Gyr controller, the HW communication converter is needed (that is produced by the CODEA company - the contact can be found at the end of this document). In the lgc1_01.pdf file there is a description of the converter.
- The DLL library LGCON1.DLL
is a driver for communication with Landis&Gyr
controllers (the producer of the driver is the CODEA
company). The PROMOTIC system makes available the functions of this DLL library by the PmDll
object. The declaration of functions and their parameters in the syntax of the VBscript language is located in the LGCON1.INC
- Detailed description of the library functions and the structure of the file with the definition of signals of Landis&Gyr is located in the INFO_01.TXT file. Please read carefully this documentation. In the example there are mentioned ways of calling the functions of the DLL library in the PROMOTIC system.
- For its functioning, the communication driver requires the LGCON1.INI file, in which the basic parameters of the serial link (Baud rate, etc.) are set.
- The information about the real addresses and names of variables in the Landis&Gyr controller is read by the communication library from the TEST01.LGC file. The file name is optional and it is passed to the communication DLL library as a parameter of the LGC_Open function (this function has to be called as the FIRST, i.e. before the reading or writing of the data from/to the Landis&Gyr controller). The syntax for filling the TEST01.LGC file is conducted by rules that are described in the INFO_01.TXT file.
- The LGCON1.INI and TEST01.LGC files are the text files.
Principle of the communication
Communication with the controllers is implemented by the electrical interface RS485. On the Landis&Gyr controller side the communication is made by the PG port (RS232). It is necessary to put an intelligent HW converter (for the description see the LGC1_01.PDF file) before each Landis&Gyr controller. By this up to 32 Landis&Gyr controllers can be connected to one RS485 line.
HW converter does:
- additional addressing of Landis&Gyr controllers
- security of a communication message by checksum
- current data from the Landis&Gyr controller are periodically prepared by requests from PC
On PC side it is possible to use any suitable converter (or HW card) for the conversion RS232->RS485. When using a HW communication card in PC, the condition for the functioning is the correct detection of the HW card in the OS Windows (new COM sockets has to be viewed in the system setting).
Short description of functions from the LGCON1.DLL library
(detailed description of the functions from the LGCON1.DLL library can be found in the INFO_01.TXT file)
a) LGC_Open - function for the initialization = opening the communication port. Reads the information from the initialization file about signals that are maintained in the internal database LGCON1.DLL It starts the timer with the period of 200 ms for reading the data from the Landis&Gyr controller Example of calling: LGC_Open("C:\PROMOTIC\TEST01.LGC","COM2", "C:\PROMOTIC\TEST01.LGC") - reads the data from the TEST01.LGC file and starts the communication to COM2.
b) LGC_Close - function for closing the communication Releases the internal database of signals LGCON1.DLL and closes the communication port.
c) GetFData - function for reading the value of a signal from the internal database LGCON1.DLL In the next versions of the DLL library, there will be possible to define in the file of signals whether the value has to be read by the function GetFData immediately from the internal database of variables or from the real Landis&Gyr controller. When reading the real value, the designer has to test (by repeated calling the function) whether the current value is already available.
d) PutFData - function for writing the value of the signal into the database LGCON1.DLL.
e) GetNewFData - function for reading the new value of the signal from the internal database It returns the information whether at least one signal has been changed in the internal database of variables. If yes, then the name of the signal and its value is returned by repeated calling of this function. The function is suitable for fast reading of the changed data.
Launching the example
The example is launched by the file RWP.PRA (it is necessary to have the Promotic system installed properly). In this example that was tested with the Landis&Gyr controller of the RWP80 type, examples of calling functions from the LGCON1.DLL library are shown.
The example further contains the following objects:
object for connecting the application with the DLL library LGCON1.DLL
object for storing the identifier of currently opened communication port
Technical support of the communication driver for Landis&Gyr
Ing. Masný, CODEA spol.s r.o.
Přemyslovců 30, 709 00 Ostrava - Mariánské hory, Czechia
phone: +420 596 621 395/397