3.8 Autonomous Metering System (AMS)

The AMS solution provides automatic remote reading of such appliances as electric meters, gas meters or water meters, but also variable sensors and detectors. Data is read, remotely collected and transmitted to central software. This provides the building manager or power supplier with fresh consumption data for further processing (service billing, e.g.). IEC 62056-21 or M-Bus via the RS 232/RS 485/M-Bus interface is used for meter communication. Data can thus be read out periodically and stored in the 2N® SmartCom PRO internal memory for sorting and filtering. Integration of other communication protocols can be solved according to the customer's needs.

The AMS is configured via the AT interfaces described below. Log in via your terminal to an AMS-supporting 2N® SmartCom PRO  and follow the instructions below. Add up to 64 independent meters to the meter list. The data space size is determined by the HW version. All records are written into a circular buffer, which means that whenever the memory is full, the oldest record is deleted and replaced with a new one.

Note

  • The standard baud rate is 300 bps. 2N® SmartCom PRO can start communication at a higher rate if necessary, which is then decreased by subsequent communication to the standard. To achieve the typical increased initial rate of 2400 bps, set a higher rate on port RS 485 in the 2N® SmartCom PRO configuration. When the AMS communication stops at 300 bps, the preset higher rate is reset automatically.
  • 2N® SmartCom PRO supports the A, C and E modes according to IEC 62056-21.

AMS Device Configuration

The commands below are used for meter configuring.

AT^SCAMS=?

The command writes out the list of AMS module control commands, their parameters and parameter formats.

Response:

^SCAMS: "ENABLE",0|1
^SCAMS: "RETRY",0-9
^SCAMS: "DEV_ADD",1-1000,"32"|1-1000,"32","3"
^SCAMS: "DEV_REMOVE",1-32
^SCAMS: "DEV_CLEAR"
^SCAMS: "DEV_INTERVAL","ALL"|1-32,"3"
^SCAMS: "DIRECT_READ",1-1000,"32"|1-1000,"32",110-230400,0|1
OK
AT^SCAMS?

The command writes out the contents of the device list to be served by the AMS module.

Table row format:
^SCAMS: <index>> <port>,<protocol>,<address>,<interval>
  • <index> – device index in the device list – number
  •   <port> – number of the physical port to which the device is connected – number
    • 1 – RS232 communication port
    • 2 – RS232/RS485/M-Bus communication port (depending on HW version)

    • 128 – internal A/D input module communication port (analogue/digital input module)

  • <protocol> – name of the communication protocol used for device communication – text string

    • "IEC62056-21" – denotes the IEC 62056-21 protocol

    • "MBUS" – denotes the M-Bus protocol

    • "MODBUS" – denotes the Modbus protocol

    • "INMAT" – denotes the INMAT 51 / INMAT 66 communication protocol 
    • "LOTOS" – denotes the LOTOS 301 communication protocol

    • "AIN_DIN" – denotes the A/D input protocol (analogue/digital input module data reading protocol)

  • <address> – device address – text string
    • device address in the format corresponding to the device address format for the given protocol
  • interval> – data reading time interval – time interval symbol text string
    • minutes, hours or days; setting options:
    • "1M", "2M", "3M", "4M", "5M", "6M", "10M", "12M", "15M", "20M", "30M", "1H", "2H", "3H", "4H", "6H", "8H", "12H", "1D"
Example of a response if the list is empty:

^SCAMS: NO DEVICE
OK

Example of a response if the list includes 4 devices:

^SCAMS: 1> 2,"IEC62056-21","869551","1M"
^SCAMS: 2> 2,"IEC62056-21","869552","15M"
^SCAMS: 3> 128,"AIN_DIN","1/ADC/CAL","1M"
^SCAMS: 4> 128,"AIN_DIN","2/PULSE/ABS","1H"
OK
AT^SCAMS="ENABLE",<on>

The AMS module command writes out the current state (on/off) of the AMS module (without additional details) or sets the on/off state for the AMS module (according to the parameter below).

  • <on> – if included, the parameter specifies the required new AMS on/off state and the command sets the new state; if the parameter is not included, the command writes out the currently set state – logical value
    • 0 – AMS disable request
    • 1 – AMS enable request

Response format (AMS set to on):

^SCAMS: "ENABLE",1
OK

Response format (AMS state setting command) – action succeeded

OK

Response format (AMS state setting command) – action failed

ERROR
AT^SCAMS="RETRY"[<retry_count>]

The AMS module command – writes out the current setting of the count of the data reading retries in case reading failed (without any additional parameters) or sets the count of the device data reading retries (according to the parameter below).
  • <retry_count> – if included, the parameter specifies the required device data reading attempts in case reading failed with an error, which allows for retrying data reading; if the parameter is not included, the command writes out the currently set retry count value.
    • number, range 0 to 9

Response format (currently set value identifying command):

^SCAMS: "RETRY",<current_retry_count>
OK

Example (find the currently set device data reading attempts):

AT^SCAMS="RETRY"

Example (set the count of the device data reading retries; when the first data reading attempt fails, up to 2 more attempts will follow):

AT^SCAMS="RETRY",2
Response format – action succeeded:
OK


Response format – action failed:

ERROR
AT^SCAMS="DEV_ADD",<port>,<protocol>,<address>,<interval>

