Difference between revisions of "Solar-h2o:Copper-Graphs"

From Earlham CS Department
Jump to navigation Jump to search
(Export database table to file)
(Export database table to file)
Line 1: Line 1:
 +
 +
  
 
=== Export database table to file ===
 
=== Export database table to file ===
  hip=# BEGIN;BEGIN
+
  hip=# BEGIN;
 +
BEGIN
 
  hip=# CREATE TEMP TABLE copper_runs AShip-# SELECT to_char(run3,'099.99') as run3,to_char(run2,'099.99') as run2,to_char(run1,'099.99') as run1 FROM ss_copper_lab ORDER BY date ASC;
 
  hip=# CREATE TEMP TABLE copper_runs AShip-# SELECT to_char(run3,'099.99') as run3,to_char(run2,'099.99') as run2,to_char(run1,'099.99') as run1 FROM ss_copper_lab ORDER BY date ASC;
 
  SELECT
 
  SELECT
  hip=# COPY copper_runs TO '/clients/users/copelco/copper_lab.txt';COPY
+
  hip=# COPY copper_runs TO '/clients/users/copelco/copper_lab.txt' NULL AS '-';COPY
  hip=# ROLLBACK;ROLLBACK
+
  hip=# ROLLBACK;
 +
ROLLBACK
 
  hip=#
 
  hip=#
 +
 +
=== Add 3 second time interval to data file ===
 +
#    run3    run2    run1
 +
#--------------------------
 +
000  073.96  073.74  072.72
 +
003  075.54  075.09  073.29
 +
006  076.55  076.66  074.41
 +
...
 +
 +
=== Create gnuplot file ===
 +
set xrange [0:210]
 +
set xlabel "Time (seconds)"
 +
set ylabel "Temperature (F)"
 +
 +
########### Test 1 ###########
 +
set title "Copper Pipe Heat Exchanger Test - Test #1"
 +
 +
A = 97.5
 +
F = 72.72
 +
f(x) = A - (A - F) * exp(-0.009547*x)
 +
 +
set terminal png
 +
set output "test1.png"
 +
plot f(x) with lines lt 1 lw 2, \
 +
  "copper_lab.txt" using 1:4 title "Test 1" with lines lt 3 lw 3
 +
 +
set term postscript eps enhanced color
 +
set output "test1.eps"
 +
replot
 +
 +
########### Test 2 ###########
 +
set title "Copper Pipe Heat Exchanger Test - Test #2"
 +
 +
A = 107
 +
F = 72.28
 +
f(x) = A - (A - F) * exp(-0.009547*x)
 +
 +
set terminal png
 +
set output "test2.png"
 +
plot f(x) with lines lt 1 lw 2, \
 +
  "copper_lab.txt" using 1:3 title "Test 2" with lines lt 3 lw 3
 +
 +
set term postscript eps enhanced color
 +
set output "test2.eps"
 +
replot
 +
 +
########### Test 3 ###########
 +
set title "Copper Pipe Heat Exchanger Test - Test #3"
 +
 
 +
A = 105
 +
F = 72.28
 +
f(x) = A - (A - F) * exp(-0.009547*x)
 +
 +
set terminal png
 +
set output "test3.png"
 +
plot f(x) with lines lt 1 lw 2, \
 +
  "copper_lab.txt" using 1:2 title "Test 3" with lines lt 3 lw 3
 +
 +
set term postscript eps enhanced color
 +
set output "test3.eps"
 +
replot

Revision as of 21:38, 21 November 2006


Export database table to file

hip=# BEGIN;
BEGIN
hip=# CREATE TEMP TABLE copper_runs AShip-# SELECT to_char(run3,'099.99') as run3,to_char(run2,'099.99') as run2,to_char(run1,'099.99') as run1 FROM ss_copper_lab ORDER BY date ASC;
SELECT
hip=# COPY copper_runs TO '/clients/users/copelco/copper_lab.txt' NULL AS '-';COPY
hip=# ROLLBACK;
ROLLBACK
hip=#

Add 3 second time interval to data file

#    run3    run2    run1
#--------------------------
000  073.96  073.74  072.72
003  075.54  075.09  073.29
006  076.55  076.66  074.41
...

Create gnuplot file

set xrange [0:210]
set xlabel "Time (seconds)"
set ylabel "Temperature (F)"

                      1. Test 1 ###########
set title "Copper Pipe Heat Exchanger Test - Test #1"

A = 97.5
F = 72.72
f(x) = A - (A - F) * exp(-0.009547*x)

set terminal png
set output "test1.png"
plot f(x) with lines lt 1 lw 2, \
  "copper_lab.txt" using 1:4 title "Test 1" with lines lt 3 lw 3

set term postscript eps enhanced color
set output "test1.eps"
replot

########### Test 2 ###########
set title "Copper Pipe Heat Exchanger Test - Test #2"

A = 107
F = 72.28
f(x) = A - (A - F) * exp(-0.009547*x)

set terminal png
set output "test2.png"
plot f(x) with lines lt 1 lw 2, \
 "copper_lab.txt" using 1:3 title "Test 2" with lines lt 3 lw 3

set term postscript eps enhanced color
set output "test2.eps"
replot

########### Test 3 ###########
set title "Copper Pipe Heat Exchanger Test - Test #3"
 
A = 105
F = 72.28
f(x) = A - (A - F) * exp(-0.009547*x)

set terminal png
set output "test3.png"
plot f(x) with lines lt 1 lw 2, \
  "copper_lab.txt" using 1:2 title "Test 3" with lines lt 3 lw 3
set term postscript eps enhanced color
set output "test3.eps"
replot