Overview
Comment:Added conversion of simulation data to SciGraphica XML format (_odes.sg).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 5db3ee198565f704def83c5477266613c3fdf360c1ab1a88d7324323b8203afc
User & Date: geraint@users.sourceforge.net on 2001-04-14 05:11:02
Other Links: branch diff | manifest | tags
Context
2001-04-15
21:09:49
Corrected number of columns in SciGraphica worksheet. check-in: 3c9561eccf user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-04-14
05:11:02
Added conversion of simulation data to SciGraphica XML format (_odes.sg). check-in: 5db3ee1985 user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-04-13
07:14:12
Implemented lower level lbl.txt recognition of #NOT[V|P]AR check-in: 2716fc0220 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [d5403023fe] to [3480cd940d].

12
13
14
15
16
17
18





19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30







+
+
+
+
+







# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.305  2001/04/11 09:44:26  gawthrop
## Fixed cc and c problems to do with pow(x,y) and integers
## mtt/lib/reduce/fix_c.r is included in rdae2dae and cse2smx_lang for
## -c, -cc and -oct options
##
## Revision 1.304  2001/04/11 07:35:22  gawthrop
## Now uses system_cr.h in place of system.h in .c rep -
##   compatible with older code
##
## Revision 1.303  2001/04/10 12:54:50  gawthrop
## Minor fixes for sensitivity versions
##
1396
1397
1398
1399
1400
1401
1402
1403

1404
1405
1406
1407
1408
1409
1410
1401
1402
1403
1404
1405
1406
1407

1408
1409
1410
1411
1412
1413
1414
1415







-
+







  rm -f *_sub.* *_type.sh
  rm -f *_dae*.* *_cse.* *_ode.*
  rm -f *_obs.* *_rfe.* *_ss.*
  rm -f *_dm.* *_csm.*  *_tf.* *_sr*.* *_ir*.* *_*fr.*
  rm -f *_numpar.m *_numpar.c *_input.m *_input.c *_switch.c *_switch.txt
  rm -f *_sm.* *_can.*
  rm -f *_struc.* *_sympar.txt *_sympar.c *_sympar.h *_sympar.m
  rm -f *_odes.c *_odes.dat *_odes.gdat *_odes.m *_odes.ps
  rm -f *_odes.c *_odes.dat *_odes.gdat *_odes.m *_odes.ps *_odes.sg
  rm -f *_odeso.dat *_odeso.gdat *_odeso.sdat *_odeso.m *_odeso.ps
  rm -f *_*.doc *_*.idx *_*.ind *_*.ilg *_*.dvi *_*.aux *_*.lof *_*.toc
  rm -f *_rep.tex
  rm -f  *_unique_raw_list *_raw_list
  rm -f mtt_error.txt mtt_info.txt *_ode2odes.out 
  rm -f *_*_write.r *_simpar.m *_simpar.p
  rm -f *_cseo.oct *_input.oct *_simpar.oct *_smxax.oct
1431
1432
1433
1434
1435
1436
1437
1438

1439
1440
1441
1442
1443
1444
1445
1436
1437
1438
1439
1440
1441
1442

1443
1444
1445
1446
1447
1448
1449
1450







-
+







  rm -f $1_rbg.* $1_cmp.* $1_fig.fig $1*_*cbg.* $1*_ese.* $1_def.* $1_alias.*
  rm -f $1_sub.* $1_type.sh
  rm -f $1_dae*.* $1_cse.* $1_ode.*  $1_obs.* $1_rfe.* $1_ss.*
  rm -f $1_dm.* $1_csm.* $1_tf.* $1_sr*.* $1_ir*.* $1_*fr.*
  rm -f  $1_numpar.m $1_numpar.c $1_input.m $1_input.c $1_switch.c $1_switch.txt
  rm -f $1_sm*.* $1_can.*
  rm -f $1_struc.* $1_sympar.txt $1_sympar.c $1_sympar.h $1_sympar.m
  rm -f $1_odes.c $1_odes.dat $1_odes.gdat $1_odes.sdat $1_odes.m $1_odes.ps
  rm -f $1_odes.c $1_odes.dat $1_odes.gdat $1_odes.sdat $1_odes.m $1_odes.ps $1_odes.sg
  rm -f $1_odeso.dat $1_odeso.gdat $1_odeso.m $1_odeso.ps
  rm -f $1_*.doc $1_*.idx $1_*.ind $1_*.ilg $1_*.dvi $1_*.aux $1_*.lof $1_*.toc
  rm -f $1_rep.tex
  rm -f $1_unique_raw_list $1_raw_list
  rm -f mtt_error.txt mtt_info.txt $1_ode2odes.out 
  rm -f $1_*_write.r $1_simpar.m $1_simpar.p
  rm -f $1_cseo.oct $1_input.oct $1_simpar.oct $1_smxax.oct
