KB-33835: Calculating a historic file’s (*.dat) size.

Question:

How can I calculate how much space a historic file will occupy in the hard disk?

Solution:

To do so, consider this:

  • File header: 24 bytes.
  • For each field, add 40 bytes.
  • For each record, add 2 bytes of the register’s CRC plus each field’s size, as seen below:

            char/byte = 1 byte
short/word = 2 bytes
long/dword/float = 4 bytes
double/datetime = 8 bytes
string = number of characters

Therefore, in a historic with two fields (one datetime, and the other one double) and 1000 records, the calculation is:

Header = 24 bytes
Two fields = 40 * 2 = 80 bytes
Each record = 2 + (8 + 8) = 18 bytes

Total size = 24 + 80 + (18 * 1000) = 18104 bytes

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *