Data Logger Suite: Logging and Monitoring
Logging and parsing data from an intellectual pressure measuring device
Pressure data logger
We require software, which can log data from an intellectual pressure measuring device from Paroscientific Inc into our data acquisition system. Paroscientific is the leader in the field of precision pressure measurement, resolution of better than 0.0001% and typical accuracy of 0.01% are achieved even under difficult environmental conditions.
When the Advanced Serial Data Logger receives the information from the serial port, he adds a date and time stamp.
We are using the Digiquartz ® pressure instrumentation. A RS-232 interface user manual for intelligent pressure devices exists on a corporate web-site.
Short hardware overview
Digiquartz ® Intelligent Transmitters, Portable Pressure Standards, Intelligent Depth Sensors, MET stations, and Water Stage Sensors consist of a standard Paroscientific pressure transducer and a digital interface board in an integral package. The digital interface boards are also available separately for customer systems where separate packaging of the transducer and interface board is desired.
Programming and operation are the same in all configurations. The digital board has a microprocessor-controlled counter and RS-232 port. The microprocessor operating program is stored in permanent memory (EPROM). User controllable parameters are stored in user writable memory (EEPROM). The user interacts with the unit via the two-way RS-232 interface.
The microprocessor monitors incoming commands from the computer. When a sampling command is received, the microprocessor selects the appropriate frequency signal source and makes a period measurement using a 14.74 MHz timebase counter. The counter integration time is user selectable. Some commands require measurements of both temperature and pressure signals. In that case, the temperature period is measured first, followed by the pressure period. When the period measurement is completed, the microprocessor makes the appropriate calculations and loads the data onto the RS-232 bus.
Short protocol overview
All commands have the form: *ddsscc__<cr><lf>
- Data framing is 8 data bits, no parity, with one stop bit or 7 data bits with even or odd parity, one stop bit. Set by command PT.
- Each line starts with an asterisk (*).
- The next 2 digits, dd are the destination for the command (00-99). The controller (IBM PC, etc.) is address 00, and the transmitters can be 01 through 98. Address 99 is for "global". A transmitter responds only to its own address or 99.
- 3. The next 2 digits, ss, are the source of the message (00-98).
- 4. The next 2 characters, cc, specify the type of message, and may be followed by more characters in some messages. Characters must be upper case. Reply messages may substitute data for the cc characters.
- 5. Each message line is terminated by a carriage return <cr> and a line feed <lf> .
- 6. Undefined commands are absorbed.
- 7. A command arriving before a previous command is completed cancels the previous command.
A typical message from the PC to transmitter #1 asking for pressure: *0100P3 <cr> <lf>
A typical reply from the transmitter to the PC: *000114.573 <cr> <lf>
- Data Logger Suite: Logging and Monitoring Professional, Enterprise, or trial version;
- ASCII Data Query and Parser
It is assumed that:
You know and can configure communication parameters (baud rate, number of data bits, flow control etc) in ASDL.
Thanks to Paroscientific for a detailed description of RS-232 protocol. The description above shows, that a data flow contains non-printable characters (CR and LF). If you want to look it, please, set following options. The option in the pos.3 allows you to identify request, which the logger will send to a device.
Fig.1. Pressure data logger. Serial data view setup
Now, click the "OK" button and try to receive a data from a serial port. Nothing? Sure, the protocol specification says, that a pressure device requires a request from a PC side. Ok. It's simple. We should configure additional modules. First, please, select the "ASCII data parser and query" plug-in from two drop-down lists (fig.2a, pos. 1 and 2). Then, enable a parsing option for data received (fig.2a, pos. 3) and select necessary data export plug-ins. The DDE server (fig.2b, pos. 3) will help to check the accuracy of the parser's configuration. The "Local database" plug-in (fig.2b, pos. 4) will create Microsoft Excel files.
Fig.2a. Pressure data logger. Data query and parser plug-ins.
Fig.2b. Pressure data logger. Data export plug-ins.
Now, please, open the ASCII query configuration window (click the "Setup" button near a first drop-down box on pic.2a, pos.1). The dialog window will appear on the desktop (fig.3).
Fig.3. Pressure data logger. Data query.
The window allows you to add one or more requests at the same time. All available requests (fig.3, pos.1) are listed in the requests list (fig.3, pos.4). The each request has a number of properties: the request data (fig.3, pos.2) and the request interval (fig.3, pos.3). You may edit a request by double-clicking over the request in the list.
Any new requests may be added by clicking the "Add request" button (fig.3, pos. 5). The new dialog window will appear over the previous window (fig.4)
Fig.4. Pressure data logger. Data query parameters.
Each request has a number of properties:
- Request string (fig.4, pos.1) - simple type the request string from the specification above and add hexadecimal codes of termination characters CR and LF at the end of the request. Each hexadecimal code should contain the "#" prefix character;
- Poll interval (fig.4, pos.2). - the module will send a new request after a specified interval. In this example the module will poll our pressure measuring device every second for a new value;
- At specified time - you should specify a time of a day, when the program will send the request;
- Wait response - the program will not send a new request until a response received within this interval.
Click the "OK" button in this dialog window. The module will add a new item to the requests list (fig. 3, pos.1).
Note: You can add a byte with any code to a request. For example, if you want to send byte with the 0x02 hexadecimal code to a device, then type the #02 string. If you want to send the "#" character, then you should type it twice.
Please, open the next page (fig.5) by clicking the "Parser" button. Then click the "Data packet" button.
Fig.5. Pressure data logger. Parser configuration window.
On this page you should type framing characters of a data packet. The field #1 is the start of the data packet ("*" in this example) and the field #2 is the end of the data packet (#0D#0A in this example, same as in the request above). In the field #3 you should specify a timeout value, which will be used if the module will not receive ending characters in the specified interval. Also, you can easily add a datetime stamp to an each data packet, that the parser will be process. Just enable the "Add date/time stamp" option in the pos.4.
The next page (fig.6) is a very important part of the parser configuration. The data parser uses this information for data extraction from the data packet. The data packet from this example contains one data item only, which should be placed to one variable. Later, this variable (a pressure value) will be used in a data export module and will be placed to a column of a database.
Fig.6. Pressure data logger. The parser item.
Any new items may be added by clicking the "Add item" button (pic.6, pos. 7). Before adding an item the program will ask you about an item description. You can type any characters here, which will help you to remember a variable's content. For this example one variable with a corresponding description has been added.
Each parser item has a number of properties:
- Item name - this name will be bound to a column in the data export plug-in. It is a limited text description and cannot contain spaces and a few other characters;
- Parser's type - is a method, which the program will use for data extraction. Our parser has a few methods from simple to most powerful. In this example, where data is being placed in fixed place, we can use the simple method - fixed position. This method allows the extraction of any number of characters from any fixed position of the data block;
- Data type - is the data type of the characters extracted. You can specify several data types. The data will be converted from the "String" data type to the conversion type. In this example, the "Pressure" item has the "Float" data type;
- Default value - the value specified here is to be used when data cannot be extracted from a data block;
- Fixed position - is the position of the first variable's character in our data block. The minimum value is 1;
- Fixed length - is the number of characters, which will be transferred to a variable. The minimum value is 1.
Other options (on other pages) are unnecessary in our case, because we don't need to filter our records and our data type doesn't require additional format options.
We are now ready for configuring of the data query and the data parser modules. Click the "OK" button in the configuration window. Connect your device and power it on if necessary. You should get something like the image below.
Fig.7. Pressure data logger. Data received.
It's another view of the received data. All non-printable characters have been replaced with their code like #0A or #0D. All requests have been highlighted by the yellow color.
Fig.8. Pressure data logger. DDE server window.
All parser items are now ready for export to any database, Microsoft Excel or Microsoft Access.