#!/usr/bin/perl -w # Directories where the log files reside in; get configured # $logdir="/home/chris/construction/BTUmetering/log"; $logdir="MAINPROGROOT/log"; # $htdocsroot="/srv/www/htdocs/static"; $htdocsroot="HTDOCROOT/static"; #$htimgroot="/srv/www/htdocs/img2"; # pressure files to log @filecores=("AHU2"); %wcolor=("AHU2" => "#efdfff" ); sub sortbyname { (reverse $a) cmp (reverse $b); } @showelist=sort sortbyname (keys %eunits); # generate some header print "content-type: text/html CQT utility consumption server "; # General blurb: print "

CQT Chilled water differential pressure display

The values shown below reflect the reading of the metering device at the indicated date/time.

"; # Generate the table header print " "; # make list of all entries foreach $core (@filecores) { # generate logging file name $file=$logdir."/pressure_".$core.".log"; # read last line from that file (latest entry) open LOGHANDLE, "tail -n 1 ".$file." |"; $logline=; close LOGHANDLE ; # split it in different entries @loglist=split ' ', $logline; if ($#loglist <1) { # No file/entry present print ""; print ""; } elsif ($loglist[0] eq "#") { # extract error msg ($dummy, $date, $time, @rest) = @loglist; # $current = $voltage/0.1800; # $bar = ($current-4.0)/16.0*3.0; # $psi = $bar*14.50377; # @rest = ($voltage, $current, $bar, $psi); print ""; print ""; print "" } else { # Assign the proper values ($date, $time, $voltage) = @loglist; $current = $voltage/0.1800; $bar = ($current-4.0)/16.0*3.0; $psi = $bar*14.50377; # Print out stuff as table rows print ""; print ""; printf "", $voltage; printf "", $current; printf "", $bar, $psi; print "\n"; } } print "
LocationDate
MM/DD/YY
Time
hh:mm:ss
Sensor reading
VoltageCurrentΔp
$core(no logfile entry present)
$core$date$time@rest
$core$date$time%1.4f V%2.3f mA%1.3f bar / %2.2f psi
\n"; # Some blurb print "

The differential pressure sensor (DPT-10 from WIKA) is calibrated to cover a full range of 3 bar for a current of 4..20mA.

The current is converted to the measured voltage through a sense resistor of 180 Ohm.

Meter installation date:

"; # print "

Show differential pressure and inferred CHW flow trend for unit # AHU1 | # AHU2 #

"; print "

Show differential pressure and inferred CHW flow trend for unit where possible AHU1 | AHU2

"; print "

Back to main page.

"; # Finish html page print "\n\n";