graphing from a logging file.dat


prozacoli

Recommended Posts

please, someone can tell me what is the best way to graph a file.dat generated by logging.

binary 32 bits floating point

i do it like this.

=====================================================================

f = file.Open("d:\historicos\cbombeo.dat",1,0,0,0) // abre el archivo en solo lectura

file.Seek(f,0) // va al inicio del arhivo

datat1 = file.ReadInter(f,0,12,4,0) // lee 4 datos del archivo contenido en "f" despues de 0 datos separados por coma en intervalo 12

datat2 = file.ReadInter(f,4,12,4,0) // lee 4 datos del archivo contenido en "f" despues de 4 datos separados por coma en intervalo 12

data = file.ReadInter(f,8,12,4,0) // lee 4 datos del archivo contenido en "f" despues de 8 datos separados por coma en intervalo 12

datat1 = to.Float(datat1) // convierte los datos a punto flotante y los pone en datat1

datat2 = to.Float(datat2) // convierte los datos a punto flotante y los pone en datat2

datat1 = floor(datat1 / 1000 + 0.5) * 1000 // redondea el valor de datat1 a el mas cercano de 1000

tiempo = datat1 + datat2 // suma la parte alta + la parte baja del tiempo

cbom_l1 = to.float(data) // convierte los datos binarios a punto flotante

cbom_l1.time = tiempo // se le asigna el tiempo de los puntos a cada punto que se graficara

=====================================================================

the idea is to generate a graph between two dates.

all works fine, i only have a problem when the file begins to grow, it takes too much time to read the file and generate the graphic.

Link to comment
Share on other sites

Are you continually reading the file over time? If so, then just save the position of the file when you finish with the reads, then seek to that point before the next round. Also, I believe you need to seek before each readinter(), as the file pointer will be at the end of the file otherwise.

Link to comment
Share on other sites

no, im not continually reading the file.

but I think you are rigth I need to seek before the readinter, because everytime I run the sequence I read all the file, and I only use part of all to generate the graph.

but I dont know how to seek a date (the start time or start date) before convert the binary file to date format.

Link to comment
Share on other sites

First, have you considered using Channel Persist instead? It kind of does all this for you. The only reason really for using a binary file like you have would be if you needed to archive the data elsewhere.

To seek a date, you'd have to read the entire date column, then use a binary tree search for the desired date, then use the offset calculated from it. This is advanced programming and as I said already done for you in the Channel Persist.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.