Overview
Comment:Added gnuplot.txt representation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 6796ef70a0ff4a35b9227fc98ea7abd6c74990c951822dd367798b1695978b43
User & Date: geraint@users.sourceforge.net on 2001-02-06 06:08:34
Other Links: branch diff | manifest | tags
Context
2001-02-06
12:40:44
typo check-in: 2fefd10db6 user: geraint@users.sourceforge.net tags: origin/master, trunk
06:08:34
Added gnuplot.txt representation. check-in: 6796ef70a0 user: geraint@users.sourceforge.net tags: origin/master, trunk
04:39:08
Added _standalone.exe representation. check-in: cfaa1be057 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/cc/Makefile from [5dcbc26dbe] to [10f25bc91c].

1
2
3
4
5
6

7
8
9
10
11
12
13
1
2
3

4
5
6
7
8
9
10
11
12
13



-


+








.POSIX:

ifeq (0,1)
CC=g++

ifeq (0,1)
CFLAGS+=-static
OCTAVE_LIBS_PATH=-L/usr/local/lib/octave
OCTAVE_LIBRARIES=-loctave -lcruft -lm -lncurses -ldl -lstdc++ -lc -lkpathsea -lreadline -lf2c

%.exe: %.cc
	$(CC) $< $(CFLAGS) $(OCTAVE_LIBS_PATH) $(OCTAVE_LIBRARIES) -o $@

43
44
45
46
47
48
49
50



43
44
45
46
47
48
49

50
51
52







-
+
+
+
$(sys)_def.r:
	mtt $(sys) def r

$(sys)_sympar.txt:
	mtt $(sys) sympar txt



# struc2gnuplot_txt.exe is used by gnuplot_rep.make to create gnuplot input file.
struc2gnuplot_txt.exe: $(MTT_CC)/struc2gnuplot_txt.cc
	$(CC) -O3 -Wall -ansi -pedantic -DMAIN $(MTT_CC)/struc2gnuplot_txt.cc -o $(MTTPATH)/trans/struc2gnuplot_txt.exe 

Added mttroot/mtt/cc/struc2gnuplot_txt.cc version [e284cf9de2].











































































































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
95
96
97
98
99
100
101
102
103
104
105
106
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

#include <iostream>
#include <list.h>
#include <string>

    
ostream &struc2gnuplot_txt(const string sys = "sim", istream &in = cin, ostream &out = cout)
{
  typedef struct record_ record_t;
  struct record_
  {
    string       	vec;
    unsigned int	num;
    string     		cmp;
    string     	 	mod;
    unsigned int       	rpt;
  };

  list<record_t>	Lx;
  list<record_t>	Ly;

  record_t		r;


  // read data from struc.txt

  while (in >> r.vec >> r.num >> r.cmp >> r.mod >> r.rpt)
    {
      if ("state" == r.vec)
	{
	  Lx.push_back(r);
	}
      else if ("output" == r.vec)
	{
	  Ly.push_back(r);
	}
    }

  // write header

  out << "set data style lines" << endl
      << "set xlabel \"time\"" << endl
      << "set grid" << endl
      << endl;

  // write states (X11)

  out << "set term X11" << endl
      << "plot\\" << endl;
  for (list<record_t>::iterator i = Lx.begin(); i != Lx.end() ; i++)
    {
      if (Lx.begin() != i)
	{
	  out << ",\\" << endl;
	}
      out << "\t\"MTT_work/" << sys << "_odes2.dat\" using 1:" << 2 + Ly.size() + i->num
	  << " axes x1y1"
	  << " title \"" << i->mod << "_" << i->cmp << "\"";
    }
  out << endl << endl << "pause(-1)" << endl << endl;

  // write states (postscript)
  
  out << "set term postscript eps color" << endl
      << "set output \"" << sys << "_states.eps\"" << endl
      << "replot" << endl << endl;  

  // write outputs (X11)

  out << "set term X11" << endl
      << "plot\\" << endl;
  for (list<record_t>::iterator i = Ly.begin(); i != Ly.end() ; i++)
    {
      if (Ly.begin() != i)
	{
	  out << ",\\" << endl;
	}
      out << "\t\"MTT_work/" << sys << "_odes2.dat\" using 1:" << 1 + i->num
	  << " axes x1y1"
	  << " title \"" << i->mod << "_" << i->cmp << "\"";
    }
  out << endl << endl << "pause(-1)" << endl << endl;

  // write outputs (postscript)
  
  out << "set term postscript eps color" << endl
      << "set output \"" << sys << "_outputs.eps\"" << endl
      << "replot" << endl << endl;  

  return out;
}

#ifdef MAIN
int main(int argc, char *argv[])
{
  if (--argc)
    {
      struc2gnuplot_txt(argv[1]);
    }
  else
    {
      struc2gnuplot_txt();
    }
  return 0;
}
#endif // MAIN

Added mttroot/mtt/lib/rep/gnuplot_rep.make version [3950a2d34b].

















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# -*-makefile-*-
# create a gnuplot input file

MTTFLAGS	= $(OPTS)

all: $(SYS)_gnuplot.$(LANG)

$(SYS)_gnuplot.txt: $(SYS)_struc.txt $(MTTPATH)/trans/struc2gnuplot_txt.exe
	$(MTTPATH)/trans/struc2gnuplot_txt.exe $(SYS) < $(SYS)_struc.txt > $(SYS)_gnuplot.txt

$(SYS)_struc.txt:
	mtt $(MTTFLAGS) $(SYS) struc txt

$(MTTPATH)/trans/struc2gnuplot_txt.exe:
	make -f $(MTT_CC)/Makefile struc2gnuplot_txt.exe


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]