The AMS module command adds a device to the device list.

  • <port> – number of the physical port to which the device is connected - number
    • 1 – RS232 communication port
    • 2 – RS232/RS485/M-Bus communication port (depending on the HW version)
    • 128 – internal A/D input module communication port (analogue/digital input module)
  • <protocol> – name/number of the communication protocol used for device communication
    • numeric format (number) or symbolic name (text string)
      • for number
        • 1 – denotes the IEC 62056-21 protocol
        • 2 – denotes the M-Bus protocol
        • 3 – denotes the Modbus protocol
        • 64 – denotes the INMAT 51 / INMAT 66 communication protocol
        • 65 – denotes the LOTOS 301 communication protocol
        • 128 – denotes the A/D input reading protocol (for reading data from the analogue/digital input module)
      • for text string
        • "IEC62056-21" – denotes the IEC 62056-21 protocol
        • "MBUS" – denotes the M-Bus protocol
        • "MODBUS" – denotes the Modbus protocol
        • "INMAT" – denotes the INMAT 51 / INMAT 66 communication protocol 
        • "LOTOS" – denotes the LOTOS 301 communication protocol 
        • "AIN_DIN" – denotes the A/D input protocol (analogue/digital input module data reading protocol)
  • <address> – device address – device address text string
    • for IEC 62056-21 the address consists of a text string <address> [@ <default_baudrate>][% <switches>], where:
      • <address> – device address (identical with the original device address) 
      • <default_baudrate> – an optional parameter defining the default baud rate in Bauds
      • <switches> – an optional parameter – switch array for data reading process control. Now an 'R' switch is only implemented to prevent a change of the default baud rate
    • for M-Bus the address consists of a text string <address>@<baudrate>
      •  <address> – M-Bus device (meter) address
        • primary address – <address> is a number ranging from 0 to 250
        • secondary address – <address> has the format *<address_8>, where <address_8> consists of 8 characters of the secondary address, where each character is:
          • a digit ranging from 0 to 9
          • a wildcard 'F' character (substituting any numerical value on the given position in the range between 0 and 9)
      • <baudrate> – communication rate in bauds; if the parameter is not included, the default value is used. Setting options: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400. Default value: 2400.
    • for Modbus the address consists of a text string <address> @ <default_baudrate> [<max_cmd_data_size>, <data_block_1>,...., <data_block_N>], where:
      • <address> – Modbus device 8-bit address (mandatory parameter) 
      • < default_baudrate > – a mandatory parameter defining the default baud rate in Bauds. Default = 9600.
      • <max_cmd_data_size> – an optional parameter defining the maximum size of the data block to be provided by the target device at once. Default = 1.
      • <data_block_x> – an optional parameter consisting of the following parts: <cmd>:<mem_addr>:<data_cnt>, where
        • <cmd> – Modbus command, 8-bit HEX
        • <mem_addr> – target Modbus device memory address, 16-bit HEX
        • <data_cnt> – data block to be read out from the target Modbus device, starting at <mem_addr>, 16-bit DEC
    • for INMAT 51/66 the address consists of a text string <address>[@<baudrate>]|<command_1>,<command_2>,....,<command_N>, where:
        • <address> – device address – number ranging from 0 to 63 
        • <baudrate> – communication rate in bauds. If the parameter is not included, the default baudrate is used: 9600.
        • <command_x> – text string <command_code>[:<parameter_1>[:<parameter_2>[:....[:<parameter_K>]]]]", which specifies one command.
          • <command_code> – an alphabetical letter that specifies an INMAT 51/66 command. The letters are assigned to the following commands:
              • 'I' – read device ID
              • 'S' – read one value
              • 'E' – read one value from value matrix
              • 'B' – read value block from value matrix
              • 'M' – read memory
          • <parameter_x> – text string of one command parameter. The count of command parameters depends on the command type. The command parameter counts and formats are as follows:
              • command 'I' (read device ID): parameter count is zero (no parameters are needed)
              • command 'S' (read one value): parameter count is 2
                • <parameter_1> – an alphabetical letter that specifies the required variable type. The letters are assigned to the following types:
                    • 'I' – type "INT", 2 bytes
                    • 'L' – type "LONG", 4 bytes
                    • 'F' – type "FLOAT", number with a decimal floating point (according to IEEE), 4 bytes
                    • 'S' – type "STRING", sequence of ASCII characters terminated with a zero char, 1 to 246 bytes
                • <parameter_2> – database variable index within a station (INX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FF
              • command 'E' (read one value from value matrix): parameter count is 4
                • <parameter_1> – an alphabetical letter that specifies the required variable type. The letters are assigned to the following types:
                  • 'I' – type "INT", 2 bytes
                  • 'L' – type "LONG", 4 bytes
                  • 'F' – type "FLOAT", number with a decimal floating point (according to IEEE), 4 bytes
                  • 'S' – type "STRING", sequence of ASCII characters terminated with a zero char, 1 to 246 bytes
                • <parameter_2> – database variable index within a station (INX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FF
                • <parameter_3> – database variable row index of the matrix type (IY); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_4> – database variable column index of the matrix type (IX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
              • command 'B' (read value block from value matrix): parameter count is 6
                • <parameter_1> – an alphabetical letter that specifies the required variable type. The letters are assigned to the following types:
                  • 'I' – type "INT", 2 bytes
                  • 'L' – type "LONG", 4 bytes
                  • 'F' – type "FLOAT", number with a decimal floating point (according to IEEE), 4 bytes
                  • 'S' – type "STRING", sequence of ASCII characters terminated with a zero char, 1 to 246 bytes
                • <parameter_2> – database variable index within a station (INX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FF
                • <parameter_3> – database variable row index of the matrix type (IY); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_4> – database variable column index of the matrix type (IX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_5> – database variable row index of the matrix type (NY); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_6> – database variable column index of the matrix type (NX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
              • command 'M' (read memory): parameter count is 6
                • <parameter_1> – "offset", defines an offset within a segment (OFFS); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_2> – "segment", defines a memory segment (SEG); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_3> – count of read bytes; hexadecimal number (16-bit ASCII HEX) ranging from 0 to F5
    • for LOTOS 301 the address consists of an empty text string (i.e. "")
    • for A/D inputs the address consists of a text string <input>/<parameter>[/<option>]
      • <input> – number of the input for which data reading is to be made, setting options:
        • 1 – input 1
        • 2 – input 2
        • 3 – input 3
      • <parameter> – text string specifying the data to be read; setting options:
        • ADC – analogue signal measurement on an analogue input
        • DIN – logical value reading on analogue input; result values: 0 to 1
        • PULSE – digital input pulse counter reading
      • <option> – text string specifying the parameter options; setting options:
        • for ADC:
          • CAL – the data reading result is a calibrated value ranging from 0 to 100
          • ABS – the data reading result is a value obtained directly from the A/D converter ranging from 0 to 1023
        • for DIN – <option> is undefined and thus unavailable for this parameter
        • for PULSE:
          • ABS – the data reading result is the current pulse count read in the input pulse counter ranging from 0 to (2^64–1)
          • REL – the data reading result is the pulse count read after the last data reading (or pulse counter deletion/resetting) ranging from 0 to (2^64–1)
  • <interval> – data reading interval – time interval symbol text string
    • count of minutes, hours or days; setting options:
    • "1M", "2M", "3M", "4M", "5M", "6M", "10M", "12M", "15M", "20M", "30M", "1H", "2H", "3H", "4H", "6H", "8H", "12H", "1D"


— Examples of Use —

As configuration is not easy, let us give a few examples to help you set the required function(s) successfully.

Example – suppose you want to add a device to the device list, which is connected to physical port 2 and communicates via IEC 62056-21, the device address is 869551 and the data reading interval is 3 minutes:

AT^SCAMS="DEV_ADD",2,"IEC62056-21","869551","3M"
Example – same as above, but the protocol is given in the numerical format:
AT^SCAMS="DEV_ADD",2,1,"869551","3M"
Example – suppose you want to add a device to the device list, which is connected to physical port 2 and communicates via M-Bus, the device address is 128, the baud rate is 2400 Bd and the data reading interval is 1 hour:
AT^SCAMS="DEV_ADD",2,"MBUS","128@2400","1H"
Example – same as above, but the baud rate is not specified and so the default baud rate of 2400 Bd is used:
AT^SCAMS="DEV_ADD",2,"MBUS","128","1H"
Example – same as above, but the protocol is given in the numerical format:
AT^SCAMS="DEV_ADD",2,2,"128","1H"

Example – suppose you want to add a device to the device list, which is connected to physical port 2 and communicates via M-Bus, the secondary device address is 01579411, the baud rate is 2400 Bd and the data reading interval is 1 hour:
AT^SCAMS="DEV_ADD",2,"MBUS","*01579411@2400","1H"

Example – suppose you want to add a device to the device list, which is connected to physical port 2 and communicates via M-Bus, the secondary device address with two wildcard positions is 015794FF, the baud rate is 2400 Bd and the data reading interval is 1 hour:
AT^SCAMS="DEV_ADD",2,"MBUS","*015794FF@2400","1H"

Example – suppose you want to add a device to the device list, which is connected to the A/D input port, and the interval of calibrated analogue value reading on analogue input 1 is 1 hour:
AT^SCAMS="DEV_ADD",128,"AIN_DIN","1/ADC/CAL","1H"

Example – suppose you want to add a device to the device list, which is connected to the A/D input port, and the interval of logical value reading on analogue input 2 is 2 hours:
AT^SCAMS="DEV_ADD",128,"AIN_DIN","2/DIN","2H"

Example – same as above, but the protocol is given in the numerical format:
AT^SCAMS="DEV_ADD",128,128,"2/DIN","2H"

Example – suppose you want to add a device to the device list, which is connected to the A/D input port, and the interval of pulse counter reading on digital input 1 is 2 hours:
AT^SCAMS="DEV_ADD",128,"AIN_DIN","1/PULSE/ABS","2H"

Response format – action succeeded:

OK

Response format – action failed:

ERROR

 

— End of Examples —

AT^SCAMS="DEV_REMOVE",<index>
The AMS module command removes a device from the device list.
  • <index> – index of the device (in the device list) to be removed
Example – suppose you want to remove the index 4 device from the device list:
AT^SCAMS="DEV_REMOVE",4

Response format – action succeeded:

OK

Response format – action failed:

ERROR
AT^SCAMS="DEV_CLEAR"

The AMS module command removes all devices from the device list.

Response format – action succeeded:

OK

Response format – action failed:

ERROR
AT^SCAMS="DEV_INTERVAL",<index>,<interval>

The AMS module command changes the data reading time interval for a device included in the device list.

  • <index> – index of the device (in the device list) for which time is to be changed
    • numeric format (number) or symbolic name (text string)
      • for number: index of the device (in the device list) for which time is to be changed
      • for text string: "ALL" - change time for all the devices included in the device list
  • <interval> – time interval symbol text string (minutes/hours/days), setting options:
    • "1M", "2M", "3M", "4M", "5M", "6M", "10M", "12M", "15M", "20M", "30M", "1H", "2H", "3H", "4H", "6H", "8H", "12H", "1D"

Example – suppose you want to change the data reading interval to 1 hour for the index 3 device:

AT^SCAMS="DEV_INTERVAL",3,"1H"

Example – suppose you want to change the data reading interval to 30 minutes for all the devices listed:

AT^SCAMS="DEV_INTERVAL","ALL","30M"

Response format – action succeeded:

OK

Response format – action failed:

ERROR
AT^SCAMS="DIRECT_READ",<port>,<protocol>,<address>,{<extra_parameter1>[<extra_parameter2>]}

The AMS module command performs immediate data reading from a device and writes out the data.

  • <port> – number of the physical port to which the device is connected – number
    • 1 – RS232 communication port
    • 2 – RS232/RS485/M-Bus communication port (depending on the HW version)
    • 128 – internal A/D input module communication port (analogue/digital input module)
  • <protocol> – name/number of the communication protocol used for device communication
    • for number:
      • 1 – denotes the IEC 62056-21 protocol
      • 2 – denotes the M-Bus protocol
      • 3 – denotes the Modbus protocol
      • 64 – denotes the INMAT 51 / INMAT 66 communication protocol
      • 65 – denotes the LOTOS 301 communication protocol
      • 128 – denotes the A/D input reading protocol (for reading data from the analogue/digital input module)
    • for text string:
      • "IEC62056-21" – denotes the IEC 62056-21 protocol
      • "MBUS" – denotes the M-Bus protocol
      • "MODBUS" – denotes the Modbus protocol
      • "INMAT" – denotes the INMAT 51 / INMAT 66 communication protocol
      • "LOTOS" – denotes the LOTOS 301 communication protocol
      • "AIN_DIN" – denotes the A/D input protocol (analogue/digital input module data reading protocol)
  • <address> – device address – device address text string
    • for IEC 62056-21 –  the address consists of text string  <address> [@ <default_baudrate>][% <switches>], where:
      • <address> – device address (identical with the original device address)
      • < default_baudrate – an optional parameter defining the default baud rate in Bauds
      • < switches > – an optional parameter – switch array for data reading process control. Now an 'R' switch is only implemented to prevent a change of the initial baud rate.
    • for M-Bus- the address consists of text string <address>[@<baudrate>]
      • <address> – M-Bus device (meter) address
        • primary address – <address> is a number ranging from 0 to 250 
        • secondary address – <address> has the format *<address_8>, where <address_8> consists of 8 characters of the secondary address, where each character is:
          • a digit ranging from 0 to 9
          • a wildcard 'F' character (substituting any numerical value on the given position in the range between 0 and 9)
      • <baudrate> – communication rate in bauds;  if the parameter is not included, the default value is used. Setting options: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400. Default value: 2400.
    • for Modbus the address consists of text string <address> @ <default_baudrate> [<max_cmd_data_size>, <data_block_1>,...., <data_block_N>], where:
      • <address> – Modbus device 8-bit address (mandatory parameter) 
      • < default_baudrate > – a mandatory parameter defining the default baud rate in bauds. Default = 9600.
      • <max_cmd_data_size> – an optional parameter defining the maximum size of the data block to be provided by the target device at once. Default = 1.
      • <data_block_x> – an optional parameter consisting of the following parts: <cmd>:<mem_addr>:<data_cnt>, where:
        • <cmd> – Modbus command, 8-bit HEX
        • <mem_addr> – target Modbus device memory address, 16-bit HEX
        • <data_cnt> – count of data to be read out of the target Modbus device, starting at  <mem_addr>, 16-bit DEC
    • for INMAT 51/66 the address consists of text string <address>[@<baudrate>]|<command_1>,<command_2>,....,<command_N>, where:
        • <address> – device address – number ranging from 0 to 63 
        • <baudrate> – communication rate in bauds. If the parameter is not included, the default baudrate is used: 9600.
        • <command_x> – text string <command_code>[:<parameter_1>[:<parameter_2>[:....[:<parameter_K>]]]]", which specifies one command.
          • <command_code> – an alphabetical letter that specifies an INMAT 51/66 command. The letters are assigned to the following commands:
              • 'I' – read device ID
              • 'S' – read one value
              • 'E' – read one value from value matrix
              • 'B' –read value block from value matrix
              • 'M' – read memory
          • <parameter_x> – text string of one command parameter. The count of command parameters depends on the command type. The command parameter counts and formats are as follows:
              • command 'I' (read device ID): parameter count is zero (no parameters are needed)
              • command 'S' (read one value): parameter count is 2
                • <parameter_1> – an alphabetical letter that specifies the required variable type. The letters are assigned to the following types:
                    • 'I' – type "INT", 2 bytes
                    • 'L' – type "LONG", 4 bytes
                    • 'F' – type "FLOAT", number with a decimal floating point (according to IEEE), 4 bytes
                    • 'S' – type "STRING", sequence of ASCII characters terminated with a zero char, 1 to 246 bytes
                • <parameter_2> – database variable index within a station (INX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FF
              • command 'E' (read  one value from value matrix): parameter count is 4
                • <parameter_1> – an alphabetical letter that specifies the required variable type. The letters are assigned to the following types:
                  • 'I' – type "INT", 2 bytes
                  • 'L' – type "LONG", 4 bytes
                  • 'F' – type "FLOAT", number with a decimal floating point (according to IEEE), 4 bytes
                  • 'S' – type "STRING", sequence of ASCII characters terminated with a zero char, 1 to 246 bytes
                • <parameter_2> – database variable index within a station (INX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FF
                • <parameter_3> – database variable row index of the matrix type (IY); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_4> – database variable column index of the matrix type (IX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
              • command 'B' (read value block from value matrix): parameter count is 6
                • <parameter_1> – an alphabetical letter that specifies the required variable type. The letters are assigned to the following types:
                  • 'I' – type "INT", 2 bytes
                  • 'L' – type "LONG", 4 bytes
                  • 'F' – type "FLOAT", number with a decimal floating point (according to IEEE), 4 bytes
                  • 'S' – type "STRING", sequence of ASCII characters terminated with a zero char, 1 to 246 bytes
                • <parameter_2> – database variable index within a station (INX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FF
                • <parameter_3> – database variable row index of the matrix type (IY); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_4> – database variable column index of the matrix type (IX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_5> – database variable row index of the matrix type (NY); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_6> – database variable column index of the matrix type (NX); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
              • command 'M' (read memory): parameter count is 6
                • <parameter_1> – "offset", defines an offset within a segment (OFFS); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_2> – "segment", defines a memory segment (SEG); hexadecimal number (16-bit ASCII HEX) ranging from 0 to FFFF
                • <parameter_3> – count of read bytes; hexadecimal number (16-bit ASCII HEX) ranging from 0 to F5
    • for LOTOS 301 the address consists of an empty text string (i.e. "")
    • for A/D inputs the address consists of text string <input>/<parameter>[/<option>]
      • <input> – number of the input for which data reading is to be made, setting options:
        • 1 – input 1
        • 2 – input 2
        • 3 – input 3
      • <parameter> – text string specifying the data to be read; setting options:
        • ADC – analogue signal measurement on an analogue input
        • DIN – logical value reading on analogue input; result values: 0 to 1
        • PULSE – digital input pulse counter reading
      • <option> – text string specifying the parameter options; setting options:
        • for ADC:
          • CAL – the data reading result is a calibrated value ranging from 0 to 100
          • ABS – the data reading result is a value obtained directly from the A/D converter ranging from 0 to 1023
        • for DIN – <option> is undefined and thus unavailable for this parameter
        • for PULSE:
          • ABS – the data reading result is the current pulse count read in the input pulse counter ranging from 0 to (2^64–1)
          • REL – the data reading result is the pulse count read after the last data reading (or pulse counter deletion/resetting) ranging from 0 to (2^64–1)
  • < extra_parameter1  > – an optional protocol parameter
    • specifies the protocol default baud rate
    • IEC 62056-21 – specifies the required default baud rate of the protocol; if the parameter is not included, the default value is used
    • M-BUS – no meaning (ignored)
    • MODBUS – no meaning (ignored)
    • INMAT 51/66 – no meaning (ignored)
    • LOTOS 301 – no meaning (ignored)
    • A/D inputs – no meaning (ignored)
  • <  extra_parameter2  > – an optional protocol parameter
    • specifies whether to deny or accept a higher baud rate offer for the "Protocol mode C"
    • IEC 62056-21 – logical value (if the parameter is not included, 0 is used)
      • 0 – the protocol accepts the higher baud rate offer from the device for the "Protocol mode C"
      • 1 – the protocol denies the higher baud rate offer from the device for the "Protocol mode C" and communication goes on at the default rate
    • M-Bus – no meaning (ignored)
    • Modbus – no meaning (ignored)
    • INMAT 51/66 – no meaning (ignored)
    • LOTOS 301 – no meaning (ignored)
    • A/D inputs – no meaning (ignored)


Response format:

^SCAMS: <error_code>,<device_identification>,<data>
OK
  • <error_code> – error code returned as a result of the data reading process (0 means no error) – number
    • 32-bit signless decimal number
  • <device_identification> – device identification – text string
  • <data> – raw data read from a device – text string

— Examples of Immediate Readings —

Example – suppose you want to read immediately and write out data for a device connected to port 2, communicating via IEC 62056-21 and having the address 947833:

AT^SCAMS="DIRECT_READ",2,1,"947833"

Example – same as above, but the default baud rate is 1200 Bd:

AT^SCAMS="DIRECT_READ",2,"IEC62056-21","947833",1200

Example – same as above, but the higher baud rate offer for the "Protocol mode C" from the device is denied:

AT^SCAMS="DIRECT_READ",2,1,"947833",1200,1

Example – suppose you want to read immediately and write out data for a device connected to port 2, communicating via M-Bus, having the primary address 128 and communicating at 2400 Bd:

AT^SCAMS="DIRECT_READ",2,"MBUS","128@2400"

Example – same as above, but the baud rate is not specified and thus the default baud rate of 2400 Bd is used: 

AT^SCAMS="DIRECT_READ",2,"MBUS","128"

Example – same as above, but the protocol is given in the numerical format :

AT^SCAMS="DIRECT_READ",2,2,"128"

Example – suppose you want to read immediately and write out data for a device connected to port 2, communicating via M-Bus, having the secondary address 01579411 and communicating at 2400 Bd:

AT^SCAMS="DIRECT_READ",2,"MBUS","*01579411@2400"

Example – suppose you want to read immediately and write out data for a device connected to port 2, communicating via M-Bus, having the secondary address with two wildcard positions 015794FF and communicating at 2400 Bd: 

AT^SCAMS="DIRECT_READ",2,"MBUS","*015794FF@2400"

Example – suppose you want to read the immediate signal value for analogue input 1 via the A/D input port and calibrate and write out the result:

AT^SCAMS="DIRECT_READ",128,"AIN_DIN","1/ADC/CAL"

Example – suppose you want to read the immediate signal value for analogue input 2 via the A/D input port, convert the result into logical signal level value and write out the result:

AT^SCAMS="DIRECT_READ",128,"AIN_DIN","2/DIN"

Example – suppose you want to read the immediate pulse counter value for digital input 1 via the A/D input port and write out the result:

AT^SCAMS="DIRECT_READ",128,"AIN_DIN","1/PULSE/ABS"

— End of Examples of Immediate Readings — 

Automatic Meter Detection

The command is used for automatic detection of a device on a bus.

Caution

  • When you enter this command, the SCDATA (record memory) and meter list will be deleted!
AT^SCAMSADD=,<port>,<protocol>,<baudrate>,<interval>,<number_of_expected_devices>

The command detects a device on the bus, adds it to AMS device list, deletes data in the data space and writes out the result including the addresses of the meters detected.

  • <port> – number of the physical port to which the device is connected – number
    • 1 – RS232 communication port
    • 2 – RS232/RS485/M-Bus communication port (depending on the HW version)
  • <protocol> – name/number of the communication protocol used for device communication
    • for number:
      • 2 – denotes the M-Bus protocol
      for text string:
      • "MBUS" – denotes the M-Bus protocol
  • <baudrate> – communication rate in bauds; if the parameter is not included, the default value is used
    • setting options: 300, 600, 1200, 2400; default value: 2400

  • <interval> – time interval symbol text string (minutes/hours/days); setting options:
    • "1M", "2M", "3M", "4M", "5M", "6M", "10M", "12M", "15M", "20M", "30M", "1H", "2H", "3H", "4H", "6H", "8H", "12H", "1D"
  • <number_of_expected_devices> –  number specifying the count of newly added devices
    • count of devices expected to be on the bus. If the count is met, automatic detection will be terminated.

Response format:

^SCAMSADD:<error_code>,<number_of_devices>,"<primary_address1>;<secondary_address1>;<primary_address2>;<secondary_address2>;....................."
OK

Examples of commands (3 meter detection on M-Bus, 2400 Bd 2 hour AMS reading interval) – one command written in different ways:

AT^SCAMSADD=2,2,"default","2h",3
AT^SCAMSADD=2,2,"2400","2h",3
AT^SCAMSADD=2,mbus,"default","2h",3
AT^SCAMSADD=2,mbus,"2400","2h",3

Examples of responses:

No error (detection of 3 meters):

^SCAMSADD: 0,3,"1,00660421;19,08780251;1,09801004"
OK

Error (a different count of meters detected, 2 meters here):

^SCAMSADD: 65286,2,"1,00660421;19,08780251"
OK

Error (secondary address collision of the M-Bus slave devices):

^SCAMSADD: 131094,0,""
OK

Reading of AMS Records

AT interface for AMS-type data record reading.

AT^SCDATA=?
The command writes out the list of commands for data reading module control.

Response:

^SCDATA: "MESS_CNT"
^SCDATA: "GET_SPACE"
^SCDATA: "GET_OLDEST"
^SCDATA: "GET_FILTERED","0-150"
^SCDATA: "DEL_OLDEST"
^SCDATA: "DEL_ALL"
OK
AT^SCDATA="MESS_CNT"

The data reading module command returns the count of data records stored.

Response format:

^SCDATA: "MESS_CNT",<count>
OK

Example of response (the data record memory contains 44 records):

^SCDATA: "MESS_CNT",44
OK
AT^SCDATA="GET_SPACE"

The data reading module command returns the memory size available for data records (in bytes).

Response format:

^SCDATA: "GET_SPACE",<count>
OK

Example of response (the available free memory space is 7008089 B):

^SCDATA: "GET_SPACE",7008089
OK
AT^SCDATA="GET_OLDEST",<count>

The data reading module command returns the listing of the oldest data records.

  • <count> – specifies the count of the oldest records to be listed – number

 

Tip

  • If you enter AT^SCDATA="GET_OLDEST" without specifying the count of records, the last record will only be read.

Response format for a known data format and meaning of the parameters in the row:

AT^SCDATA: <record_type>,<time_stamp>,<sequence_number>,<protocol>,<index>,<error_code>,<device_identification>,<data>
OK
  • <record_type> – data record type –  data record type text string
    • "AMS" – AMS (Autonomous Metering System) record
    • WMBUS" – Wireless M-Bus record
    • SYSTART" – system start record
  •   <time_stamp> – data storing timestamp – number
    • 32-bit Unix timestamp
  • <sequence_number> – record sequence number (incrementing with every new record) – number
  • <protocol> – name of the communication protocol used for device communication – text string
    • strings "IEC62056-21", "MBUS", "MODBUS", "INMAT", "LOTOS", "AIN_DIN" and "Unknown" are available in the current version
  • <index> – device index in the device list at the time of data recording - number
  • <error_code> – error code returned as a result of the device data reading process (0 means no error) – number
    • 32-bit decimal signless number
  • <device_identification> – text string returned as device identification – text string
    • for IEC 62056-21 – text identification string (as received from the device)
    • for M-Bus – empty text string (identification string does not exist)
    • for Modbus – empty text string (identification string does not exist)
    • for INMAT 51/66 – empty text string (identification string does not exist)
    • for LOTOS 301 – empty text string (identification string does not exist)
    • for A/D inputs – text identification string, which:
        • is a copy of the device address text string "<input>/<parameter>[/<variant>]" in case the device address is specified correctly
        • is empty (i.e. "") in case the device address is wrong
  • <data> – raw data read from the device  – text string
    • for IEC 62056-21 – received data text string (as received from the device)
    • for M-Bus – data framework text string received from the device in the ASCII HEX format (data byte is represented by two consecutive ASCII characters specifying the data byte value in the hexadecimal format)
    • for Modbus – text string <address>:<cmd>:<mem_addr>:whole data framework received from the device in the ASCII HEX format (data byte is represented by two consecutive ASCII characters specifying the data byte value in the hexadecimal format)
    • for INMAT 51/66 – text string <address>|<result_1>,<result_2>,....,<result_N>
        • <address> – device address (as specified in the device address string); number ranging from 0 to 63
        • <result_x> – text string <command_x>=<result_x_data>, which contains the command result (including the sequence number) in the device address string. The count of command results is equal to the count of commands in the device address string (including the sequence).
            • <command_x> – command text string from the device address string on the basis of which the result was generated
            • <result_x_data> – text string of binary data received from a device in the ASCII HEX format (data byte is represented by two successive ASCII characters giving the data byte value in the hexadecimal format) in case no error occurs; text string "ERR" in case an error is detected (unavailable data, different data type, unauthorised data access)
    • for  LOTOS 301 – text string <result_1>,<result_2>,....,<result_N>
        • <result_x> – text string <identifier>=<value>, which contains the result of data acquisition from a meter. The result count is determined by the count of unique identifiers sent by the meter. The results are arranged in ascending order according to the identifier numerical values.
            • <identifier> – numerical ID of the variable to be sent, decimal number ranging from 0 to 999
            • <value> – value of the variable to be sent; text string (without spaces) including text representation of the numerical decimal variable value (non-integers with order points/negative numbers are acceptable)
    • for A/D inputs – result value text string in the decimal format 
Example of response:
^SCDATA: "WMBUS",1452142010,36617,-14,70,"44A2057714005401377277140054A2050137E70000002F2F046D052707210167
60DFD11106563616B696E756D6F6B656C65544E320E138545030000002F2F2F2F2F2F2F2F2F"
OK

Response format for unknown data format:

AT^SCDATA: <record_type>,<time_stamp>,<sequence_number>,"Unsupported record format"
OK

Filtering of AMS Records

AT^SCDATA="GET_FILTERED",<filter>

The data reading module command returns the listing of records according to the preset record filter.

  • <filter> – specifies the filtering requirements for data record listing and is applied to all data records in the record memory.

Response format for a known data format and meaning of the parameters in the row:

AT^SCDATA: <record_type>,<time_stamp>,<sequence_number>,<protocol>,<index>,<error_code>,<device_identification>,<data>
OK
  • <record_type> – data record type – data record type text string
    • "AMS" – AMS (Autonomous Metering System) record
    • WMBUS" – Wireless M-Bus record
    • "SYSTART" – system start record
  •  <time_stamp> – data storing timestamp – number
    • 32-bit Unix timestamp
  • <sequence_number> – record sequence number (incrementing with every new record) – number
  • <protocol> – name of the communication protocol used for device communication – text string
    • "IEC62056-21", "MBUS", "MODBUS", "INMAT", "LOTOS", "AIN_DIN", "Unknown"
  • <index> – device index in the device list at the time of data recording - number
  • <error_code> – error code returned as a result of the device data reading process (0 means no error) – number
    • 32-bit decimal signless number
  • <device_identification> – text string returned as device identification – text string
    • for IEC 62056-21 – text identification string (as received from the device)
    • for M-Bus – empty text string (identification string does not exist)
    • for INMAT 51/66 – empty text string (identification string does not exist)
    • for LOTOS 301 – empty text string (identification string does not exist)
    • for A/D inputs – text identification string, which:
        • is a copy of the device address text string "<input>/<parameter>[/<variant>]" in case the device address is specified correctly
        • is empty (i.e. "") in case the device address is wrong
  • <data> – raw data read from the device – text string
    • for IEC 62056-21 – data text string (as received from the device)
    • for M-Bus – data framework text string received from the device in the ASCII HEX format (data byte is represented by two consecutive ASCII characters specifying the data byte value in the hexadecimal format)
    • for Modbus – text string <address>:<cmd>:<mem_addr>:whole data framework received from the device in the ASCII HEX format (data byte is represented by two consecutive ASCII characters specifying the data byte value in the hexadecimal format
    • for INMAT 51/66 – text string <address>|<result_1>,<result_2>,....,<result_N>
        • <address> – device address (as specified in the device address string); number ranging from 0 to 63
        • <result_x> – text string <command_x>=<result_x_data>, which contains the command result (including the sequence number) in the device address string. The count of command results is equal to the count of commands in the device address string (including the sequence)
            • <command_x> – command text string from the device address string on the basis of which the result was generated
            • <result_x_data> – text string of binary data received from a device in the ASCII HEX format (data byte is represented by two successive ASCII characters giving the data byte value in the hexadecimal format) in case no error occurs; text string "ERR" in case an error is detected (unavailable data, different data type, unauthorised data access)
    • for  LOTOS 301 – text string <result_1>,<result_2>,....,<result_N>
        • <result_x> – text string <identifier>=<value>, which contains the result of data acquisition from a meter. The result count is determined by the count of unique identifiers sent by the meter. The results are arranged in ascending order according to the identifier numerical values.
            • <identifier> – numerical ID of the variable to be sent, decimal number ranging from 0 to 999
            • <value> – value of the variable to be sent; text string (without spaces) including text representation of the numerical decimal variable value (non-integers with order points/negative numbers are acceptable).
    • for A/D inputs – result value text string in the decimal format


Filter Settings

The general format for <filter> is "<condition>;<condition>;........;<condition>", where <condition> specifies the filtering condition. The maximum count of conditions in the <filter> array is 10. The data record listing is sent only if it meets all the <filter> conditions.

<condition> – general format for <condition> is <parameter><session><value>

<parameter> – text string defining the condition parameter. The supported strings are as follows:

  • RECORD_TYPE – data record type
  • TIME – data record timestamp
  • TABLE_ID – device index in the device list
  • ERROR_CODE – data record error code

<session> – text string defining the required session between the condition parameter and condition value. The supported strings are as follows:

  • == – is equal to
  • != – is not equal to
  • > – is greater than
  • >= – is greater than or equal to
  • < – is smaller than
  • <= – is smaller than or equal to

<value> – numerical value/name text string

 

Examples of Use

The command writes out all the Wireless M-Bus data records contained in the data record memory.

AT^SCDATA="GET_FILTERED","RECORD_TYPE==WMBUS"

The command writes out all the AMS data records whose timestamps fall into the interval ranging from 1388665085 to 1388668685 inclusive.

AT^SCDATA="GET_FILTERED","RECORD_TYPE==AMS;TIME>=1388665085;TIME<=1388668685"

The command writes out all the AMS data records whose timestamps are greater than 1388665085 and whose device index in the AMS device list is 1.

AT^SCDATA="GET_FILTERED","RECORD_TYPE==AMS;TIME>1388665085;TABLE_ID==1"
The command writes out all the data records whose error code is non-zero.
AT^SCDATA="GET_FILTERED","ERROR_CODE!=0"

The command writes out all the data records whose error code is 0, whose record type is AMS and whose timestamp is greater than 1388668685.

AT^SCDATA="GET_FILTERED","ERROR_CODE==0;RECORD_TYPE==AMS;TIME>1388668685"

Record Deleting

AT^SCDATA="DEL_OLDEST",<count>

The data reading module command deletes the oldest data record.

  • <count> – specifies the count of the oldest records to be deleted.

Example: remove the 5 oldest data records from the memory.

AT^SCDATA="DEL_OLDEST",5

Response format – action succeeded:

OK

Response format – action failed:

ERROR
AT^SCDATA="DEL_ALL"

The data reading module command deletes all the data records.

Response format – action succeeded:

OK

Response format – action failed:

ERROR

AMS Error Codes in Data Reading Lists

General AMS Core Errors

0No error (no error has occurred)
1Error in parametric reading data input to protocol module
2Error in reading data output from protocol module
3Required protocol cannot be connected to specified physical port
4Data reading from device was not started

IEC 62056-21 Support Plug-In Module Errors

65536Non-specific error (module internal error)
65537Data reading interrupted and terminated by user
65538Wrong device address string format
65539Unsupported baud rate character in device response
65540Physical port baud rate was not set
65541Identification message timeout
65542AMS-unsupported protocol mode is used in AMS
65543Acknowledgement/option select message timeout
65544Physical port baud rate was not set
65545Two consecutive message character timeout
65546Two consecutive message timeout
65793Invalid character in Manufacturer's identification in Identification message received
65794Invalid character in Baud rate identification in Identification message received
65795Invalid character in Identification in Identification message received
65796Invalid character in CR and LF arrays in Identification message received
66049Invalid character in Data block in Data message received
66050Insufficient size of AMS internal received data buffer for the amount of data in Data block in Data message received
66051Invalid character in CR and LF arrays in Data message received
66052Invalid character in ETX in Data message received
66053Data integrity error in Data message, BCC value does not match the calculated block control character

M-Bus Support Plug-In Module Errors

131072

Non-specific error (module internal error)

131073

Data reading interrupted and terminated by user

131074

Wrong device address (and baud rate) string format

131075

Physical port baud rate was not set

131076

Sending "SND_NKE" communication framework to device within defined timeout failed

131077

Sending "SND_NKE" communication framework to device within defined timeout failed

131078

Response reception timeout from device to "SND_NKE" communication framework

131079

Wrong communication framework type in response from device to "SND_NKE" communication framework

131080

Sending "RE"REQ_UD2" communication framework to device within defined timeout failed

131081

Sending "RE"REQ_UD2" communication framework to device within defined timeout failed

131082

Response reception timeout from device to"REQ_UD2" communication framework

131083

Wrong communication framework type in response from device to "REQ_UD2" communication framework

131084

Wrong response type from device to "REQ_UD2" communication framework

131085

Wrong device address in response from device to "REQ_UD2" communication framework

131086

Sending "SND_UD slave selection" communication framework to device within defined timeout failed

131087Sending "SND_UD slave selection" communication framework to device within defined timeout failed
131088Response reception timeout from device to "SND_UD slave selection" communication framework
131089Wrong communication framework type in response reception from device to "SND_UD slave selection" communication framework
131090Sending "SND_UD slave selection" communication framework within defined timeout to slave devices failed during slave device detection
131091

Sending "SND_UD slave selection" communication framework within defined timeout to slave devices failed during slave device detection

131092Sending "REQ_UD2" communication framework within defined timeout to slave devices failed during slave device detection on bus
131093Sending "REQ_UD2" communication framework within defined timeout to slave devices failed during slave device detection on bus
131094Slave device address collision during slave device detection on bus (two or more slave devices use the same secondary address)
131095Sending user defined communication framework to device within defined timeout failed
131096Sending user defined communication framework to device within defined timeout failed
131097Response reception timeout from device to user defined communication framework (incomplete framework received within defined timeout)
131329Wrong first "start" character of response framework from device

131330

Wrong second "start" character of response framework from device

131331

Wrong "stop" character of response framework from device

131332

Wrong checksum of response framework from device

131333

Integrity error of data defining length of response framework from device

131334

Invalid value of data defining length of response framework from device

131335Internal data buffer length for framework reception is insufficient for received framework data amount

Modbus Support Plug-In Module Errors

196608

Non-specific error (module internal error)

196609

Data reading interrupted and terminated by user

196610

Wrong message string format

196611

Required communication port settings failed

196612

Sending communication framework to device within defined timeout failed

196613

Sending communication framework to device within defined timeout failed

196614

Response reception timeout from device to communication framework

196615

Communication framework error while receiving response from device, including CRC error

196616

Internal AMS data buffer length for data metering result transmission is insufficient

196640

Invalid or unknown Modbus device response format

INMAT 51 / INMAT 66 Support Plug-In Module Errors

4194304

Non-specific error (module internal error)

4194305

Data reading interrupted and terminated by user

4194306

Wrong device address string format (string length)

4194307

Wrong device address string format (string format)

4194308

Wrong device address string format (string format)

4194309

Required communication port settings failed

4194310

Sending "Request FDL-Status with Reply" communication framework to device within defined timeout failed

4194311

Sending "Request FDL-Status with Reply" communication framework to device within defined timeout failed

4194312Response reception timeout from device to "Request FDL-Status with Reply" communication framework
4194313Wrong communication framework type for response reception from device to "Request FDL-Status with Reply" communication framework
4194314Wrong "Destination Address" value in response from device to "Request FDL-Status with Reply" communication framework
4194315Wrong "Source Address" value in response from device to "Request FDL-Status with Reply" communication framework
4194316Wrong "Frame Control" value in response from device to "Request FDL-Status with Reply" communication framework
4194317Wrong "Frame Control" value in response from device to "Send and Request Data high" communication framework (framework with error signalling)
4194318Wrong "Frame Control" value in response from device to "Send and Request Data high" communication framework (framework with requested data)
4194319Sending "Send and Request Data high" communication framework to device within defined timeout failed
4194320Sending "Send and Request Data high" communication framework to device within defined timeout failed
4194321Response reception timeout from device to "Send and Request Data high" communication framework
4194322Wrong "Destination Address" value in response from device to "Send and Request Data high" communication framework
4194323

Wrong "Source Address" value in response from device to "Send and Request Data high" communication framework

4194324Wrong "Response Code" value (protocol application layer array) in response from device to "Send and Request Data high" communication framework (framework with requested data)
4194325Internal AMS data buffer length for data metering result transmission is insufficient
4194561Wrong first "start" character of response framework from device
4194562Wrong second "start" character of response framework from device
4194563Wrong "end" character of response framework from device
4194564Wrong checksum of response framework from device
4194565Integrity error of data defining length of response framework from device ("LE" value does not match "LEr" value)
4194566Invalid value of data defining length of response framework from device (invalid "LE" value)
4194567Internal data buffer length for framework reception is insufficient for received framework data amount

LOTOS 301 Support Plug-In Module Errors

4259840

Non-specific error (module internal error)

4259841

Data reading interrupted and terminated by user

4259842

Wrong device address string format (string length)

4259843

Wrong device address string format (string format)

4259844

Required communication port settings failed

4259845

Data acquisition process from device is still at start (data incomplete, cannot be provided yet)

4259846

Internal AMS data buffer length for data metering result transmission is insufficient

4259847

Device connection error (no data available from device)

A/D Input Support Plug-In Module Errors

8388608

Non-specific error (module internal error)

8388609

Data reading interrupted and terminated by user

8388610

Wrong device address string format

8388611

Request communication framework sending timeout to A/D input module

8388612

Request communication framework sending wait timeout to A/D input module

8388613

Response framework receiving timeout from A/D input module

8388865

Wrong response framework type from A/D input module

8388866

Wrong response framework sequence number from A/D input module

8388867

Insufficient size of AMS internal data buffer for the amount of A/D input module response framework data

8388868

Wrong checksum of response framework from A/D input module

8388869

Wrong synchronisation array of response framework end from A/D input module

ONF Customer Module Errors (Pseudo-AMS Error Codes)

65280Non-specific error (module internal error)
65281User-defined expected count of M-Bus slave devices is greater than the maximum device count to be served by AMS
65282AMS searching start error for M-Bus slave devices
65283AMS searching result reading error for M-Bus slave devices
65284AMS device list deleting error
65285AMS searching result parsing error for M-Bus slave devices
65286Count of slave devices found on M-Bus fails to match user-defined expected count of slave devices
65287Error while adding detected M-Bus slave devices to AMS device list
65288User output SMS count exceeds the maximum allowed SMS count
65289Required functionality is unavailable for the given protocol
65290AMS device list deleting error (one or more devices cannot be removed from the list)
65291More devices detected on the bus than allowed in AMS device list