Communication protocol description
Transcription
Communication protocol description
DT.A Direzione Tecnica Elettronica LOVATO ELECTRIC S.P.A. RGAM Communication protocol description I 94 GB 03 99 Date: March 10, 1999 General features: • Master-slave protocol, where usually the master is a Personal Computer or a device capable of communication and data processing (intelligent terminal). • Multidrop configuration. Up to 32 stations can share the same communication line. • Half- duplex communication with standard two-wire RS-485 interface. RGAM..RC units have a built-in RS-485 interface, while the master is usually connected by means of a RS-232 to RS-485 converter with automatic control of the transmission line. • Transmission format is: 9600 bps, 8 data bit, no parity, 1 stop bit. • ASCII mnemonic-code messages. • Possibility to connect a couple of modems between the master and the RS232 / RS485 converter. • Windows-based Remote control software available. Message structure: Every message has a frame with the following structure. ( AA CC O DDD....DDD &CK ) CR LF where: ( AA CC O DD..DDD & CK ) CR LF ASCII 28H character. Indicates the begin of the message. Address. Two-digit number that selects the address of the RGAM to which the message has to be sent ( when transmitted by the master) or that identifies the provenience of the message (when transmitted by the slave). Op-code. Two ASCII chars that identify the meaning of the message. Operator. Action that has to be connected to the previous op-code. It can be ‘?’ for a request, ‘=‘ for a write action (transmitted by the master) or for an answer (transmitted by the slave), ‘:’ for confirm, ‘!’ for forcing. Not all the opcodes can support all the operands. Data to be transmitted. Length varies depending upon the op-code and operand. Data can sometimes be separated by commas or by ‘=’. ASCII 26H character. Indicates the end of data and the begin of message checksum (optional). Checksum . Two ASCII chars, indicating the Low significant byte of the algebraic sum of the single bytes transmitted, starting from AA up to the last D before &. Checksum transmission is optional. ASCII 29H character. Indicates ASCII message end. Carriage return 0DH. Added to the end of the message. Line Feed 0AH. Added to the end of the message. Example: Master: (01MV?)CRLF Slave: (01MV=00400=00399=00401)CRLF The master asks 3-ph mains voltage value to RGAM station 01 RGAM answers 400, 399 and 401V Master: (01MV?&43)CRLF Slave: (01MV=00400=00399=00401&A9)CRLF Same as above, using checksum RGAM answers using checksum. Codice documento: I94GB03_99.DOC Pagina nr. 1 di 10 LOVATO ELECTRIC S.P.A. DT.A Direzione Tecnica Elettronica Mnemonic op-code table: Op-code ID ST ER MV GV FR BV HR MN AV IO PS AT OF MA AU TE KO KM KA KT KR KS KP KN KG MR RB SB SA SI ET EL Operand (master side) ? ? ? ? ? ? ? ? ? ? ? ? ?, = ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ?,= ?,= ?,= ? ?,= Operand (slave side) = = = = = = = = = = = = =, : : : : : : : : : : : : : : : : =, : =, : =, : = =,: Description Identification request General status request Error status request Mains voltage value (3-phase) request Generator voltage value request Generator frequency request Battery voltage request Engine total working time request (Hours - minutes) Time-to-maintenance request Battery charger alternator voltage request Digital Input / Output status request Front panel status request Automatic test request/forcing OFF mode forcing MAN mode forcing AUT mode forcing TEST mode forcing OFF key pressing simulation MAN key pressing simulation AUT key pressing simulation TEST key pressing simulation SELECT-RESET key pressing simulation START key pressing simulation STOP key pressing simulation MAINS key pressing simulation GEN key pressing simulation Maintenance interval reset System reboot Base setup values request / writing Advanced setup values request / writing Programmable inputs setup values request / writing Event timer and pointer Event log data Codice documento: I94GB03_99.DOC Pagina nr. 2 di 10 LOVATO ELECTRIC S.P.A. DT.A Direzione Tecnica Elettronica ID – Identification request The ID code is useful to ask to the RGAM the type and version of software and hardware. The slave answers with project code, denomination, firmware version, date, program memory checksum and board nominal power supply voltage. Example: Master: Slave: (01ID?)CRLF (01ID=LOVATO 5B1 RGAM REV.02 DATE:24.07.96 CKS:8076 - 12V)CRLF ST - General status request Useful to ask general status information to the RGAM. The presence of a determinate condition is evidenced by an alpha-char, while the absence of that condition is evidenced by a ‘.’. The answer is a 9-char data string. Each character of that string has the following meaning: Char position 1 2 3 4 5 6 7 8 9 Description O M A T R . A . M . G . M . G . E . T . If system is in OFF mode in MAN mode in AUT mode in TEST mode If the engine is running If not If the alarm delay (oil + temp) has elapsed if alarms are not yet enabled If mains voltage is present (inside limits) if not If generator voltage is present (inside limits) if not if mains contactor is closed if open if generator contactor is closed if open if there are live alarms no alarms Automatic test is enabled disabled Example: Master: (01ST?)CRLF Slave: (01ST=A . . M . M . .T )CRLF The message indicates that RGAM station 01 status is: AUT mode, engine stopped, alarms disabled, mains voltage ok, generator voltage not present, mains contactor closed, generator contactor opened, no live alarms present, automatic test enabled. ER – Error status request By means of this op-code it is possible to ask to RGAM if there are alarms present. In this case, their code will be answered. If there is no alarm present, ‘000’ will be transmitted. Example: Master: Slave: (01ER?)CRLF (01ER=001=013 )CRLF Two alarms present: A01 Oil pressure and A13 Emergency stop Master: Slave: (01ER?)CRLF (01ER=000)CRLF No alarms present. Example: Codice documento: I94GB03_99.DOC Pagina nr. 3 di 10 LOVATO ELECTRIC S.P.A. DT.A Direzione Tecnica Elettronica MV – Mains voltage request With this code the master can ask the instantaneous value of the three-phase mains voltage. The measures are expressed in Volt (RMS) each one in a five-digit decimal value. Example: Master: Slave: (02MV?)CRLF (02MV=00381=00385=00383)CRLF GV – Generator voltage request Returns the generator voltage value. Example: Master: Slave: (02GV ?)CRLF (02GV=00400)CRLF FR – Generator frequency request Returns the generator frequency value, expressed in Hz/10. Example: Master: Slave: (01FR?)CRLF (01FR=00502)CRLF The generator frequency is 50.2 Hz BV – Battery voltage request Returns the last battery voltage, expressed in Volts/10. We remind that there are two types of RGAM, with 12V and 24V nominal battery supply. Example: Master: Slave: (02BV?)CRLF (02BV=00142)CRLF The battery voltage of station 02 is 14.2VDC HR – Engine working time counter Returns the hours and minutes of the engine working time counter. This counter is kept even without battery supply. The answer format has 3 digits for hours and two digits for minutes. Example: Master: Slave: (03HR?)CRLF (03HR=02535)CRLF Station 03 engine working time counter is 25h35min MN – Time-to-maintenance request Returns the minutes left before maintenance interval request. Example: Master: Slave: (01MN?)CRLF (01MN=00186)CRLF There are 3h 06min left before maintenance AV - Battery charger alternator voltage request Returns the last value of the voltage applied to the battery charger input, expressed in V/10. Example: Master: Slave: (01AV?)CRLF (01AV=00142)CRLF The battery charger alternator voltage is 14.2V Codice documento: I94GB03_99.DOC Pagina nr. 4 di 10 LOVATO ELECTRIC S.P.A. DT.A Direzione Tecnica Elettronica IO – Input / Output status request Returns a 15-character string. Each character represents the status of one I/O line of the RGAM, as shown in the following table: Char position 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Description O . T . F . S . 5 . 6 . 7 . 8 . N . G . V . S . 5 . 6 . 7 . Oil pressure input active Input not active High temperature input active Input not active Fuel level input active Input not active Emergency stop input open (active) Emergency stop input closed (not active) Programmable input terminal nr.10 active Input not active Programmable input terminal nr.11 active Input not active Programmable input terminal nr.12 active Input not active Programmable input terminal nr.13 active Input not active Mains contactor relay contact closed Relay contact open Generator contactor relay contact closed Relay contact open Fuel valve relay contact closed Relay contact open Start relay contact closed Relay contact open Programmable relay terminal 18 closed Relay contact open Programmable relay terminal 16 closed Relay contact open Programmable relay terminal 20 closed Relay contact open Example: Master: Slave: (01IO?)CRLF (01IO= . . . . . . . . N . . . . . . )CRLF All inputs disabled, all outputs disabled except mains contactor output PS – Front panel status By means of this code it is possible to have the situation of the front panel LEDs and display. The answer is composed of a 9-bytes string showing the LED status, followed by a string for the alphanumeric display. Char position 1 2 Description O M A T . N G F B H if led OFF is lit if led MAN is lit if led AUT is lit if led TEST is lit none of the above if led NET (near display) is lit if led GEN (near display) is lit if led FREQ (near display) is lit if led BATT (near display) is lit if led HOUR (near display) is lit Codice documento: I94GB03_99.DOC Pagina nr. 5 di 10 LOVATO ELECTRIC S.P.A. 3 4 5 6 7 8 9 . E . N . G . 1 . 2 . 3 . G . DT.A Direzione Tecnica Elettronica none of the above if led ENGINE ON is lit if not lit if led ‘mains contactor closed’ is lit if not lit if led ‘generator contactor closed’ is lit if not lit if led ‘mains L1-L2 voltage present’ is lit if not lit if led ‘mains L2-L3 voltage present’ is lit if not lit if led ‘mains L1-L3 voltage present’ is lit if not lit if led ‘generator voltage present’ is lit if not lit The display status is transmitted just after the above mentioned led status. The display string length can be from 3 to 6 ASCII characters, depending upon the presence of decimal dots. In case of an alphanumeric string, the correspondent ASCII chars are transmitted (for example, when the display shows ‘StA’ during starting cycle, ‘StA’ will be transmitted). Example : Master: Slave: (01PS?)CRLF (01PS=MB . N . 123 . 25.3)CRLF The Leds MAN, BATT, Mains contactor closed, Mains voltage present (x3) and the display shows the battery voltage 25.3V AT – Automatic test If used with the ‘?’ operator, it returns the status (enabled or disabled) of the Automatic test, in a 3-digit format (000 = disabled, 001 = enabled). After that, the RGAM returns the minutes left before the next automatic test execution, in a five-digit format. Example: Master: Slave: (01AT?)CRLF (01AT=001=00310)CRLF The Automatic test is enabled. The next automatic test will be executed in 310 min (5h 10min). Using the AT code with the write operator ‘=’ it is possible to enable or disable the automatic test execution. Example: Master: Slave: (01AT=001)CRLF (01AT:)CRLF The master enables the automatic test. RGAM confirms. OF, MA, AU, TE – Mode selection By means of this four codes with the forcing operator ‘!’, it is possible to select one of the four operative modes (respectively OFF, MAN, AUT and TEST). Examples: Master: Slave: (01OF!)CRLF (01OF:)CRLF Master forces OFF mode RGAM confirms Master: Slave: (01TE!)CRLF (01TE:)CRLF Master forces TEST mode RGAM confirms KO, KM, KA, KT, KR, KS, KP, KN, KG – Front key pressing simulation By means of these codes, used with the forcing operator ‘!’, it is possible to simulate the front panel keystrokes. RGAM acts just like if the real key was pressed and released. Code Key Codice documento: I94GB03_99.DOC Pagina nr. 6 di 10 LOVATO ELECTRIC S.P.A. KO KM KA KT KR KS KP KN KG DT.A Direzione Tecnica Elettronica OFF MAN AUT TEST SELECT/RESET START STOP MAINS GEN Examples: Master: Slave: (01KO!)CRLF (01KO:)CRLF OFF pressed and released RGAM confirms Master: Slave: (01KR!)CRLF (01KR:)CRLF SELECT/RESET pressed and released RGAM confirms. MR – Reset of the maintenance interval The purpose of this code is to reset the maintenance interval counter. Normally it is used to reset the <A15 Maintenance requested> alarm. However, this commands resets the maintenance interval counter even if it has not yet elapsed, that is, even before the alarm has raised. Example: Master: Slave: (01MR !)CRLF (01MR:)CRLF Maintenance interval counter reset RGAM confirms. RB – Reset of the system (reboot) The purpose of this code is to reset the RGAM CPU. After this command, RGAM resets and restarts as if the power supply was switched off and then back on. In this case, no answer is given. See the following SB,SA and SI codes. Example: Master: Slave: (01RB !)CRLF RGAM system reset (no answer) Codice documento: I94GB03_99.DOC Pagina nr. 7 di 10 LOVATO ELECTRIC S.P.A. DT.A Direzione Tecnica Elettronica SB,SA,SI – Read / write of Base, Advanced and Prog-inputs setup These codes are useful to read and modify the parameters of Base setup, Advanced Setup and Programmable inputs Setup. Used with the operator ‘?’ it is possible to read the parameters values, while using ‘=’ it is possible to modify them (writing them to permanent memory). It is important to understand that it is not possible to access one single parameter but both the reading and the writing must be performed with all the parameters of the selected setup. Moreover, note that some of the parameters are expressed in 3-digits format while other are in 5-digit, and the correct sequence must be observed. Please note also that parameters modifications must be made in OFF mode only, and need to be followed by a system reset to take place (see RB code). For these reasons, we recommend the use these codes in write mode only to expert users. However, if the message syntax is not correct, the RGAM will answer with an error message. Examples: Master: Slave : (01SA ?)CRLF Advanced setup parameters read (01SA=000=00400=000=010=010=003=000=00100=000=015=010=005=005=005=001=008=010 =00120=020=005=090=00160=050=000=000=000=000=000=000=000=000=000=000) CRLF RGAM answers with Advanced setup parameters values Master: Slave: (01SB ?)CRLF Base setup parameters read (01SB=015=020=015=005=00060=020=020=005=020=000=020=000=003=010=001)CRLF RGAM answers with Base setup parameters values Master: (01SB==016=020=015=005=00060=020=020=005=020=000=020=000=003=010=001)CRLF Base setup parameters write (correct) (01SB :)CRLF RGAM confirms Slave: Master: Slave: (01SB==035=020=015=005=00060=020=020=005=020=000=020=000=003=010=001)CRLF Base setup write (not correct, first parameter out of range) (01ER :)CRLF RGAM answers with an error code ET – Event timer and pointer This code id useful to read the event log timer reference point from the RGAM. The mechanism of saving events in RGAM works as follows: • The events are kept only when DC power is applied to RGAM • The RGAM can store the last 255 events. Over that number, the newest event will overwrite the oldest (circular buffer). • The time stamp of each event is stored with reference to the moment of RGAM power-on (time 0). That is, each event is recorded with days, hours, minutes and seconds elapsed starting from RGAM power-on. This can be converted in absolute time using the PC clock time and date. The ET code returns the following information: 1. Circular buffer ‘head’ (pointer to oldest event) in 3-digit format 2. Circular buffer ‘tail’ (pointer to newest event) in 3-digit format 3. Days elapsed since power-on in 5-digit format 4. Hours elapsed since power on in 3-digit format 5. Minutes elapsed since power-on in 3-digit format 6. Seconds elapsed from power-on in 3-digit format Number of stored events can be calculated as follows: if (tail > head) Number of events = (tail - head + 1) else Number of events = 255 Example: Master: Slave: (01ET?)CRLF (01ET=000=001=00000=000=002=030)CRLF Codice documento: I94GB03_99.DOC Master asks Event timer data RGAM has stored two events and has been powered up for 2min 30 sec Pagina nr. 8 di 10 DT.A Direzione Tecnica Elettronica LOVATO ELECTRIC S.P.A. EL – Event log data With this code it is possible to read the event log data from the RGAM. Using operator ‘?’ it is possible to fetch code and relative time of each event stored. EL Returns: 1. Code of the event (see following event table) 2. Days elapsed since power-on when event happened in 5-digit format 3. Hours elapsed since power on when event happened in 3-digit format 4. Minutes elapsed since power-on when event happened in 3-digit format 5. Seconds elapsed from power-on when event happened in 3-digit format Every time the master uses the code EL? A RGAM internal pointer is moved on the next event. If the user wants to set this pointer to a specific location, then he has to use EL code with operator ‘=’. EL has to be used in conjunction with ET and with the actual date– time if the user wants to calculate number of events and their absolute time. Absolute time can be calculated as follows: Power-on absolute time = (Actual absolute time – ET time) Event absolute time = (Power-on absolute time + EL time of event) Example: Master: Slave: (01EL?)CRLF (01EL=084=00000=005=012=010)CRLF Master: Slave: (01EL?)CRLF (01EL=085=00000=005=012=042)CRLF Master asks Event log data Event with code 85 has happened 5h 12m 42s after RGAM power on. Master: Slave: (01EL=000)CRLF (01EL:)CRLF Master sets event pointer to position 0 Slave confirms Master asks Event log data Event with code 84 has happened 5h 12m 10s after RGAM power on. (again, RGAM moves automatically the pointer to the following event) Code 01 02 .. 17 21 .. 24 Event Begin of alarm A01 Begin of alarm A02 … Begin of alarm A17 Begin of alarm UA1 .. Begin of alarm UA4 31 32 … 47 51 … 54 061 062 063 064 071 072 073 074 Code 075 076 077 End of alarm A01 End of alarm A02 … End of alarm A17 End of alarm UA1 … End of alarm UA4 RGAM in OFF mode RGAM in MAN mode RGAM in AUT mode RGAM in TEST mode MAINS contactor closed MAINS contactor opened GEN contactor closed GEN contactor opened Event Engine running Engine not running MAINS voltage present Codice documento: I94GB03_99.DOC 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 MAINS voltage absent GEN voltage present GEN voltage absent Starting attempt Engine running (from frequency) Engine running (from generator voltage) RGAM is under remote control End of remote control Manual START command Manual STOP command Manual MAINS contactor changeover Manual GEN contactor changeover Access to base setup parameters (from front panel) Access to Advanced setup parameters (from front panel) Access to user alarms setup parameters (from front panel) Access to base setup parameters (from remote control) Access to Advanced setup parameters (from remote control) Access to user alarms setup parameters (from remote control) Access to Adjust parameters (from front panel) System reset (warm boot) Pagina nr. 9 di 10 LOVATO ELECTRIC S.P.A. Codice documento: I94GB03_99.DOC DT.A Direzione Tecnica Elettronica Pagina nr. 10 di 10