Data Files |
Data Files
Instrument
Data - Numerical Formats
Let's imagine a situation
in which you are trying to measure, record and analyze some data. Here is a
picture of the situation.
In this situation, the following
operations take place.
- A measurement is taken, and
the analog data is converted to a digital representation in the A/D
converter tied to the computer.
- That data - now in digital
form - is analyzed within the computer.
- After the data is analyzed,
the results are stored - either in the computer or on a disk somewhere.
This kind of sequence of operations
is very common today. In other situations, you might find that the data is used
immediately to determine control actions taken. An example might be a
temperature control in a chemical process. Measured temperature data might be
used to determine how much heat to apply to the process.
In situations like this,
although it is not immediately apparent, the data that is measured often goes
through many transformations and takes on many different representations. Think
about the following scenario.
- You take a
temperature measurement
at a weather station. Temperature is an analog variable and it is
continuously variable. In other words, temperature can take on any value
whatsoever. Let's just assume that you measure a temperature of 58.3o
Fahrenheit.
- Next that temperature
measurement is converted to a voltage.
You might use an LM34 temperature sensor, and that would produce a voltage
ov .583v to represent the temperature.
- The voltage from the
temperature sensor will be converted to a digital format in the A/D
converter. Typically, that results in an
integer that represents the voltage.
- That integer has to be
changed to a floating point number,
and that number would be 58.3.
- If you display the floating
point number in a spreadsheet, you need to convert the number to a character
form of representation. That representation would consists of ASCII
characters and they would most probably be:
- A character "five":
5
- A character
"eight": 8
- A character
"period": .
- A character
"three": 3
- A character "Line
Feed": \n
- If you save the data in a
file, you probably save it using a character representation, especially if
you save the data directly from the spreadsheet.
You should realize how many
conversions are necessary in this process.
- The temperature sensor
converts a temperature into a voltage - a conversion between two different
physical variables.
- The A/D converter converts
the voltage into an integer - a conversion of the voltage into a simple
numerical representation. The resulting integer usually takes two bytes.
- There has to be a program
that converts the integere from the A/D into a floating point
representation. Typical IEEE floating point representations take four
bytes, but more precise representations might take more storage.
- The floating point
representation has to be converted into a character representation.
Now, thing about what happens in a
spreadsheet.
- Numbers are typed into little
boxes. Each time you type a number you type a sequence of characters.
- If you do that several times
in a column, then add all of the numbers in a column, the following has to
happen.
- Every entry - every
sequence of characters in one of those little boxes - has to be
converted to a number. If you don't have a number you can't add them
up. Computers can't add a whole bunch of sequences of characters
directly. They have to convert those sequences to numbers then add the
numbers.
- Before the
computer/spreadsheet can display the result, the result has to be translated
back into a sequence of characters before the result can be displayed in
some other box in the spreadsheet.
You probably don't realize
it, but if you know how to program you have already done some conversion between
those formats. You did it every time you printed numerical results from a
computation. Still, before you have a complete understanding of data
representations you need to understand how instruments generate and store data.
That's the subject of this lesson.
When you take measurements
with a computer controlled instrument and transmit the data to the computer
there are a number of different data formats that you can encounter. You can
encounter data that is represented as characters and data that is stored in
numerical formats.
|