Blame view

SPACECRAFT_CABLE_MOD/gnuplot_functions 2.11 KB
7b23d358   Steve Greedy   Public Repository...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
write_gnuplot_result() {

# write a gnuplot input file to plot a spice result vs analytic reference result
# Then run gnuplot with this file as input

if [ $OUTPUT_FILE ]
then
OUTPUT_FILE_LINE="set output '$OUTPUT_FILE'"
PAUSE_LINE=""
else
OUTPUT_FILE_LINE=""
PAUSE_LINE="pause -1"
fi

echo "set term $TERMINAL noenhanced
$OUTPUT_FILE_LINE
set title  '$TITLE'
set xlabel '$XLABEL'
set ylabel '$YLABEL'
set $XSCALE x
plot 'analytic_solution.dat' u 1:2 title 'Analytic solution' w p lc 3,\
     'spice_solution.dat' u 2:3 title 'Spice solution' w l lc 1
$PAUSE_LINE
" > plot.plt

gnuplot plot.plt

}

write_gnuplot_reference_result() {

# write a gnuplot input file to plot a spice result vs reference spice result
# and the analytic result vs reference analytic result
# Then run gnuplot with this file as input

if [ $OUTPUT_FILE ]
then
OUTPUT_FILE_LINE1="set output 'Analytic_$OUTPUT_FILE'"
OUTPUT_FILE_LINE2="set output 'Spice_$OUTPUT_FILE'"
PAUSE_LINE=""
else
OUTPUT_FILE_LINE1=""
OUTPUT_FILE_LINE2=""
PAUSE_LINE="pause -1"
fi

echo "set term $TERMINAL noenhanced
set title  '$TITLE'
set xlabel '$XLABEL'
set ylabel '$YLABEL'
set $XSCALE x
$OUTPUT_FILE_LINE1
plot  '../analytic_solution.dat_reference' u 1:2 title 'Reference Analytic solution' w p lc 3,\
      'analytic_solution.dat' u 1:2 title 'Analytic solution' w l lc 1
$PAUSE_LINE
$OUTPUT_FILE_LINE2
plot '../spice_solution.dat_reference' u 2:3 title 'Reference Spice solution' w p lc 3,\
     'spice_solution.dat' u 2:3 title 'Spice solution' w l lc 1
$PAUSE_LINE
" > plot.plt

gnuplot plot.plt

}

write_gnuplot_plot_bundle() {

# write a gnuplot input file to plot the bundle cross section
# Then run gnuplot with this file as input

if [ $OUTPUT_FILE ]
then
OUTPUT_FILE_LINE="set output '$OUTPUT_FILE'"
PAUSE_LINE=""
else
OUTPUT_FILE_LINE=""
PAUSE_LINE="pause -1"
fi

echo "set term $TERMINAL noenhanced
$OUTPUT_FILE_LINE
set size square
set title  '$TITLE'
set xlabel 'x(m)'
set ylabel 'y(m)'
plot 'conductors.dat' u 1:2 title 'Conductors' w l lc 3,\
     'dielectrics.dat' u 1:2 title 'Dielectrics' w l lc 2,\
     'frame.dat' u 1:2 notitle  w l lc 1
$PAUSE_LINE
" > plot.plt

gnuplot plot.plt

}