1786
1787
1788
1789
1790
1791
1792
1793

1794
1795
1796
1797
1798
1799
1800
1791
1792
1793
1794
1795
1796
1797

1798
1799
1800
1801
1802
1803
1804
1805







-
+








  # Copy back form working directory
   if [ "$3" != "view" ] && [ "$3" != "hview" ] && [ -z "$reset" ]; then
      if [ "$3" = "html" ]; then
	  echo Moving $1_$2
          mv $1_$2 ..
      else
        if [ "$PLOTTYPE" = "multiple" ]; then
        if [ "$PLOTTYPE" = "multiple" -a -f $1_$2__ARGS.$ps ]; then
          echo Copying  $1_$2$__ARGS.$ps
          cp  $1_$2$__ARGS.$ps ..
        else
          echo Copying  $1$subsystem"_"$2.$lang
          cp  -p -u $1$subsystem"_"$2.$lang ..
        fi
      fi
2826
2827
2828
2829
2830
2831
2832

2833
2834
2835
2836
2837
2838
2839
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845







+







#SUMMARY sro*	step response - output (m)
#SUMMARY sro	step response - output (dat)
#SUMMARY sro	step response - output (ps)
#SUMMARY sro*	step response - output (view)

#SUMMARY odes	ode solution - state (m)
#SUMMARY odes*	ode solution - state (dat)
#SUMMARY odes  ode solution - state & output for SciGraphica (sg)
#SUMMARY odes*	ode solution - state (ps)
#SUMMARY odes*	ode solution - state (view)

#SUMMARY sms	ode (in state matrix form) solution - state & output (c)

#SUMMARY odeso	ode solution - output (m)
#SUMMARY odeso*	ode solution - output (dat)
2893
2894
2895
2896
2897
2898
2899
2900

2901
2902

2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921





2922
2923
2924
2925
2926
2927
2928
2899
2900
2901
2902
2903
2904
2905

2906
2907

2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939







-
+

-
+



















+
+
+
+
+







	    time ./$1_ode2odes.out>$1_odes.dat2
endif

ifeq ($computation,cc)
$1_sim.exe: $1_ese.r 
	mtt $mtt_switches -q $1 sim exe

$1_odes.dat2: $1_sim.exe 
$1_odes.dat2: $1_ode2odes.exe 
	echo Creating $1_odes.dat2 using cc version $ARGS
	    time ./$1_sim.exe $ARGS >$1_odes.dat2
	    time ./$1_ode2odes.exe $ARGS >$1_odes.dat2
endif


#$1_odeso.m: $1_odes.m
#	touch $1_odeso.m
#$1_smso.m: $1_sms.m
#	touch $1_smso.m
#$1_daes.m: $1_dae.m $1_numpar.m  $1_def.m $1_input.m $1_simpar.m
#	dae2daes_m $1 '$ARGS'
#$1_daeso.m: $1_daes.m
#	touch $1_daeso.m


#Conversion of data files from dat to sdat format
$1_odeso.sdat: $1_odeso.dat $1_struc.txt
	odeso_dat2sdat $1

$1_odes.sdat: $1_odes.dat $1_struc.txt
	odes_dat2sdat $1

#Conversion of data to SciGraphica
$1_odes.sg: $1_struc.m $1_odes.dat2
	echo Creating $1_odes.sg
	dat22sg.sh $1

#SUMMARY odess	ode numerical steady-states - states (m)
#SUMMARY odess	ode numerical steady-states - states (dat)
#SUMMARY odess	ode numerical steady-states - states (ps)
#SUMMARY odess	ode numerical steady-states - states (view)

#SUMMARY odesso	ode numerical steady-states - outputs (m)

Added mttroot/mtt/bin/trans/dat22sg.sh version [e99ab9281a].




















































































































































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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#! /bin/sh

