source: fact/tools/PlotTempsViaGnuplot/plot_old_Trigger_slow_files.c@ 14942

Last change on this file since 14942 was 120, checked in by dneise, 15 years ago
added code to view older temp format files as well. Trigger_yyyymmdd_hhmm.slow
File size: 2.1 KB
Line 
1#include <stdio.h>
2#include <string.h>
3#include <stdlib.h>
4#include <time.h>
5 int main(int argc, char *argv[])
6{
7
8 FILE *plotfile;
9
10 char tempFilename[80];
11 long startTime=1246582381;
12 char usingStr[40];
13
14 if (argc < 3) {
15 fprintf (stderr, "usage: plot <filename.slow> Starttimemodifier e.g. 3600 \n");
16 return -1;
17 }
18 if (argc > 3) {
19 fprintf (stderr, "too many arguments: usage: plot <filename.slow> Starttimemodifier e.g. 300\n");
20 return -1;
21 }
22
23
24 time_t rawtime;
25 struct tm * timeinfo;
26
27 time ( &rawtime );
28 timeinfo = localtime ( &rawtime );
29
30 startTime = (long)rawtime;
31 strcpy(tempFilename, argv[1]);
32
33 startTime -= atoi(argv[2]);
34
35 plotfile = fopen ("plot_t.plt","w");
36
37
38 if (plotfile!=NULL)
39 {
40 fputs ("set title 'Temperatures'\n"
41 "set xlabel 'time sec '\n"
42 "set ylabel 'T in C '\n"
43 "set grid\n"
44 ,plotfile);
45
46 sprintf(usingStr, "($6>\%d ? $6-\%d : 1/0)", startTime, startTime);
47
48 fputs("plot ",plotfile);
49
50 fprintf(plotfile, "\"%s\" using %s:8 title 'water out' with points"
51 ,tempFilename
52 ,usingStr
53 );
54
55 fputs(", \\\n", plotfile);
56 fprintf(plotfile, "\"%s\" using %s:9 title 'upper right' with points"
57 ,tempFilename
58 ,usingStr
59 );
60 fputs(", \\\n", plotfile);
61 fprintf(plotfile, "\"%s\" using %s:10 title 'upper left' with points"
62 ,tempFilename
63 ,usingStr
64 );
65 fputs(", \\\n", plotfile);
66 fprintf(plotfile, "\"%s\" using %s:11 title 'lower left' with points"
67 ,tempFilename
68 ,usingStr
69 );
70 fputs(", \\\n", plotfile);
71 fprintf(plotfile, "\"%s\" using %s:12 title 'lower right' with points"
72 ,tempFilename
73 ,usingStr
74 );
75 fputs(", \\\n", plotfile);
76 fprintf(plotfile, "\"%s\" using %s:13 title 'water in' with points"
77 ,tempFilename
78 ,usingStr
79 );
80 fputs(", \\\n", plotfile);
81 fprintf(plotfile, "\"%s\" using %s:14 title 'humidity temp' with points"
82 ,tempFilename
83 ,usingStr
84 );
85 fputs("\n", plotfile);
86
87 fputs("pause -1 \"Hit any key or press OK to continue ...\"\n",plotfile);
88
89 fclose (plotfile);
90 }
91
92 system("gnuplot plot_t.plt");
93
94 system("rm plot_t.plt");
95 return 0;
96}
Note: See TracBrowser for help on using the repository browser.