Suchen Sie etwas anderes?
Scenario details:
- We have a PLC Modbus RTU. This PLC has a series of variables/registries (for instance, temperature and 3 meter boxes) inside its internal memory, which need to be read and sent periodically to an FTP server
- That is why the MTX-Tunnel needs to ask the PLC to read said registries every 15 minutes via a serial port. The registries to be read are, for the temperature the registry number 20, and for the meter boxes the registries number 21, 22 and 23 respectively
- After every Reading, the MTX-Tunner should send the registries value to a web server via FTP using a JSON object, and in case of GPRS communication failure it should be able to store up to 1500 readings in its falsh memory that will be sent when communication is restored
- You should be able to access MTX-Tunnel anytime so you can read the PLC registries in real time, as well as writing on them and modifying PLC configuration registries
Solution: MTX-Tunnel firmware + MTX-Java-IoT/MTX-Java-T/MTX-Java-T2
EJEMPLO de configuración (fichero config.txt) para el escenario indicado:
Configuration | Observations |
COMM2_baudrate: 9600 COMM2_bitsperchar: 8 COMM2_autorts: off COMM2_autorts: off COMM2_stopbits: 1 COMM2_parity: none GPRS_apn: movistar.es GPRS_login: MOVISTAR GPRS_password: MOVISTAR GPRS_timeout: 0 MTX_PIN: 0000 MTX_mode: none MTX_model: 199801393 MTX_portAux: modbusmaster MTX_TPProtocol: ntp MTX_TPServer: ntp.roa.es MTX_TPServer2: es.pool.ntp.org MTX_ping: 35 MTX_pingIP: 8.8.8.8 MTX_rssiLevel: 10 SMS_allPhones: on SMS_sendIP: on SMS_ATEnabled: on SMS_ATResponse: on FIREWALL_enabled: off TELNET_enabled: on TELNET_login: user TELNET_password: 1234 TELNET_port: 20023 LOGGER_enabled: on LOGGER_password: ID00001 LOGGER_server: ftp.myFTPServer.com LOGGER_serverLogin: myUsername LOGGER_serverPassword: myPassword LOGGER_registerSize: 300 LOGGER_numRegistersFlash: 1500 LOGGER_mode: ftp MODBUS_address: 1 MODBUS_start: 20 MODBUS_numwords: 4 MODBUS_readCommand: 3 MODBUS_period: 900 |
Serial port (where internal GPS is connected) rate Number of bits No flow control No flow control 1 stop bit No parity APN GPRS provided by the GSM operator GPRS Login GPRS Password Modem is always GPRS connected SIM Card PIN MTX-Tunnel mode MTX modem model AUXILIAR COM port used as master modbus Time synch. protocol Time server Backup time server Ping every 35 minutes without comms IP address to ping AWe activate the MTX-65i coverage led All phone numbers are authorized IP sent to phone which called or “on” SM Remote AT commands by SMS enabled Modem response to AT command with SMS Any IP will be able to connect to the modem Telnet is activated Telnet login Telnet password Use TCP port 20023 We enable the MTX Logger, to store the records Password field can be used as ID device FTP server address FTP server username FTP server password Register size Maximum number of records in MTX Sending mode: ftp Modbus address of the computer to read Address of the initial register modbus to read Number of records to be read from the beginning Comando de lectura Every few seconds a reading is made |
Details:
- This example is about an MTX-4G-Java-IOT using an RS485 port, but we could do the same using the RS232 introducing the MTX_invertedCom parameter: on. At the end of the guide it is explained how to configure the internal microswitch to activate the RS485 bus
- Summarizing this example, the modem reads every 15 minutes a series of Modbus registries from the PLC and sends them through a JSON object to an FTP server (to the address specified in the LOGGER_server parameter). If the registry could not be sent because the server or the 3G/GPRS connection is down, it stores the data in its memory and sends them afterwards. You can connect directly to the equipment through Telnet, and check/change the PLC registries in real time. To do that, look for the AT^MTXTunnel=getmodbus and AT^MTXTUNNEL=setmodbus commands in this guide
- The JSON object sent to the FTP server is coded the following way, as an example:
{“IMEI”:353234028103206,”P”:”ID00001”,”TYPE”:”MODB”,”A”:1,”TS”:”20/08/12 08:31:44”,”ST”:20,”V1”:23,”V2”:275,”V3”:274,”V4”:32765}
- That is, the web server receives a JSON object with the modem IMEI (IMEI), a password field (P) that can be also used to identify the equipment in case you do not want to use the IMEI, the modbus address of the equipment (A), the time stamp (TS) when the modbus data has been read, the initial address read (ST) and V1, V2, … with each of the read variables.
- Important note: for compatibility’s sake, a different file is written for each registry sent to the FTP server. The name of the file is IMEI-fechaUTCdeEnvio. In case you have several módems, you can easily manage the files in your FTP server since they have an IMEI (identifying number for each modem) in the name of each file. In “fechaHoraUTCdeEnvio” you can find the UTC time the modem had (may the time be synchronized or not) in the moment of being sent to the FTP server.
- Example of name of file: 357042064802888-17-09-17-19-42-29.