# Convert simulation data to SciGraphica (v 0.61) Project file ($sys_odes.sg)

sys=$1

write_project_header ()
{
    cat <<EOF
<?xml version="1.0"?>

<sg:Project xmlns:sg="http://scigraphica.sourceforge.net">
  <sg:Summary>
    <sg:Item>
      <sg:name>application</sg:name>
      <sg:val-string>scigraphica</sg:val-string>
    </sg:Item>
    <sg:Item>
      <sg:name>author</sg:name>
      <sg:val-string>MTT:${USER}</sg:val-string>
    </sg:Item>
  </sg:Summary>

EOF
}

write_project_footer ()
{
    echo ''
    echo '</sg:Project>'
}

write_worksheet_header ()
{
    name=$1 ; ncol=$2 ; nrow=$3
    cat <<EOF

<sgw:Worksheet xmlns:sgw="http://scigraphica.sourceforge.net">
  <sgw:Summary>
    <sgw:Item>
      <sgw:name>application</sgw:name>
      <sgw:val-string>scigraphica</sgw:val-string>
    </sgw:Item>
    <sgw:Item>
      <sgw:name>author</sgw:name>
      <sgw:val-string>MTT:${USER}</sgw:val-string>
    </sgw:Item>
  </sgw:Summary>
  <sgw:Geometry Width="400" Height="350"/>
  <sgw:Name>${name}</sgw:Name>
  <sgw:MaxCol>${ncol}</sgw:MaxCol>
  <sgw:MaxRow>${nrow}</sgw:MaxRow>
  <sgw:Begin>-1</sgw:Begin>
  <sgw:End>-1</sgw:End>
EOF
}

write_worksheet_footer ()
{
    echo ''
    echo '</sgw:Worksheet>'
}

write_column_headings ()
{
    awk '{ printf ("  <sgw:Column No=\"%d\" Width=\"80\" Title=\"%s\" Format=\"0\" Precision=\"3\">\n  </sgw:Column>\n", NR-1,$0) }'
}

write_output_headings ()
{
    sys=$1
    ${MATRIX} -q <<EOF | write_column_headings
	[u_names,y_names,x_names] = ${sys}_struc;
	printf ("Time\n");
	disp (y_names);
EOF
}

write_state_headings ()
{
    sys=$1
    ${MATRIX} -q <<EOF | write_column_headings
	[u_names,y_names,x_names] = ${sys}_struc;
	printf ("Time\n");
	disp (x_names);
EOF
}

write_cell_values ()
{
    sys=$1 ; vec=$2
    ${MATRIX} -q <<EOF
function write_cell (row,col,val)
    printf ("\n");
    printf ("  <sgw:Cell Row=\"%d\" Col=\"%d\">\n", row,col);
    printf ("    <sgw:Content>%f</sgw:Content>\n", val);
    printf ("    <sgw:Formula>%f</sgw:Formula>\n", val);
    printf ("  </sgw:Cell>\n");
endfunction

    [u_names,y_names,x_names] = ${sys}_struc;
    ncol = size(${vec}_names)(1);

    load ("${sys}_odes.dat2");
    nrow = size(MTT_data)(1);

    # write Time
    for r = 1:nrow
	write_cell (r-1,0,MTT_data(r,1));
    endfor

    if ("${vec}" == "y")
	offset = 1;
    elseif ("${vec}" == "x")
	offset = size(y_names)(1);
    endif

    for r = 1:nrow
	for c = 1:ncol
	    write_cell (r-1,c,MTT_data(r,c+offset));
	endfor
    endfor
EOF
}

file=${sys}_odes.sg

NX=`mtt_getsize ${sys} x`
NY=`mtt_getsize ${sys} y`
NTMP=`wc -l ${sys}_odes.dat2 | awk '{print $1}'`
NROW=`expr ${NTMP} - 4`		# 4 comment lines in MTT_data

{
    write_project_header
    # states
    write_worksheet_header	"X_${sys}" `expr 1 + ${NX}` ${NROW}
    write_state_headings	${sys}
    write_cell_values		${sys} x
    write_worksheet_footer
    # outputs
    write_worksheet_header	"Y_${sys}" `expr 1 + ${NY}` ${NROW}
    write_output_headings	${sys}
    write_cell_values		${sys} y
    write_worksheet_footer
    write_project_footer
} > ${file}


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