Download revision 2014b
Transcript
CHAPTER 18. PRINTING—THE STAND-ALONE (SA) MODULE
RWD Nickalls
254
#!/usr/bin/perl
$starttimeunix = $ARGV[0]; ## used by the SUB Makegnnfiles()
open (timefile, ">timefile.dat")||die "ERROR: can’t open file timefile.dat\n";
##-----------# make an array of all required paremater names used for printing anaes Record
@paramname = ("bp-s", "bp-d","ecg-hr","sat-hr","cvp","nibp-s","nibp-d",
"sat", "o2-insp", "n2o-exp", "co2-exp",
"tv-exp","co2-rr","pplat", "vap-insp", "vap-exp", "mac-big" );
#get each parameter .binlog file in turn
for ($j=0; $j<=$#paramname; $j=$j+1 )
{
$ifile = $paramname[$j]; ## NO .binlog file-extension here
system ("perl binlog2data.pl $ifile") ;
...
}
A typical example of the sat.data file is as follows. Note that the elapsed-time
parameter on the first line is zero, and that both the unix-time and the elapsed-times
increase in steps of 5 seconds (data is output from the Datex monitor every 5 seconds).
#[sat.data]
1071580231,
1071580236,
1071580241,
1071580246,
1071580251,
1071580256,
1071580261,
1071580266,
...
...
2003:12:16:13:10:31,
2003:12:16:13:10:36,
2003:12:16:13:10:41,
2003:12:16:13:10:46,
2003:12:16:13:10:51,
2003:12:16:13:10:56,
2003:12:16:13:11:1,
2003:12:16:13:11:6,
0,
5,
10,
15,
20,
25,
30,
35,
92.000000
92.000000
93.000000
93.500000
93.000000
93.000000
92.500000
92.000000
Armed with the above .data file for a given parameter, then we proceed to generate
from this a series of 1-page .gnn files (each typically of 1-hour duration), as described
in the next section.
g Generate 1-page .gnn files with subroutine makegnnfiles()
This role of this subroutine is to generate from the new parameter .data file (which
may contain many hours of data, since it contains all the data held in the original
.binlog file) a series of 1-page .gnn files suitable for use by the GNUplot graphing
program—each .gnn file generating a single page of the typeset Anaesthetic Record.
The makegnnfiles() subroutine is part of the Perl program binlog2gnn.pl
(which is itself called by the co-ordinating Perl program fields2PDATA.pl). The
subroutine is called with the field parameter name (for example, bp-d, or sat-hr) as
follows.
makegnnfiles($paramname[$j]);
Calling the subroutine makennnfiles() converts each of the parameter .data
files into a series of 1-page duration two-column space-separated data-files suitable