web pages is written in the PHP language (PHP:
Hypertext Preprocessor)..
Figure 8: Read up and transfer via internet software
4.1 Software Support of Measuring
Device Control
a) Configuration File.
The configuration file sets up the PC. It defines
location for saving read values; it contains setup
information for connecting the device. Setup
information contains:
• Setup of serial port number connection
• Measuring frequency of the device
• Interval of data record in device
• Memory size of the device processor
• Setup of individual sensors
Individual sensors have in the setup items:
• Sensor data directory for saving
• Sensor type
• Specific sensor setup (input position)
• Corrective constants
b) Program operation.
Initialization. After start the script performs several
operations (setup of infinite time limit for script
running, setup of start up limit of one script
installation, PHP process identifier is saved to the
file). The next step is reading the configuration file.
Data reading. The script starts reading data from the
measuring device using serial bus.
Data processing and saving. Sensor data are sent
to the PC. Data are processed in the PC (more
precise calculation). The output values are corrected
by setup constants. Final values are checked (a
presence in the defined interval).
Virtual sensor. Special properties can be set up in
the program. It is possible to have a sensor that is
not in the measuring device in reality. The sensor
value is calculated as a mathematic operation.
4.2 Software Support of Data
Transfer via Internet
This part of software performs data saving to a
database. The data are acquired from the measuring
device. The transfer and saving of data is realized
using a PHP script. Since the script uses database
access, it is necessary to install support for the
MySQL database. Another extension is represented
by CURL that provides comfortable access to data
via internet.
Setup. The setup contains „data series“. Data of
individual sensors build up the data series.
Individual series are defined by the configuration
files.
Data copy. The source path, the target path, and
the filename are necessary information for creation
of a data copy. The data are saved in several files.
The interval of copying is set up to three minutes.
Database format. SQL database (Structured
Query Language) is suitable for data saving and
their use on the web pages. Using SQL queries
allows very simple reading of data according to the
requested parameters.
The database structure is very simple. Data series
corresponds to the measured sensor value with
assigned time value (the first column contains time,
the second column contains measured value). The
measured data are changing very slowly. The data
are saved to the database only in the case of change
(the result is acceleration of data operation). That
limits the calculation of various statistic
characteristics (data absence in time). Therefore
additional column is inserted to the structure. The
duration of a certain value is saved in this column.
The format „Unix Timestamp“ is used for saving
time information. Time values are represented by
32-bit number. PHP script converts that format.
Other two matrices have been designed (they save
time and space for data processing). The matrices
contain partially preprocessed data, namely average
values, minima, and maxima. The matrices serve for
using data from a longer time interval.
Data saving. Data are read from data series in the
files. Data are transformed to correct format and
saved to the database. Data are not saved as a single
series. One single SQL query is created. All new
data are saved in batch mode. Operation speed is
higher in that case.
WINSYS 2006 - INTERNATIONAL CONFERENCE ON WIRELESS INFORMATION NETWORKS AND SYSTEMS
308